//
// sub_1403551F0 from 0x1403551f0 to 0x1403553c1 (465 bytes)
//
// 9 xrefs:
// > GJBaseGameLayer::addToSection @ 0x14032f8bd
// > GJEffectManager::init @ 0x1403651c5
// > GJEffectManager::init @ 0x1403651df
// > LevelEditorLayer::init @ 0x1403edfbd
// > LevelEditorLayer::init @ 0x1403edfcc
// > LevelEditorLayer::init @ 0x1403ee09e
// > LevelEditorLayer::init @ 0x1403ee0ad
// > LevelEditorLayer::init @ 0x1403ee0c8
// > ??> @ 0x14092087c
//
// 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:30:49 +0000
//
void __fastcall sub_1403551F0(__int64 *a1, unsigned __int64 a2)
{
__int64 v4; // rdx
__int64 v5; // r8
unsigned __int64 v6; // r8
signed __int64 v7; // rbx
__int64 v8; // rax
__int64 v9; // r8
unsigned __int64 v10; // r8
unsigned __int64 v11; // rdx
char v12; // cl
unsigned __int64 v13; // r9
__int64 v14; // r8
unsigned __int64 v15; // r10
unsigned __int64 v16; // r8
unsigned __int64 v17; // [rsp+20h] [rbp-38h] BYREF
unsigned __int64 v18; // [rsp+28h] [rbp-30h]
unsigned __int64 v19; // [rsp+30h] [rbp-28h] BYREF
__int64 v20; // [rsp+38h] [rbp-20h]
char v21[24]; // [rsp+40h] [rbp-18h] BYREF
v4 = a1[3];
if ( v4 >= a2 )
{
if ( v4 > a2 )
{
v14 = *a1;
if ( v4 >= 0 )
v15 = v14 + 4 * ((unsigned __int64)v4 >> 5);
else
v15 = v14 - (4 * ((unsigned __int64)~v4 >> 5) + 4);
if ( (a2 & 0x8000000000000000uLL) == 0LL )
v16 = v14 + 4 * (a2 >> 5);
else
v16 = v14 - (4 * (~a2 >> 5) + 4);
v20 = a1[3] & 0x1F;
v17 = v16;
v18 = a2 & 0x1F;
v19 = v15;
((void (__fastcall *)(__int64 *, char *, unsigned __int64 *, unsigned __int64 *))sub_140359D20)(
a1,
v21,
&v17,
&v19);
}
}
else
{
v5 = *a1;
if ( v4 >= 0 )
v6 = v5 + 4 * ((unsigned __int64)v4 >> 5);
else
v6 = v5 - (4 * ((unsigned __int64)~v4 >> 5) + 4);
v17 = v6;
v7 = a2 - v4;
v18 = v4 & 0x1F;
v8 = sub_14011B320(a1, &v17, v7);
v9 = *a1;
if ( v8 >= 0 )
v10 = v9 + 4 * ((unsigned __int64)v8 >> 5);
else
v10 = v9 - (4 * ((unsigned __int64)~v8 >> 5) + 4);
v11 = v8 & 0x1F;
if ( v7 )
{
if ( v7 >= 0 || v11 >= -v7 )
{
v12 = v11 + v7;
v13 = v10 + 4 * ((v11 + v7) >> 5);
}
else
{
v12 = v11 + v7;
v13 = v10 - (4 * (~(v11 + v7) >> 5) + 4);
}
v19 = v10;
v18 = v12 & 0x1F;
v20 = v8 & 0x1F;
v17 = v13;
sub_14011B9F0((__int64)&v19, (__int64)&v17, 0);
}
}
}