//
// sub_10095BA70 from 0x10095ba70 to 0x10095bd8d (797 bytes)
//
// 1 xrefs:
// > NewsPopup::refreshFromManager @ 0x100958fc8
//
// This function is hookable on this platform (idp: pc, 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 12:38:43 +0000
//
void **__fastcall sub_10095BA70(void **a1, void **a2, void **a3, unsigned __int64 a4)
{
char *v6; // r12
__int64 v7; // rax
__int64 v8; // rbx
void *v9; // rdi
unsigned __int64 v10; // rax
__int64 v11; // r12
void **result; // rax
void **v13; // rbx
__int64 v14; // r12
__int64 v15; // rbx
__int64 v16; // r13
char *v17; // r12
_QWORD *v18; // r15
_QWORD *v19; // r14
_QWORD *v20; // r15
char *v21; // r13
char *v22; // r14
_QWORD *v23; // rbx
__int64 v24; // rax
__int64 v25; // r12
__int64 v26; // r15
void *v27; // rbx
unsigned __int64 v28; // [rsp+10h] [rbp-30h]
v6 = (char *)*a1;
v7 = (__int64)a1[2];
if ( 0xCCCCCCCCCCCCCCCDLL * ((v7 - (__int64)*a1) >> 4) >= a4 )
{
v15 = (__int64)a1[1];
if ( 0xCCCCCCCCCCCCCCCDLL * ((v15 - (__int64)v6) >> 4) >= a4 )
{
if ( a2 == a3 )
{
v21 = (char *)*a1;
}
else
{
v20 = a2 + 8;
v21 = (char *)*a1;
do
{
v22 = v6;
v23 = v20 - 8;
*(_DWORD *)v6 = *((_DWORD *)v20 - 16);
std::string::operator=((std::string *)(v6 + 8), (const std::string *)(v20 - 7));
std::string::operator=((std::string *)(v6 + 32), (const std::string *)(v20 - 4));
if ( v6 != (char *)(v20 - 8) )
sub_10095BE00(v6 + 56, *(v20 - 1), *v20, 0xAAAAAAAAAAAAAAABLL * ((__int64)(*v20 - *(v20 - 1)) >> 5));
v21 += 80;
v20 += 10;
v6 += 80;
}
while ( v23 + 10 != a3 );
v15 = (__int64)a1[1];
v6 = v22 + 80;
}
while ( (char *)v15 != v6 )
{
v15 -= 80;
sub_10066B830(v15);
}
a1[1] = v21;
return a1;
}
else
{
v16 = (__int64)a2 + (_BYTE *)a1[1] - v6;
if ( (char *)v15 != v6 )
{
v17 = v6 + 56;
v18 = a2 + 8;
do
{
v19 = v18 - 8;
*((_DWORD *)v17 - 14) = *((_DWORD *)v18 - 16);
std::string::operator=((std::string *)v17 - 2, (const std::string *)(v18 - 7));
std::string::operator=((std::string *)v17 - 1, (const std::string *)(v18 - 4));
if ( v17 - 56 != (char *)(v18 - 8) )
sub_10095BE00(v17, *(v18 - 1), *v18, 0xAAAAAAAAAAAAAAABLL * ((__int64)(*v18 - *(v18 - 1)) >> 5));
v17 += 80;
v18 += 10;
}
while ( v19 + 10 != (_QWORD *)v16 );
v15 = (__int64)a1[1];
}
v24 = v15;
if ( (void **)v16 != a3 )
{
v25 = 0;
v26 = v15;
do
{
sub_10066D370(v26, v16);
v16 += 80;
v26 += 80;
v25 -= 80;
}
while ( (void **)v16 != a3 );
v24 = v15 - v25;
}
v27 = (void *)v24;
a1[1] = v27;
return a1;
}
}
else
{
if ( v6 )
{
v28 = a4;
v8 = (__int64)a1[1];
v9 = *a1;
if ( (char *)v8 != v6 )
{
do
{
v8 -= 80;
sub_10066B830(v8);
}
while ( (char *)v8 != v6 );
v9 = *a1;
}
a1[1] = v6;
operator delete(v9);
*(_OWORD *)a1 = 0;
a1[2] = nullptr;
v7 = 0;
a4 = v28;
}
if ( a4 > 0x333333333333333LL )
goto LABEL_40;
v10 = 0xCCCCCCCCCCCCCCCDLL * (v7 >> 4);
if ( 2 * v10 > a4 )
a4 = 2 * v10;
if ( v10 >= 0x199999999999999LL )
a4 = 0x333333333333333LL;
if ( a4 > 0x333333333333333LL )
LABEL_40:
sub_10066D6A0();
v11 = 10 * a4;
result = (void **)operator new(80 * a4);
v13 = result;
*a1 = result;
a1[1] = result;
a1[2] = &result[v11];
if ( a2 != a3 )
{
v14 = 0;
do
{
sub_10066D370((__int64)&v13[v14], (__int64)&a2[v14]);
result = &a2[v14 + 10];
v14 += 10;
}
while ( result != a3 );
v13 = (void **)((char *)v13 + v14 * 8);
}
a1[1] = v13;
}
return result;
}