//
// sub_140416780 from 0x140416780 to 0x1404169be (574 bytes)
//
// 5 xrefs:
// > sub_1404141D0 @ 0x14041420f
// > ??> @ 0x1408c8200
// > ??> @ 0x1408c8210
// > ??> @ 0x1408c8234
// > ??> @ 0x140926138
//
// 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 11:32:05 +0000
//
char *__fastcall sub_140416780(_QWORD *a1, char *a2, char *a3)
{
char *v6; // rbx
_QWORD *v7; // r12
_QWORD *v8; // rcx
void **v9; // rsi
_QWORD *v10; // r13
void *v11; // r12
void *v12; // rdi
void **v14; // [rsp+20h] [rbp-58h]
__int64 v15; // [rsp+28h] [rbp-50h]
_QWORD *v16; // [rsp+30h] [rbp-48h]
_QWORD *v17; // [rsp+88h] [rbp+10h]
char **v18; // [rsp+90h] [rbp+18h]
char *v19; // [rsp+98h] [rbp+20h]
if ( a2 != a3 )
{
v6 = a2;
v7 = (_QWORD *)a1[1];
v17 = *((_QWORD **)a2 + 1);
v16 = v7;
v15 = a1[3];
v18 = (char **)(v15
+ 16
* (a1[6]
& (0x100000001B3LL
* ((0x100000001B3LL
* ((unsigned __int8)a2[18]
^ (0x100000001B3LL
* ((unsigned __int8)a2[17]
^ (0x100000001B3LL * ((unsigned __int8)a2[16] ^ 0xCBF29CE484222325uLL))))))
^ (unsigned __int8)a2[19]))));
v14 = (void **)v18[1];
v19 = *v18;
while ( 1 )
{
v8 = v6 + 48;
v9 = (void **)v6;
v6 = *(char **)v6;
sub_14003EA90(v8);
sub_140066870(v9 + 4);
j_j_free(v9);
--a1[2];
if ( v9 == v14 )
break;
if ( v6 == a3 )
{
if ( v19 == a2 )
*v18 = v6;
goto LABEL_15;
}
}
if ( v19 == a2 )
*v18 = (char *)v7;
else
v7 = v17;
for ( v18[1] = (char *)v7; v6 != a3; v10[1] = v16 )
{
v10 = (_QWORD *)(v15
+ 16
* (a1[6]
& (0x100000001B3LL
* ((unsigned __int8)v6[19]
^ (0x100000001B3LL
* ((unsigned __int8)v6[18]
^ (0x100000001B3LL
* ((unsigned __int8)v6[17]
^ (0x100000001B3LL * ((unsigned __int8)v6[16] ^ 0xCBF29CE484222325uLL))))))))));
v11 = (void *)v10[1];
while ( 1 )
{
v12 = v6;
v6 = *(char **)v6;
sub_14003EA90((_QWORD *)v12 + 6);
sub_140066870((void **)v12 + 4);
j_j_free(v12);
--a1[2];
if ( v12 == v11 )
break;
if ( v6 == a3 )
{
*v10 = v6;
goto LABEL_15;
}
}
*v10 = v16;
}
LABEL_15:
*v17 = v6;
*((_QWORD *)v6 + 1) = v17;
}
return a3;
}