//
// sub_1003D1760 from 0x1003d1760 to 0x1003d18fc (412 bytes)
//
// 4 xrefs:
// > RewardsPage::rewardsStatusFinished @ 0x10025a6c0
// > GameStatsManager::unlockSpecialChest @ 0x1003d4e58
// > GameStatsManager::unlockSecretChest @ 0x1003dcb40
// > sub_1003DCBB4 @ 0x1003dcc24
//
// 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:04:11 +0000
//
float __fastcall sub_1003D1760(__int64 a1, __int64 a2)
{
__int64 v2; // x21
float result; // s0
int v6; // w25
__int64 v7; // x22
__int64 v8; // x23
unsigned int v9; // w0
char *v11; // x1
char *v12; // x1
int Stat; // w24
int v14; // w8
__int64 RewardObjectForType; // x0
void *__p[2]; // [xsp+10h] [xbp-80h] BYREF
char v17; // [xsp+27h] [xbp-69h]
void *v18[2]; // [xsp+28h] [xbp-68h] BYREF
char v19; // [xsp+3Fh] [xbp-51h]
v2 = *(_QWORD *)(a2 + 72);
if ( v2 && (unsigned int)sub_1002E757C(*(_QWORD *)(a2 + 72)) )
{
v6 = 0;
v7 = 0;
do
{
v8 = sub_1002E75A0(v2, v7);
v9 = *(_DWORD *)(v8 + 56);
if ( v9 > 0xE || ((1 << v9) & 0x7C3E) == 0 )
goto LABEL_22;
GJRewardItem::rewardItemToStat(v18);
v11 = v19 >= 0 ? (char *)v18 : (char *)v18[0];
if ( (int)GameStatsManager::getStat(a1, v11) > 99 )
{
Stat = 100;
}
else
{
GJRewardItem::rewardItemToStat(__p);
if ( v17 >= 0 )
v12 = (char *)__p;
else
v12 = (char *)__p[0];
Stat = GameStatsManager::getStat(a1, v12);
if ( v17 < 0 )
operator delete(__p[0]);
}
if ( v19 < 0 )
operator delete(v18[0]);
v14 = *(_DWORD *)(v8 + 68);
if ( v14 + Stat < 100 || (v6 += v14 + Stat - 100, *(_DWORD *)(v8 + 68) = 100 - Stat, 100 - Stat >= 1) )
LABEL_22:
v7 = (unsigned int)(v7 + 1);
else
sub_1002E7664(v2, v7, 1);
}
while ( (unsigned int)v7 < (unsigned int)sub_1002E757C(v2) );
if ( v6 >= 1 )
{
RewardObjectForType = GJRewardItem::getRewardObjectForType(a2, 7);
result = (float)*(int *)(RewardObjectForType + 68) + (float)((float)(unsigned int)v6 * 100.0);
*(_DWORD *)(RewardObjectForType + 68) = (int)result;
}
}
return result;
}