//
// std::__ndk1::__assoc_sub_state::set_exception from 0xf873fc to 0xf87554 (344 bytes)
//
// 3 xrefs:
// > std::__ndk1::promise::~promise @ 0xf87cb4
// > std::__ndk1::promise::set_exception @ 0xf87f58
// > ??> @ 0x78820
//
// 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:53 +0000
//
__int64 __fastcall std::__assoc_sub_state::set_exception(__int64 a1, _QWORD *a2)
{
pthread_mutex_t *v3; // x19
__int64 v5; // x22
__int64 result; // x0
void *exception; // x0
unsigned __int8 v8; // w8
void *v9; // x20
_QWORD v10[2]; // [xsp+0h] [xbp-30h] BYREF
v3 = (pthread_mutex_t *)(a1 + 24);
v10[1] = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
std::mutex::lock((pthread_mutex_t *)(a1 + 24));
if ( (*(_BYTE *)(a1 + 112) & 1) != 0
|| (v10[0] = 0, v5 = *(_QWORD *)(a1 + 16), std::exception_ptr::~exception_ptr((std::exception_ptr *)v10), v5) )
{
exception = _cxa_allocate_exception(0x20u);
v8 = atomic_load((unsigned __int8 *)&byte_1565EA8);
v9 = exception;
if ( (v8 & 1) == 0 && _cxa_guard_acquire((__guard *)&byte_1565EA8) )
{
qword_1565EA0 = (__int64)&off_1535E88;
__cxa_atexit((void (*)(void *))std::error_category::~error_category, &qword_1565EA0, &unk_1548000);
_cxa_guard_release((__guard *)&byte_1565EA8);
}
std::future_error::future_error((__int64)v9, 2, (__int64)&qword_1565EA0);
_cxa_throw(
v9,
(struct type_info *)&`typeinfo for'std::future_error,
(void (*)(void *))std::future_error::~future_error);
}
std::exception_ptr::operator=((_QWORD *)(a1 + 16), a2);
*(_DWORD *)(a1 + 112) |= 4u;
std::condition_variable::notify_all((pthread_cond_t *)(a1 + 64));
result = std::mutex::unlock(v3);
_ReadStatusReg(TPIDR_EL0);
return result;
}