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

; 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.mujoco::Glfw" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.mujoco::GlfwAdapter" = type { %"class.mujoco::PlatformUIAdapter.base", %struct.GLFWvidmode, ptr, %"struct.std::pair", %"struct.std::pair" }
%"class.mujoco::PlatformUIAdapter.base" = type <{ ptr, %struct.mjuiState_, i32, [4 x i8], ptr, ptr, %struct.mjrContext_, ptr, i32 }>
%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 }
%struct.GLFWvidmode = type { i32, i32, i32, i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }

declare noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6mujoco11GlfwAdapter16ToggleFullscreenEv(ptr noundef nonnull align 8 dereferenceable(2952) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %5 = getelementptr inbounds %"struct.mujoco::Glfw", ptr %4, i32 0, i32 10
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 2
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = call noundef ptr %6(ptr noundef %8)
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %29

11:                                               ; preds = %1
  %12 = call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %13 = getelementptr inbounds %"struct.mujoco::Glfw", ptr %12, i32 0, i32 23
  %14 = load ptr, ptr %13, align 8, !tbaa !21
  %15 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 2
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 3
  %18 = getelementptr inbounds %"struct.std::pair", ptr %17, i32 0, i32 0
  %19 = load i32, ptr %18, align 8, !tbaa !22
  %20 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 3
  %21 = getelementptr inbounds %"struct.std::pair", ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 4, !tbaa !23
  %23 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 4
  %24 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !24
  %26 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 4
  %27 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !25
  call void %14(ptr noundef %16, ptr noundef null, i32 noundef %19, i32 noundef %22, i32 noundef %25, i32 noundef %28, i32 noundef 0)
  br label %66

29:                                               ; preds = %1
  %30 = call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %31 = getelementptr inbounds %"struct.mujoco::Glfw", ptr %30, i32 0, i32 11
  %32 = load ptr, ptr %31, align 8, !tbaa !26
  %33 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 3
  %36 = getelementptr inbounds %"struct.std::pair", ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 3
  %38 = getelementptr inbounds %"struct.std::pair", ptr %37, i32 0, i32 1
  call void %32(ptr noundef %34, ptr noundef %36, ptr noundef %38)
  %39 = call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %40 = getelementptr inbounds %"struct.mujoco::Glfw", ptr %39, i32 0, i32 12
  %41 = load ptr, ptr %40, align 8, !tbaa !27
  %42 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 2
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 4
  %45 = getelementptr inbounds %"struct.std::pair", ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 4
  %47 = getelementptr inbounds %"struct.std::pair", ptr %46, i32 0, i32 1
  call void %41(ptr noundef %43, ptr noundef %45, ptr noundef %47)
  %48 = call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %49 = getelementptr inbounds %"struct.mujoco::Glfw", ptr %48, i32 0, i32 23
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  %51 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 2
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  %53 = call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %54 = getelementptr inbounds %"struct.mujoco::Glfw", ptr %53, i32 0, i32 7
  %55 = load ptr, ptr %54, align 8, !tbaa !28
  %56 = call noundef ptr %55()
  %57 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 1
  %58 = getelementptr inbounds %struct.GLFWvidmode, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !29
  %60 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 1
  %61 = getelementptr inbounds %struct.GLFWvidmode, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !30
  %63 = getelementptr inbounds %"class.mujoco::GlfwAdapter", ptr %3, i32 0, i32 1
  %64 = getelementptr inbounds %struct.GLFWvidmode, ptr %63, i32 0, i32 5
  %65 = load i32, ptr %64, align 4, !tbaa !31
  call void %50(ptr noundef %52, ptr noundef %56, i32 noundef 0, i32 noundef 0, i32 noundef %59, i32 noundef %62, i32 noundef %65)
  br label %66

66:                                               ; preds = %29, %11
  ret void
}

attributes #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 = { 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" }

