//
// sub_100009C3C from 0x100009c3c to 0x100009ed4 (664 bytes)
//
// 3 xrefs:
// > sub_100009AD4 @ 0x100009b88
// > sub_100009C3C @ 0x100009da8
// > sub_100009C3C @ 0x100009e30
//
// 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 10:57:13 +0000
//
__int64 __fastcall sub_100009C3C(unsigned __int64 *a1, int a2, unsigned int *a3, const void *a4, unsigned int a5)
{
unsigned int v7; // w22
int v9; // w19
unsigned int v10; // w27
unsigned __int64 v11; // x25
unsigned int v12; // w23
__int64 v13; // x23
unsigned __int64 v14; // x8
unsigned __int64 v15; // x28
unsigned __int64 v16; // x8
char *v17; // x26
char *v18; // x21
signed __int64 v19; // x2
char *v20; // x0
unsigned __int64 v21; // x19
char *v22; // x19
size_t v23; // x24
__int64 v24; // x20
unsigned __int64 v25; // x23
unsigned __int64 v26; // x22
unsigned __int64 v27; // x26
unsigned __int64 v28; // x25
v7 = a2;
v9 = a3[1];
v10 = a3[2];
v11 = *a3;
if ( a2 > -2 )
{
v13 = a5 + a2;
v15 = *a1;
v14 = a1[1];
if ( (unsigned int)v11 <= (unsigned int)v13 )
{
v21 = v15 + (unsigned int)v13;
if ( v14 < v21 )
sub_100009ED4(a1);
*a1 = v21;
v22 = (char *)(a1[2] + v15);
if ( !a5 )
goto LABEL_20;
}
else
{
if ( v14 < v15 + v11 )
sub_100009ED4(a1);
*a1 = v15 + v11;
v16 = a1[2];
v17 = (char *)(v16 + v15);
v18 = (char *)(v16 + v15 + v11);
if ( v10 == 4 )
{
if ( a5 )
{
memmove((void *)(v16 + v15), a4, a5);
v17 += a5;
goto LABEL_40;
}
LABEL_39:
v7 += a5;
LABEL_40:
v19 = &v18[-v7] - v17;
if ( v19 >= 1 )
{
v20 = v17;
LABEL_42:
memset(v20, v9, v19);
}
return (__int64)(v18 - 1);
}
if ( v10 != 3 )
{
if ( v10 == 1 )
{
if ( a5 )
memmove((void *)(v16 + v15), a4, a5);
v18 = &v17[(unsigned int)v13];
v19 = v11 - (unsigned int)v13;
if ( v19 < 1 )
return (__int64)(v18 - 1);
v20 = &v17[(unsigned int)v13];
goto LABEL_42;
}
if ( a5 )
memmove(&v18[-(unsigned int)v13], a4, a5);
goto LABEL_39;
}
v22 = (char *)fmt::BasicWriter::FillPadding((void *)(v16 + v15), v11, a5 + v7, (char)v9);
if ( !a5 )
{
LABEL_20:
v18 = &v22[v13];
return (__int64)(v18 - 1);
}
}
memmove(v22, a4, a5);
goto LABEL_20;
}
if ( a5 )
{
if ( *((_BYTE *)a4 + a5 - 1) == 48 )
v12 = a5 - 1;
else
v12 = a5;
}
else
{
v12 = 0;
}
if ( (unsigned int)v11 <= v12 - 1 )
return sub_100009C3C(a1);
if ( a1[1] < v11 )
sub_100009ED4(a1);
v23 = (unsigned int)v11 - (v12 - 1);
if ( v10 != 1 )
{
v27 = *a1;
v28 = *a1 + (unsigned int)v23;
if ( a1[1] < v28 )
sub_100009ED4(a1);
*a1 = v28;
memset((void *)(a1[2] + v27), v9, v23);
return sub_100009C3C(a1);
}
v24 = sub_100009C3C(a1);
v25 = *a1;
v26 = *a1 + (unsigned int)v23;
if ( a1[1] < v26 )
sub_100009ED4(a1);
*a1 = v26;
memset((void *)(a1[2] + v25), v9, v23);
return v24;
}