//
// sub_100429990 from 0x100429990 to 0x100429b54 (452 bytes)
//
// 6 xrefs:
// > GJSmartTemplate::scanForPrefab @ 0x100423acb
// > GJSmartTemplate::scanForPrefab @ 0x100423af9
// > GJSmartTemplate::scanForPrefab @ 0x100423b22
// > GJSmartTemplate::scanForPrefab @ 0x100423c1c
// > GJSmartTemplate::scanForPrefab @ 0x100423c53
// > GJSmartTemplate::scanForPrefab @ 0x10042441b
//
// 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
//
char *__fastcall sub_100429990(__int64 **a1, unsigned __int8 *a2, double a3, __int64 a4, _BYTE **a5)
{
__int64 *v5; // rax
unsigned int v6; // r15d
size_t v7; // r15
const void *v8; // rbx
__int64 *v9; // r12
__int64 *v10; // r13
unsigned int v11; // r14d
size_t v12; // r14
const void *v13; // r12
size_t v14; // r13
int v15; // eax
bool v16; // cl
int v17; // eax
bool v18; // cl
char *v19; // r14
_QWORD *v20; // rdi
_BYTE *v21; // rax
__int64 *v22; // rax
__int64 *v26; // [rsp+30h] [rbp-30h]
v5 = a1[1];
if ( v5 )
{
v6 = *a2;
if ( (v6 & 1) != 0 )
{
v7 = *((_QWORD *)a2 + 1);
v8 = *((const void **)a2 + 2);
}
else
{
v7 = v6 >> 1;
v8 = a2 + 1;
}
while ( 1 )
{
while ( 1 )
{
v11 = *((unsigned __int8 *)v5 + 32);
v26 = v5;
if ( (v11 & 1) != 0 )
{
v12 = v5[5];
v13 = (const void *)v5[6];
}
else
{
v12 = v11 >> 1;
v13 = (char *)v5 + 33;
}
v14 = v7;
if ( v12 < v7 )
v14 = v12;
v15 = memcmp(v8, v13, v14);
v16 = v7 < v12;
if ( v15 )
v16 = v15 < 0;
if ( !v16 )
break;
v10 = v26;
v5 = (__int64 *)*v26;
v9 = v26;
if ( !*v26 )
goto LABEL_20;
}
v17 = memcmp(v13, v8, v14);
v18 = v12 < v7;
if ( v17 )
v18 = v17 < 0;
if ( !v18 )
return (char *)v26;
v10 = v26;
v5 = (__int64 *)v26[1];
if ( !v5 )
{
v9 = v26 + 1;
goto LABEL_20;
}
}
}
else
{
v9 = (__int64 *)(a1 + 1);
v10 = (__int64 *)(a1 + 1);
LABEL_20:
v19 = (char *)operator new(0x80u);
v20 = v19 + 32;
v21 = *a5;
if ( (**a5 & 1) != 0 )
{
sub_100006B70(v20, *((const void **)v21 + 2), *((_QWORD *)v21 + 1), a3);
}
else
{
*((_QWORD *)v19 + 6) = *((_QWORD *)v21 + 2);
*(_OWORD *)v20 = *(_OWORD *)v21;
}
*((_QWORD *)v19 + 7) = 0;
*((_WORD *)v19 + 32) = 0;
*((_WORD *)v19 + 44) = 0;
*((_DWORD *)v19 + 28) = 0;
v19[116] = 0;
*((_DWORD *)v19 + 30) = 0;
*(_DWORD *)(v19 + 123) = 0;
*(_OWORD *)v19 = 0;
*((_QWORD *)v19 + 2) = v10;
*v9 = (__int64)v19;
v22 = (__int64 *)**a1;
if ( v22 )
*a1 = v22;
sub_100054DD0(a1[1], (__int64 *)v19);
a1[2] = (__int64 *)((char *)a1[2] + 1);
}
return v19;
}