//
// sub_180075CC0 from 0x180075cc0 to 0x180075dfb (315 bytes)
//
// 8 xrefs:
// > sub_180001370 @ 0x1800013d1
// > sub_1800013F0 @ 0x1800014b9
// > sub_180075E00 @ 0x180075e57
// > sub_180075FC0 @ 0x180076017
// > ??> @ 0x18013b884
// > ??> @ 0x18013b89c
// > ??> @ 0x18013b8ac
// > ??> @ 0x1801b46f8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
unsigned __int64 __fastcall sub_180075CC0(__int64 a1, unsigned __int64 a2, unsigned __int64 a3)
{
unsigned __int64 *v5; // rcx
unsigned __int64 v6; // rsi
void *v7; // rax
unsigned __int64 *v8; // rdi
unsigned __int64 *v9; // rcx
__int64 v10; // rax
unsigned __int64 result; // rax
unsigned __int64 v12; // [rsp+40h] [rbp+18h] BYREF
v12 = a3;
v5 = *(unsigned __int64 **)(a1 + 8);
if ( ((__int64)v5 - *(_QWORD *)a1) >> 3 >= a2 )
return sub_180075700(*(unsigned __int64 **)a1, v5, &v12);
if ( a2 > 0x1FFFFFFFFFFFFFFFLL )
goto LABEL_20;
v6 = 8 * a2;
if ( 8 * a2 < 0x1000 )
{
if ( v6 )
v8 = (unsigned __int64 *)operator new(8 * a2);
else
v8 = nullptr;
goto LABEL_10;
}
if ( v6 + 39 < v6 )
LABEL_20:
Concurrency::cancel_current_task();
v7 = operator new(v6 + 39);
if ( !v7 )
goto LABEL_18;
v8 = (unsigned __int64 *)(((unsigned __int64)v7 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*(v8 - 1) = (unsigned __int64)v7;
LABEL_10:
v9 = *(unsigned __int64 **)a1;
v10 = (__int64)(*(_QWORD *)(a1 + 16) - *(_QWORD *)a1) >> 3;
if ( !v10 )
goto LABEL_15;
if ( (unsigned __int64)(8 * v10) >= 0x1000 )
{
if ( (unsigned __int64)v9 - *(v9 - 1) - 8 <= 0x1F )
{
v9 = (unsigned __int64 *)*(v9 - 1);
goto LABEL_14;
}
LABEL_18:
invalid_parameter_noinfo_noreturn();
}
LABEL_14:
j_j_free_0(v9);
LABEL_15:
result = (unsigned __int64)&v8[v6 / 8];
*(_QWORD *)a1 = v8;
*(_QWORD *)(a1 + 8) = &v8[v6 / 8];
*(_QWORD *)(a1 + 16) = &v8[v6 / 8];
if ( v8 != &v8[v6 / 8] )
{
do
*v8++ = a3;
while ( v8 != (unsigned __int64 *)result );
}
return result;
}