//
// sub_100600874 from 0x100600874 to 0x100600b08 (660 bytes)
//
// 3 xrefs:
// > sub_1005FFA90 @ 0x100600698
// > sub_1006012E4 @ 0x100601410
// > sub_1006012E4 @ 0x1006014c8
//
// 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
//
__int64 __fastcall sub_100600874(__int64 a1)
{
int v2; // w23
int v3; // w20
__int64 v4; // x22
__int64 v5; // x21
__int64 v6; // x8
__int64 v7; // x9
__int64 result; // x0
_BYTE *v9; // x23
int v10; // w8
__int64 v11; // x23
__int64 v12; // x22
int v13; // w0
int v14; // w8
int v15; // w8
int v16; // w0
int v17; // w8
int v18; // w8
bool v19; // vf
__int64 (__fastcall *v20)(__int64, __int64); // [xsp+8h] [xbp-38h]
v20 = *(__int64 (__fastcall **)(__int64, __int64))(a1 + 64);
v2 = sub_1005DEA4C(*(unsigned int **)(a1 + 160));
v3 = v2 - 1;
*(_DWORD *)(a1 + 180) = v2 - 1;
v4 = sub_1005DEA60(*(_QWORD *)(a1 + 160), v2 - 1);
if ( (*(unsigned int (__fastcall **)(__int64, __int64, __int64))(a1 + 80))(a1, v4, v4) )
{
v5 = v4;
goto LABEL_8;
}
v6 = *(_QWORD *)(a1 + 40);
v7 = *(_QWORD *)(v6 + 24);
if ( (v7 & 0x80000) != 0 )
{
v5 = v4;
goto LABEL_20;
}
if ( v2 <= 1 )
{
*(_DWORD *)(a1 + 184) = 21;
*(_QWORD *)(a1 + 192) = v4;
return v20(0, a1);
}
v5 = v4;
v3 = v2 - 2;
*(_DWORD *)(a1 + 180) = v2 - 2;
v4 = sub_1005DEA60(*(_QWORD *)(a1 + 160), v2 - 2);
while ( 1 )
{
LABEL_8:
if ( v3 < 0 )
return 1;
*(_DWORD *)(a1 + 180) = v3;
if ( !*(_DWORD *)(v4 + 24) && (v4 != v5 || (*(_BYTE *)(*(_QWORD *)(a1 + 40) + 25LL) & 0x40) != 0) )
break;
LABEL_19:
*(_DWORD *)(v4 + 24) = 1;
v6 = *(_QWORD *)(a1 + 40);
v7 = *(_QWORD *)(v6 + 24);
LABEL_20:
v11 = v4;
v12 = (v6 + 8) & (v7 << 62 >> 63);
v13 = sub_100600B08(**(_QWORD **)(*(_QWORD *)v11 + 32LL), v12);
if ( v13 )
{
if ( v13 < 1 )
goto LABEL_25;
v14 = 9;
}
else
{
v14 = 13;
}
*(_DWORD *)(a1 + 184) = v14;
*(_QWORD *)(a1 + 192) = v11;
v15 = (*(__int64 (__fastcall **)(_QWORD, __int64))(a1 + 64))(0, a1);
result = 0;
if ( !v15 )
return result;
LABEL_25:
v16 = sub_100600B08(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)v11 + 32LL) + 8LL), v12);
if ( v16 )
{
if ( (v16 & 0x80000000) == 0 )
goto LABEL_30;
v17 = 10;
}
else
{
v17 = 14;
}
*(_DWORD *)(a1 + 184) = v17;
*(_QWORD *)(a1 + 192) = v11;
v18 = (*(__int64 (__fastcall **)(_QWORD, __int64))(a1 + 64))(0, a1);
result = 0;
if ( !v18 )
return result;
LABEL_30:
*(_QWORD *)(a1 + 192) = v11;
*(_QWORD *)(a1 + 200) = v5;
if ( !(unsigned int)v20(1, a1) )
return 0;
v19 = __OFSUB__(v3--, 1);
if ( v3 < 0 != v19 )
{
v4 = v11;
}
else
{
v4 = sub_1005DEA60(*(_QWORD *)(a1 + 160), v3);
v5 = v11;
}
}
v9 = sub_1005FF0F0(v5);
if ( !v9 )
{
*(_DWORD *)(a1 + 184) = 6;
*(_QWORD *)(a1 + 192) = v5;
v10 = v20(0, a1);
result = 0;
if ( !v10 )
return result;
goto LABEL_18;
}
if ( (int)sub_100604100(v4, v9) > 0
|| (*(_DWORD *)(a1 + 184) = 7, *(_QWORD *)(a1 + 192) = v4, (unsigned int)v20(0, a1)) )
{
LABEL_18:
sub_1005E9A8C((__int64)v9);
goto LABEL_19;
}
sub_1005E9A8C((__int64)v9);
return 0;
}