//
// RAND_write_file from 0x104dd14 to 0x104de24 (272 bytes)
//
// 1 xrefs:
// > ??> @ 0xb1b20
//
// 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:16:37 +0000
//
__int64 __fastcall RAND_write_file(const char *a1)
{
__int64 result; // x0
int v3; // w0
FILE *v4; // x20
int v5; // w21
int v6; // w22
_BYTE v7[16]; // [xsp+30h] [xbp+30h] BYREF
__int16 v8; // [xsp+40h] [xbp+40h]
_BYTE v9[1024]; // [xsp+B0h] [xbp+B0h] BYREF
if ( stat(a1, (struct stat *)v7) == -1 || (result = 1, (v8 & 0xB000) != 0x2000) )
{
if ( (v3 = open(a1, 65, 384), v3 != -1) && (v4 = fdopen(v3, "wb")) != nullptr
|| (v4 = openssl_fopen(a1, "wb"), result = 0, v4) )
{
chmod(a1, 0x180u);
v5 = RAND_bytes((__int64)v9, 1024);
v6 = fwrite(v9, 1u, 0x400u, v4);
fclose(v4);
OPENSSL_cleanse(v9, 0x400u);
result = 0xFFFFFFFFLL;
if ( v5 > 0 )
{
if ( v6 < 0 )
return 0;
else
return (unsigned int)v6;
}
}
}
return result;
}