//
// sub_81118E from 0x81118e to 0x8111e0 (82 bytes)
//
// 2 xrefs:
// > sub_816CF0 @ 0x816d7a
// > sub_816CF0 @ 0x81797e
//
// 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:01:37 +0000
//
void *__fastcall sub_81118E(int a1, void *a2, int a3, int a4)
{
int *v6; // r1
size_t v7; // r8
int v8; // r9
int v9; // r6
unsigned int v10; // r5
int v11; // r5
int *v12; // r0
void *result; // r0
v6 = *(int **)(a1 + 4);
v7 = a3 - (_DWORD)a2;
v8 = *(_DWORD *)(a1 + 8) - (_DWORD)v6;
v9 = *(_DWORD *)(a1 + 12) - (_DWORD)v6;
v10 = (v8 >> 3) + ((a3 - (int)a2) >> 3);
if ( v10 > v9 >> 3 )
{
v11 = 2 * v10;
v12 = sub_8110F0(a4, v6, v9, v11 * 4);
*(_DWORD *)(a1 + 4) = v12;
*(_DWORD *)(a1 + 8) = (char *)v12 + v8;
*(_DWORD *)(a1 + 12) = &v12[v11];
}
result = memcpy(*(void **)(a1 + 8), a2, v7);
*(_DWORD *)(a1 + 8) += v7;
return result;
}