//
// LevelEditorLayer::lockedLayerForObjectString from 0x1403f4410 to 0x1403f4650 (576 bytes)
//
// 2 xrefs:
// > EditorUI::pasteObjects @ 0x1401c62dd
// > ??> @ 0x14092549c
//
// 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:49 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall LevelEditorLayer::lockedLayerForObjectString(__int64 a1, __int64 *a2)
{
int v4; // r15d
__int64 v5; // rdx
__int64 v6; // rcx
int v7; // esi
int v8; // ebp
__int64 v9; // r8
int v10; // edi
__int64 v11; // rbx
const char *v12; // rcx
int v13; // eax
const char *v14; // rcx
const char *v15; // rcx
int v16; // eax
int v17; // r8d
int v18; // ebx
__int64 v19; // r9
int v20; // eax
int v21; // eax
__int128 v22; // [rsp+20h] [rbp-48h] BYREF
__int64 v23; // [rsp+30h] [rbp-38h]
__int128 v24; // [rsp+38h] [rbp-30h] BYREF
__int64 v25; // [rsp+48h] [rbp-20h]
if ( !*(_DWORD *)(a1 + 15240) )
return 0xFFFFFFFFLL;
v24 = 0;
v25 = 0;
sub_1401C5360(a2, byte_140752308, (__int64 *)&v24);
v4 = 0;
v5 = v24;
if ( !((__int64)(*((_QWORD *)&v24 + 1) - v24) >> 5) )
{
LABEL_36:
v18 = -1;
goto LABEL_37;
}
v6 = 0;
while ( 1 )
{
v22 = 0;
v23 = 0;
sub_1401C5360((__int64 *)(v5 + 32 * v6), byte_14070ECF8, (__int64 *)&v22);
v7 = 0;
v8 = 0;
v9 = v22;
if ( (unsigned __int64)((__int64)(*((_QWORD *)&v22 + 1) - v22) >> 5) > 1 )
{
v10 = 1;
v11 = 0;
do
{
v12 = (const char *)(v11 + v9);
if ( *(_QWORD *)(v11 + v9 + 24) > 0xFu )
v12 = *(const char **)v12;
v13 = atoi(v12);
if ( v13 == 20 )
{
v14 = (const char *)(v11 + v22 + 32);
if ( *((_QWORD *)v14 + 3) > 0xFu )
v14 = *(const char **)v14;
v7 = atoi(v14);
}
else if ( v13 == 61 )
{
v15 = (const char *)(v11 + v22 + 32);
if ( *((_QWORD *)v15 + 3) > 0xFu )
v15 = *(const char **)v15;
v8 = atoi(v15);
}
v10 += 2;
v11 += 64;
v9 = v22;
}
while ( v10 < (unsigned __int64)((__int64)(*((_QWORD *)&v22 + 1) - v22) >> 5) );
}
v16 = *(__int16 *)(a1 + 14866);
if ( *(_WORD *)(a1 + 14866) != 0xFFFF && !*(_BYTE *)(a1 + 14808) && v7 != v16 && v8 != v16 )
v7 = *(__int16 *)(a1 + 14866);
if ( !*(_DWORD *)(a1 + 15240) )
goto LABEL_35;
v17 = 9999;
if ( v7 < 9999 )
v17 = v7;
if ( v17 < 0 )
v17 = 0;
v18 = 9999;
if ( v8 < 9999 )
v18 = v8;
if ( v18 < 0 )
v18 = 0;
v19 = *(_QWORD *)(a1 + 15208);
v20 = *(_DWORD *)(v19 + 4 * ((unsigned __int64)(unsigned int)v17 >> 5));
if ( _bittest(&v20, v17 & 0x1F) )
break;
if ( v18 )
{
v21 = *(_DWORD *)(v19 + 4 * ((unsigned __int64)(unsigned int)v18 >> 5));
if ( _bittest(&v21, v18 & 0x1F) )
goto LABEL_39;
}
LABEL_35:
sub_1400760C0((__int64 *)&v22);
v6 = ++v4;
v5 = v24;
if ( v4 >= (unsigned __int64)((__int64)(*((_QWORD *)&v24 + 1) - v24) >> 5) )
goto LABEL_36;
}
v18 = v17;
LABEL_39:
sub_1400760C0((__int64 *)&v22);
LABEL_37:
sub_1400760C0((__int64 *)&v24);
return (unsigned int)v18;
}