//
// ssl3_setup_write_buffer from 0x99f2b0 to 0x99f3b4 (260 bytes)
//
// 3 xrefs:
// > do_ssl3_write @ 0x99dca4
// > ssl3_setup_buffers @ 0x99f3dc
// > ??> @ 0x7439c
//
// 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:06:47 +0000
//
int __fastcall ssl3_setup_write_buffer(_DWORD *a1, int a2, int a3)
{
int v4; // r7
int v6; // r3
bool v7; // zf
int v8; // r3
int v9; // r7
int v10; // r4
int v11; // r0
int *v12; // r4
int v13; // r5
int v14; // r0
v4 = a3;
a1[143] = a2;
if ( !a3 )
{
v6 = *(_DWORD *)(*(_DWORD *)(a1[1] + 100) + 52) & 8;
v7 = v6 == 0;
if ( v6 )
v8 = 14;
else
v8 = 5;
v9 = v8 + a1[83];
if ( v7 )
v10 = 88;
else
v10 = 97;
v11 = ssl_allow_compression();
if ( v11 )
v4 = v9 + 1104;
else
v4 = v9 + 83;
if ( v11 )
v4 += 3;
if ( (a1[75] & 0x800) == 0 )
v4 += v10;
}
v12 = a1 + 151;
v13 = 0;
if ( !a2 )
return 1;
while ( 1 )
{
while ( *(v12 - 2) )
{
++v13;
v12 += 5;
if ( v13 == a2 )
return 1;
}
v14 = CRYPTO_malloc(v4, "ssl/record/ssl3_buffer.c", 109);
if ( !v14 )
break;
++v13;
*(v12 - 2) = v14;
*v12 = v4;
v12 += 5;
if ( v13 == a2 )
return 1;
}
a1[143] = v13;
ERR_put_error(20, 291, 65, "ssl/record/ssl3_buffer.c", 121);
return 0;
}