//
// SFXFolderObject::init from 0x1000d94a0 to 0x1000d96ef (591 bytes)
//
// 2 xrefs:
// > IDNameBrowserPopup::onFormAdd @ 0x10090b198
// > sub_10090C350 @ 0x10090c3e2
//
// 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:20:57 +0000
//
void __fastcall SFXFolderObject::init(__int64 a1, unsigned int a2, unsigned __int8 *a3, unsigned int a4)
{
unsigned int v4; // r14d
unsigned int v5; // r15d
_QWORD *v7; // rdi
__int64 v8; // rax
std::string *v9; // rax
unsigned __int64 v10; // r8
unsigned __int64 v11; // rdx
unsigned __int64 v12; // r9
unsigned __int64 v13; // rsi
__int64 **v14; // rax
__int64 *v15; // rdi
unsigned __int64 v16; // r8
unsigned __int64 v17; // rax
__int64 v18; // rax
std::string __str; // [rsp+8h] [rbp-48h] BYREF
unsigned int *v20; // [rsp+20h] [rbp-30h] BYREF
unsigned int v21; // [rsp+2Ch] [rbp-24h] BYREF
unsigned int v22; // [rsp+30h] [rbp-20h] BYREF
_BYTE v23[25]; // [rsp+37h] [rbp-19h] BYREF
v4 = a4;
v5 = a2;
v22 = a2;
v21 = a4;
sub_1000D8E20(&__str, a3);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
{
v7 = (_QWORD *)(a1 + 504);
if ( __str.__r_.__value_.__l.__size_ )
goto LABEL_3;
}
else
{
v7 = (_QWORD *)(a1 + 504);
if ( *(_BYTE *)&__str.__r_.__value_.__l.0 >> 1 )
{
LABEL_3:
v20 = &v21;
v8 = sub_1000E8B10(v7, &v21, &unk_100A04AD3, &v20, v23);
v20 = &v22;
v9 = (std::string *)sub_1000E8600(v8 + 24, &v22, &unk_100A04AD3, &v20, v23);
std::string::operator=(v9 + 1, &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
return;
goto LABEL_4;
}
}
v10 = *(_QWORD *)(a1 + 512);
if ( !v10 )
goto LABEL_35;
v11 = ((v10 - ((v10 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v10 - ((v10 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v10 - ((v10 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v10 - ((v10 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4);
v12 = (0x101010101010101LL * (v11 & 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v12 > 1 )
{
v13 = (int)v4;
if ( v10 <= (int)v4 )
{
if ( !((v10 | (int)v4) >> 32) )
{
v11 = v4 % (unsigned int)v10;
v13 = v11;
v14 = *(__int64 ***)(*v7 + 8 * v11);
if ( !v14 )
goto LABEL_35;
goto LABEL_15;
}
v11 = (int)v4 % v10;
v13 = v11;
}
v14 = *(__int64 ***)(*v7 + 8 * v13);
if ( !v14 )
goto LABEL_35;
LABEL_15:
v15 = *v14;
if ( !*v14 )
goto LABEL_35;
if ( (unsigned int)v12 < 2 )
{
v16 = v10 - 1;
while ( 1 )
{
v18 = v15[1];
if ( v18 == v4 )
{
if ( *((_DWORD *)v15 + 4) == v4 )
goto LABEL_33;
}
else if ( (v16 & v18) != v13 )
{
goto LABEL_35;
}
v15 = (__int64 *)*v15;
if ( !v15 )
goto LABEL_35;
}
}
while ( 1 )
{
v17 = v15[1];
if ( v17 == v4 )
{
if ( *((_DWORD *)v15 + 4) == v4 )
{
LABEL_33:
sub_1000E9050(v15 + 3, &v22, v11, (int)v4);
v5 = v22;
v4 = v21;
goto LABEL_35;
}
}
else
{
if ( v17 < v10 )
goto LABEL_24;
if ( (v10 | v17) >> 32 )
{
v11 = v17 % v10;
v17 %= v10;
LABEL_24:
if ( v17 != v13 )
goto LABEL_35;
goto LABEL_19;
}
v11 = (unsigned int)v17 % (unsigned int)v10;
if ( v11 != v13 )
goto LABEL_35;
}
LABEL_19:
v15 = (__int64 *)*v15;
if ( !v15 )
goto LABEL_35;
}
}
v13 = (int)v4 & (v10 - 1);
v14 = *(__int64 ***)(*v7 + 8 * v13);
if ( v14 )
goto LABEL_15;
LABEL_35:
sub_1000D9710(a1, v5, v4);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
return;
LABEL_4:
operator delete(__str.__r_.__value_.__l.__data_);
}