//
// sub_6105EC from 0x6105ec to 0x6107f2 (518 bytes)
//
// 1 xrefs:
// > sub_62A270 @ 0x62a304
//
// 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_6105EC(_DWORD *a1)
{
const char **v2; // r4
const char *v3; // r0
const char *v5; // r0
char *v6; // r11
int v7; // r3
bool v8; // zf
char *v9; // r2
int v10; // t1
bool v11; // zf
size_t v12; // r12
const char *v13; // r0
char *v14; // r6
int v15; // r3
bool v16; // zf
char *v17; // r1
int v18; // t1
bool v19; // zf
size_t v20; // r7
const char *v21; // r0
int v22; // r3
int v23; // [sp+10h] [bp-224h]
size_t v24; // [sp+14h] [bp-220h]
int v25; // [sp+14h] [bp-220h]
int v26; // [sp+2Ch] [bp-208h] BYREF
char v27[256]; // [sp+30h] [bp-204h] BYREF
char v28[260]; // [sp+130h] [bp-104h] BYREF
v2 = (const char **)a1[331];
if ( !v2 )
{
LABEL_10:
a1[331] = 0;
return 0;
}
while ( 1 )
{
v3 = *v2;
if ( !*v2 )
goto LABEL_5;
if ( *v3 != 45 )
break;
if ( sscanf(v3 + 1, "%255[^:]:%d", v27, &v26) == 2 )
{
v13 = (const char *)sub_626FC4("%s:%d", v27, v26);
v14 = (char *)v13;
if ( !v13 )
return 27;
v15 = *(unsigned __int8 *)v13;
v16 = v15 == 58;
if ( v15 != 58 )
v16 = v15 == 0;
if ( !v16 )
{
v17 = (char *)v13;
do
{
*v17 = *(_WORD *)(tolower_tab_ + 2 * (v15 + 1));
v18 = (unsigned __int8)*++v17;
v15 = v18;
v19 = v18 == 58;
if ( v18 != 58 )
v19 = v15 == 0;
}
while ( !v19 );
}
v20 = strlen(v13);
if ( a1[18] )
sub_631E04(a1, 3, 2);
sub_62E4C0(a1[14], v14, v20 + 1);
if ( a1[18] )
sub_631E24(a1, 3);
off_ABAEB0(v14);
LABEL_5:
v2 = (const char **)v2[1];
if ( !v2 )
goto LABEL_10;
}
else
{
sub_61807C(a1, "Couldn't parse CURLOPT_RESOLVE removal entry '%s'!\n", *v2);
v2 = (const char **)v2[1];
if ( !v2 )
goto LABEL_10;
}
}
if ( sscanf(v3, "%255[^:]:%d:%255s", v27, &v26, v28) != 3 )
{
sub_61807C(a1, "Couldn't parse CURLOPT_RESOLVE entry '%s'!\n", *v2);
goto LABEL_5;
}
v23 = sub_635E88(v28);
if ( !v23 )
{
sub_61807C(a1, "Address in '%s' found illegal!\n", *v2);
goto LABEL_5;
}
v5 = (const char *)sub_626FC4("%s:%d", v27, v26);
v6 = (char *)v5;
if ( !v5 )
goto LABEL_45;
v7 = *(unsigned __int8 *)v5;
v8 = v7 == 58;
if ( v7 != 58 )
v8 = v7 == 0;
if ( !v8 )
{
v9 = (char *)v5;
do
{
*v9 = *(_WORD *)(tolower_tab_ + 2 * (v7 + 1));
v10 = (unsigned __int8)*++v9;
v7 = v10;
v11 = v10 == 58;
if ( v10 != 58 )
v11 = v7 == 0;
}
while ( !v11 );
}
v12 = strlen(v5);
if ( a1[18] )
{
v24 = v12;
sub_631E04(a1, 3, 2);
v12 = v24;
}
v25 = sub_62E514(a1[14], v6, v12 + 1);
off_ABAEB0(v6);
if ( v25 )
{
sub_635ADC(v23);
LABEL_25:
if ( a1[18] )
sub_631E24(a1, 3);
sub_61807C(a1, "Added %s:%d:%s to DNS cache\n", v27, v26, v28);
goto LABEL_5;
}
v21 = sub_610148((int)a1, v23, v27, v26);
if ( v21 )
{
v22 = *((_DWORD *)v21 + 2);
*((_DWORD *)v21 + 1) = 0;
*((_DWORD *)v21 + 2) = v22 - 1;
goto LABEL_25;
}
if ( a1[18] )
sub_631E24(a1, 3);
LABEL_45:
sub_635ADC(v23);
return 27;
}