undefined4 NICInitializeAdapter(int param_1,undefined1 param_2)

{
  char cVar1;
  undefined4 uVar2;
  int iVar3;
  uint uVar4;
  int iVar5;
  
  if (2 < RTDebugLevel) {
    printk("--> NICInitializeAdapter\n");
  }
  iVar5 = 0;
  cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
  while (iVar5 = iVar5 + 1, cVar1 == '\0') {
    uVar4 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x208);
    if ((uVar4 & 10) == 0) goto LAB_0002a930;
    if ((*(uint *)(param_1 + 0x76904) & 0x100) != 0) {
      return 1;
    }
    RTMPusecDelay(1000);
    if (iVar5 == 100) goto LAB_0002a930;
    cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
  }
  uVar4 = 0;
LAB_0002a930:
  if (RTDebugLevel < 3) {
    cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
  }
  else {
    printk("<== DMA offset 0x208 = 0x%x\n",uVar4);
    cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
  }
  if (cVar1 == '\0') {
    *(uint *)(*(int *)(param_1 + 0xdc) + 0x208) = uVar4 & 0xfb0 | 0x40;
  }
  *(undefined2 *)(param_1 + 0x516c) = *(undefined2 *)(param_1 + 0xb4);
  *(undefined2 *)(param_1 + 0x516e) = *(undefined2 *)(param_1 + 0xb6);
  *(undefined2 *)(param_1 + 0x5170) = *(undefined2 *)(param_1 + 0xb8);
  *(undefined2 *)(param_1 + 0x5172) = *(undefined2 *)(param_1 + 0xba);
  *(undefined2 *)(param_1 + 0x5174) = *(undefined2 *)(param_1 + 0xbc);
  *(undefined2 *)(param_1 + 0x5176) = *(undefined2 *)(param_1 + 0xbe);
  *(undefined2 *)(param_1 + 0x5178) = *(undefined2 *)(param_1 + 0xc0);
  *(undefined2 *)(param_1 + 0x517a) = *(undefined2 *)(param_1 + 0xc2);
  if (*(char *)(param_1 + 0xad) == '\x01') {
    *(undefined2 *)(param_1 + 0x517c) = *(undefined2 *)(param_1 + 0xc4);
    *(undefined2 *)(param_1 + 0x517e) = *(undefined2 *)(param_1 + 0xc6);
    *(undefined2 *)(param_1 + 0x5180) = *(undefined2 *)(param_1 + 200);
    *(undefined2 *)(param_1 + 0x5182) = *(undefined2 *)(param_1 + 0xca);
    *(undefined2 *)(param_1 + 0x5184) = *(undefined2 *)(param_1 + 0xcc);
    *(undefined2 *)(param_1 + 0x5186) = *(undefined2 *)(param_1 + 0xce);
    *(undefined2 *)(param_1 + 0x5188) = *(undefined2 *)(param_1 + 0xd0);
    *(undefined2 *)(param_1 + 0x518a) = *(undefined2 *)(param_1 + 0xd2);
  }
  cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
  if (cVar1 == '\0') {
    *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x20c) = 0x1003f;
    cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x400) = 0xe1f;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
  }
  if (cVar1 == '\0') {
    *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x400) = 0xe00;
  }
  iVar5 = NICInitializeAsic(param_1,param_2);
  uVar2 = 1;
  if (iVar5 == 0) {
    if (*(char *)(param_1 + 0xec) == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x240) = *(undefined4 *)(param_1 + 0x994);
    }
    if (RTDebugLevel < 3) {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      printk("--> TX_BASE_PTR1 : 0x%x\n");
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x230) = *(undefined4 *)(param_1 + 0x188);
    }
    if (RTDebugLevel < 3) {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      printk("--> TX_BASE_PTR0 : 0x%x\n");
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x250) = *(undefined4 *)(param_1 + 0x11a0);
    }
    if (RTDebugLevel < 3) {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      printk("--> TX_BASE_PTR2 : 0x%x\n");
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x260) = *(undefined4 *)(param_1 + 0x19ac);
    }
    if (RTDebugLevel < 3) {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      printk("--> TX_BASE_PTR3 : 0x%x\n");
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x270) = *(undefined4 *)(param_1 + 0x21b8);
    }
    if (RTDebugLevel < 3) {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      printk("--> TX_BASE_PTR4 : 0x%x\n");
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x280) = *(undefined4 *)(param_1 + 0x2a80);
    }
    if (RTDebugLevel < 3) {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      printk("--> TX_BASE_PTR5 : 0x%x\n");
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x290) = *(undefined4 *)(param_1 + 0x3a90);
    }
    if (RTDebugLevel < 3) {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      printk("--> RX_BASE_PTR : 0x%x\n");
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    *(undefined4 *)(param_1 + 0x4a90) = 0;
    *(undefined4 *)(param_1 + 0x4a88) = 0x7f;
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x298) = 0x7f;
    }
    iVar3 = 0x238;
    *(undefined4 *)(param_1 + 0x988) = 0;
    iVar5 = param_1;
    while( true ) {
      *(undefined4 *)(iVar5 + 0x980) = 0;
      if (*(char *)(param_1 + 0xec) == '\0') {
        *(undefined4 *)(*(int *)(param_1 + 0xdc) + iVar3) = 0;
      }
      iVar3 = iVar3 + 0x10;
      if (iVar3 == 0x288) break;
      *(undefined4 *)(iVar5 + 0x1194) = 0;
      iVar5 = iVar5 + 0x80c;
    }
    *(undefined4 *)(param_1 + 0x3a80) = 0;
    *(undefined4 *)(param_1 + 0x3a78) = 0;
    if (*(char *)(param_1 + 0xec) == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x288) = 0;
    }
    cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x234) = 0x40;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      if (cVar1 == '\0') {
        *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x244) = 0x40;
        cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      }
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x254) = 0x40;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x264) = 0x40;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x274) = 0x40;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x284) = 0x80;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x294) = 0x80;
    }
    iVar5 = 0;
    cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    while (iVar5 = iVar5 + 1, cVar1 == '\0') {
      uVar4 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x208);
      if ((uVar4 & 10) == 0) {
        cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
        goto LAB_0002add0;
      }
      RTMPusecDelay(1000);
      if (iVar5 == 100) goto LAB_0002adcc;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    uVar4 = 0;
LAB_0002adcc:
    cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
LAB_0002add0:
    if (cVar1 == '\0') {
      *(uint *)(*(int *)(param_1 + 0xdc) + 0x208) = uVar4 & 0xfb0 | 0x40;
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    else {
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar1 == '\0') {
      *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x210) = 0;
    }
    uVar2 = 0;
    if (2 < RTDebugLevel) {
      printk("<-- NICInitializeAdapter\n");
      uVar2 = 0;
    }
  }
  return uVar2;
}