//
// RAND_write_file from 0xa3ee64 to 0xa3ef50 (236 bytes)
//
// 1 xrefs:
// > ??> @ 0x7fb2c
//
// 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:12 +0000
//
int __fastcall RAND_write_file(const char *a1)
{
int v3; // r0
FILE *v4; // r4
int v5; // r6
signed int v6; // r7
_WORD v7[52]; // [sp+0h] [bp-46Ch] BYREF
_BYTE v8[1028]; // [sp+68h] [bp-404h] BYREF
if ( stat(a1, (struct stat *)v7) != -1 && (v7[8] & 0xB000) == 0x2000 )
return 1;
v3 = open(a1, 65, 384);
if ( v3 == -1 || (v4 = fdopen(v3, "wb")) == nullptr )
{
v4 = openssl_fopen(a1, "wb");
if ( !v4 )
return 0;
}
chmod(a1, 0x180u);
v5 = RAND_bytes((int)v8, 1024);
v6 = fwrite(v8, 1u, 0x400u, v4);
fclose(v4);
OPENSSL_cleanse(v8, 0x400u);
if ( v5 <= 0 )
return -1;
else
return v6 & ~(v6 >> 31);
}