; LLVM IR from unitreerobotics/kinect_teleoperate :: src/mujoco-3.1.5/simulate/main.ll (Z13PhysicsThreadPN6mujoco8SimulateEPKc)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::unique_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.mujoco::Simulate" = type <{ i8, [7 x i8], ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, [4 x i8], %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector.0", %"class.std::vector.5", %"class.std::vector", %"class.std::vector.0", %"class.std::vector.5", %"class.std::vector.10", %"class.std::vector.10", %"class.std::vector.10", %"class.std::vector.10", %"class.std::vector.10", %struct.mjvSceneState_, %struct.mjOption_, %struct.mjvOption_, [4 x i8], %struct.mjvCamera_, i32, [4 x i8], %struct.anon.22, %"class.mujoco::SimulateMutex", %"class.std::_V2::condition_variable_any", i32, [4 x i8], %"class.std::chrono::time_point", double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", i32, [1000 x i8], [1000 x i8], [1000 x i8], [1000 x i8], i32, i8, [3 x i8], float, double, double, [300 x i8], i32, [15 x i32], [6 x i32], [6 x i32], i32, %struct.mjvScene_, ptr, ptr, ptr, %struct.mjvFigure_, %struct.mjvFigure_, %struct.mjvFigure_, %struct.mjvFigure_, %struct.mjvFigure_, [4 x i8], ptr, [10 x i8], [2 x i8], i32, [2 x i32], [2 x i32], %"class.std::unique_ptr", ptr, %struct.mjUI_, %struct.mjUI_, [13 x %struct.mjuiDef_], [14 x %struct.mjuiDef_], [5 x %struct.mjuiDef_], [1000 x i8], [1000 x i8], %"class.std::_V2::condition_variable_any", i32, i32, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::optional<std::pair<double, double>>, std::allocator<std::optional<std::pair<double, double>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::optional<std::pair<double, double>>, std::allocator<std::optional<std::pair<double, double>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::optional<std::pair<double, double>>, std::allocator<std::optional<std::pair<double, double>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::optional<std::pair<double, double>>, std::allocator<std::optional<std::pair<double, double>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.mjvSceneState_ = type { i32, ptr, i32, %struct.mjvScene_, %struct.anon, %struct.anon.21 }
%struct.anon = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.mjOption_, %struct.mjVisual_, %struct.mjStatistic_, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.mjVisual_ = type { %struct.anon.15, %struct.anon.16, %struct.anon.17, %struct.anon.18, %struct.anon.19, %struct.anon.20 }
%struct.anon.15 = type { float, float, float, float, float, float, float, i32, i32, i32, i32 }
%struct.anon.16 = type { i32, i32, i32, i32, i32 }
%struct.anon.17 = type { [3 x float], [3 x float], [3 x float], i32 }
%struct.anon.18 = type { float, float, float, float, float, float, float, float, float, float, float, float, float }
%struct.anon.19 = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }
%struct.anon.20 = type { [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float] }
%struct.mjStatistic_ = type { double, double, double, double, [3 x double] }
%struct.anon.21 = type { [8 x %struct.mjWarningStat_], i32, i32, i32, double, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.mjWarningStat_ = type { i32, i32 }
%struct.mjOption_ = type { double, double, double, double, double, double, double, [3 x double], [3 x double], [3 x double], double, double, double, [2 x double], [5 x double], [5 x double], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.mjvOption_ = type { i32, i32, [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [32 x i8], i32, i32 }
%struct.mjvCamera_ = type { i32, i32, i32, [3 x double], double, double, double }
%struct.anon.22 = type <{ %"class.std::optional", %"class.std::optional", %"class.std::optional", %"class.std::optional", i8, i8, i8, i8, i8, i8, i8, i8, i32, i8, [3 x i8], %struct.mjuiState_, i8, i8, i8, i8, i8, i8, [2 x i8] }>
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload.base", [7 x i8] }
%"struct.std::_Optional_payload.base" = type { %"struct.std::_Optional_payload_base.base" }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<std::__cxx11::basic_string<char>>::_Storage", i8 }>
%"union.std::_Optional_payload_base<std::__cxx11::basic_string<char>>::_Storage" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.mjuiState_ = type { i32, [25 x %struct.mjrRect_], ptr, i32, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, i32, i32, i32, i32, double, i32, i32, i32, i32, ptr }
%struct.mjrRect_ = type { i32, i32, i32, i32 }
%"class.mujoco::SimulateMutex" = type { %"class.std::recursive_mutex" }
%"class.std::recursive_mutex" = type { %"class.std::__recursive_mutex_base" }
%"class.std::__recursive_mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%struct.mjvScene_ = type { i32, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, i32, ptr, ptr, ptr, ptr, ptr, i32, [100 x %struct.mjvLight_], [2 x %struct.mjvGLCamera_], i8, [3 x float], [4 x float], float, i32, [10 x i8], i32, [3 x float] }
%struct.mjvLight_ = type { [3 x float], [3 x float], [3 x float], float, float, [3 x float], [3 x float], [3 x float], i8, i8, i8, float }
%struct.mjvGLCamera_ = type { [3 x float], [3 x float], [3 x float], float, float, float, float, float, float }
%struct.mjvFigure_ = type { i32, [2 x i32], i32, i32, i32, i32, float, float, [2 x i32], [3 x float], [4 x float], [4 x float], [4 x float], [3 x float], [100 x [3 x float]], [2 x [2 x float]], [20 x i8], [20 x i8], [20 x i8], [1000 x i8], [100 x i8], [100 x [100 x i8]], i32, i32, [2 x i32], i32, float, [100 x i32], [100 x [2000 x float]], [2 x i32], [2 x i32], [2 x float], [2 x float] }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.30" }
%"struct.std::_Head_base.30" = type { ptr }
%struct.mjUI_ = type { %struct.mjuiThemeSpacing_, %struct.mjuiThemeColor_, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [300 x i8], ptr, i32, [10 x %struct.mjuiSection_] }
%struct.mjuiThemeSpacing_ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.mjuiThemeColor_ = type { [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float], [3 x float] }
%struct.mjuiSection_ = type { [40 x i8], i32, i32, i32, i32, [200 x %struct.mjuiItem_], %struct.mjrRect_, %struct.mjrRect_ }
%struct.mjuiItem_ = type { i32, [40 x i8], i32, ptr, i32, i32, %union.anon.31, %struct.mjrRect_ }
%union.anon.31 = type { %struct.mjuiItemEdit_, [1288 x i8] }
%struct.mjuiItemEdit_ = type { i32, [7 x [2 x double]] }
%struct.mjuiDef_ = type { i32, [40 x i8], i32, ptr, [300 x i8] }
%"class.std::_V2::condition_variable_any" = type { %"class.std::condition_variable", %"class.std::shared_ptr" }
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%struct.mjModel_ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, %struct.mjOption_, %struct.mjVisual_, %struct.mjStatistic_, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@_ZN12_GLOBAL__N_11mE = external hidden global ptr, align 8
@_ZN12_GLOBAL__N_11dE = external hidden global ptr, align 8
@_ZN12_GLOBAL__N_19ctrlnoiseE = external hidden global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13PhysicsThreadPN6mujoco8SimulateEPKc(ptr noundef %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::unique_lock", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::unique_lock", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %61

11:                                               ; preds = %2
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN6mujoco8Simulate11LoadMessageEPKc(ptr noundef nonnull align 8 dereferenceable(10060860) %12, ptr noundef %13)
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = call noundef ptr @_ZN12_GLOBAL__N_19LoadModelEPKcRN6mujoco8SimulateE(ptr noundef %14, ptr noundef nonnull align 8 dereferenceable(10060860) %15)
  store ptr %16, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %17 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %29

19:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #6
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.mujoco::Simulate", ptr %20, i32 0, i32 34
  call void @_ZNSt11unique_lockISt15recursive_mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %5, ptr noundef nonnull align 8 dereferenceable(40) %21)
  %22 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %23 = invoke ptr @mj_makeData(ptr noundef %22)
          to label %24 unwind label %25

24:                                               ; preds = %19
  store ptr %23, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #6
  br label %29

25:                                               ; preds = %19
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %6, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %7, align 4
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #6
  br label %66

29:                                               ; preds = %24, %11
  %30 = load ptr, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %58

32:                                               ; preds = %29
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %35 = load ptr, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN6mujoco8Simulate4LoadEP8mjModel_P7mjData_PKc(ptr noundef nonnull align 8 dereferenceable(10060860) %33, ptr noundef %34, ptr noundef %35, ptr noundef %36)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.mujoco::Simulate", ptr %37, i32 0, i32 34
  call void @_ZNSt11unique_lockISt15recursive_mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %8, ptr noundef nonnull align 8 dereferenceable(40) %38)
  %39 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %40 = load ptr, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  invoke void @mj_forward(ptr noundef %39, ptr noundef %40)
          to label %41 unwind label %54

41:                                               ; preds = %32
  %42 = load ptr, ptr @_ZN12_GLOBAL__N_19ctrlnoiseE, align 8, !tbaa !5
  call void @free(ptr noundef %42) #6
  %43 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.mjModel_, ptr %43, i32 0, i32 2
  %45 = load i32, ptr %44, align 8, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = mul i64 8, %46
  %48 = call noalias ptr @malloc(i64 noundef %47) #7
  store ptr %48, ptr @_ZN12_GLOBAL__N_19ctrlnoiseE, align 8, !tbaa !5
  %49 = load ptr, ptr @_ZN12_GLOBAL__N_19ctrlnoiseE, align 8, !tbaa !5
  %50 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.mjModel_, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 8, !tbaa !9
  invoke void @mju_zero(ptr noundef %49, i32 noundef %52)
          to label %53 unwind label %54

53:                                               ; preds = %41
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  br label %60

54:                                               ; preds = %41, %32
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %6, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %7, align 4
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  br label %66

58:                                               ; preds = %29
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN6mujoco8Simulate16LoadMessageClearEv(ptr noundef nonnull align 8 dereferenceable(10060860) %59)
  br label %60

60:                                               ; preds = %58, %53
  br label %61

61:                                               ; preds = %60, %2
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN12_GLOBAL__N_111PhysicsLoopERN6mujoco8SimulateE(ptr noundef nonnull align 8 dereferenceable(10060860) %62)
  %63 = load ptr, ptr @_ZN12_GLOBAL__N_19ctrlnoiseE, align 8, !tbaa !5
  call void @free(ptr noundef %63) #6
  %64 = load ptr, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  call void @mj_deleteData(ptr noundef %64)
  %65 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  call void @mj_deleteModel(ptr noundef %65)
  ret void

66:                                               ; preds = %54, %25
  %67 = load ptr, ptr %6, align 8
  %68 = load i32, ptr %7, align 4
  %69 = insertvalue { ptr, i32 } poison, ptr %67, 0
  %70 = insertvalue { ptr, i32 } %69, i32 %68, 1
  resume { ptr, i32 } %70
}

declare void @_ZN6mujoco8Simulate11LoadMessageEPKc(ptr noundef nonnull align 8 dereferenceable(10060860), ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN12_GLOBAL__N_19LoadModelEPKcRN6mujoco8SimulateE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(10060860)) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt11unique_lockISt15recursive_mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0 align 2

declare ptr @mj_makeData(ptr noundef) #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

declare void @_ZN6mujoco8Simulate4LoadEP8mjModel_P7mjData_PKc(ptr noundef nonnull align 8 dereferenceable(10060860), ptr noundef, ptr noundef, ptr noundef) #1

declare void @mj_forward(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

declare void @mju_zero(ptr noundef, i32 noundef) #1

declare void @_ZN6mujoco8Simulate16LoadMessageClearEv(ptr noundef nonnull align 8 dereferenceable(10060860)) #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_111PhysicsLoopERN6mujoco8SimulateE(ptr noundef nonnull align 8 dereferenceable(10060860)) #0

declare void @mj_deleteData(ptr noundef) #1

declare void @mj_deleteModel(ptr noundef) #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTS8mjModel_", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !11, i64 220, !11, i64 224, !11, i64 228, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296, !11, i64 300, !12, i64 304, !12, i64 312, !13, i64 320, !15, i64 624, !23, i64 1248, !6, i64 1304, !6, i64 1312, !6, i64 1320, !6, i64 1328, !6, i64 1336, !6, i64 1344, !6, i64 1352, !6, i64 1360, !6, i64 1368, !6, i64 1376, !6, i64 1384, !6, i64 1392, !6, i64 1400, !6, i64 1408, !6, i64 1416, !6, i64 1424, !6, i64 1432, !6, i64 1440, !6, i64 1448, !6, i64 1456, !6, i64 1464, !6, i64 1472, !6, i64 1480, !6, i64 1488, !6, i64 1496, !6, i64 1504, !6, i64 1512, !6, i64 1520, !6, i64 1528, !6, i64 1536, !6, i64 1544, !6, i64 1552, !6, i64 1560, !6, i64 1568, !6, i64 1576, !6, i64 1584, !6, i64 1592, !6, i64 1600, !6, i64 1608, !6, i64 1616, !6, i64 1624, !6, i64 1632, !6, i64 1640, !6, i64 1648, !6, i64 1656, !6, i64 1664, !6, i64 1672, !6, i64 1680, !6, i64 1688, !6, i64 1696, !6, i64 1704, !6, i64 1712, !6, i64 1720, !6, i64 1728, !6, i64 1736, !6, i64 1744, !6, i64 1752, !6, i64 1760, !6, i64 1768, !6, i64 1776, !6, i64 1784, !6, i64 1792, !6, i64 1800, !6, i64 1808, !6, i64 1816, !6, i64 1824, !6, i64 1832, !6, i64 1840, !6, i64 1848, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888, !6, i64 1896, !6, i64 1904, !6, i64 1912, !6, i64 1920, !6, i64 1928, !6, i64 1936, !6, i64 1944, !6, i64 1952, !6, i64 1960, !6, i64 1968, !6, i64 1976, !6, i64 1984, !6, i64 1992, !6, i64 2000, !6, i64 2008, !6, i64 2016, !6, i64 2024, !6, i64 2032, !6, i64 2040, !6, i64 2048, !6, i64 2056, !6, i64 2064, !6, i64 2072, !6, i64 2080, !6, i64 2088, !6, i64 2096, !6, i64 2104, !6, i64 2112, !6, i64 2120, !6, i64 2128, !6, i64 2136, !6, i64 2144, !6, i64 2152, !6, i64 2160, !6, i64 2168, !6, i64 2176, !6, i64 2184, !6, i64 2192, !6, i64 2200, !6, i64 2208, !6, i64 2216, !6, i64 2224, !6, i64 2232, !6, i64 2240, !6, i64 2248, !6, i64 2256, !6, i64 2264, !6, i64 2272, !6, i64 2280, !6, i64 2288, !6, i64 2296, !6, i64 2304, !6, i64 2312, !6, i64 2320, !6, i64 2328, !6, i64 2336, !6, i64 2344, !6, i64 2352, !6, i64 2360, !6, i64 2368, !6, i64 2376, !6, i64 2384, !6, i64 2392, !6, i64 2400, !6, i64 2408, !6, i64 2416, !6, i64 2424, !6, i64 2432, !6, i64 2440, !6, i64 2448, !6, i64 2456, !6, i64 2464, !6, i64 2472, !6, i64 2480, !6, i64 2488, !6, i64 2496, !6, i64 2504, !6, i64 2512, !6, i64 2520, !6, i64 2528, !6, i64 2536, !6, i64 2544, !6, i64 2552, !6, i64 2560, !6, i64 2568, !6, i64 2576, !6, i64 2584, !6, i64 2592, !6, i64 2600, !6, i64 2608, !6, i64 2616, !6, i64 2624, !6, i64 2632, !6, i64 2640, !6, i64 2648, !6, i64 2656, !6, i64 2664, !6, i64 2672, !6, i64 2680, !6, i64 2688, !6, i64 2696, !6, i64 2704, !6, i64 2712, !6, i64 2720, !6, i64 2728, !6, i64 2736, !6, i64 2744, !6, i64 2752, !6, i64 2760, !6, i64 2768, !6, i64 2776, !6, i64 2784, !6, i64 2792, !6, i64 2800, !6, i64 2808, !6, i64 2816, !6, i64 2824, !6, i64 2832, !6, i64 2840, !6, i64 2848, !6, i64 2856, !6, i64 2864, !6, i64 2872, !6, i64 2880, !6, i64 2888, !6, i64 2896, !6, i64 2904, !6, i64 2912, !6, i64 2920, !6, i64 2928, !6, i64 2936, !6, i64 2944, !6, i64 2952, !6, i64 2960, !6, i64 2968, !6, i64 2976, !6, i64 2984, !6, i64 2992, !6, i64 3000, !6, i64 3008, !6, i64 3016, !6, i64 3024, !6, i64 3032, !6, i64 3040, !6, i64 3048, !6, i64 3056, !6, i64 3064, !6, i64 3072, !6, i64 3080, !6, i64 3088, !6, i64 3096, !6, i64 3104, !6, i64 3112, !6, i64 3120, !6, i64 3128, !6, i64 3136, !6, i64 3144, !6, i64 3152, !6, i64 3160, !6, i64 3168, !6, i64 3176, !6, i64 3184, !6, i64 3192, !6, i64 3200, !6, i64 3208, !6, i64 3216, !6, i64 3224, !6, i64 3232, !6, i64 3240, !6, i64 3248, !6, i64 3256, !6, i64 3264, !6, i64 3272, !6, i64 3280, !6, i64 3288, !6, i64 3296, !6, i64 3304, !6, i64 3312, !6, i64 3320, !6, i64 3328, !6, i64 3336, !6, i64 3344, !6, i64 3352, !6, i64 3360, !6, i64 3368, !6, i64 3376, !6, i64 3384, !6, i64 3392, !6, i64 3400, !6, i64 3408, !6, i64 3416, !6, i64 3424, !6, i64 3432, !6, i64 3440, !6, i64 3448, !6, i64 3456, !6, i64 3464, !6, i64 3472, !6, i64 3480, !6, i64 3488, !6, i64 3496, !6, i64 3504, !6, i64 3512, !6, i64 3520, !6, i64 3528, !6, i64 3536, !6, i64 3544, !6, i64 3552, !6, i64 3560, !6, i64 3568, !6, i64 3576, !6, i64 3584, !6, i64 3592, !6, i64 3600, !6, i64 3608, !6, i64 3616, !6, i64 3624, !6, i64 3632, !6, i64 3640, !6, i64 3648, !6, i64 3656, !6, i64 3664, !6, i64 3672, !6, i64 3680, !6, i64 3688, !6, i64 3696, !6, i64 3704, !6, i64 3712, !6, i64 3720, !6, i64 3728, !6, i64 3736, !6, i64 3744, !6, i64 3752, !6, i64 3760, !6, i64 3768, !6, i64 3776, !6, i64 3784, !6, i64 3792, !6, i64 3800, !6, i64 3808, !6, i64 3816, !6, i64 3824, !6, i64 3832, !6, i64 3840, !6, i64 3848, !6, i64 3856, !6, i64 3864, !6, i64 3872, !6, i64 3880, !6, i64 3888, !6, i64 3896, !6, i64 3904, !6, i64 3912, !6, i64 3920, !6, i64 3928, !6, i64 3936, !6, i64 3944, !6, i64 3952, !6, i64 3960, !6, i64 3968, !6, i64 3976, !6, i64 3984, !6, i64 3992, !6, i64 4000, !6, i64 4008, !6, i64 4016, !6, i64 4024, !6, i64 4032, !6, i64 4040, !6, i64 4048, !6, i64 4056, !6, i64 4064, !6, i64 4072, !6, i64 4080, !6, i64 4088, !6, i64 4096, !6, i64 4104, !6, i64 4112, !6, i64 4120, !6, i64 4128, !6, i64 4136, !6, i64 4144, !6, i64 4152, !6, i64 4160, !6, i64 4168, !6, i64 4176, !6, i64 4184, !6, i64 4192, !6, i64 4200, !6, i64 4208, !6, i64 4216, !6, i64 4224, !6, i64 4232, !6, i64 4240, !6, i64 4248, !6, i64 4256, !6, i64 4264, !6, i64 4272, !6, i64 4280, !6, i64 4288, !6, i64 4296, !6, i64 4304, !6, i64 4312}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTS9mjOption_", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !7, i64 56, !7, i64 80, !7, i64 104, !14, i64 128, !14, i64 136, !14, i64 144, !7, i64 152, !7, i64 168, !7, i64 208, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTS9mjVisual_", !16, i64 0, !18, i64 44, !19, i64 64, !20, i64 104, !21, i64 156, !22, i64 224}
!16 = !{!"_ZTSN9mjVisual_Ut_E", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSN9mjVisual_Ut0_E", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16}
!19 = !{!"_ZTSN9mjVisual_Ut1_E", !7, i64 0, !7, i64 12, !7, i64 24, !11, i64 36}
!20 = !{!"_ZTSN9mjVisual_Ut2_E", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !17, i64 44, !17, i64 48}
!21 = !{!"_ZTSN9mjVisual_Ut3_E", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !17, i64 44, !17, i64 48, !17, i64 52, !17, i64 56, !17, i64 60, !17, i64 64}
!22 = !{!"_ZTSN9mjVisual_Ut4_E", !7, i64 0, !7, i64 16, !7, i64 32, !7, i64 48, !7, i64 64, !7, i64 80, !7, i64 96, !7, i64 112, !7, i64 128, !7, i64 144, !7, i64 160, !7, i64 176, !7, i64 192, !7, i64 208, !7, i64 224, !7, i64 240, !7, i64 256, !7, i64 272, !7, i64 288, !7, i64 304, !7, i64 320, !7, i64 336, !7, i64 352, !7, i64 368, !7, i64 384}
!23 = !{!"_ZTS12mjStatistic_", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !7, i64 32}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::unique_lock" = type <{ ptr, i8, [7 x i8] }>

@_ZN12_GLOBAL__N_11mE = external hidden local_unnamed_addr global ptr, align 8
@_ZN12_GLOBAL__N_11dE = external hidden local_unnamed_addr global ptr, align 8
@_ZN12_GLOBAL__N_19ctrlnoiseE = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13PhysicsThreadPN6mujoco8SimulateEPKc(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::unique_lock", align 8
  %4 = alloca %"class.std::unique_lock", align 8
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %33, label %5

5:                                                ; preds = %2
  tail call void @_ZN6mujoco8Simulate11LoadMessageEPKc(ptr noundef nonnull align 8 dereferenceable(10060860) %0, ptr noundef nonnull %1)
  %6 = tail call noundef ptr @_ZN12_GLOBAL__N_19LoadModelEPKcRN6mujoco8SimulateE(ptr noundef nonnull %1, ptr noundef nonnull align 8 dereferenceable(10060860) %0)
  store ptr %6, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %.not15 = icmp eq ptr %6, null
  br i1 %.not15, label %14, label %7

7:                                                ; preds = %5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %8 = getelementptr inbounds i8, ptr %0, i64 13480
  call void @_ZNSt11unique_lockISt15recursive_mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %3, ptr noundef nonnull align 8 dereferenceable(40) %8)
  %9 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %10 = invoke ptr @mj_makeData(ptr noundef %9)
          to label %11 unwind label %12

11:                                               ; preds = %7
  store ptr %10, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  br label %14

12:                                               ; preds = %7
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  br label %37

14:                                               ; preds = %11, %5
  %15 = load ptr, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  %.not16 = icmp eq ptr %15, null
  br i1 %.not16, label %32, label %16

16:                                               ; preds = %14
  %17 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  call void @_ZN6mujoco8Simulate4LoadEP8mjModel_P7mjData_PKc(ptr noundef nonnull align 8 dereferenceable(10060860) %0, ptr noundef %17, ptr noundef nonnull %15, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %18 = getelementptr inbounds i8, ptr %0, i64 13480
  call void @_ZNSt11unique_lockISt15recursive_mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %4, ptr noundef nonnull align 8 dereferenceable(40) %18)
  %19 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %20 = load ptr, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  invoke void @mj_forward(ptr noundef %19, ptr noundef %20)
          to label %21 unwind label %30

21:                                               ; preds = %16
  %22 = load ptr, ptr @_ZN12_GLOBAL__N_19ctrlnoiseE, align 8, !tbaa !5
  call void @free(ptr noundef %22) #6
  %23 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = load i32, ptr %24, align 8, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = shl nsw i64 %26, 3
  %28 = call noalias ptr @malloc(i64 noundef %27) #7
  store ptr %28, ptr @_ZN12_GLOBAL__N_19ctrlnoiseE, align 8, !tbaa !5
  invoke void @mju_zero(ptr noundef %28, i32 noundef %25)
          to label %29 unwind label %30

29:                                               ; preds = %21
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %33

30:                                               ; preds = %21, %16
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %37

32:                                               ; preds = %14
  call void @_ZN6mujoco8Simulate16LoadMessageClearEv(ptr noundef nonnull align 8 dereferenceable(10060860) %0)
  br label %33

33:                                               ; preds = %29, %32, %2
  call void @_ZN12_GLOBAL__N_111PhysicsLoopERN6mujoco8SimulateE(ptr noundef nonnull align 8 dereferenceable(10060860) %0)
  %34 = load ptr, ptr @_ZN12_GLOBAL__N_19ctrlnoiseE, align 8, !tbaa !5
  call void @free(ptr noundef %34) #6
  %35 = load ptr, ptr @_ZN12_GLOBAL__N_11dE, align 8, !tbaa !5
  call void @mj_deleteData(ptr noundef %35)
  %36 = load ptr, ptr @_ZN12_GLOBAL__N_11mE, align 8, !tbaa !5
  call void @mj_deleteModel(ptr noundef %36)
  ret void

37:                                               ; preds = %30, %12
  %.pn = phi { ptr, i32 } [ %31, %30 ], [ %13, %12 ]
  resume { ptr, i32 } %.pn
}

declare void @_ZN6mujoco8Simulate11LoadMessageEPKc(ptr noundef nonnull align 8 dereferenceable(10060860), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN12_GLOBAL__N_19LoadModelEPKcRN6mujoco8SimulateE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(10060860)) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt11unique_lockISt15recursive_mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0 align 2

declare ptr @mj_makeData(ptr noundef) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt11unique_lockISt15recursive_mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

declare void @_ZN6mujoco8Simulate4LoadEP8mjModel_P7mjData_PKc(ptr noundef nonnull align 8 dereferenceable(10060860), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @mj_forward(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5

declare void @mju_zero(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @_ZN6mujoco8Simulate16LoadMessageClearEv(ptr noundef nonnull align 8 dereferenceable(10060860)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_111PhysicsLoopERN6mujoco8SimulateE(ptr noundef nonnull align 8 dereferenceable(10060860)) local_unnamed_addr #0

declare void @mj_deleteData(ptr noundef) local_unnamed_addr #1

declare void @mj_deleteModel(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTS8mjModel_", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !11, i64 220, !11, i64 224, !11, i64 228, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296, !11, i64 300, !12, i64 304, !12, i64 312, !13, i64 320, !15, i64 624, !23, i64 1248, !6, i64 1304, !6, i64 1312, !6, i64 1320, !6, i64 1328, !6, i64 1336, !6, i64 1344, !6, i64 1352, !6, i64 1360, !6, i64 1368, !6, i64 1376, !6, i64 1384, !6, i64 1392, !6, i64 1400, !6, i64 1408, !6, i64 1416, !6, i64 1424, !6, i64 1432, !6, i64 1440, !6, i64 1448, !6, i64 1456, !6, i64 1464, !6, i64 1472, !6, i64 1480, !6, i64 1488, !6, i64 1496, !6, i64 1504, !6, i64 1512, !6, i64 1520, !6, i64 1528, !6, i64 1536, !6, i64 1544, !6, i64 1552, !6, i64 1560, !6, i64 1568, !6, i64 1576, !6, i64 1584, !6, i64 1592, !6, i64 1600, !6, i64 1608, !6, i64 1616, !6, i64 1624, !6, i64 1632, !6, i64 1640, !6, i64 1648, !6, i64 1656, !6, i64 1664, !6, i64 1672, !6, i64 1680, !6, i64 1688, !6, i64 1696, !6, i64 1704, !6, i64 1712, !6, i64 1720, !6, i64 1728, !6, i64 1736, !6, i64 1744, !6, i64 1752, !6, i64 1760, !6, i64 1768, !6, i64 1776, !6, i64 1784, !6, i64 1792, !6, i64 1800, !6, i64 1808, !6, i64 1816, !6, i64 1824, !6, i64 1832, !6, i64 1840, !6, i64 1848, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888, !6, i64 1896, !6, i64 1904, !6, i64 1912, !6, i64 1920, !6, i64 1928, !6, i64 1936, !6, i64 1944, !6, i64 1952, !6, i64 1960, !6, i64 1968, !6, i64 1976, !6, i64 1984, !6, i64 1992, !6, i64 2000, !6, i64 2008, !6, i64 2016, !6, i64 2024, !6, i64 2032, !6, i64 2040, !6, i64 2048, !6, i64 2056, !6, i64 2064, !6, i64 2072, !6, i64 2080, !6, i64 2088, !6, i64 2096, !6, i64 2104, !6, i64 2112, !6, i64 2120, !6, i64 2128, !6, i64 2136, !6, i64 2144, !6, i64 2152, !6, i64 2160, !6, i64 2168, !6, i64 2176, !6, i64 2184, !6, i64 2192, !6, i64 2200, !6, i64 2208, !6, i64 2216, !6, i64 2224, !6, i64 2232, !6, i64 2240, !6, i64 2248, !6, i64 2256, !6, i64 2264, !6, i64 2272, !6, i64 2280, !6, i64 2288, !6, i64 2296, !6, i64 2304, !6, i64 2312, !6, i64 2320, !6, i64 2328, !6, i64 2336, !6, i64 2344, !6, i64 2352, !6, i64 2360, !6, i64 2368, !6, i64 2376, !6, i64 2384, !6, i64 2392, !6, i64 2400, !6, i64 2408, !6, i64 2416, !6, i64 2424, !6, i64 2432, !6, i64 2440, !6, i64 2448, !6, i64 2456, !6, i64 2464, !6, i64 2472, !6, i64 2480, !6, i64 2488, !6, i64 2496, !6, i64 2504, !6, i64 2512, !6, i64 2520, !6, i64 2528, !6, i64 2536, !6, i64 2544, !6, i64 2552, !6, i64 2560, !6, i64 2568, !6, i64 2576, !6, i64 2584, !6, i64 2592, !6, i64 2600, !6, i64 2608, !6, i64 2616, !6, i64 2624, !6, i64 2632, !6, i64 2640, !6, i64 2648, !6, i64 2656, !6, i64 2664, !6, i64 2672, !6, i64 2680, !6, i64 2688, !6, i64 2696, !6, i64 2704, !6, i64 2712, !6, i64 2720, !6, i64 2728, !6, i64 2736, !6, i64 2744, !6, i64 2752, !6, i64 2760, !6, i64 2768, !6, i64 2776, !6, i64 2784, !6, i64 2792, !6, i64 2800, !6, i64 2808, !6, i64 2816, !6, i64 2824, !6, i64 2832, !6, i64 2840, !6, i64 2848, !6, i64 2856, !6, i64 2864, !6, i64 2872, !6, i64 2880, !6, i64 2888, !6, i64 2896, !6, i64 2904, !6, i64 2912, !6, i64 2920, !6, i64 2928, !6, i64 2936, !6, i64 2944, !6, i64 2952, !6, i64 2960, !6, i64 2968, !6, i64 2976, !6, i64 2984, !6, i64 2992, !6, i64 3000, !6, i64 3008, !6, i64 3016, !6, i64 3024, !6, i64 3032, !6, i64 3040, !6, i64 3048, !6, i64 3056, !6, i64 3064, !6, i64 3072, !6, i64 3080, !6, i64 3088, !6, i64 3096, !6, i64 3104, !6, i64 3112, !6, i64 3120, !6, i64 3128, !6, i64 3136, !6, i64 3144, !6, i64 3152, !6, i64 3160, !6, i64 3168, !6, i64 3176, !6, i64 3184, !6, i64 3192, !6, i64 3200, !6, i64 3208, !6, i64 3216, !6, i64 3224, !6, i64 3232, !6, i64 3240, !6, i64 3248, !6, i64 3256, !6, i64 3264, !6, i64 3272, !6, i64 3280, !6, i64 3288, !6, i64 3296, !6, i64 3304, !6, i64 3312, !6, i64 3320, !6, i64 3328, !6, i64 3336, !6, i64 3344, !6, i64 3352, !6, i64 3360, !6, i64 3368, !6, i64 3376, !6, i64 3384, !6, i64 3392, !6, i64 3400, !6, i64 3408, !6, i64 3416, !6, i64 3424, !6, i64 3432, !6, i64 3440, !6, i64 3448, !6, i64 3456, !6, i64 3464, !6, i64 3472, !6, i64 3480, !6, i64 3488, !6, i64 3496, !6, i64 3504, !6, i64 3512, !6, i64 3520, !6, i64 3528, !6, i64 3536, !6, i64 3544, !6, i64 3552, !6, i64 3560, !6, i64 3568, !6, i64 3576, !6, i64 3584, !6, i64 3592, !6, i64 3600, !6, i64 3608, !6, i64 3616, !6, i64 3624, !6, i64 3632, !6, i64 3640, !6, i64 3648, !6, i64 3656, !6, i64 3664, !6, i64 3672, !6, i64 3680, !6, i64 3688, !6, i64 3696, !6, i64 3704, !6, i64 3712, !6, i64 3720, !6, i64 3728, !6, i64 3736, !6, i64 3744, !6, i64 3752, !6, i64 3760, !6, i64 3768, !6, i64 3776, !6, i64 3784, !6, i64 3792, !6, i64 3800, !6, i64 3808, !6, i64 3816, !6, i64 3824, !6, i64 3832, !6, i64 3840, !6, i64 3848, !6, i64 3856, !6, i64 3864, !6, i64 3872, !6, i64 3880, !6, i64 3888, !6, i64 3896, !6, i64 3904, !6, i64 3912, !6, i64 3920, !6, i64 3928, !6, i64 3936, !6, i64 3944, !6, i64 3952, !6, i64 3960, !6, i64 3968, !6, i64 3976, !6, i64 3984, !6, i64 3992, !6, i64 4000, !6, i64 4008, !6, i64 4016, !6, i64 4024, !6, i64 4032, !6, i64 4040, !6, i64 4048, !6, i64 4056, !6, i64 4064, !6, i64 4072, !6, i64 4080, !6, i64 4088, !6, i64 4096, !6, i64 4104, !6, i64 4112, !6, i64 4120, !6, i64 4128, !6, i64 4136, !6, i64 4144, !6, i64 4152, !6, i64 4160, !6, i64 4168, !6, i64 4176, !6, i64 4184, !6, i64 4192, !6, i64 4200, !6, i64 4208, !6, i64 4216, !6, i64 4224, !6, i64 4232, !6, i64 4240, !6, i64 4248, !6, i64 4256, !6, i64 4264, !6, i64 4272, !6, i64 4280, !6, i64 4288, !6, i64 4296, !6, i64 4304, !6, i64 4312}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTS9mjOption_", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !7, i64 56, !7, i64 80, !7, i64 104, !14, i64 128, !14, i64 136, !14, i64 144, !7, i64 152, !7, i64 168, !7, i64 208, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTS9mjVisual_", !16, i64 0, !18, i64 44, !19, i64 64, !20, i64 104, !21, i64 156, !22, i64 224}
!16 = !{!"_ZTSN9mjVisual_Ut_E", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSN9mjVisual_Ut0_E", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16}
!19 = !{!"_ZTSN9mjVisual_Ut1_E", !7, i64 0, !7, i64 12, !7, i64 24, !11, i64 36}
!20 = !{!"_ZTSN9mjVisual_Ut2_E", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !17, i64 44, !17, i64 48}
!21 = !{!"_ZTSN9mjVisual_Ut3_E", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !17, i64 44, !17, i64 48, !17, i64 52, !17, i64 56, !17, i64 60, !17, i64 64}
!22 = !{!"_ZTSN9mjVisual_Ut4_E", !7, i64 0, !7, i64 16, !7, i64 32, !7, i64 48, !7, i64 64, !7, i64 80, !7, i64 96, !7, i64 112, !7, i64 128, !7, i64 144, !7, i64 160, !7, i64 176, !7, i64 192, !7, i64 208, !7, i64 224, !7, i64 240, !7, i64 256, !7, i64 272, !7, i64 288, !7, i64 304, !7, i64 320, !7, i64 336, !7, i64 352, !7, i64 368, !7, i64 384}
!23 = !{!"_ZTS12mjStatistic_", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !7, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass