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

; 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.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::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::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 }
%"struct.Visualization::MonoVertex" = type { [3 x float], [3 x float] }
%"class.Visualization::RendererBase" = type <{ ptr, i8, [3 x i8], [4 x [4 x float]], [4 x [4 x float]], [4 x i8], ptr, i32, i32, i32, [4 x i8] }>

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN13Visualization10MonoVertexESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN13Visualization10MonoVertexESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #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
declare dso_local void @_ZN13Visualization8Cylinder9UpdateVAOEv(ptr noundef nonnull align 8 dereferenceable(252)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13Visualization8Cylinder9SetHeightEf(ptr noundef nonnull align 8 dereferenceable(252) %0, float noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  %8 = load float, ptr %4, align 4, !tbaa !9
  %9 = fcmp ole float %8, 0.000000e+00
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  br label %42

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %12 = load float, ptr %4, align 4, !tbaa !9
  %13 = getelementptr inbounds %"class.Visualization::Cylinder", ptr %7, i32 0, i32 2
  %14 = load float, ptr %13, align 8, !tbaa !11
  %15 = fdiv float %12, %14
  store float %15, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !24
  br label %16

16:                                               ; preds = %31, %11
  %17 = load i64, ptr %6, align 8, !tbaa !24
  %18 = getelementptr inbounds %"class.Visualization::Cylinder", ptr %7, i32 0, i32 4
  %19 = call noundef i64 @_ZNKSt6vectorIN13Visualization10MonoVertexESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #3
  %20 = icmp ult i64 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %34

22:                                               ; preds = %16
  %23 = load float, ptr %5, align 4, !tbaa !9
  %24 = getelementptr inbounds %"class.Visualization::Cylinder", ptr %7, i32 0, i32 4
  %25 = load i64, ptr %6, align 8, !tbaa !24
  %26 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN13Visualization10MonoVertexESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %25) #3
  %27 = getelementptr inbounds %"struct.Visualization::MonoVertex", ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds [3 x float], ptr %27, i64 0, i64 2
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = fmul float %29, %23
  store float %30, ptr %28, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %22
  %32 = load i64, ptr %6, align 8, !tbaa !24
  %33 = add i64 %32, 1
  store i64 %33, ptr %6, align 8, !tbaa !24
  br label %16, !llvm.loop !26

34:                                               ; preds = %21
  %35 = load float, ptr %4, align 4, !tbaa !9
  %36 = getelementptr inbounds %"class.Visualization::Cylinder", ptr %7, i32 0, i32 2
  store float %35, ptr %36, align 8, !tbaa !11
  %37 = getelementptr inbounds %"class.Visualization::RendererBase", ptr %7, i32 0, i32 1
  %38 = load i8, ptr %37, align 8, !tbaa !28, !range !29, !noundef !30
  %39 = trunc i8 %38 to i1
  br i1 %39, label %40, label %41

40:                                               ; preds = %34
  call void @_ZN13Visualization8Cylinder9UpdateVAOEv(ptr noundef nonnull align 8 dereferenceable(252) %7)
  br label %41

41:                                               ; preds = %40, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %42

42:                                               ; preds = %41, %10
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 168}
!12 = !{!"_ZTSN13Visualization8CylinderE", !13, i64 0, !10, i64 164, !10, i64 168, !15, i64 172, !16, i64 176, !20, i64 200, !15, i64 224, !15, i64 228, !15, i64 232, !15, i64 236, !15, i64 240, !15, i64 244, !15, i64 248}
!13 = !{!"_ZTSN13Visualization12RendererBaseE", !14, i64 8, !7, i64 12, !7, i64 76, !6, i64 144, !15, i64 152, !15, i64 156, !15, i64 160}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSSt6vectorIN13Visualization10MonoVertexESaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIN13Visualization10MonoVertexESaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN13Visualization10MonoVertexESaIS1_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN13Visualization10MonoVertexESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_ZTSSt6vectorIjSaIjEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!25, !25, i64 0}
!25 = !{!"long", !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!13, !14, i64 8}
!29 = !{i8 0, i8 2}
!30 = !{}


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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN13Visualization10MonoVertexESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN13Visualization10MonoVertexESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13Visualization8Cylinder9SetHeightEf(ptr noundef nonnull align 8 dereferenceable(252) %0, float noundef %1) local_unnamed_addr #1 align 2 {
  %3 = fcmp ugt float %1, 0.000000e+00
  br i1 %3, label %4, label %21

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 168
  %6 = load float, ptr %5, align 8, !tbaa !5
  %7 = fdiv float %1, %6
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  %9 = tail call noundef i64 @_ZNKSt6vectorIN13Visualization10MonoVertexESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #2
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %4
  store float %1, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load i8, ptr %10, align 8, !tbaa !22, !range !23, !noundef !24
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %20, label %21

.lr.ph:                                           ; preds = %4, %.lr.ph
  %.08 = phi i64 [ %17, %.lr.ph ], [ 0, %4 ]
  %13 = tail call noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN13Visualization10MonoVertexESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %.08) #2
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = load float, ptr %14, align 4, !tbaa !25
  %16 = fmul float %7, %15
  store float %16, ptr %14, align 4, !tbaa !25
  %17 = add nuw i64 %.08, 1
  %18 = tail call noundef i64 @_ZNKSt6vectorIN13Visualization10MonoVertexESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #2
  %19 = icmp ult i64 %17, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !26

20:                                               ; preds = %._crit_edge
  tail call void @_ZN13Visualization8Cylinder9UpdateVAOEv(ptr noundef nonnull align 8 dereferenceable(252) %0)
  br label %21

21:                                               ; preds = %._crit_edge, %20, %2
  ret void
}

attributes #0 = { 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 #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 = { 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, !13, i64 168}
!6 = !{!"_ZTSN13Visualization8CylinderE", !7, i64 0, !13, i64 164, !13, i64 168, !12, i64 172, !14, i64 176, !18, i64 200, !12, i64 224, !12, i64 228, !12, i64 232, !12, i64 236, !12, i64 240, !12, i64 244, !12, i64 248}
!7 = !{!"_ZTSN13Visualization12RendererBaseE", !8, i64 8, !9, i64 12, !9, i64 76, !11, i64 144, !12, i64 152, !12, i64 156, !12, i64 160}
!8 = !{!"bool", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!"float", !9, i64 0}
!14 = !{!"_ZTSSt6vectorIN13Visualization10MonoVertexESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN13Visualization10MonoVertexESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN13Visualization10MonoVertexESaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN13Visualization10MonoVertexESaIS1_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!18 = !{!"_ZTSSt6vectorIjSaIjEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!22 = !{!7, !8, i64 8}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!13, !13, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass