//
// std::__ndk1::moneypunct_byname::init from 0xf616d0 to 0xf61a00 (816 bytes)
//
// 5 xrefs:
// > sub_F61630 @ 0xf6167c
// > std::__ndk1::moneypunct_byname::init @ 0xf619ac
// > sub_F6A1A8 @ 0xf6a83c
// > sub_F6B1B0 @ 0xf6b6d0
// > ??> @ 0xcfad8
//
// 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:27 +0000
//
__int64 __fastcall std::moneypunct_byname::init(__int64 a1, char *a2)
{
__int64 v4; // x22
struct lconv *v5; // x21
char v6; // w8
char v7; // w8
int frac_digits; // w8
__int64 *v9; // x0
__int64 *v10; // x0
__int64 result; // x0
void *exception; // x19
size_t v13; // x0
_QWORD *v14; // x0
__int64 v15[3]; // [xsp+48h] [xbp-58h] BYREF
__int128 v16; // [xsp+60h] [xbp-40h] BYREF
__int64 v17; // [xsp+70h] [xbp-30h]
__int64 v18; // [xsp+78h] [xbp-28h]
v18 = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
if ( !newlocale() )
{
exception = _cxa_allocate_exception(0x10u);
memset(v15, 0, sizeof(v15));
v13 = strlen(a2);
std::string::__init(v15, a2, v13);
v14 = std::string::insert(v15, 0, "moneypunct_byname failed to construct for ");
v17 = v14[2];
v16 = *(_OWORD *)v14;
v14[1] = 0;
v14[2] = 0;
*v14 = 0;
std::runtime_error::runtime_error(exception, &v16);
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::runtime_error,
(void (*)(void *))std::overflow_error::~overflow_error);
}
v4 = uselocale();
v5 = localeconv();
if ( v4 )
uselocale();
v6 = *v5->mon_decimal_point;
if ( !v6 )
v6 = -1;
*(_BYTE *)(a1 + 16) = v6;
v7 = *v5->mon_thousands_sep;
if ( !v7 )
v7 = -1;
*(_BYTE *)(a1 + 17) = v7;
std::string::assign((__int64 *)(a1 + 24), v5->mon_grouping);
std::string::assign((__int64 *)(a1 + 48), v5->currency_symbol);
frac_digits = (unsigned __int8)v5->frac_digits;
v9 = (__int64 *)(a1 + 72);
if ( frac_digits == 255 )
frac_digits = 0;
*(_DWORD *)(a1 + 120) = frac_digits;
if ( v5->p_sign_posn )
std::string::assign(v9, v5->positive_sign);
else
std::string::assign(v9, "()");
v10 = (__int64 *)(a1 + 96);
if ( v5->n_sign_posn )
std::string::assign(v10, v5->negative_sign);
else
std::string::assign(v10, "()");
std::string::basic_string((unsigned __int64)&v16, (_QWORD *)(a1 + 48));
sub_F77C10(
a1 + 124,
&v16,
0,
*(unsigned __int16 *)&v5->p_cs_precedes,
HIBYTE(*(unsigned __int16 *)&v5->p_cs_precedes),
(unsigned __int8)v5->p_sign_posn);
sub_F77C10(
a1 + 128,
a1 + 48,
0,
*(unsigned int *)&v5->n_cs_precedes,
(unsigned __int8)BYTE1(*(_DWORD *)&v5->n_cs_precedes),
HIBYTE(*(_DWORD *)&v5->n_cs_precedes));
std::string::~string((__int64)&v16);
result = freelocale();
_ReadStatusReg(TPIDR_EL0);
return result;
}