//
// GameStatsManager::registerRewardsFromItem from 0x1003d16a8 to 0x1003d1760 (184 bytes)
//
// 5 xrefs:
// > sub_1003D1608 @ 0x1003d1640
// > GameStatsManager::completedDailyLevel @ 0x1003d2758
// > GameStatsManager::unlockSpecialChest @ 0x1003d4e64
// > GameStatsManager::unlockSecretChest @ 0x1003dcb4c
// > sub_1003DCBB4 @ 0x1003dcc30
//
// 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
//
__int64 __fastcall GameStatsManager::registerRewardsFromItem(__int64 result, __int64 a2)
{
__int64 v2; // x19
char v3; // w24
__int64 v4; // x20
unsigned int v5; // w21
__int64 v6; // x0
unsigned int v7; // w8
__int64 v8; // x22
char *v9; // x23
__int64 v10; // x0
v2 = result;
v3 = *(_BYTE *)(result + 808);
*(_BYTE *)(result + 808) = 1;
v4 = *(_QWORD *)(a2 + 72);
if ( v4 )
{
result = sub_1002E757C(*(_QWORD *)(a2 + 72));
if ( (_DWORD)result )
{
v5 = 0;
do
{
v6 = sub_1002E75A0(v4, v5);
v7 = *(_DWORD *)(v6 + 56) - 1;
if ( v7 <= 0xE && ((0x7EFFu >> v7) & 1) != 0 )
{
v8 = v6;
v9 = off_100948D98[v7];
v10 = GameStatsManager::sharedState();
GameStatsManager::incrementStat(v10, v9, *(unsigned int *)(v8 + 68));
}
++v5;
result = sub_1002E757C(v4);
}
while ( v5 < (unsigned int)result );
}
}
*(_BYTE *)(v2 + 808) = v3;
return result;
}