//
// sub_9527A8 from 0x9527a8 to 0x952a66 (702 bytes)
//
// 1 xrefs:
// > sub_95380C @ 0x953838
//
// 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:05:25 +0000
//
int __fastcall sub_9527A8(int a1, int a2, unsigned int a3, unsigned int a4)
{
unsigned int v6; // r11
int v8; // r5
unsigned int v9; // r6
int v10; // r10
int v11; // r2
unsigned int v12; // r1
int result; // r0
int v14; // r3
int v15; // r2
int v16; // r0
int v17; // r1
int v18; // r2
int v19; // r2
int v20; // r0
int v21; // r1
int v22; // r3
int v23; // r10
int v24; // r0
int v25; // r5
int v26; // r1
int v27; // r0
unsigned int v34; // r1
unsigned int v35; // r0
int v36; // r1
unsigned int v37; // r0
int v38; // [sp+4h] [bp-14h] BYREF
v6 = a3;
if ( a3 >= a4 )
{
LABEL_55:
sub_953194(a1, 14, &v38);
sub_9531C8(a1, 15);
return 8;
}
v8 = 0;
do
{
v9 = v6 + 1;
v10 = *(unsigned __int8 *)(a2 + (v6 ^ 3));
if ( (v10 & 0x80) == 0 )
{
sub_953194(a1, 13, &v38);
if ( (v10 & 0x40) != 0 )
v11 = -4 - (unsigned __int8)(4 * v10) + v38;
else
v11 = 4 * v10 + v38 + 4;
v38 = v11;
LABEL_13:
sub_9531C8(a1, 13);
goto LABEL_33;
}
v12 = v10 & 0xF0;
result = 9;
if ( v12 > 0xAF )
{
if ( v12 == 176 )
{
result = 9;
switch ( *(_BYTE *)(a2 + (v6 ^ 3)) )
{
case 0xB0:
goto LABEL_54;
case 0xB1:
if ( v9 >= a4 )
return 9;
v19 = *(unsigned __int8 *)(a2 + (v9 ^ 3));
result = 9;
if ( !*(_BYTE *)(a2 + (v9 ^ 3)) || (v19 & 0xF0) != 0 )
return result;
v20 = a1;
v21 = 0;
v22 = 0;
goto LABEL_49;
case 0xB2:
v23 = v8;
v24 = 0;
v25 = 0;
break;
case 0xB3:
v22 = 1;
v27 = *(unsigned __int8 *)(a2 + (v9 ^ 3));
_R1 = v27 << 12;
__asm { UXTB16.W R1, R1 }
v19 = ((v27 & 0xF) + 1) | _R1;
v20 = a1;
v21 = 1;
goto LABEL_49;
case 0xB4:
case 0xB5:
case 0xB6:
case 0xB7:
return result;
default:
v17 = 1;
v14 = 1;
v15 = ((v10 & 7) + 1) | 0x80000;
v16 = a1;
goto LABEL_32;
}
while ( v9 < a4 )
{
v26 = v9++ ^ 3;
LOBYTE(v26) = *(_BYTE *)(a2 + v26);
v25 |= (v26 & 0x7F) << v24;
v24 += 7;
if ( (v26 & 0x80) == 0 )
{
sub_953194(a1, 13, &v38);
v38 += 4 * v25 + 516;
sub_9531C8(a1, 13);
v6 = v9;
v8 = v23;
goto LABEL_34;
}
}
return 9;
}
if ( v12 != 192 )
{
if ( v12 != 208 )
return result;
if ( (v10 & 8) != 0 )
return 9;
v17 = 1;
v15 = ((v10 & 7) + 1) | 0x80000;
LABEL_31:
v16 = a1;
v14 = 5;
LABEL_32:
sub_952C08(v16, v17, v15, v14);
LABEL_33:
++v6;
continue;
}
switch ( *(_BYTE *)(a2 + (v6 ^ 3)) )
{
case 0xC0:
case 0xC1:
case 0xC2:
case 0xC3:
case 0xC4:
case 0xC5:
v17 = 3;
v15 = ((v10 & 7) + 1) | 0xA0000;
goto LABEL_31;
case 0xC6:
v37 = *(unsigned __int8 *)(a2 + (v9 ^ 3));
if ( (v37 & 0xF) + (v37 >> 4) > 0xF )
return 9;
v19 = ((v37 & 0xF) + 1) | (v37 >> 4 << 16);
v20 = a1;
v21 = 3;
break;
case 0xC7:
if ( !*(_BYTE *)(a2 + (v9 ^ 3)) || *(unsigned __int8 *)(a2 + (v9 ^ 3)) >= 0x10u )
return 9;
goto LABEL_50;
case 0xC8:
case 0xC9:
v34 = *(unsigned __int8 *)(a2 + (v9 ^ 3));
v35 = v34 >> 4;
if ( v10 == 200 )
v35 = (v34 >> 4) | 0x10;
v36 = v34 & 0xF;
if ( v35 + v36 > 0x1F )
return 9;
v19 = (v36 + 1) | (v35 << 16);
v20 = a1;
v21 = 1;
break;
default:
return 9;
}
v22 = 5;
LABEL_49:
sub_952C08(v20, v21, v19, v22);
LABEL_50:
v6 += 2;
}
else
{
if ( v12 != 128 )
{
if ( v12 != 144 )
{
if ( v12 != 160 )
return result;
v14 = 0;
v15 = ((16 << ((v10 & 7) + 1)) - 16) | (v10 << 11) & 0x4000;
v16 = a1;
v17 = 0;
goto LABEL_32;
}
if ( (v10 & 0xD | 2) == 0xF )
return 9;
sub_953194(a1, v10 & 0xF, &v38);
goto LABEL_13;
}
if ( v9 >= a4 )
return 9;
v18 = (unsigned __int16)((_WORD)v10 << 12) | (16 * *(unsigned __int8 *)(a2 + (v9 ^ 3)));
if ( !v18 )
return 9;
sub_952C08(a1, 0, v18, 0);
v6 += 2;
v8 |= (unsigned __int16)(((_WORD)v10 << 12) & 0x8000) >> 15;
}
LABEL_34:
;
}
while ( v6 < a4 );
LABEL_54:
if ( (v8 & 1) == 0 )
goto LABEL_55;
return 8;
}