//
// std::__ndk1::__assoc_sub_state::set_value_at_thread_exit from 0xf872a8 to 0xf873fc (340 bytes)
//
// 2 xrefs:
// > std::__ndk1::promise::set_value_at_thread_exit @ 0xf88060
// > ??> @ 0x100b58
//
// 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_value_at_thread_exit(std::__assoc_sub_state *this)
{
pthread_mutex_t *v2; // x19
__int64 v3; // x21
pthread_key_t *v4; // x0
std::__thread_struct *v5; // x0
__int64 result; // x0
void *exception; // x0
unsigned __int8 v8; // w8
void *v9; // x20
_QWORD v10[2]; // [xsp+0h] [xbp-30h] BYREF
v2 = (pthread_mutex_t *)((char *)this + 24);
v10[1] = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
std::mutex::lock((pthread_mutex_t *)((char *)this + 24));
if ( (*((_BYTE *)this + 112) & 1) != 0
|| (v10[0] = 0, v3 = *((_QWORD *)this + 2), std::exception_ptr::~exception_ptr((std::exception_ptr *)v10), v3) )
{
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);
}
*((_DWORD *)this + 28) |= 1u;
v4 = (pthread_key_t *)std::__thread_local_data();
v5 = (std::__thread_struct *)pthread_getspecific(*v4);
std::__thread_struct::__make_ready_at_thread_exit(v5, this);
result = std::mutex::unlock(v2);
_ReadStatusReg(TPIDR_EL0);
return result;
}