//
// sub_100526994 from 0x100526994 to 0x100526b54 (448 bytes)
//
// 2 xrefs:
// > sub_100521AE0 @ 0x100521cf4
// > sub_100538A48 @ 0x100538dc4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
unsigned __int64 __fastcall sub_100526994(__int64 a1)
{
unsigned __int64 result; // x0
__int64 v3; // x8
__int64 v4; // x2
__int64 v5; // x4
__int64 v6; // x9
__int64 (__fastcall *v7)(__int64, _QWORD); // x8
int v8; // w0
_BYTE *v9; // x8
unsigned __int64 v10; // x20
__int64 v11; // x0
__int64 v12; // x4
int v13; // [xsp+Ch] [xbp-14h]
result = (*(__int64 (**)(void))(*(_QWORD *)(a1 + 8) + 96LL))();
if ( v13 )
{
v3 = *(_QWORD *)(a1 + 128);
if ( *(_DWORD *)(v3 + 928) == 22 )
{
if ( result <= 3 )
{
v4 = 159;
v5 = 2368;
LABEL_19:
sub_1005E0E48(20, 289, v4, "s3_clnt.c", v5);
goto LABEL_22;
}
v9 = *(_BYTE **)(a1 + 88);
if ( *v9 != 1 )
{
v4 = 329;
v5 = 2374;
goto LABEL_19;
}
v10 = ((unsigned __int64)(unsigned __int8)v9[1] << 16)
| ((unsigned __int64)(unsigned __int8)v9[2] << 8)
| (unsigned __int8)v9[3];
if ( v10 + 4 != result )
{
v4 = 159;
v5 = 2380;
goto LABEL_19;
}
v11 = sub_1005DA2B0(
v9 + 4,
((unsigned __int64)(unsigned __int8)v9[1] << 16)
| ((unsigned __int64)(unsigned __int8)v9[2] << 8)
| (unsigned __int8)v9[3]);
*(_QWORD *)(a1 + 520) = v11;
if ( !v11 )
{
v12 = 2386;
goto LABEL_21;
}
*(_DWORD *)(a1 + 528) = v10;
}
else
{
*(_DWORD *)(v3 + 964) = 1;
}
v6 = *(_QWORD *)(a1 + 368);
v7 = *(__int64 (__fastcall **)(__int64, _QWORD))(v6 + 488);
if ( !v7 )
return 1;
v8 = v7(a1, *(_QWORD *)(v6 + 496));
if ( !v8 )
{
sub_1005E0E48(20, 289, 328, "s3_clnt.c", 2396);
LABEL_22:
sub_10052C058(a1, 2);
*(_DWORD *)(a1 + 72) = 5;
return 0xFFFFFFFFLL;
}
if ( (v8 & 0x80000000) == 0 )
return 1;
v12 = 2401;
LABEL_21:
sub_1005E0E48(20, 289, 65, "s3_clnt.c", v12);
goto LABEL_22;
}
return result;
}