//
// sub_83C76C from 0x83c76c to 0x83c988 (540 bytes)
//
// 2 xrefs:
// > sub_83C9A0 @ 0x83c9e4
// > sub_83C9A0 @ 0x83ca18
//
// 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_83C76C(int *a1, char *a2, int a3)
{
char *v3; // r8
char *i; // r5
int v7; // r3
char *v8; // r7
bool v9; // zf
size_t v10; // r5
signed int j; // r4
const char *v12; // r10
int *v13; // r0
int *v14; // r4
unsigned __int8 *v15; // r0
int v16; // r5
_DWORD *v18; // r0
v3 = a2;
for ( i = a2; ; i = v8 )
{
v8 = i + 1;
v7 = (unsigned __int8)*i;
v9 = v7 == 58;
if ( v7 != 58 )
v9 = v7 == 0;
if ( !v9 )
continue;
v10 = i - v3;
if ( !v10 )
{
v3 = v8;
if ( !v7 )
return 1;
continue;
}
for ( j = 0; j < OPENSSL_sk_num(*a1); ++j )
{
v12 = *(const char **)OPENSSL_sk_value((_DWORD *)*a1, j);
if ( v10 == strlen(v12) && !strncmp(v12, v3, v10) )
break;
}
if ( OPENSSL_sk_num(*a1) <= j )
break;
LABEL_22:
v3 = v8;
if ( !*(v8 - 1) )
return 1;
}
if ( !*a1 )
{
v18 = OPENSSL_sk_new_null();
*a1 = (int)v18;
if ( !v18 )
{
v16 = 0;
ERR_put_error(11, 100, 65, (int)"crypto/x509/by_dir.c", 185);
return v16;
}
}
v13 = (int *)CRYPTO_malloc(&byte_9[3], (int)"crypto/x509/by_dir.c", 189);
v14 = v13;
if ( v13 )
{
v13[1] = a3;
v13[2] = (int)OPENSSL_sk_new((int)sub_83C034);
v15 = CRYPTO_strndup((unsigned __int8 *)v3, v10, (int)"crypto/x509/by_dir.c", 194);
*v14 = (int)v15;
if ( !v15 || !v14[2] )
{
CRYPTO_free(v15, (int)"crypto/x509/by_dir.c", 137);
OPENSSL_sk_pop_free(v14[2], (void (__fastcall *)(int))sub_83C060);
CRYPTO_free(v14, (int)"crypto/x509/by_dir.c", 139);
return 0;
}
v16 = OPENSSL_sk_push((int *)*a1, (int)v14);
if ( !v16 )
{
CRYPTO_free((void *)*v14, (int)"crypto/x509/by_dir.c", 137);
OPENSSL_sk_pop_free(v14[2], (void (__fastcall *)(int))sub_83C060);
CRYPTO_free(v14, (int)"crypto/x509/by_dir.c", 139);
return v16;
}
goto LABEL_22;
}
return 0;
}