//
// jinit_2pass_quantizer from 0x69ed70 to 0x69ee50 (224 bytes)
//
// 1 xrefs:
// > jinit_master_decompress @ 0x67f908
//
// 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
//
int __fastcall jinit_2pass_quantizer(int a1)
{
_DWORD *v2; // r0
_DWORD *v3; // r7
int v4; // r4
int v5; // r6
int result; // r0
int v7; // r4
int v8; // r3
int v9; // r2
int v10; // r3
int v11; // r1
int v12; // r2
v2 = (_DWORD *)(**(int (***)(void))(a1 + 4))();
*(_DWORD *)(a1 + 484) = v2;
v3 = v2;
*v2 = sub_69DCA8;
v2[3] = sub_69DC9C;
v2[8] = 0;
v2[10] = 0;
if ( *(_DWORD *)(a1 + 120) != 3 )
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 48;
(**(void (__fastcall ***)(int))a1)(a1);
}
v4 = 0;
v5 = (**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 128);
for ( v3[6] = v5; ; v5 = v3[6] )
{
result = (*(int (__fastcall **)(int, int, int))(*(_DWORD *)(a1 + 4) + 4))(a1, 1, 4096);
*(_DWORD *)(v5 + v4) = result;
v4 += 4;
if ( v4 == 128 )
break;
}
v3[7] = 1;
if ( *(_DWORD *)(a1 + 108) )
{
v7 = *(_DWORD *)(a1 + 96);
if ( v7 <= 7 )
{
v10 = *(_DWORD *)a1;
v11 = 58;
v12 = 8;
}
else
{
if ( v7 <= 256 )
goto LABEL_9;
v10 = *(_DWORD *)a1;
v11 = 59;
v12 = 256;
}
*(_DWORD *)(v10 + 20) = v11;
*(_DWORD *)(*(_DWORD *)a1 + 24) = v12;
(**(void (__fastcall ***)(int))a1)(a1);
LABEL_9:
result = (*(int (__fastcall **)(int, int, int, int))(*(_DWORD *)(a1 + 4) + 8))(a1, 1, v7, 3);
v3[5] = v7;
v3[4] = result;
if ( !*(_DWORD *)(a1 + 88) )
return result;
LABEL_12:
v8 = *(_DWORD *)(a1 + 112);
v9 = *(_DWORD *)(a1 + 4);
*(_DWORD *)(a1 + 88) = 2;
v3[8] = (*(int (__fastcall **)(int, int, int))(v9 + 4))(a1, 1, 6 * v8 + 12);
return sub_69D9D8(a1);
}
v3[4] = 0;
if ( *(_DWORD *)(a1 + 88) )
goto LABEL_12;
return result;
}