//
// SRP_Calc_client_key from 0xa4ba18 to 0xa4bbe4 (460 bytes)
//
// 2 xrefs:
// > srp_generate_client_master_secret @ 0x9ca838
// > ??> @ 0x7761c
//
// 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:20 +0000
//
int __fastcall SRP_Calc_client_key(int *a1, int a2, int *a3, int **a4, int a5, int **a6)
{
bool v6; // zf
bool v7; // zf
bool v8; // zf
int v13; // r8
_BYTE *v14; // r9
_BYTE *v15; // r10
int **v16; // r11
int v17; // r6
int *v18; // r5
int v19; // r0
int v21; // r0
v6 = a2 == 0;
if ( a2 )
v6 = a6 == nullptr;
if ( v6 )
return 0;
v7 = a3 == nullptr;
if ( a3 )
v7 = a1 == nullptr;
if ( v7 )
return 0;
v8 = a5 == 0;
if ( a5 )
v8 = a4 == nullptr;
if ( v8 )
return 0;
v13 = BN_CTX_new(a1);
if ( !v13 )
return 0;
v14 = (_BYTE *)BN_new();
if ( v14 && (v15 = (_BYTE *)BN_new()) != nullptr )
{
v16 = (int **)BN_new();
if ( v16 )
{
if ( BN_mod_exp(v14, a3, a4, a1, v13) )
{
v18 = sub_A4B2E0(a1, a3, a1);
if ( v18 )
{
if ( BN_mod_mul(v15, v14, v18, a1, v13) )
{
v19 = BN_mod_sub(v14, a2, v15, a1, v13);
if ( v19 && (v19 = BN_mul(v16, a6, a4, v13)) != 0 && (v19 = BN_add(v15, a5, v16)) != 0 )
{
v21 = BN_new();
v17 = v21;
if ( v21 )
{
if ( !BN_mod_exp(v21, v14, v15, a1, v13) )
{
BN_free(v17);
v17 = 0;
}
}
}
else
{
v17 = v19;
}
}
else
{
v17 = 0;
}
}
else
{
v17 = 0;
}
}
else
{
v17 = 0;
v18 = nullptr;
}
}
else
{
v17 = 0;
v18 = nullptr;
}
}
else
{
v17 = 0;
v18 = nullptr;
v16 = nullptr;
v15 = nullptr;
}
BN_CTX_free(v13);
BN_clear_free(v14);
BN_clear_free(v15);
BN_clear_free(v16);
BN_free((int)v18);
return v17;
}