!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, !6, i64 80}
!10 = !{!"_ZTSN6mujoco4GlfwE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256}
!11 = !{!12, !6, i64 2928}
!12 = !{!"_ZTSN6mujoco11GlfwAdapterE", !13, i64 0, !19, i64 2900, !6, i64 2928, !20, i64 2936, !20, i64 2944}
!13 = !{!"_ZTSN6mujoco17PlatformUIAdapterE", !14, i64 8, !15, i64 552, !6, i64 560, !6, i64 568, !17, i64 576, !6, i64 2888, !15, i64 2896}
!14 = !{!"_ZTS10mjuiState_", !15, i64 0, !7, i64 4, !6, i64 408, !15, i64 416, !15, i64 420, !15, i64 424, !15, i64 428, !15, i64 432, !15, i64 436, !16, i64 440, !16, i64 448, !16, i64 456, !16, i64 464, !16, i64 472, !16, i64 480, !16, i64 488, !15, i64 496, !15, i64 500, !15, i64 504, !15, i64 508, !16, i64 512, !15, i64 520, !15, i64 524, !15, i64 528, !15, i64 532, !6, i64 536}
!15 = !{!"int", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!"_ZTS11mjrContext_", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16, !7, i64 20, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !7, i64 56, !7, i64 96, !7, i64 136, !15, i64 176, !15, i64 180, !15, i64 184, !15, i64 188, !15, i64 192, !15, i64 196, !15, i64 200, !15, i64 204, !7, i64 208, !7, i64 248, !7, i64 288, !7, i64 328, !15, i64 368, !7, i64 372, !7, i64 772, !15, i64 1172, !15, i64 1176, !15, i64 1180, !15, i64 1184, !15, i64 1188, !15, i64 1192, !15, i64 1196, !15, i64 1200, !15, i64 1204, !15, i64 1208, !15, i64 1212, !15, i64 1216, !15, i64 1220, !6, i64 1224, !6, i64 1232, !6, i64 1240, !6, i64 1248, !7, i64 1256, !7, i64 1764, !15, i64 2272, !15, i64 2276, !15, i64 2280, !15, i64 2284, !15, i64 2288, !15, i64 2292, !15, i64 2296, !15, i64 2300, !15, i64 2304, !15, i64 2308}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTS11GLFWvidmode", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20}
!20 = !{!"_ZTSSt4pairIiiE", !15, i64 0, !15, i64 4}
!21 = !{!10, !6, i64 184}
!22 = !{!12, !15, i64 2936}
!23 = !{!12, !15, i64 2940}
!24 = !{!12, !15, i64 2944}
!25 = !{!12, !15, i64 2948}
!26 = !{!10, !6, i64 88}
!27 = !{!10, !6, i64 96}
!28 = !{!10, !6, i64 56}
!29 = !{!12, !15, i64 2900}
!30 = !{!12, !15, i64 2904}
!31 = !{!12, !15, i64 2920}


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

declare noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6mujoco11GlfwAdapter16ToggleFullscreenEv(ptr noundef nonnull align 8 dereferenceable(2952) %0) unnamed_addr #1 align 2 {
  %2 = tail call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %3 = getelementptr inbounds i8, ptr %2, i64 80
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 2928
  %6 = load ptr, ptr %5, align 8, !tbaa !10
  %7 = tail call noundef ptr %4(ptr noundef %6)
  %.not = icmp eq ptr %7, null
  %8 = tail call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %9 = load ptr, ptr %5, align 8, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %0, i64 2936
  br i1 %.not, label %21, label %11

11:                                               ; preds = %1
  %12 = getelementptr inbounds i8, ptr %8, i64 184
  %13 = load ptr, ptr %12, align 8, !tbaa !20
  %14 = load i32, ptr %10, align 8, !tbaa !21
  %15 = getelementptr inbounds i8, ptr %0, i64 2940
  %16 = load i32, ptr %15, align 4, !tbaa !22
  %17 = getelementptr inbounds i8, ptr %0, i64 2944
  %18 = load i32, ptr %17, align 8, !tbaa !23
  %19 = getelementptr inbounds i8, ptr %0, i64 2948
  %20 = load i32, ptr %19, align 4, !tbaa !24
  tail call void %13(ptr noundef %9, ptr noundef null, i32 noundef %14, i32 noundef %16, i32 noundef %18, i32 noundef %20, i32 noundef 0)
  br label %45

21:                                               ; preds = %1
  %22 = getelementptr inbounds i8, ptr %8, i64 88
  %23 = load ptr, ptr %22, align 8, !tbaa !25
  %24 = getelementptr inbounds i8, ptr %0, i64 2940
  tail call void %23(ptr noundef %9, ptr noundef nonnull %10, ptr noundef nonnull %24)
  %25 = tail call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %26 = getelementptr inbounds i8, ptr %25, i64 96
  %27 = load ptr, ptr %26, align 8, !tbaa !26
  %28 = load ptr, ptr %5, align 8, !tbaa !10
  %29 = getelementptr inbounds i8, ptr %0, i64 2944
  %30 = getelementptr inbounds i8, ptr %0, i64 2948
  tail call void %27(ptr noundef %28, ptr noundef nonnull %29, ptr noundef nonnull %30)
  %31 = tail call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %32 = getelementptr inbounds i8, ptr %31, i64 184
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %34 = load ptr, ptr %5, align 8, !tbaa !10
  %35 = tail call noundef nonnull align 8 dereferenceable(264) ptr @_ZN6mujoco4GlfwEPv(ptr noundef null)
  %36 = getelementptr inbounds i8, ptr %35, i64 56
  %37 = load ptr, ptr %36, align 8, !tbaa !27
  %38 = tail call noundef ptr %37()
  %39 = getelementptr inbounds i8, ptr %0, i64 2900
  %40 = load i32, ptr %39, align 4, !tbaa !28
  %41 = getelementptr inbounds i8, ptr %0, i64 2904
  %42 = load i32, ptr %41, align 8, !tbaa !29
  %43 = getelementptr inbounds i8, ptr %0, i64 2920
  %44 = load i32, ptr %43, align 8, !tbaa !30
  tail call void %33(ptr noundef %34, ptr noundef %38, i32 noundef 0, i32 noundef 0, i32 noundef %40, i32 noundef %42, i32 noundef %44)
  br label %45

45:                                               ; preds = %21, %11
  ret void
}

