//
// sub_10090C4C0 from 0x10090c4c0 to 0x10090c7b3 (755 bytes)
//
// 10 xrefs:
// > IDNameBrowserPopup::onFormArrowLeft @ 0x10090ab45
// > IDNameBrowserPopup::onFormArrowRight @ 0x10090ac83
// > IDNameBrowserPopup::onFormNextFree @ 0x10090af1e
// > IDNameBrowserPopup::onFormAdd @ 0x10090b1f9
// > sub_10090C0E0 @ 0x10090c229
// > sub_10090C350 @ 0x10090c412
// > IDNameBrowserPopup::textChanged @ 0x10090c470
// > IDNameBrowserPopup::textChanged @ 0x10090c47d
// > sub_10090C820 @ 0x10090c83a
// > sub_10090C820 @ 0x10090c847
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:38:07 +0000
//
__int64 __fastcall sub_10090C4C0(__int64 a1)
{
__int64 v2; // rdx
__int64 v3; // r14
__int64 v4; // rsi
char v5; // r12
char *v6; // rdi
int v8; // r15d
__int64 v9; // rsi
int v10; // eax
int v11; // ecx
int v12; // eax
const char *v13; // r8
std::string v14; // [rsp+0h] [rbp-E0h] BYREF
void *v15[2]; // [rsp+18h] [rbp-C8h] BYREF
void *__p; // [rsp+28h] [rbp-B8h]
char *__str[2]; // [rsp+30h] [rbp-B0h] BYREF
char *v18; // [rsp+40h] [rbp-A0h]
if ( !*(_QWORD *)(a1 + 728) )
return __stack_chk_guard;
if ( !*(_QWORD *)(GameManager::sharedState() + 552)
|| !*(_QWORD *)(*(_QWORD *)(GameManager::sharedState() + 552) + 3272LL) )
{
return (*(__int64 (__fastcall **)(_QWORD, const char *, __int64, _QWORD))(**(_QWORD **)(a1 + 728) + 928LL))(
*(_QWORD *)(a1 + 728),
"",
v2,
__stack_chk_guard);
}
v3 = *(_QWORD *)(*(_QWORD *)(GameManager::sharedState() + 552) + 3272LL);
v4 = *(_QWORD *)(a1 + 712);
if ( v4 )
{
CCTextInputNode::getString(__str, v4);
v5 = (char)__str[0];
if ( ((__int64)__str[0] & 1) != 0 )
{
if ( !__str[1] )
{
v8 = 0;
goto LABEL_21;
}
v6 = v18;
LABEL_13:
v10 = atoi(v6);
v11 = 0;
if ( v10 > 0 )
v11 = v10;
v8 = 9999;
if ( v11 < 9999 )
v8 = v11;
if ( (v5 & 1) == 0 )
{
v9 = *(_QWORD *)(a1 + 720);
if ( v9 )
goto LABEL_19;
goto LABEL_22;
}
LABEL_21:
operator delete(v18);
v9 = *(_QWORD *)(a1 + 720);
if ( v9 )
goto LABEL_19;
goto LABEL_22;
}
if ( LOBYTE(__str[0]) )
{
v6 = (char *)__str + 1;
goto LABEL_13;
}
}
v8 = 0;
v9 = *(_QWORD *)(a1 + 720);
if ( v9 )
{
LABEL_19:
CCTextInputNode::getString(__str, v9);
goto LABEL_23;
}
LABEL_22:
LOWORD(__str[0]) = 0;
LABEL_23:
sub_1000D8E20(&v14, (unsigned __int8 *)__str);
if ( ((__int64)__str[0] & 1) != 0 )
operator delete(v18);
if ( (*(_BYTE *)&v14.__r_.__value_.__s.0 & 1) != 0 )
{
if ( !v14.__r_.__value_.__l.__size_ )
goto LABEL_32;
}
else if ( !(*(_BYTE *)&v14.__r_.__value_.__l.0 >> 1) )
{
goto LABEL_32;
}
v12 = sub_1000D98C0(v3, (__int64)&v14, *(_DWORD *)(a1 + 676));
if ( v12 > 0 && v12 != v8 )
{
snprintf((char *)__str, 0x40u, "Name used by ID %d", v12);
(*(void (__fastcall **)(_QWORD, char **))(**(_QWORD **)(a1 + 728) + 928LL))(*(_QWORD *)(a1 + 728), __str);
goto LABEL_43;
}
LABEL_32:
if ( v8 )
{
sub_1000D91B0(v15, v3, v8, *(_DWORD *)(a1 + 676));
if ( ((__int64)v15[0] & 1) != 0 )
{
if ( v15[1] )
{
v13 = (const char *)__p;
goto LABEL_39;
}
}
else if ( LOBYTE(v15[0]) )
{
v13 = (char *)v15 + 1;
LABEL_39:
snprintf((char *)__str, 0x80u, "ID %d already named \"%s\" - Add will rename it", v8, v13);
(*(void (__fastcall **)(_QWORD, char **))(**(_QWORD **)(a1 + 728) + 928LL))(*(_QWORD *)(a1 + 728), __str);
goto LABEL_41;
}
(*(void (__fastcall **)(_QWORD, const char *))(**(_QWORD **)(a1 + 728) + 928LL))(*(_QWORD *)(a1 + 728), "");
LABEL_41:
if ( ((__int64)v15[0] & 1) != 0 )
operator delete(__p);
goto LABEL_43;
}
(*(void (__fastcall **)(_QWORD, const char *))(**(_QWORD **)(a1 + 728) + 928LL))(*(_QWORD *)(a1 + 728), "");
LABEL_43:
if ( (*(_BYTE *)&v14.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v14.__r_.__value_.__l.__data_);
return __stack_chk_guard;
}