//
// UI_dup_input_string from 0x839e70 to 0x83a0a0 (560 bytes)
//
// 1 xrefs:
// > ??> @ 0x6689c
//
// 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 UI_dup_input_string(int a1, const char *a2, int a3, int a4, int a5, int a6)
{
void *v9; // r5
_DWORD *v10; // r0
int v11; // r4
int *v12; // r0
int result; // r0
int v14; // r5
if ( !a2 )
{
ERR_put_error(40, 109, 67, (int)"crypto/ui/ui_lib.c", 99);
return -1;
}
v9 = CRYPTO_strdup(a2, (int)"crypto/ui/ui_lib.c", 207);
if ( !v9 )
{
ERR_put_error(40, 103, 65, (int)"crypto/ui/ui_lib.c", 209);
return 0;
}
if ( !a4 )
{
ERR_put_error(40, 109, 105, (int)"crypto/ui/ui_lib.c", 102);
return -1;
}
v10 = CRYPTO_malloc(&dword_20, (int)"crypto/ui/ui_lib.c", 103);
v11 = (int)v10;
if ( !v10 )
return -1;
v10[1] = v9;
v10[3] = a4;
v12 = *(int **)(a1 + 4);
*(_DWORD *)(v11 + 8) = a3;
*(_DWORD *)(v11 + 28) = 1;
*(_DWORD *)v11 = 1;
if ( v12 || (v12 = OPENSSL_sk_new_null(), (*(_DWORD *)(a1 + 4) = v12) != 0) )
{
*(_DWORD *)(v11 + 16) = a5;
*(_DWORD *)(v11 + 20) = a6;
*(_DWORD *)(v11 + 24) = 0;
result = OPENSSL_sk_push(v12, v11);
if ( result <= 0 )
{
v14 = result - 1;
if ( (*(_DWORD *)(v11 + 28) & 1) != 0 )
{
CRYPTO_free(*(void **)(v11 + 4), (int)"crypto/ui/ui_lib.c", 56);
if ( *(_DWORD *)v11 == 3 )
{
CRYPTO_free(*(void **)(v11 + 16), (int)"crypto/ui/ui_lib.c", 59);
CRYPTO_free(*(void **)(v11 + 20), (int)"crypto/ui/ui_lib.c", 60);
CRYPTO_free(*(void **)(v11 + 24), (int)"crypto/ui/ui_lib.c", 61);
}
}
CRYPTO_free((void *)v11, (int)"crypto/ui/ui_lib.c", 67);
return v14;
}
}
else
{
if ( (*(_DWORD *)(v11 + 28) & 1) != 0 )
{
CRYPTO_free(*(void **)(v11 + 4), (int)"crypto/ui/ui_lib.c", 56);
if ( *(_DWORD *)v11 == 3 )
{
CRYPTO_free(*(void **)(v11 + 16), (int)"crypto/ui/ui_lib.c", 59);
CRYPTO_free(*(void **)(v11 + 20), (int)"crypto/ui/ui_lib.c", 60);
CRYPTO_free(*(void **)(v11 + 24), (int)"crypto/ui/ui_lib.c", 61);
}
}
CRYPTO_free((void *)v11, (int)"crypto/ui/ui_lib.c", 67);
return -1;
}
return result;
}