//
// NewsPopup::onBlockClicked from 0xb8c418 to 0xb8cad4 (1724 bytes)
//
// 4 xrefs:
// > ??> @ 0xdb238
// > NewsPopup::rebuildPage @ 0xb8b854
// > NewsPopup::rebuildPage @ 0xb8bb1c
// > ??> @ 0x1546908
//
// 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 13:02:35 +0000
//
__int64 __fastcall NewsPopup::onBlockClicked(NewsPopup *this, cocos2d::CCObject *a2)
{
__int64 v4; // x23
signed int v5; // w22
signed int v7; // w0
__int64 v8; // x22
__int64 v9; // x1
unsigned int *v10; // x20
MusicDownloadManager *v11; // x0
unsigned __int8 v12; // w2
NewsPopup *v13; // x23
__int64 v14; // x0
const void *v15; // x1
size_t v16; // x2
__int64 v17; // x1
int v18; // w23
int v19; // w0
size_t v20; // x2
char *v21; // x3
__int64 v22; // x4
char *v23; // x7
char *v24; // x4
char *v25; // x8
int v26; // w2
char *v27; // x1
char *v28; // x9
char *v29; // x2
const char *v30; // x3
int v31; // t1
size_t v32; // x25
char *v33; // x0
int v34; // w26
char *v35; // x25
char *v36; // x21
char *v37; // x20
__int64 v38; // x20
MusicDownloadManager *v39; // x24
__int64 v40; // x1
int isNewsImageDownloaded; // w24
MusicDownloadManager *v42; // x0
__int64 v43; // x0
__int64 v44; // x24
__int64 v45; // x1
int v46; // w0
_BYTE *v47; // x0
cocos2d::CCString *v48; // x0
size_t v49; // x0
const char *CString; // [xsp+58h] [xbp+58h]
__int64 v51; // [xsp+60h] [xbp+60h] BYREF
size_t v52; // [xsp+68h] [xbp+68h]
void *v53; // [xsp+70h] [xbp+70h]
__int64 v54[3]; // [xsp+78h] [xbp+78h] BYREF
__int64 v55[3]; // [xsp+90h] [xbp+90h] BYREF
__int64 v56[3]; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v57; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v58; // [xsp+C8h] [xbp+C8h]
void *v59; // [xsp+D0h] [xbp+D0h]
if ( !a2 )
return _stack_chk_guard;
cocos2d::CCObject::retain(a2);
cocos2d::CCObject::autorelease(a2);
v4 = *((_QWORD *)this + 85);
v5 = *((_DWORD *)this + 176);
if ( v5 >= (int)(-858993459 * ((*((_QWORD *)this + 86) - v4) >> 4)) )
return _stack_chk_guard;
v7 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
if ( v7 < 0 )
return _stack_chk_guard;
v8 = v4 + 80LL * v5;
v9 = *(_QWORD *)(v8 + 56);
if ( v7 >= (int)(-1431655765 * ((*(_QWORD *)(v8 + 64) - v9) >> 5)) )
return _stack_chk_guard;
v10 = (unsigned int *)(v9 + 96LL * v7);
v11 = (MusicDownloadManager *)*v10;
if ( (_DWORD)v11 != 1 )
goto LABEL_7;
v57 = 0;
v58 = 0;
v39 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v11);
v59 = nullptr;
if ( (v10[8] & 1) != 0 )
{
std::string::__init(&v57, *((void **)v10 + 6), *((_QWORD *)v10 + 5));
}
else
{
v40 = *((_QWORD *)v10 + 5);
v57 = *((_QWORD *)v10 + 4);
v58 = v40;
v59 = *((void **)v10 + 6);
}
isNewsImageDownloaded = (unsigned __int8)MusicDownloadManager::isNewsImageDownloaded(v39, (char *)&v57);
if ( (v57 & 1) != 0 )
operator delete(v59);
if ( isNewsImageDownloaded )
{
LABEL_7:
v12 = *((_BYTE *)v10 + 72);
v13 = (NewsPopup *)(v10 + 18);
v14 = v12 >> 1;
if ( (v12 & 1) != 0 )
v14 = *((_QWORD *)v10 + 10);
if ( !v14 )
return _stack_chk_guard;
if ( (NewsPopup *)((char *)this + 768) != v13 )
{
if ( (v10[18] & 1) != 0 )
{
v15 = *((const void **)v10 + 11);
v16 = *((_QWORD *)v10 + 10);
}
else
{
v15 = (char *)v10 + 73;
v16 = v12 >> 1;
}
std::string::assign((__int64 *)this + 96, v15, v16);
}
v51 = 0;
v52 = 0;
v53 = nullptr;
std::string::__init(&v51, "Watch this video on YouTube?", 0x24u);
if ( *((_BYTE *)v10 + 64) )
{
v36 = (char *)this + 664;
v37 = "Open YouTube";
LABEL_41:
v57 = 0;
v58 = 0;
v59 = nullptr;
if ( (v51 & 1) != 0 )
{
std::string::__init(&v57, v53, v52);
}
else
{
v57 = v51;
v58 = v52;
v59 = v53;
}
v38 = FLAlertLayer::create(
(__int64)v36,
(cocos2d::CCLabelBMFont *)v37,
(char *)&v57,
(ButtonSprite *)"Cancel",
(ButtonSprite *)"Open");
if ( (v57 & 1) != 0 )
operator delete(v59);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v38 + 1312LL))(v38);
if ( (v51 & 1) != 0 )
operator delete(v53);
return _stack_chk_guard;
}
v57 = 0;
v58 = 0;
v59 = nullptr;
if ( (v10[18] & 1) != 0 )
{
std::string::__init(&v57, *((void **)v10 + 11), *((_QWORD *)v10 + 10));
}
else
{
v17 = *((_QWORD *)v10 + 10);
v57 = *(_QWORD *)v13;
v58 = v17;
v59 = *((void **)v10 + 11);
}
v18 = (unsigned __int8)v57;
v19 = v57 & 1;
if ( v19 )
{
v20 = v58;
v21 = (char *)v59;
v22 = v58;
v23 = (char *)v59;
if ( (unsigned __int64)(v58 - 3) > 0x7FFFFFFFFFFFFFFCLL )
goto LABEL_32;
}
else
{
v22 = (unsigned __int8)v57 >> 1;
v23 = (char *)&v57 + 1;
if ( (unsigned __int64)(v22 - 3) > 0x7FFFFFFFFFFFFFFCLL )
goto LABEL_70;
}
v24 = &v23[v22];
if ( v24 - 2 != v23 )
{
v25 = v23 + 1;
while ( 1 )
{
v26 = (unsigned __int8)*(v25 - 1);
v27 = v25 - 1;
v28 = v25++;
if ( v26 == 58 )
break;
LABEL_91:
if ( v28 == v24 - 2 )
goto LABEL_30;
}
v29 = v27;
v30 = "://";
while ( 1 )
{
++v30;
if ( v29 == v25 )
break;
v31 = (unsigned __int8)*++v29;
if ( v31 != *(unsigned __int8 *)v30 )
goto LABEL_91;
}
if ( v24 != v27 && v27 - v23 != -1 )
{
std::string::basic_string(v54, (__int64)&v57, v27 - v23 + 3, 0xFFFFFFFFFFFFFFFFLL);
if ( (v57 & 1) != 0 )
{
*(_BYTE *)v59 = 0;
v58 = 0;
}
else
{
LOWORD(v57) = 0;
}
std::string::reserve(&v57, 0);
v58 = v54[1];
v18 = LOBYTE(v54[0]);
v57 = v54[0];
v19 = v54[0] & 1;
v59 = (void *)v54[2];
}
}
LABEL_30:
if ( v19 )
{
v21 = (char *)v59;
v20 = v58;
LABEL_32:
v32 = 4;
if ( v20 < 4 )
v32 = v20;
v33 = v21;
v34 = 1;
if ( !v32 )
{
LABEL_35:
v35 = v21;
if ( !v20 )
{
LABEL_36:
std::string::assign(&v51, "Open this link in your browser?", 0x1Fu);
LABEL_37:
if ( (v57 & 1) != 0 )
operator delete(v59);
v36 = (char *)this + 664;
if ( *((_BYTE *)v10 + 64) )
v37 = "Open YouTube";
else
v37 = "Open Link";
goto LABEL_41;
}
LABEL_74:
v47 = memchr(v35, 47, v20);
if ( v47 && v47 - v35 != -1 )
{
std::string::basic_string(v56, (__int64)&v57, 0, v47 - v35);
if ( (v57 & 1) != 0 )
{
*(_BYTE *)v59 = 0;
v58 = 0;
}
else
{
LOWORD(v57) = 0;
}
std::string::reserve(&v57, 0);
v57 = v56[0];
v18 = LOBYTE(v56[0]);
v58 = v56[1];
v34 = v56[0] & 1;
v59 = (void *)v56[2];
}
if ( v34 )
{
if ( !v58 )
goto LABEL_36;
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Open %s in your browser?",
(const char *)v59);
}
else
{
if ( !(v18 >> 1) )
goto LABEL_36;
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Open %s in your browser?",
(const char *)&v57 + 1);
}
CString = (const char *)cocos2d::CCString::getCString(v48);
v49 = strlen(CString);
std::string::assign(&v51, CString, v49);
goto LABEL_37;
}
goto LABEL_62;
}
LABEL_70:
v46 = v18 >> 1;
v32 = v18 >> 1;
if ( v18 >> 1 > 3 )
{
v32 = 4;
}
else if ( !v46 )
{
v34 = 0;
goto LABEL_73;
}
v34 = 0;
v33 = (char *)&v57 + 1;
LABEL_62:
if ( !memcmp(v33, "www.", v32) && v32 == 4 )
{
std::string::basic_string(v55, (__int64)&v57, 4u, 0xFFFFFFFFFFFFFFFFLL);
if ( (v57 & 1) != 0 )
{
*(_BYTE *)v59 = 0;
v58 = 0;
}
else
{
LOWORD(v57) = 0;
}
std::string::reserve(&v57, 0);
v57 = v55[0];
v18 = LOBYTE(v55[0]);
v58 = v55[1];
v34 = v55[0] & 1;
v59 = (void *)v55[2];
}
v46 = v18 >> 1;
if ( v34 )
{
v21 = (char *)v59;
v20 = v58;
goto LABEL_35;
}
LABEL_73:
v20 = v46;
v35 = (char *)&v57 + 1;
if ( !v46 )
goto LABEL_36;
goto LABEL_74;
}
v42 = (MusicDownloadManager *)std::__tree::__erase_unique(
(__int64 **)this + 99,
(__int64)(v10 + 8));
v43 = MusicDownloadManager::sharedState(v42);
v57 = 0;
v58 = 0;
v44 = v43;
v59 = nullptr;
if ( (v10[8] & 1) != 0 )
{
std::string::__init(&v57, *((void **)v10 + 6), *((_QWORD *)v10 + 5));
}
else
{
v45 = *((_QWORD *)v10 + 5);
v57 = *((_QWORD *)v10 + 4);
v58 = v45;
v59 = *((void **)v10 + 6);
}
MusicDownloadManager::downloadNewsImage(v44, (unsigned __int8 *)&v57);
if ( (v57 & 1) != 0 )
operator delete(v59);
NewsPopup::rebuildPage(this, *((_DWORD *)this + 176));
return _stack_chk_guard;
}