//
// sub_373316 from 0x373316 to 0x3733ba (164 bytes)
//
// 4 xrefs:
// > processTraceOutSource @ 0x37762c
// > processTraceOutSource @ 0x3777f8
// > processTrace @ 0x37941e
// > processTrace @ 0x37948c
//
// 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
//
int __fastcall sub_373316(int a1, _DWORD *a2, int a3)
{
unsigned int v6; // r0
int **v7; // r3
int v8; // r10
unsigned int **v9; // r7
unsigned int *v10; // r6
_DWORD *v11; // r0
int v12; // r1
int v13; // r2
int v14; // r3
_DWORD *inserted; // r0
char v16; // r3
int *v18; // r3
unsigned int v19; // [sp+0h] [bp-14h]
unsigned int v20; // [sp+4h] [bp-10h]
unsigned int v21; // [sp+8h] [bp-Ch]
int **v22; // [sp+Ch] [bp-8h]
v6 = sub_3650C0((unsigned int *)a3);
v19 = a2[1];
v20 = v6;
v7 = *(int ***)(*a2 + 4 * (v6 % v19));
v8 = v6 % v19;
if ( !v7 )
goto LABEL_6;
v9 = (unsigned int **)*v7;
v21 = *(_DWORD *)a3;
while ( (unsigned int *)v21 != v9[2] || *(_QWORD *)(a3 + 8) != *((_QWORD *)v9 + 2) )
{
v10 = *v9;
if ( !*v9 )
goto LABEL_6;
v22 = (int **)v9;
if ( sub_3650C0(v10 + 2) % v19 != v8 )
goto LABEL_6;
v9 = (unsigned int **)v10;
v7 = v22;
}
v18 = *v7;
if ( v18 )
{
*(_DWORD *)a1 = v18;
v16 = 0;
}
else
{
LABEL_6:
v11 = (_DWORD *)operator new(0x18u);
*v11 = 0;
v12 = *(_DWORD *)(a3 + 4);
v13 = *(_DWORD *)(a3 + 8);
v14 = *(_DWORD *)(a3 + 12);
v11[2] = *(_DWORD *)a3;
v11[3] = v12;
v11[4] = v13;
v11[5] = v14;
inserted = std::_Hashtable,std::__detail::_Identity,std::equal_to,StateKeyHash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_insert_unique_node(
(int)a2,
v8,
v20,
v11);
v16 = 1;
*(_DWORD *)a1 = inserted;
}
*(_BYTE *)(a1 + 4) = v16;
return a1;
}