//
// sub_83B450 from 0x83b450 to 0x83bbd4 (1924 bytes)
//
// 2 xrefs:
// > sub_83B450 @ 0x83b4e0
// > sub_83BC04 @ 0x83bc14
//
// 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:02:16 +0000
//
int __fastcall sub_83B450(unsigned __int8 *a1, _BYTE *a2)
{
int v4; // r3
int v5; // r2
int result; // r0
int v7; // r2
unsigned __int8 *v8; // r3
int v9; // t1
int v10; // r2
unsigned __int8 *v11; // r7
int v12; // t1
int v13; // r3
int v14; // r0
unsigned int v15; // r1
unsigned __int8 *v16; // r3
int v17; // r10
unsigned int v18; // r4
int v19; // r5
unsigned int v20; // r2
bool v21; // cc
int v22; // r2
bool v23; // zf
bool v24; // zf
int v25; // r1
int v26; // r2
int v27; // r1
int v28; // r0
int v29; // r2
int v30; // r2
int v31; // r1
int v32; // r1
int v33; // r2
int v34; // r1
int v35; // r1
int v36; // r1
int v37; // r1
int v38; // r1
int v39; // r1
int v40; // r1
int v41; // r1
int v42; // r1
int v43; // r1
int v44; // r1
int v45; // r1
int v46; // r2
unsigned __int8 *v47; // r1
bool v48; // zf
unsigned __int8 *v49; // [sp+2Ch] [bp-1Ch]
unsigned __int8 *v50; // [sp+30h] [bp-18h]
int v51; // [sp+3Ch] [bp-Ch] BYREF
int v52; // [sp+40h] [bp-8h]
__int16 v53; // [sp+44h] [bp-4h]
_BYTE v55[276]; // [sp+48h] [bp+0h] BYREF
memset(v55, 0, 0x10Fu);
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
LABEL_2:
while ( 1 )
{
v4 = *a1;
if ( v4 != 42 )
break;
v7 = a1[1];
if ( v7 == 42 )
{
v8 = a1 + 1;
do
{
a1 = v8;
v9 = *++v8;
v7 = v9;
}
while ( v9 == 42 );
}
if ( !*a2 && !v7 || !sub_83B450(a1 + 1, a2) )
return 0;
if ( !*a2 )
return 1;
++a2;
}
if ( v4 != 63 )
break;
if ( (*(_BYTE *)(ctype_ + (unsigned __int8)*a2 + 1) & 0x97) == 0 )
{
if ( !*a2 )
return 1;
return 2;
}
++a2;
++a1;
}
if ( !*a1 )
{
result = (unsigned __int8)*a2;
if ( *a2 )
return 1;
return result;
}
if ( v4 != 92 )
break;
v12 = a1[1];
v11 = a1 + 1;
v10 = v12;
if ( (*(_BYTE *)(ctype_ + v12 + 1) & 0x97) == 0 )
return 2;
v13 = (unsigned __int8)*a2;
a1 = v11 + 1;
++a2;
if ( v13 != v10 )
return 1;
}
if ( v4 == 91 )
break;
v5 = (unsigned __int8)*a2;
++a1;
++a2;
if ( v5 != v4 )
return 1;
}
v14 = 0;
v15 = a1[1];
v16 = a1 + 1;
v17 = 0;
v18 = 0;
v19 = 0;
while ( 2 )
{
switch ( v19 )
{
case 0:
v22 = *(_BYTE *)(ctype_ + v15 + 1) & 7;
if ( (*(_BYTE *)(ctype_ + v15 + 1) & 7) != 0 )
{
v14 = 1;
v55[v15] = 1;
v18 = v15;
v19 = 1;
v15 = *++v16;
continue;
}
if ( v15 == 93 )
{
if ( v14 )
goto LABEL_79;
v14 = 1;
v15 = v16[1];
v55[93] = 1;
v19 = 3;
++v16;
continue;
}
if ( v15 == 91 )
{
v15 = v16[1];
if ( v15 != 58 )
{
v55[91] = 1;
++v16;
v14 = 1;
continue;
}
v27 = v16[2];
v52 = v22;
v51 = v22;
v50 = v16 + 3;
v53 = v22;
if ( (*(_BYTE *)(ctype_ + v27 + 1) & 3) != 0 && (*(_BYTE *)(ctype_ + v27 + 1) & 2) != 0 )
{
v50 = v16 + 4;
v28 = v16[3];
LOBYTE(v51) = v27;
v29 = *(unsigned __int8 *)(ctype_ + v28 + 1);
if ( v29 << 30 && (v29 & 2) != 0 )
{
v30 = v16[4];
v50 = v16 + 5;
BYTE1(v51) = v28;
v31 = *(unsigned __int8 *)(ctype_ + v30 + 1);
if ( v31 << 30 && (v31 & 2) != 0 )
{
v32 = 0;
BYTE2(v51) = v30;
}
else
{
if ( v30 != 58 )
return 2;
v32 = 1;
}
v49 = v16 + 6;
v33 = v16[5];
if ( !v32 )
{
v34 = *(unsigned __int8 *)(ctype_ + v33 + 1);
if ( v34 << 30 && (v34 & 2) != 0 )
{
v35 = 0;
HIBYTE(v51) = v16[5];
}
else
{
if ( v33 != 58 )
return 2;
v35 = 1;
}
v50 = v16 + 7;
v33 = v16[6];
if ( v35 )
goto LABEL_156;
v36 = *(unsigned __int8 *)(ctype_ + v33 + 1);
if ( v36 << 30 && (v36 & 2) != 0 )
{
v37 = 0;
LOBYTE(v52) = v16[6];
}
else
{
if ( v33 != 58 )
return 2;
v37 = 1;
}
v49 = v16 + 8;
v33 = v16[7];
if ( !v37 )
{
v38 = *(unsigned __int8 *)(ctype_ + v33 + 1);
if ( v38 << 30 && (v38 & 2) != 0 )
{
v39 = 0;
BYTE1(v52) = v16[7];
}
else
{
if ( v33 != 58 )
return 2;
v39 = 1;
}
v50 = v16 + 9;
v33 = v16[8];
if ( v39 )
goto LABEL_156;
v40 = *(unsigned __int8 *)(ctype_ + v33 + 1);
if ( v40 << 30 && (v40 & 2) != 0 )
{
v41 = 0;
BYTE2(v52) = v16[8];
}
else
{
if ( v33 != 58 )
return 2;
v41 = 1;
}
v49 = v16 + 10;
v33 = v16[9];
if ( !v41 )
{
v42 = *(unsigned __int8 *)(ctype_ + v33 + 1);
if ( v42 << 30 && (v42 & 2) != 0 )
{
v43 = 0;
HIBYTE(v52) = v16[9];
}
else
{
if ( v33 != 58 )
return 2;
v43 = 1;
}
v50 = v16 + 11;
v33 = v16[10];
if ( !v43 )
{
v44 = *(unsigned __int8 *)(ctype_ + v33 + 1);
if ( v44 << 30 && (v44 & 2) != 0 )
{
v45 = 0;
LOBYTE(v53) = v16[10];
}
else
{
if ( v33 != 58 )
return 2;
v45 = 1;
}
v49 = v16 + 12;
v33 = v16[11];
if ( !v45 )
return 2;
goto LABEL_116;
}
LABEL_156:
v47 = v49;
v49 = v50;
v50 = v47;
}
}
}
}
else
{
if ( v28 != 58 )
return 2;
v49 = v16 + 5;
v33 = v16[4];
}
}
else
{
if ( v27 != 58 )
return 2;
v49 = v16 + 4;
v33 = v16[3];
}
LABEL_116:
if ( v33 != 93 )
return 2;
if ( !strcmp((const char *)&v51, "digit") )
{
v55[258] = 1;
}
else if ( !strcmp((const char *)&v51, "alnum") )
{
v55[257] = 1;
}
else if ( !strcmp((const char *)&v51, "alpha") )
{
v55[260] = 1;
}
else if ( !strcmp((const char *)&v51, "xdigit") )
{
v55[259] = 1;
}
else if ( !strcmp((const char *)&v51, "print") )
{
v55[261] = 1;
}
else if ( !strcmp((const char *)&v51, "graph") )
{
v55[264] = 1;
}
else if ( !strcmp((const char *)&v51, "space") )
{
v55[265] = 1;
}
else if ( !strcmp((const char *)&v51, "blank") )
{
v55[262] = 1;
}
else if ( !strcmp((const char *)&v51, "upper") )
{
v55[266] = 1;
}
else
{
if ( strcmp((const char *)&v51, "lower") )
return 2;
v55[263] = 1;
}
v14 = 1;
v15 = v50[1];
v16 = v49;
continue;
}
v23 = v15 == 63;
if ( v15 != 63 )
v23 = v15 == 42;
if ( v23 )
goto LABEL_57;
v24 = v15 == 94;
if ( v15 != 94 )
v24 = v15 == 33;
if ( !v24 )
{
if ( v15 != 92 )
{
if ( !v15 )
return 2;
LABEL_57:
v55[v15] = 1;
v14 = 1;
v15 = *++v16;
continue;
}
v18 = v16[1];
if ( (*(_BYTE *)(ctype_ + v18 + 1) & 0x97) == 0 )
return 2;
v14 = 1;
v15 = v16[2];
v55[v18] = 1;
v19 = 1;
v16 += 2;
continue;
}
if ( v14 )
goto LABEL_34;
if ( v55[256] )
{
v55[v15] = 1;
v14 = 1;
}
else
{
v55[256] = 1;
}
goto LABEL_35;
case 1:
if ( v15 == 45 )
{
v17 = 45;
v55[45] = 1;
v15 = v16[1];
v19 = 2;
++v16;
continue;
}
if ( v15 == 91 )
{
v19 = 0;
continue;
}
if ( *(unsigned __int8 *)(ctype_ + v15 + 1) << 29 )
{
LABEL_34:
v55[v15] = 1;
LABEL_35:
v15 = *++v16;
continue;
}
if ( v15 == 92 )
{
v25 = v16[1];
if ( (*(_BYTE *)(ctype_ + v25 + 1) & 0x97) == 0 )
return 2;
v55[v25] = 1;
v16 += 2;
v15 = *v16;
continue;
}
if ( v15 != 93 )
return 2;
LABEL_79:
v26 = (unsigned __int8)*a2;
if ( !v55[v26] )
{
if ( v55[257] )
{
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 7;
}
else if ( v55[260] )
{
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 3;
}
else if ( v55[258] )
{
v46 = (unsigned int)(v26 - 48) <= 9;
}
else if ( v55[259] )
{
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 0x44;
}
else if ( v55[261] )
{
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 0x97;
}
else if ( v55[265] )
{
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 8;
}
else if ( v55[266] )
{
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 1;
}
else if ( v55[263] )
{
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 2;
}
else if ( v55[262] )
{
v48 = v26 == 32;
if ( v26 != 32 )
v48 = v26 == 9;
v46 = v48;
}
else
{
if ( !v55[264] )
{
if ( !v55[256] )
return 1;
goto LABEL_81;
}
v46 = *(_BYTE *)(v26 + ctype_ + 1) & 0x17;
}
if ( v55[256] )
v46 = v46 == 0;
if ( !v46 )
return 1;
LABEL_81:
a1 = v16 + 1;
++a2;
memset(v55, 0, 0x10Fu);
goto LABEL_2;
}
if ( !v55[256] )
goto LABEL_81;
return 1;
case 2:
if ( v15 == 92 )
{
v15 = v16[1];
if ( (*(_BYTE *)(ctype_ + v15 + 1) & 0x97) == 0 )
return 2;
if ( v15 == 93 )
{
++v16;
goto LABEL_79;
}
if ( v15 == 92 )
{
v15 = v16[2];
if ( (*(_BYTE *)(ctype_ + v15 + 1) & 0x97) == 0 )
return 2;
v55[v15] = 1;
v16 += 3;
v19 = 0;
}
else
{
++v16;
}
}
else if ( v15 == 93 )
{
goto LABEL_79;
}
if ( v18 > v15 )
{
v15 = *v16;
}
else
{
if ( ((*(_BYTE *)(ctype_ + v15 + 1) & 2) == 0 || (*(_BYTE *)(ctype_ + v18 + 1) & 2) == 0)
&& (v15 - 48 > 9 || v18 - 48 > 9)
&& ((*(_BYTE *)(ctype_ + v15 + 1) & 1) == 0 || (*(_BYTE *)(ctype_ + v18 + 1) & 1) == 0) )
{
return 2;
}
v55[v17] = 0;
v20 = (unsigned __int8)(v18 + 2);
if ( (unsigned __int8)(v18 + 1) > v15 )
{
v15 = v16[1];
v18 = (unsigned __int8)(v18 + 2);
v19 = 0;
++v16;
}
else
{
do
{
v21 = v20 > v15;
v55[v20 - 1] = 1;
v18 = (unsigned __int8)(v20 + 1);
v20 = v18;
}
while ( !v21 );
v15 = v16[1];
v19 = 0;
++v16;
}
}
continue;
case 3:
if ( v15 == 91 )
{
v55[91] = 1;
v19 = 4;
goto LABEL_35;
}
if ( v15 == 93 )
goto LABEL_79;
if ( !v15 || (*(_BYTE *)(ctype_ + v15 + 1) & 0x97) == 0 )
return 2;
LABEL_25:
v55[v15] = 1;
v19 = 0;
v15 = *++v16;
continue;
case 4:
if ( v15 != 93 )
goto LABEL_25;
goto LABEL_79;
}
}
}