//
// _malloc_base from 0x180134854 to 0x1801348b2 (94 bytes)
//
// 20 xrefs:
// > __acrt_mbs_to_wcs_cp<__crt_win32_buffer_internal_dynamic_resizing> @ 0x180128fbb
// > __acrt_mbs_to_wcs_cp<__crt_win32_buffer_internal_dynamic_resizing> @ 0x18012904a
// > j__malloc_base @ 0x18012b810
// > __crt_stdio_output::formatting_buffer::ensure_buffer_is_big_enough @ 0x18012bc55
// > __crt_stdio_output::formatting_buffer::ensure_buffer_is_big_enough @ 0x18012bd00
// > __acrt_stdio_begin_temporary_buffering_nolock @ 0x1801385a5
// > _realloc_base @ 0x180138658
// > __acrt_wcs_to_mbs_cp<__crt_win32_buffer_internal_dynamic_resizing> @ 0x180139920
// > __acrt_wcs_to_mbs_cp<__crt_win32_buffer_internal_dynamic_resizing> @ 0x1801399b9
// > setmbcp_internal @ 0x18013a5eb
// > __dcrt_get_narrow_environment_from_os @ 0x18013ac8e
// > __dcrt_get_wide_environment_from_os @ 0x18013ad61
// > InternalCompareStringA @ 0x18013bca2
// > InternalCompareStringA @ 0x18013bd66
// > tzset_from_environment_nolock @ 0x18013cdcc
// > tzset_nolock @ 0x18013d1bc
// > __acrt_GetStringTypeA @ 0x18013d801
// > __acrt_LCMapStringA_stat @ 0x180140d04
// > __acrt_LCMapStringA_stat @ 0x180140e35
// > ??> @ 0x180203290
//
// 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
//
void *__cdecl malloc_base(size_t Size)
{
size_t v1; // rbx
void *result; // rax
v1 = Size;
if ( Size > 0xFFFFFFFFFFFFFFE0uLL )
{
LABEL_9:
*errno() = 12;
return nullptr;
}
else
{
if ( !Size )
v1 = 1;
while ( 1 )
{
result = HeapAlloc(hHeap, 0, v1);
if ( result )
break;
if ( !(unsigned int)sub_18013BEC4() || !callnewh(v1) )
goto LABEL_9;
}
}
return result;
}