//
// sub_100152610 from 0x100152610 to 0x10015279b (395 bytes)
//
// 26 xrefs:
// > GJBaseGameLayer::parseRecording @ 0x10013584e
// > GJBaseGameLayer::parseRecording @ 0x1001358ab
// > GJBaseGameLayer::parseRecording @ 0x100135908
// > GJBaseGameLayer::parseRecording @ 0x100135965
// > GJBaseGameLayer::parseRecording @ 0x100135a76
// > GJBaseGameLayer::parseRecording @ 0x100135acf
// > GJBaseGameLayer::parseRecording @ 0x100135d22
// > ColorAction::setupFromMap @ 0x1002c650e
// > ColorAction::setupFromMap @ 0x1002c6560
// > ColorAction::setupFromMap @ 0x1002c65b6
// > ColorAction::setupFromMap @ 0x1002c663a
// > ColorAction::setupFromMap @ 0x1002c6690
// > ColorAction::setupFromMap @ 0x1002c66e6
// > ColorAction::setupFromMap @ 0x1002c6766
// > ColorAction::setupFromMap @ 0x1002c67bc
// > ColorAction::setupFromMap @ 0x1002c681a
// > ColorAction::setupFromMap @ 0x1002c686c
// > ColorAction::setupFromMap @ 0x1002c68d2
// > ColorAction::setupFromMap @ 0x1002c692e
// > ColorAction::setupFromMap @ 0x1002c6985
// > ColorAction::setupFromMap @ 0x1002c69e1
// > ColorAction::setupFromMap @ 0x1002c6a39
// > ColorAction::setupFromMap @ 0x1002c6a8f
// > ColorAction::setupFromMap @ 0x1002c6ae5
// > ColorAction::setupFromMap @ 0x1002c6b41
// > sub_1009237C0 @ 0x1009239e7
//
// 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:25:02 +0000
//
char *__fastcall sub_100152610(__int64 **a1, unsigned __int8 *a2, __int64 a3, __int64 *a4)
{
__int64 *v4; // rax
unsigned int v5; // edi
size_t v6; // rdi
const void *v7; // rbx
__int64 *v8; // r15
__int64 *v9; // rcx
unsigned int v10; // r12d
size_t v11; // r12
const void *v12; // r13
size_t v13; // r15
int v14; // eax
bool v15; // cl
int v16; // eax
bool v17; // cl
__int64 *v18; // rbx
char *v19; // r14
__int64 v20; // rax
__int64 *v21; // rax
__int64 *v25; // [rsp+10h] [rbp-30h]
v4 = a1[1];
if ( v4 )
{
v5 = *a2;
if ( (v5 & 1) != 0 )
{
v6 = *((_QWORD *)a2 + 1);
v7 = *((const void **)a2 + 2);
}
else
{
v6 = v5 >> 1;
v7 = a2 + 1;
}
while ( 1 )
{
while ( 1 )
{
v10 = *((unsigned __int8 *)v4 + 32);
v25 = v4;
if ( (v10 & 1) != 0 )
{
v11 = v4[5];
v12 = (const void *)v4[6];
}
else
{
v11 = v10 >> 1;
v12 = (char *)v4 + 33;
}
v13 = v6;
if ( v11 < v6 )
v13 = v11;
v14 = memcmp(v7, v12, v13);
v15 = v6 < v11;
if ( v14 )
v15 = v14 < 0;
if ( !v15 )
break;
v9 = v25;
v4 = (__int64 *)*v25;
v8 = v25;
if ( !*v25 )
goto LABEL_20;
}
v16 = memcmp(v12, v7, v13);
v17 = v11 < v6;
if ( v16 )
v17 = v16 < 0;
if ( !v17 )
return (char *)v25;
v9 = v25;
v4 = (__int64 *)v25[1];
if ( !v4 )
{
v8 = v25 + 1;
goto LABEL_20;
}
}
}
else
{
v8 = (__int64 *)(a1 + 1);
v9 = (__int64 *)(a1 + 1);
LABEL_20:
v18 = v9;
v19 = (char *)operator new(0x50u);
v20 = *a4;
*((_QWORD *)v19 + 6) = *(_QWORD *)(*a4 + 16);
*((_OWORD *)v19 + 2) = *(_OWORD *)v20;
*(_OWORD *)v20 = 0;
*(_QWORD *)(v20 + 16) = 0;
*(_OWORD *)(v19 + 56) = 0;
*((_QWORD *)v19 + 9) = 0;
*(_OWORD *)v19 = 0;
*((_QWORD *)v19 + 2) = v18;
*v8 = (__int64)v19;
v21 = (__int64 *)**a1;
if ( v21 )
*a1 = v21;
sub_10001B680(a1[1], (__int64 *)v19);
a1[2] = (__int64 *)((char *)a1[2] + 1);
}
return v19;
}