//
// GJBaseGameLayer::generatePickupAnimRandVal from 0x1001290b0 to 0x100129406 (854 bytes)
//
// 1 xrefs:
// > GameObject::playDestroyObjectAnim @ 0x10025f4b5
//
// 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 GJBaseGameLayer::generatePickupAnimRandVal(GJBaseGameLayer *a1, GameObject *a2, float *a3, float *a4)
{
float *v5; // r13
__int64 v6; // rax
int v7; // ebx
__int64 v8; // rdx
std::__compressed_pair *>> *p_pair1; // r13
std::__tree_end_node *>::pointer left; // rax
std::__tree_end_node *>::pointer v11; // rcx
int v12; // eax
int v13; // eax
float v14; // xmm1_4
std::__compressed_pair *>> *v15; // r14
char *v16; // r12
std::__tree_end_node *>::pointer v17; // rcx
std::__tree_end_node *> *v18; // rax
std::__compressed_pair *>> *v19; // r14
char *v20; // r12
std::__tree_end_node *>::pointer v21; // rcx
__int64 v22; // r15
std::__tree_end_node *> *v23; // rax
float *v24; // r14
char *v25; // r15
char *v26; // rbx
__int64 v27; // r12
std::__tree_end_node *> *v28; // rax
char *v30; // [rsp+10h] [rbp-60h]
float *v31; // [rsp+18h] [rbp-58h]
__int64 v32; // [rsp+30h] [rbp-40h]
__int64 v33; // [rsp+38h] [rbp-38h]
float v34; // [rsp+40h] [rbp-30h]
char *v35; // [rsp+40h] [rbp-30h]
v5 = (float *)((__int64 (__fastcall *)(GameObject *))a2->getPosition)(a2);
v6 = ((__int64 (__fastcall *)(GameObject *))a2->getPosition)(a2);
v7 = (int)*v5;
v8 = (unsigned int)(int)*(float *)(v6 + 4);
p_pair1 = &a1->m_destroyObjectValues.__tree_.__pair1_;
left = a1->m_destroyObjectValues.__tree_.__pair1_.__value_.__left_;
v33 = (unsigned int)v7;
v32 = v8;
v31 = a4;
if ( left )
{
v11 = a1->m_destroyObjectValues.__tree_.__pair1_.__value_.__left_;
do
{
if ( *((_DWORD *)v11 + 7) <= v7 )
{
if ( *((_DWORD *)v11 + 7) >= v7 )
{
if ( *((_DWORD *)v11 + 8) > (int)v8 )
goto LABEL_4;
if ( *((_DWORD *)v11 + 8) >= (int)v8 )
goto LABEL_23;
}
v11 = (std::__tree_end_node *>::pointer)((char *)v11 + 8);
}
LABEL_4:
v11 = *(std::__tree_end_node *>::pointer *)v11;
}
while ( v11 );
}
v12 = rand();
v34 = (float)((float)((float)v12 * 4.6566129e-10) + (float)((float)v12 * 4.6566129e-10)) + -1.0;
v13 = rand();
v8 = v32;
v14 = (float)v13 * 4.6566129e-10;
left = p_pair1->__value_.__left_;
v15 = &a1->m_destroyObjectValues.__tree_.__pair1_;
v16 = (char *)&a1->m_destroyObjectValues.__tree_.__pair1_;
if ( p_pair1->__value_.__left_ )
{
v17 = p_pair1->__value_.__left_;
while ( 1 )
{
v16 = (char *)v17;
if ( *((_DWORD *)v17 + 7) > v7 )
goto LABEL_12;
if ( *((_DWORD *)v17 + 7) < v7 )
{
LABEL_17:
v17 = *((std::__tree_end_node *>::pointer *)v17 + 1);
if ( !v17 )
{
v15 = (std::__compressed_pair *>> *)(v16 + 8);
break;
}
}
else
{
if ( *((_DWORD *)v17 + 8) <= (int)v32 )
{
if ( *((_DWORD *)v17 + 8) >= (int)v32 )
goto LABEL_22;
goto LABEL_17;
}
LABEL_12:
v17 = *(std::__tree_end_node *>::pointer *)v17;
v15 = (std::__compressed_pair *>> *)v16;
if ( !*(_QWORD *)v16 )
break;
}
}
}
v30 = v16;
v16 = (char *)operator new(0x30u);
*(_QWORD *)(v16 + 28) = (unsigned int)v7 + (v32 << 32);
*(_QWORD *)(v16 + 36) = 0;
*(_OWORD *)v16 = 0;
*((_QWORD *)v16 + 2) = v30;
v15->__value_.__left_ = (std::__tree_end_node *>::pointer)v16;
v18 = (std::__tree_end_node *> *)a1->m_destroyObjectValues.__tree_.__begin_node_->__left_;
if ( v18 )
a1->m_destroyObjectValues.__tree_.__begin_node_ = v18;
sub_100054DD0((__int64 *)a1->m_destroyObjectValues.__tree_.__pair1_.__value_.__left_, (__int64 *)v16);
++a1->m_destroyObjectValues.__tree_.__pair3_.__value_;
left = a1->m_destroyObjectValues.__tree_.__pair1_.__value_.__left_;
v8 = v32;
LABEL_22:
*((float *)v16 + 9) = v34;
*((float *)v16 + 10) = v14;
v19 = &a1->m_destroyObjectValues.__tree_.__pair1_;
v20 = (char *)&a1->m_destroyObjectValues.__tree_.__pair1_;
if ( !left )
{
LABEL_31:
v35 = v20;
v22 = v8;
v20 = (char *)operator new(0x30u);
*(_QWORD *)(v20 + 28) = (unsigned int)v7 + (v22 << 32);
*(_QWORD *)(v20 + 36) = 0;
*(_OWORD *)v20 = 0;
*((_QWORD *)v20 + 2) = v35;
v19->__value_.__left_ = (std::__tree_end_node *>::pointer)v20;
v23 = (std::__tree_end_node *> *)a1->m_destroyObjectValues.__tree_.__begin_node_->__left_;
if ( v23 )
a1->m_destroyObjectValues.__tree_.__begin_node_ = v23;
sub_100054DD0((__int64 *)a1->m_destroyObjectValues.__tree_.__pair1_.__value_.__left_, (__int64 *)v20);
++a1->m_destroyObjectValues.__tree_.__pair3_.__value_;
left = a1->m_destroyObjectValues.__tree_.__pair1_.__value_.__left_;
v24 = v31;
v8 = v32;
goto LABEL_34;
}
LABEL_23:
v21 = left;
while ( 1 )
{
while ( 1 )
{
v20 = (char *)v21;
if ( *((_DWORD *)v21 + 7) <= v7 )
break;
LABEL_24:
v21 = *(std::__tree_end_node *>::pointer *)v21;
v19 = (std::__compressed_pair *>> *)v20;
if ( !*(_QWORD *)v20 )
goto LABEL_31;
}
if ( *((_DWORD *)v21 + 7) >= v7 )
break;
LABEL_29:
v21 = *((std::__tree_end_node *>::pointer *)v21 + 1);
if ( !v21 )
{
v19 = (std::__compressed_pair *>> *)(v20 + 8);
goto LABEL_31;
}
}
if ( *((_DWORD *)v21 + 8) > (int)v8 )
goto LABEL_24;
if ( *((_DWORD *)v21 + 8) < (int)v8 )
goto LABEL_29;
v24 = v31;
LABEL_34:
*a3 = *((float *)v20 + 9);
v25 = (char *)&a1->m_destroyObjectValues.__tree_.__pair1_;
LABEL_36:
if ( left )
{
do
{
v25 = (char *)left;
if ( *((_DWORD *)left + 7) > v7 )
{
LABEL_35:
left = *(std::__tree_end_node *>::pointer *)left;
p_pair1 = (std::__compressed_pair *>> *)v25;
goto LABEL_36;
}
if ( *((_DWORD *)left + 7) >= v7 )
{
if ( *((_DWORD *)left + 8) > (int)v8 )
goto LABEL_35;
if ( *((_DWORD *)left + 8) >= (int)v8 )
goto LABEL_46;
}
left = *((std::__tree_end_node *>::pointer *)left + 1);
}
while ( left );
p_pair1 = (std::__compressed_pair *>> *)(v25 + 8);
}
v26 = v25;
v27 = v8;
v25 = (char *)operator new(0x30u);
*(_QWORD *)(v25 + 28) = (v27 << 32) | v33;
*(_QWORD *)(v25 + 36) = 0;
*(_OWORD *)v25 = 0;
*((_QWORD *)v25 + 2) = v26;
p_pair1->__value_.__left_ = (std::__tree_end_node *>::pointer)v25;
v28 = (std::__tree_end_node *> *)a1->m_destroyObjectValues.__tree_.__begin_node_->__left_;
if ( v28 )
a1->m_destroyObjectValues.__tree_.__begin_node_ = v28;
sub_100054DD0((__int64 *)a1->m_destroyObjectValues.__tree_.__pair1_.__value_.__left_, (__int64 *)v25);
++a1->m_destroyObjectValues.__tree_.__pair3_.__value_;
LABEL_46:
*v24 = *((float *)v25 + 10);
}