//
// _calloc_base from 0x180137224 to 0x180137299 (117 bytes)
//
// 31 xrefs:
// > j__calloc_base @ 0x18012b7f4
// > __acrt_initialize_stdio @ 0x18012f898
// > __acrt_initialize_stdio @ 0x18012f8c2
// > create_thread_parameter @ 0x180130a6d
// > __acrt_allocate_buffer_for_argv @ 0x180131c8d
// > create_environment @ 0x180131f5f
// > create_environment @ 0x180131f92
// > create_environment @ 0x18013206e
// > create_environment @ 0x1801320a6
// > initialize_environment_by_cloning_nolock @ 0x180132214
// > initialize_environment_by_cloning_nolock @ 0x1801322d8
// > _getdrive @ 0x18013479a
// > __acrt_getptd @ 0x180135310
// > __acrt_getptd_head @ 0x1801353cf
// > __acrt_getptd_noexit @ 0x18013548c
// > __acrt_lowio_create_handle_array @ 0x180135fe0
// > _lambda_b4f66040be5f354a654fb75160c27bfc_::operator @ 0x180139496
// > copy_and_add_argument_to_buffer @ 0x180139cc0
// > copy_and_add_argument_to_buffer @ 0x180139d23
// > common_set_variable_in_environment_nolock @ 0x18013ae90
// > common_set_variable_in_environment_nolock @ 0x18013aec9
// > common_set_variable_in_environment_nolock @ 0x18013b01c
// > common_set_variable_in_environment_nolock @ 0x18013b1b2
// > common_set_variable_in_environment_nolock @ 0x18013b1eb
// > common_set_variable_in_environment_nolock @ 0x18013b33e
// > copy_environment @ 0x18013b440
// > copy_environment @ 0x18013b471
// > copy_environment @ 0x18013b533
// > copy_environment @ 0x18013b564
// > __acrt_stdio_allocate_buffer_nolock @ 0x180142097
// > ??> @ 0x1802035c0
//
// 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 calloc_base(size_t Count, size_t Size)
{
SIZE_T v2; // rbx
void *result; // rax
if ( Count && 0xFFFFFFFFFFFFFFE0uLL / Count < Size )
{
LABEL_10:
*errno() = 12;
return nullptr;
}
else
{
v2 = Size * Count;
if ( !(Size * Count) )
v2 = 1;
while ( 1 )
{
result = HeapAlloc(hHeap, 8u, v2);
if ( result )
break;
if ( !(unsigned int)sub_18013BEC4() || !callnewh(v2) )
goto LABEL_10;
}
}
return result;
}