//
// sub_140401640 from 0x140401640 to 0x1404016da (154 bytes)
//
// 3 xrefs:
// > sub_140401DD0 @ 0x1404021d8
// > sub_140401DD0 @ 0x1404025a7
// > sub_140401DD0 @ 0x1404025ca
//
// 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:31:54 +0000
//
__int64 __fastcall sub_140401640(unsigned int a1, _QWORD *a2)
{
__int64 v3; // r8
__int64 *v4; // rcx
__int64 v5; // rax
__int64 v6; // rcx
v3 = a2[1];
v4 = (__int64 *)(a2[3]
+ 16
* (a2[6]
& (0x100000001B3LL
* ((0x100000001B3LL
* (BYTE2(a1)
^ (0x100000001B3LL
* (BYTE1(a1) ^ (0x100000001B3LL * ((unsigned __int8)a1 ^ 0xCBF29CE484222325uLL))))))
^ HIBYTE(a1)))));
v5 = v4[1];
if ( v5 != v3 )
{
v6 = *v4;
if ( a1 == *(_DWORD *)(v5 + 16) )
goto LABEL_7;
while ( v5 != v6 )
{
v5 = *(_QWORD *)(v5 + 8);
if ( a1 == *(_DWORD *)(v5 + 16) )
goto LABEL_7;
}
}
v5 = 0;
LABEL_7:
if ( !v5 )
v5 = a2[1];
if ( v5 == v3 )
return a1;
else
return *(unsigned int *)(v5 + 20);
}