//
// sub_1800D5970 from 0x1800d5970 to 0x1800d5a0c (156 bytes)
//
// 3 xrefs:
// > sub_1800C6AE0 @ 0x1800c6c3f
// > cocos2d::CCKeyboardDispatcher::operator= @ 0x1800d1a7a
// > ??> @ 0x1801c47a0
//
// 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:22:32 +0000
//
unsigned __int64 __fastcall sub_1800D5970(__int64 a1, __int64 a2)
{
unsigned __int64 v2; // rbx
float v3; // xmm0_4
float v4; // xmm0_4
unsigned __int64 v5; // rax
unsigned __int64 v6; // rcx
unsigned __int64 result; // rax
v2 = *(_QWORD *)(a1 + 56);
if ( a2 < 0 )
v3 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v3 = (float)(int)a2;
v4 = ceilf(v3 / *(float *)a1);
v5 = 0;
if ( v4 >= 9.223372e18 )
{
v4 = v4 - 9.223372e18;
if ( v4 < 9.223372e18 )
v5 = 0x8000000000000000uLL;
}
v6 = v5 + (unsigned int)(int)v4;
result = 8;
if ( v6 > 8 )
result = v6;
if ( v2 >= result )
return v2;
if ( v2 < 0x200 && 8 * v2 >= result )
return 8 * v2;
return result;
}