//
// sub_F780A0 from 0xf780a0 to 0xf78520 (1152 bytes)
//
// 4 xrefs:
// > std::__ndk1::moneypunct_byname::init @ 0xf6228c
// > std::__ndk1::moneypunct_byname::init @ 0xf622a8
// > std::__ndk1::moneypunct_byname::init @ 0xf62964
// > std::__ndk1::moneypunct_byname::init @ 0xf62980
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:13:44 +0000
//
__int64 __fastcall sub_F780A0(__int64 result, unsigned __int8 *a2, char a3, char a4, char a5, char a6)
{
__int64 v6; // x19
unsigned __int64 v7; // x9
unsigned __int64 v8; // x9
_BOOL4 v9; // w9
unsigned __int64 v10; // x10
bool v11; // zf
unsigned __int64 v12; // x14
unsigned __int8 *v13; // x10
__int64 v14; // x12
unsigned __int8 *v15; // x11
int v16; // w14
__int64 v17; // x13
__int64 v18; // x12
int v19; // w12
int v20; // w13
int v21; // w14
int v22; // w15
int v23; // w16
__int64 v24; // x13
__int64 v25; // x14
unsigned __int8 *v26; // x12
int v27; // w14
int v28; // t1
unsigned __int8 *v29; // x17
unsigned __int8 *v30; // x16
unsigned __int8 *v31; // x15
unsigned int v32; // t1
__int16 v33; // w10
__int16 v34; // w10
__int16 v35; // w10
__int16 v36; // w10
unsigned __int64 v37; // x9
__int64 v38; // x9
__int64 v39; // x10
__int64 v40; // x9
v6 = result;
if ( (a3 & 1) != 0 )
{
v7 = *a2;
if ( (v7 & 1) != 0 )
v8 = *((_QWORD *)a2 + 1);
else
v8 = v7 >> 1;
v9 = v8 == 4;
}
else
{
v9 = 0;
}
if ( a4 == 1 )
{
switch ( a6 )
{
case 0:
*(_DWORD *)result = 67109379;
if ( !a5 || a5 == 2 )
return result;
if ( a5 != 1 )
goto LABEL_74;
if ( !v9 )
return std::wstring::insert(a2, 0, 1, 32);
return result;
case 1:
*(_BYTE *)result = 3;
*(_BYTE *)(result + 3) = 4;
if ( a5 == 2 )
goto LABEL_76;
if ( a5 == 1 )
goto LABEL_77;
if ( a5 )
goto LABEL_74;
goto LABEL_38;
case 2:
*(_BYTE *)result = 2;
*(_BYTE *)(result + 3) = 3;
if ( a5 == 2 )
{
v33 = 260;
goto LABEL_86;
}
if ( a5 == 1 )
{
v34 = 1024;
goto LABEL_90;
}
if ( a5 )
goto LABEL_74;
*(_WORD *)(result + 1) = 1024;
return result;
case 3:
*(_BYTE *)result = 3;
*(_BYTE *)(result + 3) = 4;
if ( a5 == 2 )
{
LABEL_76:
v33 = 513;
goto LABEL_86;
}
if ( a5 == 1 )
{
LABEL_77:
v34 = 2;
goto LABEL_90;
}
if ( a5 )
goto LABEL_74;
LABEL_38:
*(_WORD *)(result + 1) = 2;
return result;
case 4:
*(_BYTE *)result = 2;
*(_BYTE *)(result + 3) = 4;
if ( a5 == 2 )
{
v34 = 768;
LABEL_90:
*(_WORD *)(result + 1) = v34;
if ( !v9 )
result = std::wstring::push_back(a2, 32);
}
else if ( a5 == 1 )
{
v33 = 259;
LABEL_86:
*(_WORD *)(result + 1) = v33;
if ( v9 )
{
v37 = *a2;
if ( (v37 & 1) != 0 )
{
v39 = *((_QWORD *)a2 + 2);
v40 = *((_QWORD *)a2 + 1) - 1LL;
*((_QWORD *)a2 + 1) = v40;
*(_DWORD *)(v39 + 4 * v40) = 0;
}
else
{
v38 = (v37 >> 1) - 1;
*a2 = 2 * v38;
*(_DWORD *)&a2[4 * v38 + 4] = 0;
}
}
}
else
{
if ( a5 )
goto LABEL_74;
*(_WORD *)(result + 1) = 3;
}
break;
default:
goto LABEL_74;
}
}
else if ( a4 )
{
LABEL_74:
*(_DWORD *)v6 = 67109634;
}
else
{
if ( v9 )
{
v10 = *a2;
v11 = (v10 & 1) == 0;
v12 = v10 >> 1;
v13 = (v10 & 1) != 0 ? *((unsigned __int8 **)a2 + 2) : a2 + 4;
v14 = v11 ? v12 : *((_QWORD *)a2 + 1);
if ( v14 != 3 )
{
v15 = &v13[4 * v14];
if ( v14 == 4 )
{
v16 = *((_DWORD *)v13 + 3);
v17 = *(_QWORD *)v13;
*((_DWORD *)v15 - 1) = *((_DWORD *)v13 + 2);
*(_QWORD *)(v15 - 12) = v17;
*(_DWORD *)v13 = v16;
}
else
{
v18 = (4 * v14 - 12) >> 2;
if ( v18 == 3 )
{
v19 = *((_DWORD *)v13 + 3);
v20 = *(_DWORD *)v13;
v21 = *((_DWORD *)v13 + 1);
v22 = *((_DWORD *)v13 + 4);
v23 = *((_DWORD *)v13 + 5);
*((_DWORD *)v13 + 5) = *((_DWORD *)v13 + 2);
*((_DWORD *)v13 + 3) = v20;
*((_DWORD *)v13 + 4) = v21;
*(_DWORD *)v13 = v19;
*((_DWORD *)v13 + 1) = v22;
*((_DWORD *)v13 + 2) = v23;
}
else
{
v24 = 3;
do
{
v25 = v24;
v24 = v18;
v18 = v25 % v18;
}
while ( v18 );
if ( v24 )
{
v26 = &v13[4 * v24];
do
{
v28 = *((_DWORD *)v26 - 1);
v26 -= 4;
v27 = v28;
v29 = v26 + 12;
v30 = v26;
do
{
v31 = v29;
v32 = *(_DWORD *)v29;
v29 += 12;
result = v32;
if ( v15 - v31 <= 12 )
v29 = &v13[4 * (3 - ((unsigned __int64)(v15 - v31) >> 2))];
*(_DWORD *)v30 = result;
v30 = v31;
}
while ( v29 != v26 );
*(_DWORD *)v31 = v27;
}
while ( v26 != v13 );
}
}
}
}
}
switch ( a6 )
{
case 0:
*(_DWORD *)v6 = 33555459;
if ( !a5 || a5 == 2 )
return result;
if ( a5 != 1 )
goto LABEL_74;
if ( !v9 )
return std::wstring::insert(a2, 0, 1, 32);
return result;
case 1:
*(_BYTE *)v6 = 3;
*(_BYTE *)(v6 + 3) = 2;
if ( a5 == 2 )
{
v35 = 1025;
goto LABEL_98;
}
if ( a5 == 1 )
{
v36 = 4;
goto LABEL_95;
}
if ( a5 )
goto LABEL_74;
*(_WORD *)(v6 + 1) = 4;
return result;
case 2:
*(_BYTE *)v6 = 4;
*(_BYTE *)(v6 + 3) = 3;
if ( a5 == 2 )
goto LABEL_78;
if ( a5 == 1 )
{
if ( !v9 )
result = std::wstring::insert(a2, 0, 1, 32);
}
else if ( a5 )
{
goto LABEL_74;
}
goto LABEL_84;
case 3:
*(_BYTE *)v6 = 4;
*(_BYTE *)(v6 + 3) = 2;
if ( a5 == 2 )
{
v36 = 3;
goto LABEL_95;
}
if ( a5 == 1 )
{
v35 = 769;
goto LABEL_98;
}
if ( a5 )
goto LABEL_74;
*(_WORD *)(v6 + 1) = 768;
return result;
case 4:
*(_BYTE *)v6 = 4;
*(_BYTE *)(v6 + 3) = 3;
if ( a5 == 2 )
{
LABEL_78:
v35 = 258;
LABEL_98:
*(_WORD *)(v6 + 1) = v35;
if ( v9 )
return std::wstring::erase(a2, 0, 1);
return result;
}
if ( a5 != 1 )
{
if ( a5 )
goto LABEL_74;
LABEL_84:
*(_WORD *)(v6 + 1) = 512;
return result;
}
v36 = 512;
LABEL_95:
*(_WORD *)(v6 + 1) = v36;
if ( v9 )
return result;
break;
default:
goto LABEL_74;
}
return std::wstring::insert(a2, 0, 1, 32);
}
return result;
}