//
// sub_105FC58 from 0x105fc58 to 0x105feec (660 bytes)
//
// 2 xrefs:
// > UI_add_input_boolean @ 0x106085c
// > UI_dup_input_boolean @ 0x1060958
//
// This function is hookable on this platform (idp: arm, 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 13:16:50 +0000
//
__int64 __fastcall sub_105FC58(__int64 a1, __int64 a2, __int64 a3, _BYTE *a4, char *a5, int a6, int a7, __int64 a8)
{
int v16; // w1
_BYTE *v17; // x19
int v18; // t1
_QWORD *v19; // x0
__int64 v20; // x19
int *v21; // x0
unsigned int v22; // w20
if ( !a4 )
{
v22 = -1;
ERR_put_error(40, 108, 67, (__int64)"crypto/ui/ui_lib.c", 154);
return v22;
}
if ( !a5 )
{
v22 = -1;
ERR_put_error(40, 108, 67, (__int64)"crypto/ui/ui_lib.c", 156);
return v22;
}
v16 = (unsigned __int8)*a4;
v17 = a4;
if ( *a4 )
{
do
{
if ( strchr(a5, v16) )
ERR_put_error(40, 108, 104, (__int64)"crypto/ui/ui_lib.c", 161);
v18 = (unsigned __int8)*++v17;
v16 = v18;
}
while ( v18 );
}
if ( !a2 )
{
ERR_put_error(40, 109, 67, (__int64)"crypto/ui/ui_lib.c", 99);
return (unsigned int)-1;
}
if ( !a8 )
{
v22 = -1;
ERR_put_error(40, 109, 105, (__int64)"crypto/ui/ui_lib.c", 102);
return v22;
}
v19 = CRYPTO_malloc(&dword_40, (__int64)"crypto/ui/ui_lib.c", 103);
v20 = (__int64)v19;
if ( !v19 )
return (unsigned int)-1;
v19[1] = a2;
v19[3] = a8;
*((_DWORD *)v19 + 14) = a6 != 0;
v21 = *(int **)(a1 + 8);
*(_DWORD *)(v20 + 16) = a7;
*(_DWORD *)v20 = 3;
if ( v21 || (v21 = (int *)OPENSSL_sk_new_null(), (*(_QWORD *)(a1 + 8) = v21) != 0) )
{
*(_QWORD *)(v20 + 48) = a5;
*(_QWORD *)(v20 + 32) = a3;
*(_QWORD *)(v20 + 40) = a4;
v22 = OPENSSL_sk_push(v21, v20);
if ( (int)v22 <= 0 )
{
--v22;
if ( (*(_DWORD *)(v20 + 56) & 1) != 0 )
{
CRYPTO_free(*(void **)(v20 + 8), (__int64)"crypto/ui/ui_lib.c", 56);
if ( *(_DWORD *)v20 == 3 )
{
CRYPTO_free(*(void **)(v20 + 32), (__int64)"crypto/ui/ui_lib.c", 59);
CRYPTO_free(*(void **)(v20 + 40), (__int64)"crypto/ui/ui_lib.c", 60);
CRYPTO_free(*(void **)(v20 + 48), (__int64)"crypto/ui/ui_lib.c", 61);
}
}
CRYPTO_free((void *)v20, (__int64)"crypto/ui/ui_lib.c", 67);
}
}
else
{
if ( (*(_DWORD *)(v20 + 56) & 1) != 0 )
{
CRYPTO_free(*(void **)(v20 + 8), (__int64)"crypto/ui/ui_lib.c", 56);
if ( *(_DWORD *)v20 == 3 )
{
CRYPTO_free(*(void **)(v20 + 32), (__int64)"crypto/ui/ui_lib.c", 59);
CRYPTO_free(*(void **)(v20 + 40), (__int64)"crypto/ui/ui_lib.c", 60);
CRYPTO_free(*(void **)(v20 + 48), (__int64)"crypto/ui/ui_lib.c", 61);
}
}
v22 = -1;
CRYPTO_free((void *)v20, (__int64)"crypto/ui/ui_lib.c", 67);
}
return v22;
}