//
// jinit_d_main_controller from 0x88c2e4 to 0x88c41c (312 bytes)
//
// 1 xrefs:
// > jinit_master_decompress @ 0x88fb42
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:03:18 +0000
//
int (__fastcall **__fastcall jinit_d_main_controller(int a1, int a2))(int result, int a2)
{
int (__fastcall **result)(int, int); // r0
int (__fastcall **v5)(int, int); // r8
int v6; // r7
int v7; // r11
int v8; // r0
int v9; // r6
int v10; // r4
int v11; // r9
int i; // r7
int v13; // r3
int v14; // r10
int v15; // r6
int v16; // r1
int v17; // r9
int (__fastcall **v18)(int, int); // r8
int v19; // r7
int v20; // r2
int v21; // r0
result = (int (__fastcall **)(int, int))(**(int (***)(void))(a1 + 4))();
*(_DWORD *)(a1 + 448) = result;
v5 = result;
*result = sub_88BE00;
if ( a2 )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 3;
result = (int (__fastcall **)(int, int))(**(int (__fastcall ***)(int))a1)(a1);
}
if ( *(_DWORD *)(*(_DWORD *)(a1 + 476) + 8) )
{
v6 = *(_DWORD *)(a1 + 328);
if ( v6 <= 1 )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 48;
(**(void (__fastcall ***)(int))a1)(a1);
v6 = *(_DWORD *)(a1 + 328);
}
v7 = *(_DWORD *)(a1 + 448);
v8 = (**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 8 * *(_DWORD *)(a1 + 36));
*(_DWORD *)(v7 + 56) = v8;
result = (int (__fastcall **)(int, int))(v8 + 4 * *(_DWORD *)(a1 + 36));
*(_DWORD *)(v7 + 60) = result;
v9 = *(_DWORD *)(a1 + 36);
v10 = *(_DWORD *)(a1 + 216);
if ( v9 > 0 )
{
v11 = v6 + 4;
for ( i = 0; i < v9; ++i )
{
v13 = *(_DWORD *)(v10 + 12);
v10 += 88;
v14 = v11 * (*(_DWORD *)(v10 - 48) * v13 / *(_DWORD *)(a1 + 328));
v15 = *(_DWORD *)(v10 - 48) * v13 / *(_DWORD *)(a1 + 328);
result = (int (__fastcall **)(int, int))((**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 8 * v14)
+ 4 * v15);
*(_DWORD *)(*(_DWORD *)(v7 + 56) + 4 * i) = result;
*(_DWORD *)(*(_DWORD *)(v7 + 60) + 4 * i) = &result[v14];
v9 = *(_DWORD *)(a1 + 36);
}
v10 = *(_DWORD *)(a1 + 216);
}
v16 = *(_DWORD *)(a1 + 328);
v17 = v16 + 2;
}
else
{
v17 = *(_DWORD *)(a1 + 328);
v9 = *(_DWORD *)(a1 + 36);
v10 = *(_DWORD *)(a1 + 216);
v16 = v17;
}
if ( v9 > 0 )
{
v18 = v5 + 1;
v19 = 0;
while ( 1 )
{
v20 = *(_DWORD *)(v10 + 12);
++v19;
v21 = *(_DWORD *)(v10 + 40);
v10 += 88;
result = (int (__fastcall **)(int, int))(*(int (__fastcall **)(int, int, int, int))(*(_DWORD *)(a1 + 4) + 8))(
a1,
1,
*(_DWORD *)(v10 - 60) * *(_DWORD *)(v10 - 52),
v17 * (v21 * v20 / v16));
v18[1] = (int (__fastcall *)(int, int))result;
++v18;
if ( *(_DWORD *)(a1 + 36) <= v19 )
break;
v16 = *(_DWORD *)(a1 + 328);
}
}
return result;
}