//
// sub_837200 from 0x837200 to 0x83733c (316 bytes)
//
// 2 xrefs:
// > SRP_create_verifier @ 0x838480
// > SRP_create_verifier @ 0x8385dc
//
// 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
//
_BYTE *__fastcall sub_837200(_BYTE *result, unsigned __int8 *a2, int a3)
{
int v3; // r6
unsigned int v4; // r11
unsigned int v5; // r5
int v6; // r3
unsigned __int8 *v7; // r1
unsigned int v8; // lr
_BYTE *v9; // r4
int v10; // lr
int v11; // r5
int v12; // r12
v3 = a3 % 3;
if ( a3 % 3 == 1 )
{
v4 = *a2;
v5 = 0;
}
else if ( v3 == 2 )
{
v5 = *a2;
v4 = a2[1];
}
else
{
v4 = 0;
v5 = 0;
}
LOBYTE(v6) = 0;
v7 = &a2[v3];
v8 = 0;
v9 = result;
while ( 1 )
{
v12 = v6 & 1;
if ( v8 >> 2 )
v12 = 1;
if ( v12 )
{
*v9 = a0123456789abcd_12[v8 >> 2];
v10 = (v5 >> 4) | (16 * (v8 & 3));
++v9;
LABEL_6:
*v9 = a0123456789abcd_12[v10];
v11 = (v4 >> 6) | (4 * (v5 & 0xF));
++v9;
LABEL_7:
*v9++ = a0123456789abcd_12[v11];
v6 = v4 & 0x3F;
goto LABEL_8;
}
v10 = (v5 >> 4) | (16 * (v8 & 3));
if ( v10 )
goto LABEL_6;
v11 = (v4 >> 6) | (4 * (v5 & 0xF));
if ( v11 )
goto LABEL_7;
v6 = v4 & 0x3F;
if ( (v4 & 0x3F) == 0 )
break;
LABEL_8:
*v9 = a0123456789abcd_12[v6];
v7 += 3;
++v9;
LOBYTE(v6) = 1;
if ( v3 >= a3 )
goto LABEL_17;
LABEL_9:
v8 = *(v7 - 3);
v5 = *(v7 - 2);
v4 = *(v7 - 1);
v3 += 3;
}
v7 += 3;
if ( v3 < a3 )
goto LABEL_9;
LABEL_17:
*v9 = 0;
return result;
}