//
// sub_1800438E0 from 0x1800438e0 to 0x180043984 (164 bytes)
//
// 9 xrefs:
// > fmt::BasicFormatter::Format @ 0x180041a74
// > fmt::BasicFormatter::Format @ 0x180041a8f
// > fmt::BasicFormatter::Format @ 0x180041b4b
// > fmt::internal::PrintfParser::Format @ 0x180041dbb
// > fmt::internal::PrintfParser::Format @ 0x180041dcb
// > fmt::internal::PrintfParser::Format @ 0x18004244d
// > ??> @ 0x18013fb7c
// > ??> @ 0x18013fb8c
// > ??> @ 0x1801bb668
//
// This function is hookable on this platform (idp: pc, 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 11:21:40 +0000
//
void *__fastcall sub_1800438E0(__int64 a1, const void *a2, __int64 a3)
{
size_t v4; // rsi
size_t v6; // rdx
size_t v7; // rcx
size_t v8; // rdx
void *v9; // r14
void *v10; // rcx
void *result; // rax
v4 = a3 - (_QWORD)a2;
v6 = *(_QWORD *)(a1 + 8);
v7 = v4 + *(_QWORD *)a1;
if ( v7 > v6 )
{
v8 = (v6 >> 1) + v6;
if ( v7 < v8 )
v7 = v8;
*(_QWORD *)(a1 + 8) = v7;
v9 = (void *)sub_1800E4C6C(v7);
memmove(v9, *(const void **)(a1 + 16), *(_QWORD *)a1);
v10 = *(void **)(a1 + 16);
if ( v10 != (void *)(a1 + 24) )
j_j_free_0(v10);
*(_QWORD *)(a1 + 16) = v9;
}
result = memmove((void *)(*(_QWORD *)a1 + *(_QWORD *)(a1 + 16)), a2, v4);
*(_QWORD *)a1 += v4;
return result;
}