//
// sub_1400E4630 from 0x1400e4630 to 0x1400e472c (252 bytes)
//
// 5 xrefs:
// > sub_1400E4730 @ 0x1400e482b
// > sub_1400E4730 @ 0x1400e4847
// > ??> @ 0x1408930fc
// > ??> @ 0x14089310c
// > ??> @ 0x140914bf4
//
// 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:26:32 +0000
//
__int64 __fastcall sub_1400E4630(_QWORD *a1, unsigned __int64 a2, __int64 *a3)
{
unsigned int v3; // r10d
unsigned __int64 v6; // rdi
unsigned __int64 v7; // r9
__int64 v8; // rbx
unsigned __int64 v9; // rbp
__int64 v10; // r8
_QWORD *v11; // rcx
unsigned __int8 v12; // cl
v3 = 0;
v6 = 0;
v7 = 0;
if ( a2 )
{
v8 = 0;
v9 = a1[2];
while ( 1 )
{
if ( v7 >= v9 )
return v3;
v10 = *a3;
if ( v6 < (a3[1] - *a3) / 24 && v7 == *(_QWORD *)(v8 + v10) )
{
v7 += *(_QWORD *)(v8 + v10 + 8);
++v6;
v8 += 24;
}
else
{
v11 = a1;
if ( a1[3] > 0xFu )
v11 = (_QWORD *)*a1;
v12 = *((_BYTE *)v11 + v7);
if ( v12 < 0x80u )
{
LABEL_16:
++v7;
goto LABEL_17;
}
if ( (v12 & 0xE0) == 0xC0 )
{
v7 += 2LL;
}
else if ( (v12 & 0xF0) == 0xE0 )
{
v7 += 3LL;
}
else
{
if ( (v12 & 0xF8) != 0xF0 )
goto LABEL_16;
v7 += 4LL;
}
}
LABEL_17:
++v3;
if ( v7 >= a2 )
return v3;
}
}
return 0;
}