Newer
Older
AMI-Aptio-BIOS-Reversed / IntelPhyCard / sub_2FD4_decomp.txt
@Ajax Dong Ajax Dong 2 days ago 11 KB Init
char __fastcall sub_2FD4(__int64 a1, __int64 *a2)
{
  const char *XMC_25QH_Series; // rdx
  __int64 n15; // r8
  int n0x40000; // r8d
  bool v7; // zf
  __int64 v8; // rcx

  if ( !(unsigned __int8)sub_216C(a1, &n24608) ) /*0x2fe8*/
    return 0; /*0x2fef*/
  if ( (unsigned __int16)n24608 > 0x40C8u ) /*0x3008*/
  {
    if ( (unsigned __int16)n24608 <= 0x7020u ) /*0x336b*/
    {
      if ( (unsigned __int16)n24608 != 28704 ) /*0x3371*/
      {
        if ( (unsigned __int16)n24608 <= 0x6020u ) /*0x337e*/
        {
          if ( (unsigned __int16)n24608 == 24608 ) /*0x3384*/
          {
            n4096 = 4096; /*0x3424*/
            n32 = 32; /*0x342e*/
            n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x343a*/
            XMC_25QH_Series = "XMC 25QH Series"; /*0x3440*/
            n15 = 15; /*0x3447*/
            goto LABEL_92; /*0x344d*/
          }
          if ( (unsigned __int16)n24608 == 16623 ) /*0x3390*/
            goto LABEL_75; /*0x3390*/
          if ( (unsigned __int16)n24608 != 16780 ) /*0x339c*/
          {
            if ( (unsigned __int16)n24608 != 20719 ) /*0x33a4*/
            {
              if ( (unsigned __int16)n24608 == 24258 ) /*0x33b0*/
                goto LABEL_14; /*0x33b0*/
              if ( (unsigned __int16)n24608 == 24577 ) /*0x33bc*/
              {
                n4096 = 4096; /*0x33c4*/
                n32 = 32; /*0x33ce*/
                n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x33da*/
                XMC_25QH_Series = "Spansion 25FL(L) Series"; /*0x33e0*/
                n15 = 23; /*0x33e7*/
                goto LABEL_92; /*0x33ed*/
              }
              return 0; /*0x2ff3*/
            }
            goto LABEL_75; /*0x33a4*/
          }
          goto LABEL_56; /*0x339c*/
        }
        if ( (unsigned __int16)n24608 == 24733 ) /*0x3458*/
        {
          n4096 = 4096; /*0x34d6*/
          n32 = 32; /*0x34e0*/
          n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x34ec*/
          XMC_25QH_Series = "ISSI 25LP Series"; /*0x34f2*/
          n15 = 16; /*0x34f9*/
          goto LABEL_92; /*0x34ff*/
        }
        if ( (unsigned __int16)n24608 != 24776 ) /*0x345d*/
        {
          if ( (unsigned __int16)n24608 != 24815 ) /*0x3462*/
          {
            if ( (unsigned __int16)n24608 != 28700 ) /*0x346e*/
              return 0; /*0x346e*/
LABEL_62:
            n4096 = 4096; /*0x3474*/
            n32 = 32; /*0x3480*/
            n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x348c*/
            XMC_25QH_Series = "EON 25F/Q/S/QH Series"; /*0x3492*/
            n15 = 21; /*0x3499*/
            goto LABEL_92; /*0x349f*/
          }
          goto LABEL_75; /*0x3462*/
        }
LABEL_63:
        n4096 = 4096; /*0x34a4*/
        n32 = 32; /*0x34b0*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x34bc*/
        XMC_25QH_Series = "GigaDevice 25Q Series"; /*0x34c2*/
        n15 = 21; /*0x34c9*/
        goto LABEL_92; /*0x34cf*/
      }
LABEL_73:
      n4096 = 4096; /*0x3579*/
      n32 = 32; /*0x3585*/
      n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x3591*/
      XMC_25QH_Series = "STM/Micron/Numonyx 25PF/PX Series"; /*0x3597*/
      n15 = 33; /*0x359e*/
      goto LABEL_92; /*0x35a4*/
    }
    if ( (unsigned __int16)n24608 <= 0x80EFu ) /*0x350b*/
    {
      switch ( (unsigned __int16)n24608 ) /*0x3511*/
      {
        case 0x80EFu: /*0x3511*/
          goto LABEL_75; /*0x3511*/
        case 0x709Du: /*0x3511*/
          n4096 = 4096; /*0x35ab*/
          n32 = 32; /*0x35b5*/
          n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x35c1*/
          XMC_25QH_Series = "ISSI 25WP Series"; /*0x35c7*/
          n15 = 16; /*0x35ce*/
          goto LABEL_92; /*0x35d4*/
        case 0x70EFu: /*0x3511*/
          goto LABEL_75; /*0x3526*/
      }
      if ( (unsigned __int16)n24608 != 28960 ) /*0x352f*/
      {
        if ( (unsigned __int16)n24608 != 29167 ) /*0x3537*/
        {
          if ( (unsigned __int16)n24608 == 32800 ) /*0x3543*/
          {
            n4096 = 256; /*0x354b*/
            n32 = -37; /*0x3555*/
            n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x3561*/
            XMC_25QH_Series = "STM/Numonyx 25PE Series"; /*0x3567*/
            n15 = 23; /*0x356e*/
            goto LABEL_92; /*0x3574*/
          }
          return 0; /*0x3543*/
        }
        goto LABEL_75; /*0x3537*/
      }
      goto LABEL_73; /*0x352f*/
    }
    if ( (unsigned __int16)n24608 != 35209 ) /*0x360f*/
    {
      if ( (unsigned __int16)n24608 == 40319 ) /*0x3617*/
      {
        n4096 = 4096; /*0x365c*/
        n32 = -41; /*0x3666*/
        n0x1000000 = sub_2F24((unsigned int)n24608); /*0x3672*/
        XMC_25QH_Series = "PMC 25LV/LQ Series"; /*0x3678*/
        n15 = 18; /*0x367f*/
        goto LABEL_92; /*0x3685*/
      }
      if ( (((unsigned __int16)n24608 - 47648) & 0xFFFFFEFF) == 0 ) /*0x3624*/
      {
        n4096 = 4096; /*0x362c*/
        n32 = 32; /*0x3636*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x3642*/
        XMC_25QH_Series = "Micron/Numonyx 25Q Series"; /*0x3648*/
        n15 = 25; /*0x364f*/
        goto LABEL_92; /*0x3655*/
      }
      return 0; /*0x3624*/
    }
    n4096 = 0x10000; /*0x3694*/
    if ( BYTE2(n24608) != 17 ) /*0x369e*/
    {
      if ( BYTE2(n24608) == 18 ) /*0x36a3*/
        goto LABEL_89; /*0x36a3*/
      if ( BYTE2(n24608) == 19 ) /*0x36a8*/
        goto LABEL_88; /*0x36a8*/
      if ( BYTE2(n24608) != 21 ) /*0x36ad*/
      {
        if ( BYTE2(n24608) != 22 ) /*0x36b2*/
        {
          if ( BYTE2(n24608) != 23 ) /*0x36b7*/
          {
            n0x1000000 = 0x1000000; /*0x36b9*/
LABEL_91:
            n15 = 24; /*0x36e7*/
            XMC_25QH_Series = "Intel/Numonyx 25F160/320"; /*0x36ed*/
            goto LABEL_92; /*0x36ed*/
          }
LABEL_88:
          n0x1000000 = 0x800000; /*0x36c5*/
          goto LABEL_91; /*0x36cf*/
        }
LABEL_89:
        n0x1000000 = 0x400000; /*0x36d1*/
        goto LABEL_91; /*0x36db*/
      }
    }
    n0x1000000 = 0x200000; /*0x36dd*/
    goto LABEL_91; /*0x36dd*/
  }
  if ( (unsigned __int16)n24608 == 16584 ) /*0x300e*/
    goto LABEL_63; /*0x300e*/
  if ( (unsigned __int16)n24608 > 0x3037u ) /*0x301b*/
  {
    if ( (unsigned __int16)n24608 <= 0x3820u ) /*0x31f0*/
    {
      if ( (unsigned __int16)n24608 == 14368 ) /*0x31f6*/
      {
        n4096 = 4096; /*0x3287*/
        n32 = 32; /*0x3291*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x329d*/
        XMC_25QH_Series = "XMC 25QU Series"; /*0x32a3*/
        n15 = 15; /*0x32aa*/
        goto LABEL_92; /*0x32b0*/
      }
      if ( (unsigned __int16)n24608 != 12527 ) /*0x3202*/
      {
        switch ( (unsigned __int16)n24608 ) /*0x320b*/
        {
          case 0x311Cu: /*0x320b*/
            goto LABEL_62; /*0x320b*/
          case 0x32F8u: /*0x320b*/
            n4096 = 4096; /*0x3257*/
            n32 = 32; /*0x3261*/
            n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x326d*/
            XMC_25QH_Series = "FIDELIX 25Q Series"; /*0x3273*/
            n15 = 18; /*0x327a*/
            goto LABEL_92; /*0x3280*/
          case 0x377Fu: /*0x320b*/
            n4096 = 4096; /*0x322e*/
            n0x1000000 = sub_2F24((unsigned int)n24608); /*0x323d*/
            XMC_25QH_Series = "AMIC 25L Series"; /*0x3243*/
            n15 = 15; /*0x324a*/
            goto LABEL_92; /*0x3250*/
        }
        v7 = (unsigned __int16)n24608 == 14364; /*0x3221*/
        goto LABEL_25; /*0x3227*/
      }
LABEL_75:
      n4096 = 4096; /*0x35d9*/
      n32 = 32; /*0x35e5*/
      n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x35f1*/
      XMC_25QH_Series = "Winbond 25X/Q Series"; /*0x35f7*/
      n15 = 20; /*0x35fe*/
      goto LABEL_92; /*0x3604*/
    }
    if ( (unsigned __int16)n24608 == 16385 ) /*0x32bb*/
    {
      n4096 = 4096; /*0x3336*/
      n32 = 32; /*0x3340*/
      n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x334c*/
      XMC_25QH_Series = "Spansion 25FL(K) Series"; /*0x3352*/
      n15 = 23; /*0x3359*/
      goto LABEL_92; /*0x335f*/
    }
    if ( (unsigned __int16)n24608 == 16439 ) /*0x32c0*/
      goto LABEL_44; /*0x32c0*/
    if ( (unsigned __int16)n24608 != 16524 ) /*0x32c5*/
    {
      if ( (unsigned __int16)n24608 == 16545 ) /*0x32ce*/
      {
        n4096 = 4096; /*0x32d6*/
        n32 = 32; /*0x32e0*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x32ec*/
        XMC_25QH_Series = "Fudan FM25Q Series"; /*0x32f2*/
        n15 = 18; /*0x32f9*/
        goto LABEL_92; /*0x32ff*/
      }
      return 0; /*0x32ce*/
    }
LABEL_56:
    n4096 = 4096; /*0x33f2*/
    n32 = 32; /*0x33fe*/
    n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x340a*/
    XMC_25QH_Series = "ESMT 25L QA/PA Series"; /*0x3410*/
    n15 = 21; /*0x3417*/
    goto LABEL_92; /*0x341d*/
  }
  if ( (unsigned __int16)n24608 == 12343 ) /*0x3021*/
  {
LABEL_44:
    n4096 = 4096; /*0x3304*/
    n32 = 32; /*0x3310*/
    n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x331c*/
    XMC_25QH_Series = "AMIC 25L/LQ Series"; /*0x3322*/
    n15 = 18; /*0x3329*/
    goto LABEL_92; /*0x332f*/
  }
  if ( (unsigned __int16)n24608 > 0x24C2u ) /*0x302e*/
  {
    switch ( (unsigned __int16)n24608 ) /*0x3162*/
    {
      case 0x25C2u: /*0x3162*/
        goto LABEL_14; /*0x3162*/
      case 0x26BFu: /*0x3162*/
        n4096 = 4096; /*0x31bb*/
        byte_4AA9 = 1; /*0x31c5*/
        n0x1000000 = sub_2F74((unsigned int)n24608); /*0x31d1*/
        XMC_25QH_Series = "SST 26VF Series"; /*0x31d7*/
        n15 = 15; /*0x31de*/
        goto LABEL_92; /*0x31e4*/
      case 0x28C2u: /*0x3162*/
        n4096 = 4096; /*0x318b*/
        n32 = 32; /*0x3195*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x31a1*/
        XMC_25QH_Series = "MXIC 25R Series"; /*0x31a7*/
        n15 = 15; /*0x31ae*/
        goto LABEL_92; /*0x31b4*/
    }
    v7 = (unsigned __int16)n24608 == 12316; /*0x3178*/
LABEL_25:
    if ( !v7 ) /*0x317e*/
      return 0; /*0x317e*/
    goto LABEL_62; /*0x317e*/
  }
  if ( (unsigned __int16)n24608 != 9410 ) /*0x3034*/
  {
    switch ( (unsigned __int16)n24608 ) /*0x303c*/
    {
      case 0x201u: /*0x303c*/
        n4096 = 0x10000; /*0x3138*/
        n0x1000000 = sub_2F24((unsigned int)n24608); /*0x3144*/
        XMC_25QH_Series = "Spansion 25FL Series"; /*0x314a*/
        n15 = 19; /*0x3151*/
        goto LABEL_92; /*0x3157*/
      case 0x2001u: /*0x303c*/
        n4096 = 0x10000; /*0x310c*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x3118*/
        XMC_25QH_Series = "Spansion 25FL(P) Series"; /*0x311e*/
        n15 = 23; /*0x3125*/
        goto LABEL_92; /*0x312b*/
      case 0x201Cu: /*0x303c*/
        n32 = -40; /*0x30d7*/
        n4096 = 0x10000; /*0x30e0*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x30ec*/
        XMC_25QH_Series = "EON 25P Series"; /*0x30f2*/
        n15 = 14; /*0x30f9*/
        goto LABEL_92; /*0x30ff*/
      case 0x2020u: /*0x303c*/
        n32 = -40; /*0x3092*/
        n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x30a9*/
        XMC_25QH_Series = "STM/Micron/Numonyx 25P Series"; /*0x30b4*/
        if ( n0x1000000 == 0x1000000 ) /*0x30bb*/
          n0x40000 = 0x40000; /*0x30bb*/
        n4096 = n0x40000; /*0x30bf*/
        n15 = 29; /*0x30c6*/
        goto LABEL_92; /*0x30cc*/
    }
    if ( (unsigned __int16)n24608 != 8386 ) /*0x305e*/
      return 0; /*0x305e*/
  }
LABEL_14:
  n4096 = 4096; /*0x3060*/
  n32 = 32; /*0x306c*/
  n0x1000000 = sub_2E7C((unsigned int)n24608); /*0x3078*/
  XMC_25QH_Series = "MXIC 25L/U Series"; /*0x307e*/
  n15 = 17; /*0x3085*/
LABEL_92:
  sub_3A00(&unk_4C40, XMC_25QH_Series, n15); /*0x36f4*/
  *a2 = (__int64)off_4A30; /*0x3717*/
  sub_3A00(&unk_4A88, &unk_4B08, 24); /*0x3721*/
  n24608_0 = n24608; /*0x372c*/
  v8 = *a2; /*0x3732*/
  n24608_1 = n24608; /*0x3735*/
  *(_DWORD *)(v8 + 72) = dword_4B18; /*0x3742*/
  *(_DWORD *)(*a2 + 76) = n4096; /*0x374e*/
  *(_QWORD *)(*a2 + 80) = &unk_4C40; /*0x3754*/
  qword_4A20 = *(unsigned int *)sub_1CAC(1036304); /*0x3764*/
  sub_20C8(); /*0x376b*/
  sub_2638(4278190080LL); /*0x3775*/
  return 1; /*0x3781*/
}