//
// sub_A4E518 from 0xa4e518 to 0xa4e7d8 (704 bytes)
//
// 2 xrefs:
// > UI_add_input_boolean @ 0xa4f140
// > UI_dup_input_boolean @ 0xa4f234
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:08:21 +0000
//
int __fastcall sub_A4E518(int a1, int a2, int a3, _BYTE *a4, char *a5, int a6, int a7, int a8)
{
int v10; // r1
_BYTE *v13; // r4
int v14; // t1
_DWORD *v15; // r0
int v16; // r4
int *v17; // r0
int v18; // r0
int v19; // r5
int v21; // r5
if ( !a4 )
{
ERR_put_error(40, 108, 67, (int)"crypto/ui/ui_lib.c", 154);
return -1;
}
if ( !a5 )
{
ERR_put_error(40, 108, 67, (int)"crypto/ui/ui_lib.c", 156);
return -1;
}
v10 = (unsigned __int8)*a4;
v13 = a4;
if ( *a4 )
{
do
{
if ( strchr(a5, v10) )
ERR_put_error(40, 108, 104, (int)"crypto/ui/ui_lib.c", 161);
v14 = (unsigned __int8)*++v13;
v10 = v14;
}
while ( v14 );
}
if ( !a2 )
{
ERR_put_error(40, 109, 67, (int)"crypto/ui/ui_lib.c", 99);
return -1;
}
if ( !a8 )
{
ERR_put_error(40, 109, 105, (int)"crypto/ui/ui_lib.c", 102);
return -1;
}
v15 = CRYPTO_malloc(&dword_20, (int)"crypto/ui/ui_lib.c", 103);
v16 = (int)v15;
if ( !v15 )
return -1;
v15[3] = a8;
v15[1] = a2;
v17 = *(int **)(a1 + 4);
*(_DWORD *)(v16 + 8) = a7;
*(_DWORD *)(v16 + 28) = a6 != 0;
*(_DWORD *)v16 = 3;
if ( !v17 )
{
v17 = OPENSSL_sk_new_null();
*(_DWORD *)(a1 + 4) = v17;
if ( !v17 )
{
if ( (*(_DWORD *)(v16 + 28) & 1) != 0 )
{
CRYPTO_free(*(void **)(v16 + 4), (int)"crypto/ui/ui_lib.c", 56);
if ( *(_DWORD *)v16 == 3 )
{
CRYPTO_free(*(void **)(v16 + 16), (int)"crypto/ui/ui_lib.c", 59);
CRYPTO_free(*(void **)(v16 + 20), (int)"crypto/ui/ui_lib.c", 60);
CRYPTO_free(*(void **)(v16 + 24), (int)"crypto/ui/ui_lib.c", 61);
}
}
CRYPTO_free((void *)v16, (int)"crypto/ui/ui_lib.c", 67);
return -1;
}
}
*(_DWORD *)(v16 + 24) = a5;
*(_DWORD *)(v16 + 16) = a3;
*(_DWORD *)(v16 + 20) = a4;
v18 = OPENSSL_sk_push(v17, v16);
v19 = v18;
if ( v18 > 0 )
return v19;
v21 = v18 - 1;
if ( (*(_DWORD *)(v16 + 28) & 1) != 0 )
{
CRYPTO_free(*(void **)(v16 + 4), (int)"crypto/ui/ui_lib.c", 56);
if ( *(_DWORD *)v16 == 3 )
{
CRYPTO_free(*(void **)(v16 + 16), (int)"crypto/ui/ui_lib.c", 59);
CRYPTO_free(*(void **)(v16 + 20), (int)"crypto/ui/ui_lib.c", 60);
CRYPTO_free(*(void **)(v16 + 24), (int)"crypto/ui/ui_lib.c", 61);
}
}
CRYPTO_free((void *)v16, (int)"crypto/ui/ui_lib.c", 67);
return v21;
}