//
// sub_140122770 from 0x140122770 to 0x1401229f4 (644 bytes)
//
// 2 xrefs:
// > DropdownListPopup::init @ 0x14012165a
// > ??> @ 0x1409166f4
//
// 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 11:26:57 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall sub_140122770(__int64 a1, unsigned int *a2, unsigned __int64 a3)
{
unsigned __int64 v3; // r14
unsigned int *v4; // r15
char *v6; // rsi
__int64 result; // rax
char *v8; // rbx
__int64 v9; // rdi
char *v10; // rbx
unsigned __int64 v11; // r13
void **v12; // rbp
size_t *v13; // rdi
void *v14; // rdx
_QWORD *v15; // rdx
unsigned __int64 v16; // r14
__int64 v17; // rdi
char *v18; // rbp
void **v19; // rdi
size_t *v20; // rbx
void *v21; // rdx
_QWORD *v22; // rdx
char *v23; // rdi
__int64 v24; // rbx
v3 = a3;
v4 = a2;
v6 = *(char **)a1;
if ( a3 <= (*(_QWORD *)(a1 + 16) - *(_QWORD *)a1) / 72LL )
{
v10 = *(char **)(a1 + 8);
result = (unsigned __int64)((unsigned __int128)((v10 - v6) * (__int128)0xE38E38E38E38E39LL) >> 64) >> 63;
v11 = (v10 - v6) / 72;
if ( a3 <= v11 )
{
result = 9 * a3;
v18 = &v6[72 * a3];
if ( a3 )
{
v19 = (void **)(v6 + 40);
v20 = (size_t *)(a2 + 2);
do
{
result = *((unsigned int *)v20 - 2);
*(_DWORD *)v6 = result;
if ( v19 - 4 != (void **)v20 )
{
v21 = v20;
if ( v20[3] > 0xF )
v21 = (void *)*v20;
result = (__int64)sub_1400405A0(v19 - 4, v21, v20[2]);
}
v22 = v20 + 4;
if ( v19 != (void **)(v20 + 4) )
{
if ( v20[7] > 0xF )
v22 = (_QWORD *)*v22;
result = (__int64)sub_1400405A0(v19, v22, v20[6]);
}
v6 += 72;
v19 += 9;
v20 += 9;
--v3;
}
while ( v3 );
}
v23 = *(char **)(a1 + 8);
if ( v18 != v23 )
{
v24 = (__int64)(v18 + 8);
do
{
sub_14003D310(v24 + 32);
sub_14003D310(v24);
v24 += 72;
result = v24 - 8;
}
while ( (char *)(v24 - 8) != v23 );
}
*(_QWORD *)(a1 + 8) = v18;
}
else
{
if ( v6 != v10 )
{
v12 = (void **)(v6 + 40);
v13 = (size_t *)(a2 + 2);
do
{
result = *v4;
*(_DWORD *)v6 = result;
if ( v12 - 4 != (void **)v13 )
{
v14 = v13;
if ( v13[3] > 0xF )
v14 = (void *)*v13;
result = (__int64)sub_1400405A0(v12 - 4, v14, v13[2]);
}
v15 = v13 + 4;
if ( v12 != (void **)(v13 + 4) )
{
if ( v13[7] > 0xF )
v15 = (_QWORD *)*v15;
result = (__int64)sub_1400405A0(v12, v15, v13[6]);
}
v6 += 72;
v12 += 9;
v4 += 18;
v13 += 9;
v10 = *(char **)(a1 + 8);
}
while ( v6 != v10 );
}
v16 = v3 - v11;
if ( v16 )
{
v17 = (__int64)(v4 + 10);
do
{
*(_DWORD *)v10 = *(_DWORD *)(v17 - 40);
sub_14003F4F0((__int64)(v10 + 8), v17 - 32);
result = sub_14003F4F0((__int64)(v10 + 40), v17);
v10 += 72;
v17 += 72;
--v16;
}
while ( v16 );
}
*(_QWORD *)(a1 + 8) = v10;
}
}
else
{
result = sub_140123000(a1, a3);
v8 = *(char **)a1;
if ( v3 )
{
v9 = (__int64)(v4 + 10);
do
{
*(_DWORD *)v8 = *(_DWORD *)(v9 - 40);
sub_14003F4F0((__int64)(v8 + 8), v9 - 32);
result = sub_14003F4F0((__int64)(v8 + 40), v9);
v8 += 72;
v9 += 72;
--v3;
}
while ( v3 );
}
*(_QWORD *)(a1 + 8) = v8;
}
return result;
}