//
// GameStatsManager::getNextVideoAdReward from 0x40e1a8 to 0x40e3a2 (506 bytes)
//
// 5 xrefs:
// > GameManager::rewardedVideoHidden @ 0x320312
// > GameManager::canShowRewardedVideo @ 0x322110
// > GJGarageLayer::onRewardedVideo @ 0x4025da
// > RetryLevelLayer::onRewardedVideo @ 0x43611e
// > FollowRewardPage::onRewardedVideo @ 0x4ffa3e
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
GameStatsManager *__fastcall GameStatsManager::getNextVideoAdReward(GameStatsManager *this, int a2)
{
stl::StringData::Internal *v4; // r2
stl::StringData::Internal *v5; // r3
int isSpecialChestUnlocked; // r9
GameStatsManager *v7; // r0
char *v8; // r1
stl::StringData::Internal *v9; // r2
stl::StringData::Internal *v10; // r3
int v11; // r9
stl::StringData::Internal *v12; // r2
stl::StringData::Internal *v13; // r3
int v14; // r9
stl::StringData::Internal *v15; // r2
stl::StringData::Internal *v16; // r3
int v17; // r9
stl::StringData::Internal *v18; // r2
stl::StringData::Internal *v19; // r3
int v20; // r9
stl::StringData::Internal *v21; // r2
stl::StringData::Internal *v22; // r3
int v23; // r9
stl::StringData::Internal *v24; // r2
stl::StringData::Internal *v25; // r3
int v26; // r9
stl::StringData::Internal *v27; // r2
stl::StringData::Internal *v28; // r3
int v29; // r9
stl::StringData::Internal *v30; // r2
stl::StringData::Internal *v31; // r3
int v32; // r9
stl::StringData::Internal *v33; // r2
stl::StringData::Internal *v34; // r3
int v35; // r6
char *v37; // [sp+8h] [bp+4h] BYREF
sub_776584((int)&v37, "0012");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v4, v5);
sub_774008(&v37);
if ( isSpecialChestUnlocked )
{
sub_776584((int)&v37, "0013");
v11 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v9, v10);
sub_774008(&v37);
if ( v11 )
{
sub_776584((int)&v37, "0014");
v14 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v12, v13);
sub_774008(&v37);
if ( v14 )
{
sub_776584((int)&v37, "0015");
v17 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v15, v16);
sub_774008(&v37);
if ( v17 )
{
sub_776584((int)&v37, "0016");
v20 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v18, v19);
sub_774008(&v37);
if ( v20 )
{
sub_776584((int)&v37, "0017");
v23 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v21, v22);
sub_774008(&v37);
if ( v23 )
{
sub_776584((int)&v37, "0018");
v26 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v24, v25);
sub_774008(&v37);
if ( v26 )
{
sub_776584((int)&v37, "0019");
v29 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v27, v28);
sub_774008(&v37);
if ( v29 )
{
sub_776584((int)&v37, "0020");
v32 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v30, v31);
sub_774008(&v37);
if ( v32 )
{
sub_776584((int)&v37, "0021");
v35 = GameStatsManager::isSpecialChestUnlocked(a2, &v37, v33, v34);
sub_774008(&v37);
v7 = this;
if ( v35 )
v8 = (char *)&unk_939830;
else
v8 = "0021";
}
else
{
v7 = this;
v8 = "0020";
}
}
else
{
v7 = this;
v8 = "0019";
}
}
else
{
v7 = this;
v8 = "0018";
}
}
else
{
v7 = this;
v8 = "0017";
}
}
else
{
v7 = this;
v8 = "0016";
}
}
else
{
v7 = this;
v8 = "0015";
}
}
else
{
v7 = this;
v8 = "0014";
}
}
else
{
v7 = this;
v8 = "0013";
}
}
else
{
v7 = this;
v8 = "0012";
}
sub_776584((int)v7, v8);
return this;
}