//
// sub_100394E80 from 0x100394e80 to 0x100395024 (420 bytes)
//
// 3 xrefs:
// > sub_100394D68 @ 0x100394e68
// > sub_1003952C0 @ 0x10039539c
// > sub_1003953B0 @ 0x100395490
//
// 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 11:03:40 +0000
//
__int64 __fastcall sub_100394E80(__int64 result)
{
__int64 v1; // x19
__int64 v2; // x20
__int64 v3; // x20
void **v4; // x8
__int64 v5; // x20
__int64 v6; // x20
__int64 v7; // x21
__int64 v8; // x22
__int64 v9; // x23
__int64 v10; // x24
__int64 v11; // x25
__int64 v12; // x0
__int64 v13; // [xsp+18h] [xbp-98h] BYREF
__int64 v14; // [xsp+20h] [xbp-90h] BYREF
_QWORD v15[2]; // [xsp+28h] [xbp-88h] BYREF
char v16; // [xsp+3Fh] [xbp-71h]
_QWORD v17[2]; // [xsp+40h] [xbp-70h] BYREF
char v18; // [xsp+57h] [xbp-59h]
void *__p[2]; // [xsp+58h] [xbp-58h] BYREF
char v20; // [xsp+6Fh] [xbp-41h]
if ( (*(_BYTE *)(result + 621) & 1) != 0 )
return result;
v1 = result;
*(_BYTE *)(result + 621) = 1;
v2 = FMODAudioEngine::sharedEngine();
sub_100009900(__p, "gold02.ogg");
FMODAudioEngine::playEffect_1(v2, (__int64)__p);
if ( v20 < 0 )
operator delete(__p[0]);
if ( *(_BYTE *)(v1 + 680) != 1 )
{
if ( *(int *)(v1 + 664) < 1 )
goto LABEL_11;
v5 = FMODAudioEngine::sharedEngine();
sub_100009900(v15, "magicExplosion.ogg");
FMODAudioEngine::playEffect_1(v5, (__int64)v15);
if ( (v16 & 0x80000000) == 0 )
goto LABEL_11;
v4 = (void **)v15;
goto LABEL_10;
}
v3 = FMODAudioEngine::sharedEngine();
sub_100009900(v17, "secretKey.ogg");
FMODAudioEngine::playEffect_1(v3, (__int64)v17);
if ( v18 < 0 )
{
v4 = (void **)v17;
LABEL_10:
operator delete(*v4);
}
LABEL_11:
sub_1000262F4(&v14, (double *)(v1 + 648));
v6 = *(unsigned int *)(v1 + 664);
if ( (int)v6 <= 0 )
{
sub_10002630C(&v14, (double *)(v1 + 640));
v6 = *(unsigned int *)(v1 + 664);
}
v7 = *(unsigned __int8 *)(v1 + 680);
if ( *(_BYTE *)(v1 + 680) )
v8 = 9;
else
v8 = 0;
v9 = *(unsigned int *)(v1 + 668);
v10 = *(unsigned int *)(v1 + 672);
v11 = *(unsigned int *)(v1 + 676);
sub_1000262F4(&v13, (double *)&v14);
v12 = CurrencyRewardLayer::create(v6, v9, v10, v11, v8, v7, 0, 0, 0.0, 1.0, &v13, 0);
return (*(__int64 (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v1 + 464LL))(v1, v12, 100);
}