//
// std::__shared_count< from 0x5ab994 to 0x5aba14 (128 bytes)
//
// 5 xrefs:
// > sub_5ABA18 @ 0x5aba76
// > sub_5ABA18 @ 0x5aba7c
// > sub_5ABA18 @ 0x5aba90
// > sub_5ABA18 @ 0x5aba96
// > sub_5ABAB0 @ 0x5abac2
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Alternative name is '_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EED1Ev'
unsigned int **__fastcall std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(unsigned int **a1)
{
unsigned int *v2; // r4
unsigned int *v3; // r3
unsigned int v4; // r2
unsigned int *v5; // r2
unsigned int v6; // r3
unsigned int v7; // r3
v2 = *a1;
if ( *a1 )
{
if ( &pthread_create )
{
v3 = v2 + 1;
__dmb(0xFu);
do
v4 = __ldrex(v3);
while ( __strex(v4 - 1, v3) );
__dmb(0xFu);
if ( v4 != 1 )
return a1;
(*(void (__fastcall **)(unsigned int *))(*v2 + 8))(v2);
v5 = v2 + 2;
__dmb(0xFu);
do
v7 = __ldrex(v5);
while ( __strex(v7 - 1, v5) );
__dmb(0xFu);
}
else
{
v6 = v2[1];
v2[1] = v6 - 1;
if ( v6 != 1 )
return a1;
(*(void (__fastcall **)(unsigned int *))(*v2 + 8))(v2);
v7 = v2[2];
v2[2] = v7 - 1;
}
if ( v7 == 1 )
(*(void (__fastcall **)(unsigned int *))(*v2 + 12))(v2);
}
return a1;
}