//
// sub_96D650 from 0x96d650 to 0x96dc20 (1488 bytes)
//
// 2 xrefs:
// > std::__ndk1::locale::locale @ 0x96ec72
// > std::__ndk1::locale::locale @ 0x96ed0e
//
// 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:50 +0000
//
int __fastcall sub_96D650(int a1, int a2, int a3)
{
__int64 v5; // r0
int *v6; // r11
int *v7; // r0
int v8; // r0
int v9; // r2
int v10; // r1
unsigned int v11; // r4
std::__shared_count *v12; // r0
std::__shared_count *v13; // r4
std::__shared_count *v14; // r4
std::__shared_count *v15; // r4
std::__shared_count *v16; // r4
std::__shared_count *v17; // r4
std::__shared_count *v18; // r6
char *v19; // r1
std::__shared_count *v20; // r4
std::__shared_count *v21; // r4
std::__shared_count *v22; // r4
std::__shared_count *v23; // r4
int v24; // r6
__int64 v25; // r0
char *v26; // r1
int v27; // r6
__int64 v28; // r0
char *v29; // r1
int v30; // r6
__int64 v31; // r0
int v32; // r1
_DWORD *v33; // r6
__int64 v34; // r0
char *v35; // r1
std::__shared_count *v36; // r6
std::__shared_count *v37; // r6
int *v38; // r6
__int64 v39; // r0
int *v40; // r6
__int64 v41; // r0
std::__shared_count *v42; // r4
std::__shared_count *v43; // r4
HIDWORD(v5) = a3 - 1;
v6 = (int *)(a1 + 8);
LODWORD(v5) = &off_D13EB8;
*(_QWORD *)a1 = v5;
sub_96D5D0(a1 + 8, 28);
v7 = std::string::basic_string((int *)(a1 + 144), a2);
v8 = *(_DWORD *)std::locale::classic((std::locale *)v7);
if ( v8 != a1 )
sub_9762F0(v6, *(_DWORD *)(v8 + 8), *(_DWORD *)(v8 + 12));
v9 = *(_DWORD *)(a1 + 12);
v10 = *(_DWORD *)(a1 + 8);
if ( v9 != v10 )
{
v11 = 0;
do
{
v12 = *(std::__shared_count **)(v10 + 4 * v11);
if ( v12 )
{
std::__shared_count::__add_shared(v12);
v10 = *v6;
v9 = *(_DWORD *)(a1 + 12);
}
++v11;
}
while ( v11 < (v9 - v10) >> 2 );
}
v13 = (std::__shared_count *)operator new(0xCu);
std::collate_byname::collate_byname(v13, a1 + 144, 0);
std::locale::id::__get((std::locale::id *)&std::collate::id);
sub_96EA08(a1, v13);
v14 = (std::__shared_count *)operator new(0xCu);
std::collate_byname::collate_byname(v14, a1 + 144, 0);
std::locale::id::__get((std::locale::id *)&std::collate::id);
sub_96EA08(a1, v14);
v15 = (std::__shared_count *)operator new(0x14u);
std::ctype_byname::ctype_byname(v15, a1 + 144, 0);
std::locale::id::__get((std::locale::id *)&std::ctype::id);
sub_96EA08(a1, v15);
v16 = (std::__shared_count *)operator new(0xCu);
std::ctype_byname::ctype_byname(v16, a1 + 144, 0);
std::locale::id::__get((std::locale::id *)&std::ctype::id);
sub_96EA08(a1, v16);
v17 = (std::__shared_count *)operator new(8u);
*((_DWORD *)v17 + 1) = -1;
*(_DWORD *)v17 = &off_D13DF8;
std::locale::id::__get((std::locale::id *)&std::codecvt::id);
sub_96EA08(a1, v17);
v18 = (std::__shared_count *)operator new(0xCu);
v19 = *(char **)(a1 + 152);
if ( (*(_BYTE *)(a1 + 144) & 1) == 0 )
v19 = (char *)(a1 + 145);
std::codecvt::codecvt(v18, v19, 0);
*(_DWORD *)v18 = &off_D13E28;
std::locale::id::__get((std::locale::id *)&std::codecvt::id);
sub_96EA08(a1, v18);
v20 = (std::__shared_count *)operator new(8u);
*((_DWORD *)v20 + 1) = -1;
*(_DWORD *)v20 = &off_D13E58;
std::locale::id::__get((std::locale::id *)&std::codecvt::id);
sub_96EA08(a1, v20);
v21 = (std::__shared_count *)operator new(8u);
*((_DWORD *)v21 + 1) = -1;
*(_DWORD *)v21 = &off_D13E88;
std::locale::id::__get((std::locale::id *)&std::codecvt::id);
sub_96EA08(a1, v21);
v22 = (std::__shared_count *)operator new(0x18u);
std::numpunct_byname::numpunct_byname((int)v22);
std::locale::id::__get((std::locale::id *)&std::numpunct::id);
sub_96EA08(a1, v22);
v23 = (std::__shared_count *)operator new(0x1Cu);
std::numpunct_byname::numpunct_byname((int)v23);
std::locale::id::__get((std::locale::id *)&std::numpunct::id);
sub_96EA08(a1, v23);
v24 = operator new(0x48u);
HIDWORD(v25) = -1;
LODWORD(v25) = &off_D13C28;
*(_QWORD *)v24 = v25;
memset((void *)(v24 + 12), 0, 0x30u);
v26 = *(char **)(a1 + 152);
if ( (*(_BYTE *)(a1 + 144) & 1) == 0 )
v26 = (char *)(a1 + 145);
std::moneypunct_byname::init(v24, v26);
std::locale::id::__get((std::locale::id *)&std::moneypunct::id);
sub_96EA08(a1, (std::__shared_count *)v24);
v27 = operator new(0x48u);
HIDWORD(v28) = -1;
LODWORD(v28) = &off_D13C60;
*(_QWORD *)v27 = v28;
memset((void *)(v27 + 12), 0, 0x30u);
v29 = *(char **)(a1 + 152);
if ( (*(_BYTE *)(a1 + 144) & 1) == 0 )
v29 = (char *)(a1 + 145);
std::moneypunct_byname::init(v27, v29);
std::locale::id::__get((std::locale::id *)&std::moneypunct::id);
sub_96EA08(a1, (std::__shared_count *)v27);
v30 = operator new(0x4Cu);
HIDWORD(v31) = -1;
LODWORD(v31) = &off_D13C98;
*(_QWORD *)v30 = v31;
memset((void *)(v30 + 16), 0, 0x30u);
v32 = *(_DWORD *)(a1 + 152);
if ( (*(_BYTE *)(a1 + 144) & 1) == 0 )
v32 = a1 + 145;
((void (__fastcall *)(int, int))std::moneypunct_byname::init)(v30, v32);
std::locale::id::__get((std::locale::id *)&std::moneypunct::id);
sub_96EA08(a1, (std::__shared_count *)v30);
v33 = (_DWORD *)operator new(0x4Cu);
HIDWORD(v34) = -1;
LODWORD(v34) = &off_D13CD0;
*(_QWORD *)v33 = v34;
memset(v33 + 4, 0, 0x30u);
v35 = *(char **)(a1 + 152);
if ( (*(_BYTE *)(a1 + 144) & 1) == 0 )
v35 = (char *)(a1 + 145);
std::moneypunct_byname::init(v33, v35);
std::locale::id::__get((std::locale::id *)&std::moneypunct::id);
sub_96EA08(a1, (std::__shared_count *)v33);
v36 = (std::__shared_count *)operator new(0x220u);
*(_DWORD *)v36 = &off_D13960;
*((_DWORD *)v36 + 1) = -1;
*((_DWORD *)v36 + 2) = &off_D13990;
std::__time_get_storage::__time_get_storage((int)v36 + 12, a1 + 144);
*(_DWORD *)v36 = &off_D13A08;
*((_DWORD *)v36 + 2) = &off_D13A54;
std::locale::id::__get((std::locale::id *)&std::time_get>::id);
sub_96EA08(a1, v36);
v37 = (std::__shared_count *)operator new(0x220u);
*(_DWORD *)v37 = &off_D139B4;
*((_DWORD *)v37 + 1) = -1;
*((_DWORD *)v37 + 2) = &off_D139E4;
std::__time_get_storage::__time_get_storage((int)v37 + 12, a1 + 144);
*(_DWORD *)v37 = &off_D13A78;
*((_DWORD *)v37 + 2) = &off_D13AC4;
std::locale::id::__get((std::locale::id *)&std::time_get>::id);
sub_96EA08(a1, v37);
v38 = (int *)operator new(0xCu);
HIDWORD(v39) = -1;
LODWORD(v39) = &off_D14088;
*(_QWORD *)v38 = v39;
std::__time_put::__time_put(v38 + 2, a1 + 144);
*v38 = (int)&off_D13B18;
std::locale::id::__get((std::locale::id *)&std::time_put>::id);
sub_96EA08(a1, (std::__shared_count *)v38);
v40 = (int *)operator new(0xCu);
HIDWORD(v41) = -1;
LODWORD(v41) = &off_D14088;
*(_QWORD *)v40 = v41;
std::__time_put::__time_put(v40 + 2, a1 + 144);
*v40 = (int)&off_D13B30;
std::locale::id::__get((std::locale::id *)&std::time_put>::id);
sub_96EA08(a1, (std::__shared_count *)v40);
v42 = (std::__shared_count *)operator new(8u);
*((_DWORD *)v42 + 1) = -1;
*(_DWORD *)v42 = &off_D13DB8;
std::locale::id::__get((std::locale::id *)&std::messages::id);
sub_96EA08(a1, v42);
v43 = (std::__shared_count *)operator new(8u);
*((_DWORD *)v43 + 1) = -1;
*(_DWORD *)v43 = &off_D13DD8;
std::locale::id::__get((std::locale::id *)&std::messages::id);
sub_96EA08(a1, v43);
return a1;
}