//
// sub_1005D6BE0 from 0x1005d6be0 to 0x1005d6e90 (688 bytes)
//
// 4 xrefs:
// > sub_100582FE8 @ 0x10058301c
// > sub_1005D6BE0 @ 0x1005d6d8c
// > sub_1005D90FC @ 0x1005d9224
// > sub_1005D90FC @ 0x1005d92b0
//
// 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_1005D6BE0(const char *a1)
{
__int64 v2; // x20
__int64 v3; // x0
char *v4; // x0
const char *v5; // x21
__int64 v6; // x0
if ( !a1 )
{
sub_1005E0E48(38, 106, 67, "eng_list.c", 330);
return 0;
}
sub_100588190(9, 30, (__int64)"eng_list.c", 333);
v2 = qword_100882D18;
if ( qword_100882D18 )
{
while ( strcmp(a1, *(const char **)v2) )
{
v2 = *(_QWORD *)(v2 + 208);
if ( !v2 )
goto LABEL_12;
}
if ( (*(_BYTE *)(v2 + 168) & 4) == 0 )
{
++*(_DWORD *)(v2 + 172);
LABEL_11:
sub_100588190(10, 30, (__int64)"eng_list.c", 356);
return v2;
}
v3 = sub_1005D6414();
if ( v3 )
{
*(_QWORD *)v3 = *(_QWORD *)v2;
*(_QWORD *)(v3 + 8) = *(_QWORD *)(v2 + 8);
*(_QWORD *)(v3 + 16) = *(_QWORD *)(v2 + 16);
*(_QWORD *)(v3 + 24) = *(_QWORD *)(v2 + 24);
*(_QWORD *)(v3 + 32) = *(_QWORD *)(v2 + 32);
*(_QWORD *)(v3 + 40) = *(_QWORD *)(v2 + 40);
*(_QWORD *)(v3 + 48) = *(_QWORD *)(v2 + 48);
*(_QWORD *)(v3 + 56) = *(_QWORD *)(v2 + 56);
*(_QWORD *)(v3 + 64) = *(_QWORD *)(v2 + 64);
*(_QWORD *)(v3 + 72) = *(_QWORD *)(v2 + 72);
*(_QWORD *)(v3 + 80) = *(_QWORD *)(v2 + 80);
*(_QWORD *)(v3 + 88) = *(_QWORD *)(v2 + 88);
*(_QWORD *)(v3 + 104) = *(_QWORD *)(v2 + 104);
*(_QWORD *)(v3 + 112) = *(_QWORD *)(v2 + 112);
*(_QWORD *)(v3 + 120) = *(_QWORD *)(v2 + 120);
*(_QWORD *)(v3 + 128) = *(_QWORD *)(v2 + 128);
*(_QWORD *)(v3 + 136) = *(_QWORD *)(v2 + 136);
*(_QWORD *)(v3 + 144) = *(_QWORD *)(v2 + 144);
*(_QWORD *)(v3 + 160) = *(_QWORD *)(v2 + 160);
*(_DWORD *)(v3 + 168) = *(_DWORD *)(v2 + 168);
v2 = v3;
goto LABEL_11;
}
}
LABEL_12:
sub_100588190(10, 30, (__int64)"eng_list.c", 356);
if ( !strcmp(a1, "dynamic") )
{
v2 = 0;
LABEL_25:
sub_1005D6580((int *)v2);
sub_1005E0E48(38, 106, 116, "eng_list.c", 390);
sub_1005E19F0(2);
return 0;
}
v4 = getenv("OPENSSL_ENGINES");
if ( v4 )
v5 = v4;
else
v5 = "/Users/guanghui/Github/cocos2d-x-3rd-party-libs-src/contrib/install-ios/arm64/lib/engines";
v6 = sub_1005D6BE0("dynamic");
v2 = v6;
if ( !v6 )
{
v2 = 0;
goto LABEL_25;
}
if ( !(unsigned int)sub_1005D76DC(v6, "ID", a1, 0)
|| !(unsigned int)sub_1005D76DC(v2, "DIR_LOAD", "2", 0)
|| !(unsigned int)sub_1005D76DC(v2, "DIR_ADD", v5, 0)
|| !(unsigned int)sub_1005D76DC(v2, "LIST_ADD", "1", 0)
|| !(unsigned int)sub_1005D76DC(v2, "LOAD", 0, 0) )
{
goto LABEL_25;
}
return v2;
}