//
// __alloca_probe from 0x1404d17d0 to 0x1404d181e (78 bytes)
//
// 10 xrefs:
// > AchievementManager::addManualAchievements @ 0x14000841a
// > sub_1400494F0 @ 0x140049515
// > GameManager::verifyCoinUnlocks @ 0x14017e5c5
// > GameObject::setupCustomSprites @ 0x1401aef1d
// > GameStatsManager::setupIconCredits @ 0x1401c4121
// > sub_1402E3B00 @ 0x1402e3b1d
// > ObjectToolbox::init @ 0x140348d83
// > SecretLayer5::init @ 0x1403f4055
// > SecretLayer5::onSubmit @ 0x1403f6c4f
// > ??> @ 0x1406dd808
//
// 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 _alloca_probe()
{
unsigned __int64 result; // rax
char *v1; // r10
char *StackLimit; // r11
char v3; // [rsp+18h] [rbp+8h] BYREF
v1 = &v3 - result;
if ( (unsigned __int64)&v3 < result )
v1 = nullptr;
StackLimit = (char *)NtCurrentTeb()->NtTib.StackLimit;
if ( v1 < StackLimit )
{
LOWORD(v1) = (unsigned __int16)v1 & 0xF000;
do
{
StackLimit -= 4096;
*StackLimit = 0;
}
while ( v1 != StackLimit );
}
return result;
}