//
// sub_975F18 from 0x975f18 to 0x9761b8 (672 bytes)
//
// 4 xrefs:
// > ??> @ 0x968596
// > ??> @ 0x9685b0
// > std::__ndk1::moneypunct_byname::init @ 0x968a2e
// > std::__ndk1::moneypunct_byname::init @ 0x968a48
//
// 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:57 +0000
//
int __fastcall sub_975F18(int a1, unsigned __int8 *a2, int a3, int a4, int a5, int a6)
{
int v8; // r10
unsigned int v9; // r1
unsigned int v10; // r0
unsigned int v11; // r0
unsigned int v12; // r2
_DWORD *v13; // r6
int v14; // r3
_DWORD *v15; // r2
int v16; // r11
int result; // r0
unsigned int v18; // r0
int v19; // r0
unsigned __int8 v20; // r1
v8 = 0;
if ( a3 == 1 )
{
v9 = *a2;
v10 = *((_DWORD *)a2 + 1);
if ( (v9 & 1) == 0 )
v10 = v9 >> 1;
if ( v10 == 4 )
v8 = 1;
}
if ( a4 == 1 )
{
switch ( a6 )
{
case 0:
result = 67109379;
LABEL_26:
*(_DWORD *)a1 = result;
if ( !a5 || a5 == 2 )
return result;
if ( a5 != 1 )
goto LABEL_50;
LABEL_71:
if ( !v8 )
return std::wstring::insert(a2, 0, 1, 32);
return result;
case 1:
case 3:
*(_BYTE *)a1 = 3;
*(_BYTE *)(a1 + 3) = 4;
if ( a5 == 2 )
{
result = 513;
goto LABEL_61;
}
if ( a5 == 1 )
{
result = 2;
goto LABEL_65;
}
if ( a5 )
goto LABEL_50;
*(_WORD *)(a1 + 1) = 2;
return 2;
case 2:
*(_BYTE *)a1 = 2;
*(_BYTE *)(a1 + 3) = 3;
if ( a5 == 2 )
{
result = 260;
goto LABEL_61;
}
if ( a5 == 1 )
{
result = 1024;
goto LABEL_65;
}
if ( a5 )
goto LABEL_50;
*(_WORD *)(a1 + 1) = 1024;
return 1024;
case 4:
*(_BYTE *)a1 = 2;
*(_BYTE *)(a1 + 3) = 4;
if ( a5 == 2 )
{
result = 768;
LABEL_65:
*(_WORD *)(a1 + 1) = result;
if ( !v8 )
result = std::wstring::push_back(a2, 32);
}
else if ( a5 == 1 )
{
result = 259;
LABEL_61:
*(_WORD *)(a1 + 1) = result;
if ( v8 )
{
v18 = *a2;
if ( (v18 & 1) != 0 )
{
result = *((_DWORD *)a2 + 1) - 1;
*((_DWORD *)a2 + 1) = result;
*(_DWORD *)(*((_DWORD *)a2 + 2) + 4 * result) = 0;
}
else
{
v19 = (v18 >> 1) - 1;
v20 = 2 * v19;
result = (int)&a2[4 * v19];
*a2 = v20;
*(_DWORD *)(result + 4) = 0;
}
}
}
else
{
if ( a5 )
goto LABEL_50;
*(_WORD *)(a1 + 1) = 3;
result = 3;
}
break;
default:
goto LABEL_50;
}
}
else if ( a4 )
{
LABEL_50:
result = 67109634;
*(_DWORD *)a1 = 67109634;
}
else
{
if ( v8 == 1 )
{
v11 = *((_DWORD *)a2 + 1);
v12 = *a2;
v13 = *((_DWORD **)a2 + 2);
v14 = v12 & 1;
if ( (v12 & 1) == 0 )
{
v11 = v12 >> 1;
v13 = a2 + 4;
}
if ( v11 != 3 )
{
v15 = &v13[v11];
if ( v11 == 4 )
{
v16 = v13[3];
memmove(v15 - 3, v13, 0xCu);
*v13 = v16;
}
else
{
std::__rotate_gcd>(v13, v13 + 3, v15, v14);
}
}
}
switch ( a6 )
{
case 0:
result = 33555459;
goto LABEL_26;
case 1:
*(_BYTE *)a1 = 3;
*(_BYTE *)(a1 + 3) = 2;
if ( a5 == 2 )
{
result = 1025;
goto LABEL_74;
}
if ( a5 == 1 )
{
result = 4;
goto LABEL_70;
}
if ( a5 )
goto LABEL_50;
*(_WORD *)(a1 + 1) = 4;
return 4;
case 2:
*(_BYTE *)a1 = 4;
*(_BYTE *)(a1 + 3) = 3;
if ( a5 == 2 )
goto LABEL_54;
if ( a5 != 1 )
goto LABEL_44;
if ( !v8 )
std::wstring::insert(a2, 0, 1, 32);
goto LABEL_59;
case 3:
*(_BYTE *)a1 = 4;
*(_BYTE *)(a1 + 3) = 2;
if ( a5 == 2 )
{
result = 3;
goto LABEL_70;
}
if ( a5 == 1 )
{
result = 769;
goto LABEL_74;
}
if ( a5 )
goto LABEL_50;
*(_WORD *)(a1 + 1) = 768;
return 768;
case 4:
*(_BYTE *)a1 = 4;
*(_BYTE *)(a1 + 3) = 3;
if ( a5 == 2 )
{
LABEL_54:
result = 258;
LABEL_74:
*(_WORD *)(a1 + 1) = result;
if ( v8 )
result = std::wstring::erase(a2, 0, 1);
}
else
{
if ( a5 == 1 )
{
result = 512;
LABEL_70:
*(_WORD *)(a1 + 1) = result;
goto LABEL_71;
}
LABEL_44:
if ( a5 )
goto LABEL_50;
LABEL_59:
*(_WORD *)(a1 + 1) = 512;
result = 512;
}
break;
default:
goto LABEL_50;
}
}
return result;
}