attributes #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 = { 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" }

!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, !7, i64 80}
!6 = !{!"_ZTSN6mujoco4GlfwE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !7, i64 256}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 2928}
!11 = !{!"_ZTSN6mujoco11GlfwAdapterE", !12, i64 0, !18, i64 2900, !7, i64 2928, !19, i64 2936, !19, i64 2944}
!12 = !{!"_ZTSN6mujoco17PlatformUIAdapterE", !13, i64 8, !14, i64 552, !7, i64 560, !7, i64 568, !16, i64 576, !7, i64 2888, !14, i64 2896}
!13 = !{!"_ZTS10mjuiState_", !14, i64 0, !8, i64 4, !7, i64 408, !14, i64 416, !14, i64 420, !14, i64 424, !14, i64 428, !14, i64 432, !14, i64 436, !15, i64 440, !15, i64 448, !15, i64 456, !15, i64 464, !15, i64 472, !15, i64 480, !15, i64 488, !14, i64 496, !14, i64 500, !14, i64 504, !14, i64 508, !15, i64 512, !14, i64 520, !14, i64 524, !14, i64 528, !14, i64 532, !7, i64 536}
!14 = !{!"int", !8, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = !{!"_ZTS11mjrContext_", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !8, i64 20, !14, i64 36, !14, i64 40, !14, i64 44, !14, i64 48, !14, i64 52, !8, i64 56, !8, i64 96, !8, i64 136, !14, i64 176, !14, i64 180, !14, i64 184, !14, i64 188, !14, i64 192, !14, i64 196, !14, i64 200, !14, i64 204, !8, i64 208, !8, i64 248, !8, i64 288, !8, i64 328, !14, i64 368, !8, i64 372, !8, i64 772, !14, i64 1172, !14, i64 1176, !14, i64 1180, !14, i64 1184, !14, i64 1188, !14, i64 1192, !14, i64 1196, !14, i64 1200, !14, i64 1204, !14, i64 1208, !14, i64 1212, !14, i64 1216, !14, i64 1220, !7, i64 1224, !7, i64 1232, !7, i64 1240, !7, i64 1248, !8, i64 1256, !8, i64 1764, !14, i64 2272, !14, i64 2276, !14, i64 2280, !14, i64 2284, !14, i64 2288, !14, i64 2292, !14, i64 2296, !14, i64 2300, !14, i64 2304, !14, i64 2308}
!17 = !{!"float", !8, i64 0}
!18 = !{!"_ZTS11GLFWvidmode", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!19 = !{!"_ZTSSt4pairIiiE", !14, i64 0, !14, i64 4}
!20 = !{!6, !7, i64 184}
!21 = !{!11, !14, i64 2936}
!22 = !{!11, !14, i64 2940}
!23 = !{!11, !14, i64 2944}
!24 = !{!11, !14, i64 2948}
!25 = !{!6, !7, i64 88}
!26 = !{!6, !7, i64 96}
!27 = !{!6, !7, i64 56}
!28 = !{!11, !14, i64 2900}
!29 = !{!11, !14, i64 2904}
!30 = !{!11, !14, i64 2920}


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