//
// NumberInputLayer::deleteLast from 0x956f20 to 0x957124 (516 bytes)
//
// 2 xrefs:
// > NumberInputLayer::onNumber @ 0x957208
// > ??> @ 0x9c370
//
// This function is hookable on this platform (idp: arm, 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 12:57:25 +0000
//
__int64 __fastcall NumberInputLayer::deleteLast(NumberInputLayer *this)
{
__int64 *v1; // x22
int v3; // w19
size_t v4; // x19
unsigned __int64 v5; // x0
char *v6; // x24
char *v7; // x3
char *v8; // x23
char *v9; // x0
int v10; // w19
__int64 v11; // x2
size_t v12; // x2
size_t v13; // x1
unsigned __int64 v15; // x0
unsigned __int64 v16; // x0
unsigned __int64 v17; // x0
unsigned __int8 v18; // w2
__int64 v19; // [xsp+40h] [xbp+40h] BYREF
size_t v20; // [xsp+48h] [xbp+48h]
char *v21; // [xsp+50h] [xbp+50h]
v1 = (__int64 *)((char *)this + 720);
v3 = *((unsigned __int8 *)this + 720);
if ( (v3 & 1) != 0 )
{
v4 = *((_QWORD *)this + 91);
if ( v4 )
{
v19 = 0;
v5 = v4 - 1;
v20 = 0;
v21 = nullptr;
v6 = (char *)v1[2];
goto LABEL_6;
}
}
else
{
LODWORD(v4) = v3 >> 1;
if ( (_DWORD)v4 )
{
v4 = (int)v4;
v19 = 0;
v20 = 0;
v6 = (char *)this + 721;
v21 = nullptr;
v5 = (int)v4 - 1LL;
LABEL_6:
if ( v4 > v5 )
v4 = v5;
if ( v4 > 0xFFFFFFFFFFFFFFEFLL )
sub_62D2DC();
if ( v4 > 0x16 )
{
v15 = (v4 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v19 = v15 | 1;
v7 = (char *)operator new(v15);
v21 = v7;
v20 = v4;
}
else
{
LOBYTE(v19) = 2 * v4;
v7 = (char *)&v19 + 1;
if ( !v4 )
goto LABEL_11;
}
v7 = (char *)memcpy(v7, v6, v4);
LABEL_11:
v7[v4] = 0;
if ( (*((_BYTE *)this + 720) & 1) == 0 )
{
LABEL_17:
v1[2] = (__int64)v21;
v13 = v20;
*v1 = v19;
v1[1] = v13;
return NumberInputLayer::updateNumberState(this);
}
*(_BYTE *)v1[2] = 0;
v1[1] = 0;
if ( (*((_BYTE *)this + 720) & 1) != 0 )
{
v8 = (char *)v1[2];
v9 = (char *)this + 721;
v10 = 1;
LABEL_14:
v11 = v1[1];
goto LABEL_15;
}
v16 = *((_BYTE *)this + 720) >> 1;
if ( v16 <= 0x16 )
goto LABEL_17;
v17 = (v16 + 16) & 0xFFFFFFFFFFFFFFF0LL;
if ( v17 == 23 )
goto LABEL_17;
if ( v17 - 1 > 0x16 )
{
v9 = (char *)operator new(v17);
v18 = *((_BYTE *)this + 720);
v10 = v18 & 1;
if ( (v18 & 1) == 0 )
{
LABEL_31:
v8 = (char *)this + 721;
v11 = v18 >> 1;
LABEL_15:
v12 = v11 + 1;
if ( v12 )
{
memcpy(v9, v8, v12);
if ( !v10 )
goto LABEL_17;
}
else if ( !v10 )
{
goto LABEL_17;
}
operator delete(v8);
goto LABEL_17;
}
}
else
{
v9 = (char *)operator new(v17);
v18 = *((_BYTE *)this + 720);
v10 = v18 & 1;
if ( (v18 & 1) == 0 )
goto LABEL_31;
}
v8 = (char *)v1[2];
goto LABEL_14;
}
}
return _stack_chk_guard;
}