/* WARNING: Restarted to delay deadcode elimination for space: register */

void RTMPIoctlGetMacTable(int param_1,uint *param_2)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  code *pcVar5;
  uint uVar6;
  size_t sVar7;
  char *pcVar8;
  uint uVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int *piVar13;
  undefined1 *puVar14;
  int iVar15;
  int unaff_gp;
  undefined *puVar16;
  undefined *puVar17;
  undefined *puVar18;
  undefined *puVar19;
  int *local_30;
  char *local_2c;
  
  local_30 = (int *)0x0;
  os_alloc_mem(0,&local_30,0x704);
  if (local_30 == (int *)0x0) {
    if (RTDebugLevel == 0) {
      return;
    }
    pcVar8 = "%s: Allocate memory fail!!!\n";
    pcVar5 = printk;
    piVar13 = (int *)"RTMPIoctlGetMacTable";
    goto LAB_00039f38;
  }
  memset(local_30,0,0x704)   //possible issue identified - semgrep
  *local_30 = 0;
  puVar14 = (undefined1 *)(param_1 + 0x5d3c9);
  iVar15 = 0;
  do {
    piVar13 = local_30;
    if ((*(int *)(puVar14 + -0x491) == 1) && (*(int *)(puVar14 + -0x21d) == 2)) {
      iVar10 = *local_30;
      *(undefined1 *)(local_30 + iVar10 * 0xe + 1) = puVar14[-0x460];
      memcpy((void *)((int)local_30 + iVar10 * 0x38 + 5),
             (void *)(param_1 + iVar15 * 0xa20 + 0x5d190),6)   //possible issue identified - semgrep
      iVar11 = iVar10 * 7 + 1;
      *(char *)((int)piVar13 + iVar10 * 0x38 + 0xb) = (char)*(undefined2 *)(puVar14 + -0x213);
      *(undefined1 *)(piVar13 + iVar11 * 2 + 1) = puVar14[-0x221];
      *(undefined1 *)((int)piVar13 + iVar11 * 8 + 5) = puVar14[-0x38];
      iVar12 = param_1 + iVar15 * 0xa20;
      *(undefined1 *)((int)piVar13 + iVar11 * 8 + 6) = *puVar14;
      *(undefined1 *)((int)piVar13 + iVar11 * 8 + 7) = puVar14[1];
      *(undefined1 *)(piVar13 + iVar11 * 2 + 2) = puVar14[2];
      uVar6 = piVar13[iVar10 * 0xe + 6];
      piVar13[iVar10 * 0xe + 5] = *(int *)(puVar14 + -0x1f5);
      uVar9 = *(uint *)(iVar12 + 0x5d350) & 0x7f;
      piVar13[iVar10 * 0xe + 6] = uVar6 & 0xffffff80 | uVar9;
      uVar1 = ((uint)(*(int *)(iVar12 + 0x5d350) << 0x18) >> 0x1f) << 7;
      piVar13[iVar10 * 0xe + 6] = uVar6 & 0xffffff00 | uVar9 | uVar1;
      uVar2 = ((uint)(*(int *)(iVar12 + 0x5d350) << 0x17) >> 0x1f) << 8;
      piVar13[iVar10 * 0xe + 6] = uVar6 & 0xfffffe00 | uVar9 | uVar1 | uVar2;
      uVar3 = ((uint)(*(int *)(iVar12 + 0x5d350) << 0x15) >> 0x1e) << 9;
      piVar13[iVar10 * 0xe + 6] = uVar6 & 0xfffff800 | uVar9 | uVar1 | uVar2 | uVar3;
      uVar4 = ((uint)(*(int *)(iVar12 + 0x5d350) << 0x13) >> 0x1f) << 0xb;
      piVar13[iVar10 * 0xe + 6] = uVar6 & 0xffffc000 | uVar9 | uVar1 | uVar2 | uVar3 | uVar4;
      piVar13[iVar10 * 0xe + 6] =
           uVar6 & 0xffff0000 | uVar9 | uVar1 | uVar2 | uVar3 | uVar4 |
           ((uint)(*(int *)(iVar12 + 0x5d350) << 0x10) >> 0x1e) << 0xe;
      *(undefined2 *)(piVar13 + iVar10 * 0xe + 6) = *(undefined2 *)(puVar14 + -0x79);
      piVar13[iVar10 * 0xe + 7] = *(int *)(puVar14 + 0x1b);
      *local_30 = *local_30 + 1;
    }
    iVar15 = iVar15 + 1;
    puVar14 = puVar14 + 0xa20;
  } while (iVar15 != 0x20);
  uVar9 = *param_2;
  *(undefined2 *)(param_2 + 1) = 0x704;
  if (((uVar9 + 0x704 | uVar9) & *(uint *)(unaff_gp + 0x18)) == 0) {
    iVar15 = 0x704;
    __copy_user(uVar9,local_30);
    if (iVar15 != 0) goto LAB_00039be0;
  }
  else {
LAB_00039be0:
    if (2 < RTDebugLevel) {
      printk("%s: copy_to_user() fail\n","RTMPIoctlGetMacTable");
    }
  }
  os_alloc_mem(0,&local_2c,0x864);
  if (local_2c == (char *)0x0) {
    if (RTDebugLevel != 0) {
      pcVar8 = "%s():Alloc memory failed\n";
      local_2c = "RTMPIoctlGetMacTable";
      pcVar5 = printk;
      goto LAB_00039f1c;
    }
  }
  else {
    memset(local_2c,0,0x800)   //possible issue identified - semgrep
    sprintf(local_2c,"%s",&_LC89)   //possible issue identified - semgrep
    pcVar8 = local_2c;
    sVar7 = strlen(local_2c);
    puVar16 = &_LC110;
    puVar17 = &_LC111;
    puVar18 = &_LC112;
    puVar19 = &_LC113;
    sprintf(pcVar8 + sVar7,"%-14s%-4s%-4s%-4s%-4s%-6s%-6s%-10s%-10s%-10s\n",&_LC104,&_LC105,&_LC106,
            &_LC107,&_LC108,&_LC109,&_LC110,&_LC111,&_LC112,&_LC113)   //possible issue identified - semgrep
    piVar13 = (int *)(param_1 + 0x5d1ac);
    iVar15 = 0;
    do {
      iVar15 = iVar15 + 1;
      if ((piVar13[-0x9d] == 1) && (*piVar13 == 2)) {
        sVar7 = strlen(local_2c);
        pcVar8 = local_2c;
        if (0x7ff < sVar7 + 0x40) break;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%02x%02x%02x%02x%02x%02x  ",(uint)*(byte *)(piVar13 + -7),
                (uint)*(byte *)((int)piVar13 + -0x1b),(uint)*(byte *)((int)piVar13 + -0x1a),
                (uint)*(byte *)((int)piVar13 + -0x19),(uint)*(byte *)(piVar13 + -6),
                (uint)*(byte *)((int)piVar13 + -0x17),puVar16,puVar17,puVar18,puVar19)   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-4d",(uint)*(byte *)((int)piVar13 + -0x243))   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-4d",(uint)*(ushort *)((int)piVar13 + 10))   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-4d",(uint)*(byte *)(piVar13 + -1))   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-4d",piVar13[1])   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-6d",(uint)(byte)(&RateIdToMbps)[*(byte *)((int)piVar13 + 0xd9)])   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-6d",0)   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-10d",0)   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-10d",0)   //possible issue identified - semgrep
        pcVar8 = local_2c;
        sVar7 = strlen(local_2c);
        sprintf(pcVar8 + sVar7,"%-10d\n",0)   //possible issue identified - semgrep
      }
      piVar13 = piVar13 + 0x288;
    } while (iVar15 != 0x20);
    if (2 < RTDebugLevel) {
      printk(&_LC102,local_2c)   //possible issue identified - semgrep
    }
    pcVar8 = (char *)0x0;
    pcVar5 = os_free_mem;
LAB_00039f1c:
    (*pcVar5)(pcVar8,local_2c);
  }
  if (local_30 == (int *)0x0) {
    return;
  }
  pcVar8 = (char *)0x0;
  pcVar5 = os_free_mem;
  piVar13 = local_30;
LAB_00039f38:
  (*pcVar5)(pcVar8,piVar13);
  return;
}