//
// sub_1005B9178 from 0x1005b9178 to 0x1005b9358 (480 bytes)
//
// 2 xrefs:
// > ??> @ 0x100838968
// > ??> @ 0x100838a98
//
// 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_1005B9178(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, void **a6)
{
void **v6; // x21
void **v12; // x19
unsigned int (__fastcall *v13)(__int64, __int64, __int64, void **); // x8
unsigned int (__fastcall *v14)(__int64, __int64, __int64, void **); // x8
_BOOL4 v15; // w23
__int64 v16; // x20
unsigned int (__fastcall *v17)(__int64, __int64, __int64, void **); // x8
unsigned int (__fastcall *v18)(__int64, __int64, void **); // x9
v6 = a6;
if ( a6 )
{
v12 = nullptr;
}
else
{
v6 = (void **)sub_1005ABAC8();
v12 = v6;
if ( !v6 )
return 0;
}
if ( a3 )
{
if ( !(unsigned int)sub_1005AD044(a2 + 8, a3, a1 + 104, (__int64)v6) )
{
v16 = 0;
goto LABEL_33;
}
v13 = *(unsigned int (__fastcall **)(__int64, __int64, __int64, void **))(*(_QWORD *)a1 + 280LL);
if ( v13 )
{
if ( !v13(a1, a2 + 8, a2 + 8, v6) )
{
v16 = 0;
goto LABEL_33;
}
}
}
if ( a4 )
{
if ( !(unsigned int)sub_1005AD044(a2 + 32, a4, a1 + 104, (__int64)v6) )
{
v16 = 0;
goto LABEL_33;
}
v14 = *(unsigned int (__fastcall **)(__int64, __int64, __int64, void **))(*(_QWORD *)a1 + 280LL);
if ( v14 )
{
if ( !v14(a1, a2 + 32, a2 + 32, v6) )
{
v16 = 0;
goto LABEL_33;
}
}
}
if ( !a5 )
goto LABEL_32;
if ( !(unsigned int)sub_1005AD044(a2 + 56, a5, a1 + 104, (__int64)v6) )
{
v16 = 0;
goto LABEL_33;
}
if ( *(_DWORD *)(a2 + 64) == 1 )
v15 = **(_QWORD **)(a2 + 56) == 1 && *(_DWORD *)(a2 + 72) == 0;
else
v15 = 0;
v17 = *(unsigned int (__fastcall **)(__int64, __int64, __int64, void **))(*(_QWORD *)a1 + 280LL);
if ( !v17 )
goto LABEL_31;
if ( v15 )
{
v18 = *(unsigned int (__fastcall **)(__int64, __int64, void **))(*(_QWORD *)a1 + 296LL);
if ( v18 )
{
if ( !v18(a1, a2 + 56, v6) )
{
v16 = 0;
goto LABEL_33;
}
goto LABEL_31;
}
}
if ( v17(a1, a2 + 56, a2 + 56, v6) )
{
LABEL_31:
*(_DWORD *)(a2 + 80) = v15;
LABEL_32:
v16 = 1;
goto LABEL_33;
}
v16 = 0;
LABEL_33:
if ( v12 )
sub_1005ABB2C(v12);
return v16;
}