//
// jinit_c_main_controller from 0xbfb694 to 0xbfb770 (220 bytes)
//
// 2 xrefs:
// > jinit_compress_master @ 0xbfb490
// > ??> @ 0x81360
//
// 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
//
_QWORD *__fastcall jinit_c_main_controller(__int64 a1, int a2)
{
_QWORD *result; // x0
int v5; // w2
_DWORD *v6; // x19
_QWORD *v7; // x22
int v8; // w21
int v9; // w6
int v10; // w2
int v11; // w5
int v12; // w3
int v13; // w1
__int64 (__fastcall *v14)(__int64); // x2
result = (_QWORD *)(**(__int64 (***)(void))(a1 + 8))();
*(_QWORD *)(a1 + 504) = result;
v5 = *(_DWORD *)(a1 + 288);
*result = sub_BFB63C;
if ( !v5 )
{
if ( a2 )
{
v14 = **(__int64 (__fastcall ***)(__int64))a1;
*(_DWORD *)(*(_QWORD *)a1 + 40LL) = 3;
return (_QWORD *)v14(a1);
}
else
{
v6 = *(_DWORD **)(a1 + 104);
if ( *(int *)(a1 + 92) > 0 )
{
v7 = result + 4;
v8 = 0;
do
{
v9 = v6[9];
v10 = v6[7];
v11 = v6[3];
++v8;
v12 = v6[10];
v6 += 24;
result = (_QWORD *)(*(__int64 (__fastcall **)(__int64, __int64, _QWORD, _QWORD))(*(_QWORD *)(a1 + 8) + 16LL))(
a1,
1,
(unsigned int)(v9 * v10),
(unsigned int)(v11 * v12));
v13 = *(_DWORD *)(a1 + 92);
*v7++ = result;
}
while ( v13 > v8 );
}
}
}
return result;
}