//
// jinit_color_deconverter from 0x88758c to 0x887a0a (1150 bytes)
//
// 1 xrefs:
// > jinit_master_decompress @ 0x88fae4
//
// 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:15 +0000
//
int __fastcall jinit_color_deconverter(int a1)
{
int result; // r0
int v3; // r4
int v4; // r3
int v5; // r1
int v6; // r3
int v7; // r3
int v8; // r4
int v9; // r3
int v10; // lr
unsigned int v11; // r7
int v12; // r8
unsigned int v13; // r5
int v14; // r12
int v15; // r3
int32x4_t v16; // q9
int32x4_t v17; // q3
int32x4_t v18; // q8
int32x4_t *v19; // r4
int32x4_t v20; // q15
int32x4_t *v21; // r2
int v22; // r3
int32x4_t v23; // q14
unsigned int v24; // r1
int32x4_t v25; // q13
int32x4_t v26; // q12
int32x4_t v27; // q10
int32x4_t v28; // q9
unsigned int v29; // r7
int v30; // lr
int v31; // r10
int v32; // r9
_DWORD *v33; // r1
int v34; // r2
_DWORD *v35; // r12
unsigned int v36; // r7
_DWORD *v37; // r5
int v38; // r1
int v39; // r2
int v40; // r3
char *v41; // r5
_DWORD *v42; // r7
char *v43; // r4
int v44; // r0
int v45; // r1
int v46; // r2
int v47; // r3
int v48; // r12
int v49; // lr
int v50; // r3
result = (**(int (***)(void))(a1 + 4))();
*(_DWORD *)(a1 + 480) = result;
v3 = result;
*(_DWORD *)result = nullsub_27;
v4 = *(_DWORD *)(a1 + 40);
switch ( v4 )
{
case 1:
if ( *(_DWORD *)(a1 + 36) != 1 )
goto LABEL_3;
if ( !*(_DWORD *)(a1 + 304) )
{
v5 = *(_DWORD *)(a1 + 44);
switch ( v5 )
{
case 1:
*(_DWORD *)(a1 + 120) = 1;
goto LABEL_45;
case 2:
*(_DWORD *)(a1 + 120) = 3;
goto LABEL_58;
case 4:
*(_DWORD *)(a1 + 120) = 4;
goto LABEL_15;
case 6:
*(_DWORD *)(a1 + 120) = 3;
goto LABEL_15;
default:
goto LABEL_14;
}
}
goto LABEL_6;
case 2:
case 3:
case 6:
case 7:
if ( *(_DWORD *)(a1 + 36) == 3 )
goto LABEL_4;
goto LABEL_3;
case 4:
case 5:
if ( *(_DWORD *)(a1 + 36) != 4 )
goto LABEL_3;
goto LABEL_4;
default:
if ( *(int *)(a1 + 36) <= 0 )
{
LABEL_3:
*(_DWORD *)(*(_DWORD *)a1 + 20) = 11;
result = (**(int (__fastcall ***)(int))a1)(a1);
v4 = *(_DWORD *)(a1 + 40);
}
LABEL_4:
if ( *(_DWORD *)(a1 + 304) && (v4 & 0xFFFFFFFB) != 2 )
{
LABEL_6:
*(_DWORD *)(*(_DWORD *)a1 + 20) = 28;
result = (**(int (__fastcall ***)(int))a1)(a1);
v4 = *(_DWORD *)(a1 + 40);
}
v5 = *(_DWORD *)(a1 + 44);
switch ( v5 )
{
case 1:
*(_DWORD *)(a1 + 120) = 1;
switch ( v4 )
{
case 1:
case 3:
case 7:
LABEL_45:
*(_DWORD *)(v3 + 4) = sub_88756C;
if ( *(int *)(a1 + 36) > 1 )
{
v38 = 88;
v39 = 1;
result = 0;
do
{
++v39;
v40 = *(_DWORD *)(a1 + 216) + v38;
v38 += 88;
*(_DWORD *)(v40 + 52) = 0;
}
while ( *(_DWORD *)(a1 + 36) > v39 );
}
break;
case 2:
v7 = *(_DWORD *)(a1 + 304);
if ( v7 )
{
if ( v7 == 1 )
{
*(_DWORD *)(v3 + 4) = sub_886E50;
}
else
{
*(_DWORD *)(*(_DWORD *)a1 + 20) = 28;
(**(void (__fastcall ***)(int))a1)(a1);
}
}
else
{
*(_DWORD *)(v3 + 4) = sub_8869EC;
}
v8 = *(_DWORD *)(a1 + 480);
result = (**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 3072);
*(_DWORD *)(v8 + 24) = result;
v9 = (result << 29 >> 31) & 3;
if ( v9 )
{
*(_DWORD *)result = 0;
*(_DWORD *)(result + 1024) = 0;
*(_DWORD *)(result + 2048) = 0x8000;
if ( v9 == 1 )
{
v10 = 255;
v11 = 1;
}
else
{
*(_DWORD *)(result + 4) = 19595;
*(_DWORD *)(result + 1028) = 38470;
*(_DWORD *)(result + 2052) = 40239;
if ( v9 == 3 )
{
v10 = 253;
v11 = 3;
*(_DWORD *)(result + 1032) = &stru_12C8C;
*(_DWORD *)(result + 8) = 39190;
*(_DWORD *)(result + 2056) = 47710;
}
else
{
v10 = 254;
v11 = 2;
}
}
v12 = 256 - v9;
v13 = 63;
v14 = 252;
}
else
{
v12 = 256;
v13 = 64;
v14 = 256;
v10 = 256;
v11 = 0;
}
v15 = 4 * v9;
v16.n128_u64[0] = 0x100000000LL;
v16.n128_u64[1] = 0x300000002LL;
v17.n128_u64[0] = 0x400000004LL;
v17.n128_u64[1] = 0x400000004LL;
v18 = vaddq_s32(vdupq_n_s32(v11), v16);
v19 = (int32x4_t *)(v15 + 1024 + result);
v20.n128_u64[0] = 0x800000008000LL;
v20.n128_u64[1] = 0x800000008000LL;
v21 = (int32x4_t *)(v15 + 2048 + result);
v22 = v15 + result;
v23.n128_u64[0] = 0x4C8B00004C8BLL;
v23.n128_u64[1] = 0x4C8B00004C8BLL;
v24 = 0;
v25.n128_u64[0] = 0x964600009646LL;
v25.n128_u64[1] = 0x964600009646LL;
v26.n128_u64[0] = 0x1D2F00001D2FLL;
v26.n128_u64[1] = 0x1D2F00001D2FLL;
do
{
++v24;
v22 += 16;
v27 = vmulq_s32(v18, v25);
v28 = vmlaq_s32(v20, v18, v26);
*(int32x4_t *)(v22 - 16) = vmulq_s32(v18, v23);
v18 = vaddq_s32(v18, v17);
*v19++ = v27;
*v21++ = v28;
}
while ( v24 < v13 );
v29 = v11 + v14;
v30 = v10 - v14;
if ( v14 != v12 )
{
v31 = 19595 * v29;
v32 = 38470 * v29;
v33 = (_DWORD *)(result + 4 * v29);
v34 = 7471 * v29;
*v33 = 19595 * v29;
v33[512] = 7471 * v29 + 0x8000;
v33[256] = 38470 * v29;
if ( v30 != 1 )
{
v35 = (_DWORD *)(result + 4 * (v29 + 1));
*v35 = v31 + 19595;
v36 = v29 + 2;
v35[256] = v32 + 38470;
v35[512] = v34 + 40239;
if ( v30 != 2 )
{
v37 = (_DWORD *)(result + 4 * v36);
*v37 = v31 + 39190;
v37[256] = v32 + 76940;
v37[512] = v34 + 47710;
}
}
}
break;
default:
goto LABEL_15;
}
break;
case 2:
*(_DWORD *)(a1 + 120) = 3;
switch ( v4 )
{
case 1:
LABEL_58:
*(_DWORD *)(v3 + 4) = sub_887254;
goto LABEL_16;
case 2:
v50 = *(_DWORD *)(a1 + 304);
if ( v50 )
{
if ( v50 != 1 )
goto LABEL_15;
*(_DWORD *)(v3 + 4) = sub_886A64;
}
else
{
*(_DWORD *)(v3 + 4) = sub_886EE4;
}
break;
case 3:
*(_DWORD *)(v3 + 4) = sub_886938;
result = sub_886890(a1);
goto LABEL_16;
case 7:
*(_DWORD *)(v3 + 4) = sub_886938;
v41 = (char *)&loc_589980;
v42 = *(_DWORD **)(a1 + 480);
v43 = "gerdash";
v42[2] = (**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 1024);
v42[3] = (**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 1024);
v42[4] = (**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 1024);
v44 = (**(int (__fastcall ***)(int, int, int))(a1 + 4))(a1, 1, 1024);
v45 = -29696512;
v46 = -23488896;
v47 = 0;
v42[5] = v44;
do
{
v48 = v46 >> 16;
v49 = v45 >> 16;
v46 += 183763;
*(_DWORD *)(v42[2] + v47) = v48;
v45 += 232260;
*(_DWORD *)(v42[3] + v47) = v49;
*(_DWORD *)(v42[4] + v47) = v43;
result = v42[5];
v43 -= 93603;
*(_DWORD *)(result + v47) = v41;
v47 += 4;
v41 -= 45107;
}
while ( v47 != 1024 );
goto LABEL_16;
default:
goto LABEL_15;
}
break;
case 4:
*(_DWORD *)(a1 + 120) = 4;
if ( v4 == 4 )
{
*(_DWORD *)(v3 + 4) = sub_8871F8;
}
else
{
if ( v4 != 5 )
goto LABEL_15;
*(_DWORD *)(v3 + 4) = sub_887498;
result = sub_886890(a1);
}
break;
case 6:
*(_DWORD *)(a1 + 120) = 3;
if ( v4 != 6 )
goto LABEL_15;
v6 = *(_DWORD *)(a1 + 304);
if ( v6 )
{
if ( v6 != 1 )
goto LABEL_15;
*(_DWORD *)(v3 + 4) = sub_886A64;
}
else
{
*(_DWORD *)(v3 + 4) = sub_886EE4;
}
break;
default:
LABEL_14:
if ( v5 == v4 )
{
*(_DWORD *)(a1 + 120) = *(_DWORD *)(a1 + 36);
*(_DWORD *)(v3 + 4) = sub_8871F8;
}
else
{
LABEL_15:
*(_DWORD *)(*(_DWORD *)a1 + 20) = 28;
result = (**(int (__fastcall ***)(int))a1)(a1);
}
break;
}
LABEL_16:
if ( *(_DWORD *)(a1 + 84) )
*(_DWORD *)(a1 + 124) = 1;
else
*(_DWORD *)(a1 + 124) = *(_DWORD *)(a1 + 120);
return result;
}
}