; LLVM IR from unitreerobotics/kinect_teleoperate :: src/sample_helper_libs/window_controller_3d (WindowController3d)

; 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::lock_guard" = type { ptr }
%"class.Visualization::WindowController3d" = type { i8, i32, i32, i8, %class.ViewControl, %class.ViewControl, %class.ViewControl, %class.ViewControl, %"struct.std::array", %"class.Visualization::PointCloudRenderer", %"class.Visualization::SkeletonRenderer", %"class.Visualization::FloorRenderer", double, float, i32, i32, i32, i32, float, float, ptr, i8, i8, i32, [2 x float], ptr, ptr, ptr, ptr, %"class.std::mutex" }
%class.ViewControl = type { %struct.ViewParameters, %struct.Viewport, i8, float, float, float }
%struct.ViewParameters = type { [3 x float], float, [3 x float], float, float, [3 x float], [3 x float], [3 x float] }
%struct.Viewport = type { i32, i32, i32, i32 }
%"struct.std::array" = type { [4 x ptr] }
%"class.Visualization::PointCloudRenderer" = type { %"class.Visualization::RendererBase.base", float, %"class.std::optional", i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %"class.std::mutex" }
%"class.Visualization::RendererBase.base" = type <{ ptr, i8, [3 x i8], [4 x [4 x float]], [4 x [4 x float]], [4 x i8], ptr, i32, i32, i32 }>
%"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.base", [3 x i8] }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<float>::_Storage", i8 }>
%"union.std::_Optional_payload_base<float>::_Storage" = type { float }
%"class.Visualization::SkeletonRenderer" = type { %"class.Visualization::RendererBase.base", i8, i8, float, float, float, float, %"class.Visualization::Sphere", %"class.Visualization::Cylinder", %"class.Visualization::CoordinateAxes", %"class.std::vector.10", %"class.std::vector.15" }
%"class.Visualization::Sphere" = type <{ %"class.Visualization::RendererBase.base", float, i32, i32, %"class.std::vector", %"class.std::vector.0", i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Visualization::MonoVertex, std::allocator<Visualization::MonoVertex>>::_Vector_impl" }
%"struct.std::_Vector_base<Visualization::MonoVertex, std::allocator<Visualization::MonoVertex>>::_Vector_impl" = type { %"struct.std::_Vector_base<Visualization::MonoVertex, std::allocator<Visualization::MonoVertex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Visualization::MonoVertex, std::allocator<Visualization::MonoVertex>>::_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<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Visualization::Cylinder" = type <{ %"class.Visualization::RendererBase.base", float, float, i32, %"class.std::vector", %"class.std::vector.0", i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.Visualization::CoordinateAxes" = type { %"class.Visualization::RendererBase.base", float, float, %"class.std::vector.5", %"class.std::vector.0", i32, i32, i32, i32, i32, i32 }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Visualization::ColorVertex, std::allocator<Visualization::ColorVertex>>::_Vector_impl" }
%"struct.std::_Vector_base<Visualization::ColorVertex, std::allocator<Visualization::ColorVertex>>::_Vector_impl" = type { %"struct.std::_Vector_base<Visualization::ColorVertex, std::allocator<Visualization::ColorVertex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Visualization::ColorVertex, std::allocator<Visualization::ColorVertex>>::_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<Visualization::Joint, std::allocator<Visualization::Joint>>::_Vector_impl" }
%"struct.std::_Vector_base<Visualization::Joint, std::allocator<Visualization::Joint>>::_Vector_impl" = type { %"struct.std::_Vector_base<Visualization::Joint, std::allocator<Visualization::Joint>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Visualization::Joint, std::allocator<Visualization::Joint>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<Visualization::Bone, std::allocator<Visualization::Bone>>::_Vector_impl" }
%"struct.std::_Vector_base<Visualization::Bone, std::allocator<Visualization::Bone>>::_Vector_impl" = type { %"struct.std::_Vector_base<Visualization::Bone, std::allocator<Visualization::Bone>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Visualization::Bone, std::allocator<Visualization::Bone>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Visualization::FloorRenderer" = type <{ %"class.Visualization::RendererBase.base", [4 x [4 x float]], float, float, [4 x i8], %"class.std::vector", %"class.std::vector.0", i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__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 }

declare i32 @__gxx_personality_v0(...)

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

; 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
declare dso_local void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE3endEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13Visualization18WindowController3d13SetMirrorModeEb(ptr noundef nonnull align 8 dereferenceable(2184) %0, i1 noundef zeroext %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca %"class.std::lock_guard", align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %12 = zext i1 %1 to i8
  store i8 %12, ptr %4, align 1, !tbaa !9
  %13 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %14 = getelementptr inbounds %"class.Visualization::WindowController3d", ptr %13, i32 0, i32 29
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(40) %14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %15 = getelementptr inbounds %"class.Visualization::WindowController3d", ptr %13, i32 0, i32 8
  store ptr %15, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = call noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) %16) #5
  store ptr %17, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE3endEv(ptr noundef nonnull align 8 dereferenceable(32) %18) #5
  store ptr %19, ptr %8, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %32, %2
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = icmp ne ptr %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %39

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  store ptr %27, ptr %9, align 8, !tbaa !5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %30 = trunc i8 %29 to i1
  invoke void @_ZN11ViewControl13SetMirrorModeEb(ptr noundef nonnull align 4 dereferenceable(104) %28, i1 noundef zeroext %30)
          to label %31 unwind label %35

31:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds ptr, ptr %33, i32 1
  store ptr %34, ptr %7, align 8, !tbaa !5
  br label %20

35:                                               ; preds = %25
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %10, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %40

39:                                               ; preds = %24
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void

40:                                               ; preds = %35
  %41 = load ptr, ptr %10, align 8
  %42 = load i32, ptr %11, align 4
  %43 = insertvalue { ptr, i32 } poison, ptr %41, 0
  %44 = insertvalue { ptr, i32 } %43, i32 %42, 1
  resume { ptr, i32 } %44
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11ViewControl13SetMirrorModeEb(ptr noundef nonnull align 4 dereferenceable(104), i1 noundef zeroext) #2 align 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 = { mustprogress nounwind willreturn memory(none) 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 }
attributes #5 = { nounwind willreturn memory(none) }

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


; 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::lock_guard" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE3endEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13Visualization18WindowController3d13SetMirrorModeEb(ptr noundef nonnull align 8 dereferenceable(2184) %0, i1 noundef zeroext %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::lock_guard", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %4 = getelementptr inbounds i8, ptr %0, i64 2144
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(40) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 432
  %6 = call noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  %7 = call noundef ptr @_ZNSt5arrayIP11ViewControlLm4EE3endEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  %.not8 = icmp eq ptr %6, %7
  br i1 %.not8, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  ret void

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.09 = phi ptr [ %9, %.lr.ph ], [ %6, %2 ]
  %8 = load ptr, ptr %.09, align 8, !tbaa !5
  call void @_ZN11ViewControl13SetMirrorModeEb(ptr noundef nonnull align 4 dereferenceable(104) %8, i1 noundef zeroext %1)
  %9 = getelementptr inbounds i8, ptr %.09, i64 8
  %.not = icmp eq ptr %9, %7
  br i1 %.not, label %._crit_edge, label %.lr.ph
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11ViewControl13SetMirrorModeEb(ptr noundef nonnull align 4 dereferenceable(104), i1 noundef zeroext) local_unnamed_addr #2 align 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 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 }
attributes #5 = { nounwind willreturn memory(none) }

!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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass