//
// std::__ndk1::stoi from 0xf81a00 to 0xf81c80 (640 bytes)
//
// 1 xrefs:
// > ??> @ 0x8fa58
//
// 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 13:13:51 +0000
//
__int64 __fastcall std::stoi(__int64 a1, _QWORD *a2, int a3)
{
const wchar_t *v5; // x20
int *v6; // x21
__int64 result; // x0
_QWORD *exception; // x20
_QWORD *v9; // x20
_QWORD *v10; // x20
_QWORD v11[3]; // [xsp+8h] [xbp-98h] BYREF
int v12; // [xsp+24h] [xbp-7Ch]
wchar_t *endptr; // [xsp+28h] [xbp-78h] BYREF
unsigned __int64 v14[2]; // [xsp+30h] [xbp-70h] BYREF
unsigned __int64 v15[2]; // [xsp+48h] [xbp-58h] BYREF
unsigned __int64 v16[4]; // [xsp+60h] [xbp-40h] BYREF
v16[3] = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
v11[1] = 0;
v11[2] = 0;
v11[0] = 0x696F747308LL;
endptr = nullptr;
if ( (*(_BYTE *)a1 & 1) != 0 )
v5 = *(const wchar_t **)(a1 + 16);
else
v5 = (const wchar_t *)(a1 + 4);
v6 = (int *)__errno();
v12 = *v6;
*v6 = 0;
result = wcstol(v5, &endptr, a3);
LODWORD(v16[0]) = *v6;
*v6 = v12;
v12 = v16[0];
if ( LODWORD(v16[0]) == 34 )
{
std::operator+(": out of range", (__int64)v11, v14);
exception = _cxa_allocate_exception(0x10u);
std::logic_error::logic_error(exception, (__int64)v14);
*exception = off_1536D68;
_cxa_throw(
exception,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::logic_error::~logic_error);
}
if ( endptr == v5 )
{
std::operator+(": no conversion", (__int64)v11, v16);
v9 = _cxa_allocate_exception(0x10u);
std::logic_error::logic_error(v9, (__int64)v16);
*v9 = off_1536CE8;
_cxa_throw(
v9,
(struct type_info *)&`typeinfo for'std::invalid_argument,
(void (*)(void *))std::logic_error::~logic_error);
}
if ( a2 )
*a2 = endptr - v5;
if ( (unsigned __int64)(result + 0x80000000LL) >> 32 )
{
std::operator+(": out of range", (__int64)v11, v15);
v10 = _cxa_allocate_exception(0x10u);
std::logic_error::logic_error(v10, (__int64)v15);
*v10 = off_1536D68;
_cxa_throw(
v10,
(struct type_info *)&`typeinfo for'std::out_of_range,
(void (*)(void *))std::logic_error::~logic_error);
}
_ReadStatusReg(TPIDR_EL0);
return result;
}