//
// NumberInputLayer::deleteLast from 0x568ec0 to 0x569036 (374 bytes)
//
// 1 xrefs:
// > NumberInputLayer::onNumber @ 0x569054
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:30 +0000
//
int __fastcall NumberInputLayer::deleteLast(NumberInputLayer *this)
{
int result; // r0
int v3; // r5
size_t v4; // r5
unsigned int v5; // r0
char *v6; // r9
char *v7; // r8
unsigned int v8; // r0
bool v9; // zf
int v10; // r5
int v11; // r5
unsigned int v12; // r3
unsigned int v13; // r0
char *v14; // r0
char *v15; // r7
int v16; // r5
int v17; // r2
int v18; // r2
size_t v19; // r1
char *v20; // r2
int v21; // [sp+0h] [bp-14h] BYREF
size_t v22; // [sp+4h] [bp-10h]
char *v23; // [sp+8h] [bp-Ch]
result = *((unsigned __int8 *)this + 552);
if ( (result & 1) == 0 )
{
v3 = result >> 1;
if ( !(result >> 1) )
return result;
LABEL_5:
v4 = v3 - 1;
v21 = 0;
v22 = 0;
v23 = nullptr;
if ( (result & 1) != 0 )
{
v5 = *((_DWORD *)this + 139);
v6 = *((char **)this + 140);
}
else
{
v5 = result >> 1;
v6 = (char *)this + 553;
}
if ( v4 >= v5 )
v4 = v5;
if ( v4 > 0xFFFFFFEF )
sub_388710();
if ( v4 > 0xA )
{
v8 = (v4 + 16) & 0xFFFFFFF0;
v21 = v8 | 1;
v22 = v4;
v7 = (char *)operator new(v8);
v23 = v7;
}
else
{
v7 = (char *)&v21 + 1;
LOBYTE(v21) = 2 * v4;
}
std::char_traits::copy(v7, v6, v4);
v7[v4] = 0;
v9 = (*((_BYTE *)this + 552) & 1) == 0;
if ( (*((_BYTE *)this + 552) & 1) != 0 )
{
**((_BYTE **)this + 140) = 0;
}
else
{
*((_BYTE *)this + 552) = 0;
*((_BYTE *)this + 553) = 0;
}
v10 = *((unsigned __int8 *)this + 552);
if ( !v9 )
*((_DWORD *)this + 139) = 0;
if ( (v10 & 1) != 0 )
{
v11 = *((_DWORD *)this + 139);
v12 = (*((_DWORD *)this + 138) & 0xFFFFFFFE) - 1;
if ( (unsigned int)v11 <= 0xA )
{
if ( (*((_DWORD *)this + 138) & 0xFFFFFFFE) != 0xB )
goto LABEL_27;
goto LABEL_36;
}
}
else
{
v11 = v10 >> 1;
if ( v11 <= 10 )
goto LABEL_36;
v12 = 10;
}
v13 = (v11 + 16) & 0xFFFFFFF0;
if ( v13 - 1 != v12 )
{
if ( v13 != 11 )
{
v14 = (char *)operator new(v13);
v16 = *((_BYTE *)this + 552) & 1;
if ( (*((_BYTE *)this + 552) & 1) != 0 )
v15 = *((char **)this + 140);
else
v15 = (char *)this + 553;
LABEL_31:
v17 = *((unsigned __int8 *)this + 552);
if ( (v17 & 1) != 0 )
v18 = *((_DWORD *)this + 139);
else
v18 = v17 >> 1;
std::char_traits::copy(v14, v15, v18 + 1);
if ( v16 )
operator delete(v15);
goto LABEL_36;
}
LABEL_27:
v14 = (char *)this + 553;
v15 = *((char **)this + 140);
v16 = 1;
goto LABEL_31;
}
LABEL_36:
v19 = v22;
v20 = v23;
*((_DWORD *)this + 138) = v21;
*((_DWORD *)this + 139) = v19;
*((_DWORD *)this + 140) = v20;
v21 = 0;
v22 = 0;
v23 = nullptr;
std::string::~string((int)&v21);
return NumberInputLayer::updateNumberState(this);
}
v3 = *((_DWORD *)this + 139);
if ( v3 )
goto LABEL_5;
return result;
}