From Cream Pheasant, 10 Months ago, written in C.
Embed
  1. signed __int64 sub_181AFD18()
  2. {
  3.   tesla *v0; // x0
  4.   __int64 v1; // x19
  5.   __int128 v2; // q0
  6.   __int128 v3; // q1
  7.   tesla::detail::InitializedShmSession *v4; // x20
  8.   __int64 v5; // x19
  9.   __int128 v6; // q0
  10.   __int128 v7; // q1
  11.   tesla::detail::InitializedShmSession *v8; // x20
  12.   tesla *v10; // x0
  13.   __int64 v11; // x0
  14.   __int64 v12; // x0
  15.   __int64 v13; // [xsp+0h] [xbp-350h]
  16.   __int64 (__fastcall *v14)(); // [xsp+160h] [xbp-1F0h]
  17.   void (*v15)(void); // [xsp+170h] [xbp-1E0h]
  18.   __int64 (__fastcall *v16)(); // [xsp+178h] [xbp-1D8h]
  19.   char v17; // [xsp+180h] [xbp-1D0h]
  20.   __int128 v18; // [xsp+2E0h] [xbp-70h]
  21.   __int128 v19; // [xsp+2F8h] [xbp-58h]
  22.   __int64 v20; // [xsp+308h] [xbp-48h]
  23.  
  24.   if ( tesla::BaseDvGroup<tesla::vision_signals::VisionSignalsInfo,(tesla::DvAccess)1,(tesla::DvSync)2,17ul>::sync_shm_session_ptr_ )
  25.   {
  26.     v0 = (tesla *)pthread_mutex_trylock(
  27.                     *(_QWORD *)tesla::BaseDvGroup<tesla::vision_signals::VisionSignalsInfo,(tesla::DvAccess)1,(tesla::DvSync)2,17ul>::sync_shm_session_ptr_
  28.                   + 64LL);
  29.     if ( (_DWORD)v0 )
  30.       goto LABEL_18;
  31.     v0 = (tesla *)pthread_mutex_unlock(
  32.                     *(_QWORD *)tesla::BaseDvGroup<tesla::vision_signals::VisionSignalsInfo,(tesla::DvAccess)1,(tesla::DvSync)2,17ul>::sync_shm_session_ptr_
  33.                   + 64LL);
  34.   }
  35.   else
  36.   {
  37.     sub_181AFF74("TeslaDv_VisionSignals_3cdef8b1da7f2bf5_sync", 43LL);
  38.     v14 = sub_181B0178;
  39.     v15 = (void (*)(void))std::_Function_base::_Base_manager<void (*)(void *)>::_M_manager;
  40.     v16 = std::_Function_handler<void ()(void *),void (*)(void *)>::_M_invoke;
  41.     v1 = operator new(0x18uLL);
  42.     memcpy(&v17, &v13, 348LL);
  43.     *(_QWORD *)&v2 = std::_Function_base::_Base_manager<void (*)(void *)>::_M_manager;
  44.     *(_QWORD *)&v3 = (unsigned __int128)vdupq_n_s64(0x110uLL);
  45.     *((_QWORD *)&v2 + 1) = std::_Function_handler<void ()(void *),void (*)(void *)>::_M_invoke;
  46.     *((_QWORD *)&v3 + 1) = sub_181B0178;
  47.     v18 = v3;
  48.     v19 = v2;
  49.     tesla::detail::InitializedShmSession::InitializedShmSession(v1, &v17);
  50.     if ( (_QWORD)v19 )
  51.       ((void (*)(void))v19)();
  52.     v4 = (tesla::detail::InitializedShmSession *)tesla::BaseDvGroup<tesla::vision_signals::VisionSignalsInfo,(tesla::DvAccess)1,(tesla::DvSync)2,17ul>::sync_shm_session_ptr_;
  53.     tesla::BaseDvGroup<tesla::vision_signals::VisionSignalsInfo,(tesla::DvAccess)1,(tesla::DvSync)2,17ul>::sync_shm_session_ptr_ = v1;
  54.     if ( v4 )
  55.     {
  56.       tesla::detail::InitializedShmSession::~InitializedShmSession(v4);
  57.       operator delete((void *)v4);
  58.     }
  59.     if ( v15 )
  60.       v15();
  61.     sub_181AFF74("TeslaDv_VisionSignals_3cdef8b1da7f2bf5_data", 43LL);
  62.     v15 = (void (*)(void))std::_Function_base::_Base_manager<void (*)(void *)>::_M_manager;
  63.     v16 = std::_Function_handler<void ()(void *),void (*)(void *)>::_M_invoke;
  64.     v14 = sub_181B02AC;
  65.     v5 = operator new(0x18uLL);
  66.     memcpy(&v17, &v13, 348LL);
  67.     *(_QWORD *)&v6 = std::_Function_base::_Base_manager<void (*)(void *)>::_M_manager;
  68.     *(_QWORD *)&v7 = (unsigned __int128)vdupq_n_s64(0x2537630uLL);
  69.     *((_QWORD *)&v6 + 1) = std::_Function_handler<void ()(void *),void (*)(void *)>::_M_invoke;
  70.     *((_QWORD *)&v7 + 1) = sub_181B02AC;
  71.     v18 = v7;
  72.     v19 = v6;
  73.     v0 = (tesla *)tesla::detail::InitializedShmSession::InitializedShmSession(v5, &v17);
  74.     if ( (_QWORD)v19 )
  75.       v0 = (tesla *)((__int64 (*)(void))v19)();
  76.     v8 = (tesla::detail::InitializedShmSession *)tesla::BaseDvGroup<tesla::vision_signals::VisionSignalsInfo,(tesla::DvAccess)1,(tesla::DvSync)2,17ul>::data_shm_session_ptr_;
  77.     tesla::BaseDvGroup<tesla::vision_signals::VisionSignalsInfo,(tesla::DvAccess)1,(tesla::DvSync)2,17ul>::data_shm_session_ptr_ = v5;
  78.     if ( v8 )
  79.     {
  80.       tesla::detail::InitializedShmSession::~InitializedShmSession(v8);
  81.       operator delete((void *)v8);
  82.     }
  83.     if ( v15 )
  84.       v0 = (tesla *)((__int64 (*)(void))v15)();
  85.   }
  86.   if ( _stack_chk_guard != v20 )
  87.   {
  88. LABEL_18:
  89.     v10 = (tesla *)tesla::get_global_logger(v0);
  90.     v11 = tesla::get_global_logger(v10);
  91.     v12 = tesla::logger::send_text_log_message_printf_FATAL(
  92.             v11,
  93.             "include/dv/dv_base.hpp",
  94.             99LL,
  95.             "Multiple wait free writer instantiation not allowed");
  96.     abort(v12);
  97.   }
  98.   return 1LL;
  99. }