//
// std::__ndk1::basic_filebuf>::open from 0x80bde4 to 0x80bec6 (226 bytes)
//
// 6 xrefs:
// > DS_Dictionary::saveRootSubDictToFile @ 0x80e46c
// > DS_Dictionary::saveRootSubDictToFile @ 0x80e4e0
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x80e828
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x80e894
// > DS_Dictionary::copyFile @ 0x80ea3c
// > DS_Dictionary::copyFile @ 0x80ea96
//
// 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:01:31 +0000
//
int __fastcall std::filebuf::open(int a1, char *filename, int a3)
{
unsigned int v5; // r3
bool v6; // zf
const char *v7; // r3
FILE *v8; // r0
if ( *(_DWORD *)(a1 + 64) )
return 0;
v5 = a3 & 0xFFFFFFFD;
if ( (a3 & 0xFFFFFFFD) == 0x14 )
goto LABEL_37;
if ( (a3 & 0xFFFFFFFD) > 0x14 )
{
if ( v5 == 29 )
goto LABEL_39;
if ( v5 <= 0x1D )
{
if ( v5 == 24 )
{
v7 = "r+";
goto LABEL_41;
}
if ( v5 <= 0x18 )
{
if ( v5 != 21 )
return 0;
goto LABEL_38;
}
if ( v5 == 25 )
{
LABEL_36:
v7 = "a+";
goto LABEL_41;
}
if ( v5 == 28 )
{
v7 = "r+b";
goto LABEL_41;
}
return 0;
}
if ( v5 != 52 )
{
if ( v5 <= 0x34 )
{
if ( v5 != 48 )
return 0;
goto LABEL_43;
}
if ( v5 == 56 )
{
v7 = "w+";
goto LABEL_41;
}
if ( v5 == 60 )
{
v7 = "w+b";
goto LABEL_41;
}
return 0;
}
LABEL_37:
v7 = "wb";
goto LABEL_41;
}
if ( v5 == 9 )
goto LABEL_36;
if ( v5 <= 9 )
{
if ( v5 != 5 )
{
if ( v5 == 8 )
{
v7 = (const char *)&a1i2r3e45s789g[3];
goto LABEL_41;
}
v6 = v5 == 1;
goto LABEL_15;
}
LABEL_38:
v7 = "ab";
goto LABEL_41;
}
if ( v5 == 13 )
{
LABEL_39:
v7 = "a+b";
goto LABEL_41;
}
if ( v5 <= 0xD )
{
if ( v5 == 12 )
{
v7 = "rb";
goto LABEL_41;
}
return 0;
}
if ( v5 == 16 )
{
LABEL_43:
v7 = "w";
goto LABEL_41;
}
v6 = v5 == 17;
LABEL_15:
if ( !v6 )
return 0;
v7 = "a";
LABEL_41:
v8 = fopen(filename, v7);
*(_DWORD *)(a1 + 64) = v8;
if ( !v8 )
return 0;
*(_DWORD *)(a1 + 88) = a3;
if ( (a3 & 2) == 0 || !fseek(v8, 0, 2) )
return a1;
fclose(*(FILE **)(a1 + 64));
*(_DWORD *)(a1 + 64) = 0;
return 0;
}