; LLVM IR from unitreerobotics/kinect_teleoperate :: src/mujoco-3.1.5/simulate (platform_ui_adapter)

; 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"

%"struct.std::pair" = type { i32, i32 }
%"class.mujoco::PlatformUIAdapter" = type <{ ptr, %struct.mjuiState_, i32, [4 x i8], ptr, ptr, %struct.mjrContext_, ptr, i32, [4 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 }
%struct.mjrContext_ = type { float, float, float, float, float, [4 x float], i32, i32, i32, i32, i32, [10 x i32], [10 x i32], [10 x i32], i32, i32, i32, i32, i32, i32, i32, i32, [10 x i32], [10 x i32], [10 x i32], [10 x i32], i32, [100 x i32], [100 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, [127 x i32], [127 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6mujoco17PlatformUIAdapter15UpdateMjuiStateEv(ptr noundef nonnull align 8 dereferenceable(2900)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6mujoco17PlatformUIAdapter14OnWindowResizeEii(ptr noundef nonnull align 8 dereferenceable(2900) %0, i32 noundef %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = getelementptr inbounds ptr, ptr %11, i64 6
  %13 = load ptr, ptr %12, align 8
  %14 = call i64 %13(ptr noundef nonnull align 8 dereferenceable(2900) %10)
  store i64 %14, ptr %7, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %7) #3
  store ptr %15, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %7) #3
  store ptr %16, ptr %9, align 8, !tbaa !5
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  %20 = getelementptr inbounds %struct.mjuiState_, ptr %19, i32 0, i32 1
  %21 = getelementptr inbounds [25 x %struct.mjrRect_], ptr %20, i64 0, i64 0
  %22 = getelementptr inbounds %struct.mjrRect_, ptr %21, i32 0, i32 2
  store i32 %18, ptr %22, align 4, !tbaa !13
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  %26 = getelementptr inbounds %struct.mjuiState_, ptr %25, i32 0, i32 1
  %27 = getelementptr inbounds [25 x %struct.mjrRect_], ptr %26, i64 0, i64 0
  %28 = getelementptr inbounds %struct.mjrRect_, ptr %27, i32 0, i32 3
  store i32 %24, ptr %28, align 4, !tbaa !15
  %29 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  %30 = getelementptr inbounds %struct.mjuiState_, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 8, !tbaa !16
  %32 = icmp slt i32 %31, 1
  br i1 %32, label %33, label %36

33:                                               ; preds = %3
  %34 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  %35 = getelementptr inbounds %struct.mjuiState_, ptr %34, i32 0, i32 0
  store i32 1, ptr %35, align 8, !tbaa !16
  br label %36

36:                                               ; preds = %33, %3
  %37 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !22
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %44

40:                                               ; preds = %36
  %41 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 5
  %42 = load ptr, ptr %41, align 8, !tbaa !22
  %43 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  call void %42(ptr noundef %43)
  br label %44

44:                                               ; preds = %40, %36
  call void @_ZN6mujoco17PlatformUIAdapter15UpdateMjuiStateEv(ptr noundef nonnull align 8 dereferenceable(2900) %10)
  %45 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  %46 = getelementptr inbounds %struct.mjuiState_, ptr %45, i32 0, i32 3
  store i32 6, ptr %46, align 8, !tbaa !23
  %47 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  %48 = getelementptr inbounds %struct.mjuiState_, ptr %47, i32 0, i32 23
  store i32 0, ptr %48, align 8, !tbaa !24
  %49 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  %50 = getelementptr inbounds %struct.mjuiState_, ptr %49, i32 0, i32 22
  store i32 0, ptr %50, align 4, !tbaa !25
  %51 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 4
  %52 = load ptr, ptr %51, align 8, !tbaa !26
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %58

54:                                               ; preds = %44
  %55 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 4
  %56 = load ptr, ptr %55, align 8, !tbaa !26
  %57 = getelementptr inbounds %"class.mujoco::PlatformUIAdapter", ptr %10, i32 0, i32 1
  call void %56(ptr noundef %57)
  br label %58

58:                                               ; preds = %54, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nounwind }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTS8mjrRect_", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!15 = !{!14, !10, i64 12}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTSN6mujoco17PlatformUIAdapterE", !18, i64 8, !10, i64 552, !6, i64 560, !6, i64 568, !20, i64 576, !6, i64 2888, !10, i64 2896}
!18 = !{!"_ZTS10mjuiState_", !10, i64 0, !7, i64 4, !6, i64 408, !10, i64 416, !10, i64 420, !10, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !19, i64 440, !19, i64 448, !19, i64 456, !19, i64 464, !19, i64 472, !19, i64 480, !19, i64 488, !10, i64 496, !10, i64 500, !10, i64 504, !10, i64 508, !19, i64 512, !10, i64 520, !10, i64 524, !10, i64 528, !10, i64 532, !6, i64 536}
!19 = !{!"double", !7, i64 0}
!20 = !{!"_ZTS11mjrContext_", !21, i64 0, !21, i64 4, !21, i64 8, !21, i64 12, !21, i64 16, !7, i64 20, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !7, i64 56, !7, i64 96, !7, i64 136, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !7, i64 208, !7, i64 248, !7, i64 288, !7, i64 328, !10, i64 368, !7, i64 372, !7, i64 772, !10, i64 1172, !10, i64 1176, !10, i64 1180, !10, i64 1184, !10, i64 1188, !10, i64 1192, !10, i64 1196, !10, i64 1200, !10, i64 1204, !10, i64 1208, !10, i64 1212, !10, i64 1216, !10, i64 1220, !6, i64 1224, !6, i64 1232, !6, i64 1240, !6, i64 1248, !7, i64 1256, !7, i64 1764, !10, i64 2272, !10, i64 2276, !10, i64 2280, !10, i64 2284, !10, i64 2288, !10, i64 2292, !10, i64 2296, !10, i64 2300, !10, i64 2304, !10, i64 2308}
!21 = !{!"float", !7, i64 0}
!22 = !{!17, !6, i64 568}
!23 = !{!17, !10, i64 424}
!24 = !{!17, !10, i64 536}
!25 = !{!17, !10, i64 532}
!26 = !{!17, !6, i64 560}


; 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"

%"struct.std::pair" = type { i32, i32 }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6mujoco17PlatformUIAdapter15UpdateMjuiStateEv(ptr noundef nonnull align 8 dereferenceable(2900)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6mujoco17PlatformUIAdapter14OnWindowResizeEii(ptr noundef nonnull align 8 dereferenceable(2900) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 48
  %7 = load ptr, ptr %6, align 8
  %8 = tail call i64 %7(ptr noundef nonnull align 8 dereferenceable(2900) %0)
  store i64 %8, ptr %4, align 8
  %9 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %4) #3
  %10 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %4) #3
  %11 = load i32, ptr %9, align 4, !tbaa !8
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %11, ptr %13, align 4, !tbaa !11
  %14 = load i32, ptr %10, align 4, !tbaa !8
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %14, ptr %15, align 8, !tbaa !13
  %16 = load i32, ptr %12, align 8, !tbaa !14
  %17 = icmp slt i32 %16, 1
  br i1 %17, label %18, label %19

18:                                               ; preds = %3
  store i32 1, ptr %12, align 8, !tbaa !14
  br label %19

19:                                               ; preds = %18, %3
  %20 = getelementptr inbounds i8, ptr %0, i64 568
  %21 = load ptr, ptr %20, align 8, !tbaa !21
  %.not = icmp eq ptr %21, null
  br i1 %.not, label %23, label %22

22:                                               ; preds = %19
  call void %21(ptr noundef nonnull %12)
  br label %23

23:                                               ; preds = %22, %19
  call void @_ZN6mujoco17PlatformUIAdapter15UpdateMjuiStateEv(ptr noundef nonnull align 8 dereferenceable(2900) %0)
  %24 = getelementptr inbounds i8, ptr %0, i64 424
  store i32 6, ptr %24, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %0, i64 536
  store i32 0, ptr %25, align 8, !tbaa !23
  %26 = getelementptr inbounds i8, ptr %0, i64 532
  store i32 0, ptr %26, align 4, !tbaa !24
  %27 = getelementptr inbounds i8, ptr %0, i64 560
  %28 = load ptr, ptr %27, align 8, !tbaa !25
  %.not4 = icmp eq ptr %28, null
  br i1 %.not4, label %30, label %29

29:                                               ; preds = %23
  call void %28(ptr noundef nonnull %12)
  br label %30

30:                                               ; preds = %29, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nounwind }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !9, i64 8}
!12 = !{!"_ZTS8mjrRect_", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12}
!13 = !{!12, !9, i64 12}
!14 = !{!15, !9, i64 8}
!15 = !{!"_ZTSN6mujoco17PlatformUIAdapterE", !16, i64 8, !9, i64 552, !17, i64 560, !17, i64 568, !19, i64 576, !17, i64 2888, !9, i64 2896}
!16 = !{!"_ZTS10mjuiState_", !9, i64 0, !10, i64 4, !17, i64 408, !9, i64 416, !9, i64 420, !9, i64 424, !9, i64 428, !9, i64 432, !9, i64 436, !18, i64 440, !18, i64 448, !18, i64 456, !18, i64 464, !18, i64 472, !18, i64 480, !18, i64 488, !9, i64 496, !9, i64 500, !9, i64 504, !9, i64 508, !18, i64 512, !9, i64 520, !9, i64 524, !9, i64 528, !9, i64 532, !17, i64 536}
!17 = !{!"any pointer", !10, i64 0}
!18 = !{!"double", !10, i64 0}
!19 = !{!"_ZTS11mjrContext_", !20, i64 0, !20, i64 4, !20, i64 8, !20, i64 12, !20, i64 16, !10, i64 20, !9, i64 36, !9, i64 40, !9, i64 44, !9, i64 48, !9, i64 52, !10, i64 56, !10, i64 96, !10, i64 136, !9, i64 176, !9, i64 180, !9, i64 184, !9, i64 188, !9, i64 192, !9, i64 196, !9, i64 200, !9, i64 204, !10, i64 208, !10, i64 248, !10, i64 288, !10, i64 328, !9, i64 368, !10, i64 372, !10, i64 772, !9, i64 1172, !9, i64 1176, !9, i64 1180, !9, i64 1184, !9, i64 1188, !9, i64 1192, !9, i64 1196, !9, i64 1200, !9, i64 1204, !9, i64 1208, !9, i64 1212, !9, i64 1216, !9, i64 1220, !17, i64 1224, !17, i64 1232, !17, i64 1240, !17, i64 1248, !10, i64 1256, !10, i64 1764, !9, i64 2272, !9, i64 2276, !9, i64 2280, !9, i64 2284, !9, i64 2288, !9, i64 2292, !9, i64 2296, !9, i64 2300, !9, i64 2304, !9, i64 2308}
!20 = !{!"float", !10, i64 0}
!21 = !{!15, !17, i64 568}
!22 = !{!15, !9, i64 424}
!23 = !{!15, !9, i64 536}
!24 = !{!15, !9, i64 532}
!25 = !{!15, !17, i64 560}


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