//
// std::__ndk1::ios_base::copyfmt from 0x954be4 to 0x954e08 (548 bytes)
//
// 2 xrefs:
// > std::__ndk1::basic_ios>::copyfmt @ 0x954b78
// > std::__ndk1::basic_ios>::copyfmt @ 0x9553ca
//
// 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:27 +0000
//
void __fastcall std::ios_base::copyfmt(std::ios_base *this, const std::ios_base *a2)
{
unsigned int v4; // r0
size_t v5; // r6
void *v6; // r8
void *v7; // r9
std::bad_alloc *v8; // r0
void *v9; // r0
unsigned int v10; // r0
void *v11; // r10
std::bad_alloc *v12; // r0
void *v13; // r0
unsigned int v14; // r0
void *v15; // r6
std::bad_alloc *v16; // r0
void *v17; // r0
unsigned int v18; // r0
int v19; // r0
unsigned int v20; // r2
int v21; // r1
unsigned int v22; // r0
std::bad_alloc *exception; // r0
void *v24; // r0
v4 = *((_DWORD *)a2 + 10);
if ( *((_DWORD *)this + 11) >= v4 )
{
v7 = nullptr;
v6 = nullptr;
}
else
{
v5 = 4 * v4;
v6 = malloc(4 * v4);
if ( !v6 )
{
exception = (std::bad_alloc *)_cxa_allocate_exception(4u);
v24 = (void *)std::bad_alloc::bad_alloc(exception);
_cxa_throw(v24, (struct type_info *)&`typeinfo for'std::bad_alloc, (void (*)(void *))std::bad_alloc::~bad_alloc);
}
v7 = malloc(v5);
if ( !v7 )
{
v8 = (std::bad_alloc *)_cxa_allocate_exception(4u);
v9 = (void *)std::bad_alloc::bad_alloc(v8);
_cxa_throw(v9, (struct type_info *)&`typeinfo for'std::bad_alloc, (void (*)(void *))std::bad_alloc::~bad_alloc);
}
}
v10 = *((_DWORD *)a2 + 13);
if ( *((_DWORD *)this + 14) >= v10 )
{
v11 = nullptr;
}
else
{
v11 = malloc(4 * v10);
if ( !v11 )
{
v12 = (std::bad_alloc *)_cxa_allocate_exception(4u);
v13 = (void *)std::bad_alloc::bad_alloc(v12);
_cxa_throw(v13, (struct type_info *)&`typeinfo for'std::bad_alloc, (void (*)(void *))std::bad_alloc::~bad_alloc);
}
}
v14 = *((_DWORD *)a2 + 16);
if ( *((_DWORD *)this + 17) >= v14 )
{
v15 = nullptr;
}
else
{
v15 = malloc(4 * v14);
if ( !v15 )
{
v16 = (std::bad_alloc *)_cxa_allocate_exception(4u);
v17 = (void *)std::bad_alloc::bad_alloc(v16);
_cxa_throw(v17, (struct type_info *)&`typeinfo for'std::bad_alloc, (void (*)(void *))std::bad_alloc::~bad_alloc);
}
}
*((_DWORD *)this + 1) = *((_DWORD *)a2 + 1);
*((_DWORD *)this + 2) = *((_DWORD *)a2 + 2);
*((_DWORD *)this + 3) = *((_DWORD *)a2 + 3);
std::locale::operator=((char *)this + 28, (char *)a2 + 28);
if ( *((_DWORD *)this + 11) < *((_DWORD *)a2 + 10) )
{
free(*((void **)this + 8));
*((_DWORD *)this + 8) = v6;
free(*((void **)this + 9));
*((_DWORD *)this + 9) = v7;
v7 = nullptr;
v6 = nullptr;
*((_DWORD *)this + 11) = *((_DWORD *)a2 + 10);
}
*((_DWORD *)this + 10) = 0;
if ( *((_DWORD *)a2 + 10) )
{
v18 = 0;
do
{
*(_DWORD *)(*((_DWORD *)this + 8) + 4 * v18) = *(_DWORD *)(*((_DWORD *)a2 + 8) + 4 * v18);
*(_DWORD *)(*((_DWORD *)this + 9) + 4 * v18) = *(_DWORD *)(*((_DWORD *)a2 + 9) + 4 * v18);
v18 = *((_DWORD *)this + 10) + 1;
*((_DWORD *)this + 10) = v18;
}
while ( v18 < *((_DWORD *)a2 + 10) );
}
if ( *((_DWORD *)this + 14) < *((_DWORD *)a2 + 13) )
{
free(*((void **)this + 12));
*((_DWORD *)this + 12) = v11;
v11 = nullptr;
*((_DWORD *)this + 14) = *((_DWORD *)a2 + 13);
}
*((_DWORD *)this + 13) = 0;
if ( *((_DWORD *)a2 + 13) )
{
v19 = *((_DWORD *)this + 12);
v20 = 0;
v21 = *((_DWORD *)a2 + 12);
do
{
*(_DWORD *)(v19 + 4 * v20) = *(_DWORD *)(v21 + 4 * v20);
*((_DWORD *)this + 13) = ++v20;
}
while ( v20 < *((_DWORD *)a2 + 13) );
}
if ( *((_DWORD *)this + 17) < *((_DWORD *)a2 + 16) )
{
free(*((void **)this + 15));
*((_DWORD *)this + 15) = v15;
v15 = nullptr;
*((_DWORD *)this + 17) = *((_DWORD *)a2 + 16);
}
*((_DWORD *)this + 16) = 0;
if ( *((_DWORD *)a2 + 16) )
{
v22 = 0;
do
{
*(_DWORD *)(*((_DWORD *)this + 15) + 4 * v22) = *(_DWORD *)(*((_DWORD *)a2 + 15) + 4 * v22);
*((_DWORD *)this + 16) = ++v22;
}
while ( v22 < *((_DWORD *)a2 + 16) );
}
if ( v15 )
free(v15);
if ( v11 )
free(v11);
if ( v7 )
free(v7);
if ( v6 )
j_free(v6);
}