//
// sub_FF43E8 from 0xff43e8 to 0xff4550 (360 bytes)
//
// 1 xrefs:
// > ??> @ 0x13ff920
//
// 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:15:47 +0000
//
__int64 __fastcall sub_FF43E8(__int64 a1, char *a2, signed int a3)
{
char *v3; // x22
unsigned int *v6; // x19
__int64 v7; // x23
int v8; // w2
void *v9; // x0
signed int v10; // w21
bool v11; // zf
unsigned int v12; // w1
int v13; // w0
unsigned int v14; // w21
__int64 result; // x0
int v16; // w0
v3 = a2;
if ( !a2 )
return 0;
v6 = *(unsigned int **)(a1 + 48);
if ( !v6 )
return 0;
v7 = *(_QWORD *)(a1 + 56);
if ( v7 )
{
LODWORD(v7) = 0;
BIO_clear_flags(a1, 15);
v8 = v6[4];
while ( 1 )
{
v9 = v3;
v10 = v8 > a3 ? a3 : v8;
if ( v8 )
{
v3 += v10;
LODWORD(v7) = v7 + v10;
memcpy(v9, (const void *)(*((_QWORD *)v6 + 1) + (int)v6[5]), v10);
v11 = a3 == v10;
v12 = v6[4];
a3 -= v10;
v6[5] += v10;
v6[4] = v12 - v10;
if ( v11 )
break;
}
if ( a3 > (int)*v6 )
{
while ( 1 )
{
v16 = BIO_read(*(_QWORD *)(a1 + 56), v3, (unsigned int)a3);
v14 = v16;
v3 += v16;
if ( v16 <= 0 )
break;
v11 = a3 == v16;
LODWORD(v7) = v7 + v16;
a3 -= v16;
if ( v11 )
return (unsigned int)v7;
}
LABEL_13:
BIO_copy_next_retry(a1);
result = (unsigned int)v7;
if ( v14 )
{
if ( (int)v7 <= 0 )
return v14;
else
return (unsigned int)v7;
}
return result;
}
v13 = BIO_read(*(_QWORD *)(a1 + 56), *((_QWORD *)v6 + 1), *v6);
v14 = v13;
v8 = v13;
if ( v13 <= 0 )
goto LABEL_13;
v6[5] = 0;
v6[4] = v13;
}
}
return (unsigned int)v7;
}