//
// sub_1005D90FC from 0x1005d90fc to 0x1005d954c (1104 bytes)
//
// 1 xrefs:
// > sub_1005D90E0 @ 0x1005d90e8
//
// 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
//
__int64 __fastcall sub_1005D90FC(__int64 a1, __int64 a2)
{
__int64 v3; // x0
__int64 v4; // x0
__int64 v5; // x22
__int64 v6; // x21
__int64 v7; // x0
char *v8; // x19
__int64 v9; // x27
char *v10; // x20
__int64 v11; // x0
__int64 v12; // x28
int *v13; // x26
__int64 v14; // x25
__int64 v15; // x23
char *v16; // x20
char *v17; // x0
char *v18; // x24
__int64 v19; // x0
__int64 v20; // x0
const char *v21; // x1
const char *v22; // x2
__int64 v23; // x0
int v24; // w19
__int64 v25; // x0
__int64 v27; // [xsp+40h] [xbp-70h]
int v29; // [xsp+54h] [xbp-5Ch]
v3 = sub_10061344C();
v4 = sub_1006113B4(a2, v3);
v5 = v4;
v27 = v4;
if ( v4 )
{
if ( (int)sub_1005DEA4C(v4) < 1 )
return 1;
v6 = 0;
while ( 1 )
{
v7 = sub_1005DEA60(v5, v6);
v8 = *(char **)(v7 + 8);
v9 = *(_QWORD *)(v7 + 16);
v10 = strchr(v8, 46);
v11 = sub_1006113B4(a2, v9);
v12 = v11;
if ( !v11 )
{
sub_1005E0E48(38, 188, 149, "eng_cnf.c", 111);
return 0;
}
if ( (int)sub_1005DEA4C(v11) < 1 )
goto LABEL_52;
v29 = 0;
v13 = nullptr;
v14 = 0;
if ( v10 )
v8 = v10 + 1;
do
{
v15 = sub_1005DEA60(v12, v14);
v16 = *(char **)(v15 + 8);
v17 = strchr(v16, 46);
if ( v17 )
v16 = v17 + 1;
v18 = *(char **)(v15 + 16);
if ( !strcmp(v16, "engine_id") )
{
v8 = v18;
goto LABEL_33;
}
if ( !strcmp(v16, "soft_load") )
{
v29 = 1;
goto LABEL_33;
}
if ( !strcmp(v16, "dynamic_path") )
{
v23 = sub_1005D6BE0("dynamic");
v13 = (int *)v23;
if ( !v23 )
{
v13 = nullptr;
goto LABEL_45;
}
if ( !(unsigned int)sub_1005D76DC(v23, "SO_PATH", v18, 0)
|| !(unsigned int)sub_1005D76DC((__int64)v13, "LIST_ADD", "2", 0) )
{
goto LABEL_45;
}
v22 = nullptr;
v20 = (__int64)v13;
v21 = "LOAD";
goto LABEL_28;
}
if ( !v13 )
{
v19 = sub_1005D6BE0(v8);
v13 = (int *)v19;
if ( v29 && !v19 )
{
sub_1005E1158(0);
v5 = v27;
goto LABEL_52;
}
if ( !v19 )
{
v13 = nullptr;
goto LABEL_45;
}
}
if ( !strcmp(v18, "EMPTY") )
v18 = nullptr;
if ( !strcmp(v16, "init") )
{
if ( (unsigned int)sub_1006114B0(a2, v9, "init") )
sub_1005E0E48(38, 188, 151, "eng_cnf.c", 172);
LABEL_45:
sub_1005E0E48(38, 188, 102, "eng_cnf.c", 191);
if ( v15 )
sub_1005E19F0(6);
v24 = 0;
LABEL_48:
v5 = v27;
goto LABEL_49;
}
if ( strcmp(v16, "default_algorithms") )
{
v20 = (__int64)v13;
v21 = v16;
v22 = v18;
LABEL_28:
if ( !(unsigned int)sub_1005D76DC(v20, v21, v22, 0) )
goto LABEL_45;
goto LABEL_33;
}
if ( !sub_1005D818C((__int64)v13, v18) )
goto LABEL_45;
LABEL_33:
v14 = (unsigned int)(v14 + 1);
}
while ( (int)v14 < (int)sub_1005DEA4C(v12) );
v24 = 1;
if ( !v13 )
goto LABEL_48;
v5 = v27;
if ( (unsigned int)sub_1005D6FFC((__int64)v13) )
{
v25 = qword_100882D80;
if ( qword_100882D80 || (v25 = sub_1005DE4A4(0), (qword_100882D80 = v25) != 0) )
{
if ( (unsigned int)sub_1005DE80C(v25, v13) )
{
v24 = 1;
goto LABEL_49;
}
}
sub_1005D70C4((__int64)v13);
}
sub_1005E0E48(38, 188, 102, "eng_cnf.c", 191);
v24 = 0;
LABEL_49:
if ( v13 )
sub_1005D6580(v13);
if ( !v24 )
return 0;
LABEL_52:
v6 = (unsigned int)(v6 + 1);
if ( (int)v6 >= (int)sub_1005DEA4C(v5) )
return 1;
}
}
sub_1005E0E48(38, 187, 148, "eng_cnf.c", 216);
return 0;
}