//
// GauntletLayer::loadLevelsFailed from 0x100394370 to 0x1003944c5 (341 bytes)
//
// 2 xrefs:
// > sub_1003944F0 @ 0x1003944fc
// > ??> @ 0x1009200f0
//
// 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 __fastcall GauntletLayer::loadLevelsFailed(GauntletLayer *a1, const char *a2, int a3)
{
double v3; // xmm0_8
GameLevelManager *v4; // rax
size_t v5; // rax
size_t v6; // r12
char *v7; // r14
char *v8; // r13
size_t v9; // rbx
void *v10; // r15
size_t v11; // rax
char *p_s1; // rdi
size_t v13; // rdx
bool v14; // zf
char v15; // r14
__int64 __dst; // [rsp+8h] [rbp-58h] BYREF
size_t v18; // [rsp+10h] [rbp-50h]
void *__s2; // [rsp+18h] [rbp-48h]
unsigned __int8 v20; // [rsp+20h] [rbp-40h] BYREF
char __s1; // [rsp+21h] [rbp-3Fh] BYREF
size_t __n; // [rsp+28h] [rbp-38h]
void *__p; // [rsp+30h] [rbp-30h]
v4 = GameLevelManager::sharedState();
GameLevelManager::getGauntletSearchKey(&v20, v4, (unsigned int)a1->m_gauntletType);
v5 = strlen(a2);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
v6 = v5;
v7 = (char *)&__dst + 1;
if ( v5 >= 0x17 )
{
v9 = 26;
if ( (v5 | 7) != 0x17 )
v9 = (v5 | 7) + 1;
v8 = (char *)operator new(v9);
__s2 = v8;
__dst = v9 | 1;
v18 = v6;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v5;
v8 = (char *)&__dst + 1;
if ( v5 )
LABEL_8:
memcpy(v8, a2, v6);
v8[v6] = 0;
v10 = __s2;
if ( (v20 & 1) != 0 )
{
v11 = __n;
p_s1 = (char *)__p;
}
else
{
v11 = v20 >> 1;
p_s1 = &__s1;
}
v13 = (unsigned __int8)__dst >> 1;
if ( (__dst & 1) != 0 )
{
v13 = v18;
v7 = (char *)__s2;
}
v14 = v13 == v11;
if ( v13 >= v11 )
v13 = v11;
v15 = v14 & (memcmp(p_s1, v7, v13) == 0);
if ( (__dst & 1) != 0 )
operator delete(v10);
if ( v15 )
{
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 0);
((void (__fastcall *)(TextArea *, __int64))a1->m_tryAgainText->setVisible)(a1->m_tryAgainText, 1);
}
if ( (v20 & 1) != 0 )
operator delete(__p);
}