undefined4 Set_EECMD_Proc(int param_1,int param_2)

{
  undefined2 uVar1;
  code *pcVar2;
  int iVar3;
  undefined4 uVar4;
  char *pcVar5;
  short sVar6;
  short sVar7;
  ushort uVar8;
  byte *pbVar9;
  uint uVar10;
  uint uVar11;
  ushort local_28;
  ushort local_26 [3];
  
  local_28 = simple_strtol(param_2,0,10);
  if (local_28 == 1) {
    if (*(int *)(param_1 + 0x29f8) != 4) {
      return 1;
    }
    printk("EEPROM reset to default......\n");
    printk("The last byte of MAC address will be re-generated...\n");
    iVar3 = rtmp_ee_flash_reset(nv_ee_start);
    if (iVar3 == 0) {
      rtmp_ee_flash_read(param_1,8,local_26)   //possible issue identified - semgrep
      uVar11 = (uint)(byte)local_26[0];
      local_26[0] = local_26[0] & 0xff;
      uVar10 = RandomByte(param_1);
      uVar11 = (uVar10 & 0xf8) << 8 | uVar11;
      local_26[0] = (ushort)uVar11;
      printk("Addr45 = %4x\n",uVar11);
      rtmp_ee_flash_write(param_1,8,local_26[0]);
      iVar3 = rtmp_ee_flash_read(param_1,0,&local_28)   //possible issue identified - semgrep
      if (iVar3 == 0x2880) goto LAB_00054004;
      iVar3 = rtmp_ee_flash_read(param_1,0,&local_28)   //possible issue identified - semgrep
      if (iVar3 == 0x2860) {
        return 1;
      }
      if (RTDebugLevel == 0) {
        return 0;
      }
      pcVar5 = "Set_EECMD_Proc: invalid eeprom\n";
    }
    else {
      if (RTDebugLevel == 0) {
        return 0;
      }
      pcVar5 = "Set_EECMD_Proc: rtmp_ee_flash_reset() failed\n";
    }
    printk(pcVar5);
    uVar4 = 0;
  }
  else {
    uVar10 = 0;
    if (local_28 == 0) {
      pcVar2 = *(code **)(param_1 + 0x10);
      local_28 = 0;
      while( true ) {
        (*pcVar2)(param_1,uVar10,local_26);
        uVar10 = uVar10 + 2;
        printk("%4.4x ",local_26[0]);
        if ((uVar10 & 0x1f) == 0) {
          printk(&_LC14)   //possible issue identified - semgrep
        }
        if (uVar10 == 0x200) break;
        pcVar2 = *(code **)(param_1 + 0x10);
      }
      return 1;
    }
    if (local_28 != 2) {
      return 1;
    }
    uVar1 = simple_strtol(param_2 + 2,0,10);
    pbVar9 = (byte *)(param_2 + 4);
    sVar7 = 0;
    while( true ) {
      uVar8 = (ushort)*pbVar9;
      sVar6 = sVar7 * 0x10 + (uVar8 - 0x30)   //possible issue identified - semgrep
      if (uVar8 == 0) break;
      if (9 < (uVar8 - 0x30 & 0xff)) {
        sVar6 = sVar7 * 0x10 + (uVar8 - 0x57)   //possible issue identified - semgrep
        if ((5 < (uVar8 - 0x61 & 0xff)) && (sVar6 = sVar7, (uVar8 - 0x41 & 0xff) < 6)) {   //possible issue identified - semgrep
          sVar6 = sVar7 * 0x10 + (uVar8 - 0x37)   //possible issue identified - semgrep
        }
      }
      pbVar9 = pbVar9 + 1;
      sVar7 = sVar6;
    }
    (**(code **)(param_1 + 0x14))(param_1,uVar1,sVar7);
LAB_00054004:
    uVar4 = 1;
  }
  return uVar4;
}