; LLVM IR from vectozavr/3dzavr :: engine/components/geometry/TriangleMesh.ll (ZN12TriangleMesh15calculateBoundsEv)

; 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.Vec3D = type { %"struct.std::array.6" }
%"struct.std::array.6" = type { [3 x double] }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%struct.Bounds = type { %class.Vec3D, %class.Vec3D }
%class.TriangleMesh = type <{ %class.Component, %"class.std::enable_shared_from_this", %"class.std::vector", %"class.std::shared_ptr", %struct.Bounds, i8, [7 x i8] }>
%class.Component = type { ptr, ptr }
%"class.std::enable_shared_from_this" = type { %"class.std::weak_ptr" }
%"class.std::weak_ptr" = type { %"class.std::__weak_ptr" }
%"class.std::__weak_ptr" = type { ptr, %"class.std::__weak_count" }
%"class.std::__weak_count" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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 }

; 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 nounwind uwtable
declare dso_local ptr @_ZNSt6vectorI8TriangleSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP8TriangleSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12TriangleMesh15calculateBoundsEv(ptr noundef nonnull align 8 dereferenceable(121) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.Vec3D, align 8
  %4 = alloca %class.Vec3D, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.Bounds, align 8
  %13 = alloca %class.Vec3D, align 8
  %14 = alloca %class.Vec3D, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #7
  %16 = getelementptr inbounds %class.TriangleMesh, ptr %15, i32 0, i32 2
  %17 = call noundef zeroext i1 @_ZNKSt6vectorI8TriangleSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  br i1 %17, label %18, label %19

18:                                               ; preds = %1
  call void @llvm.memset.p0.i64(ptr align 8 %3, i8 0, i64 24, i1 false)
  call void @_ZN5Vec3DC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  br label %23

19:                                               ; preds = %1
  %20 = getelementptr inbounds %class.TriangleMesh, ptr %15, i32 0, i32 2
  %21 = call noundef nonnull align 8 dereferenceable(192) ptr @_ZNSt6vectorI8TriangleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef 0) #7
  %22 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %21, i32 noundef 0)
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(32) %22)
  br label %23

23:                                               ; preds = %19, %18
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #7
  call void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %24 = getelementptr inbounds %class.TriangleMesh, ptr %15, i32 0, i32 2
  store ptr %24, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call ptr @_ZNSt6vectorI8TriangleSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #7
  %27 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %26, ptr %27, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call ptr @_ZNSt6vectorI8TriangleSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #7
  %30 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %29, ptr %30, align 8
  br label %31

31:                                               ; preds = %82, %23
  %32 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP8TriangleSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br i1 %32, label %34, label %33

33:                                               ; preds = %31
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %84

34:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %35 = call noundef nonnull align 8 dereferenceable(192) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP8TriangleSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  store ptr %35, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %78, %34
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = icmp slt i32 %37, 3
  br i1 %38, label %40, label %39

39:                                               ; preds = %36
  store i32 4, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %81

40:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %74, %40
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = icmp slt i32 %42, 3
  br i1 %43, label %45, label %44

44:                                               ; preds = %41
  store i32 7, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %77

45:                                               ; preds = %41
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %47)
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %49, i32 noundef %50)
  %52 = load i32, ptr %11, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %51, i64 noundef %53)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull align 8 dereferenceable(8) %54)
  %56 = load double, ptr %55, align 8, !tbaa !11
  %57 = load i32, ptr %11, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %58)
  store double %56, ptr %59, align 8, !tbaa !11
  %60 = load i32, ptr %11, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %61)
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = load i32, ptr %10, align 4, !tbaa !9
  %65 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %63, i32 noundef %64)
  %66 = load i32, ptr %11, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %65, i64 noundef %67)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %62, ptr noundef nonnull align 8 dereferenceable(8) %68)
  %70 = load double, ptr %69, align 8, !tbaa !11
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %72)
  store double %70, ptr %73, align 8, !tbaa !11
  br label %74

74:                                               ; preds = %45
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %11, align 4, !tbaa !9
  br label %41, !llvm.loop !13

77:                                               ; preds = %44
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %10, align 4, !tbaa !9
  br label %36, !llvm.loop !15

81:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %82

82:                                               ; preds = %81
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP8TriangleSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  br label %31

84:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #7
  %85 = getelementptr inbounds %struct.Bounds, ptr %12, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #7
  call void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @_ZNK5Vec3DdvEd(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %85, ptr noundef nonnull align 8 dereferenceable(24) %13, double noundef 2.000000e+00)
  %86 = getelementptr inbounds %struct.Bounds, ptr %12, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #7
  call void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @_ZNK5Vec3DdvEd(ptr dead_on_unwind writable sret(%class.Vec3D) align 8 %86, ptr noundef nonnull align 8 dereferenceable(24) %14, double noundef 2.000000e+00)
  %87 = getelementptr inbounds %class.TriangleMesh, ptr %15, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %87, ptr align 8 %12, i64 48, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #7
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DdvEd(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192), i32 noundef) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

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

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 = { inlinehint 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 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 = { inlinehint 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i64 0, i64 24, !17, i64 24, i64 24, !17}
!17 = !{!7, !7, i64 0}


; 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.Vec3D = type { %"struct.std::array.6" }
%"struct.std::array.6" = type { [3 x double] }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%struct.Bounds = type { %class.Vec3D, %class.Vec3D }

; 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 nounwind uwtable
declare dso_local ptr @_ZNSt6vectorI8TriangleSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP8TriangleSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12TriangleMesh15calculateBoundsEv(ptr noundef nonnull align 8 dereferenceable(121) %0) local_unnamed_addr #3 align 2 {
  %2 = alloca %class.Vec3D, align 8
  %3 = alloca %class.Vec3D, align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %struct.Bounds, align 8
  %7 = alloca %class.Vec3D, align 8
  %8 = alloca %class.Vec3D, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #7
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = tail call noundef zeroext i1 @_ZNKSt6vectorI8TriangleSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #7
  br i1 %10, label %11, label %12

11:                                               ; preds = %1
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, i8 0, i64 24, i1 false)
  call void @_ZN5Vec3DC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  br label %15

12:                                               ; preds = %1
  %13 = tail call noundef nonnull align 8 dereferenceable(192) ptr @_ZNSt6vectorI8TriangleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef 0) #7
  %14 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %13, i32 noundef 0)
  call void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(32) %14)
  br label %15

15:                                               ; preds = %12, %11
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  call void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %16 = call ptr @_ZNSt6vectorI8TriangleSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #7
  store ptr %16, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %17 = call ptr @_ZNSt6vectorI8TriangleSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #7
  store ptr %17, ptr %5, align 8
  %18 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP8TriangleSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %59, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @_ZNK5Vec3DdvEd(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %7, double noundef 2.000000e+00)
  %19 = getelementptr inbounds i8, ptr %6, i64 24
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @_ZNK5Vec3DdvEd(ptr dead_on_unwind nonnull writable sret(%class.Vec3D) align 8 %19, ptr noundef nonnull align 8 dereferenceable(24) %8, double noundef 2.000000e+00)
  %20 = getelementptr inbounds i8, ptr %0, i64 72
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %20, ptr noundef nonnull align 8 dereferenceable(48) %6, i64 48, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #7
  ret void

.lr.ph:                                           ; preds = %15, %59
  %21 = call noundef nonnull align 8 dereferenceable(192) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP8TriangleSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph, %.preheader
  %.01618 = phi i32 [ 0, %.lr.ph ], [ %58, %.preheader ]
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 0)
  %23 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %21, i32 noundef %.01618)
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %23, i64 noundef 0)
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 0)
  store double %26, ptr %27, align 8, !tbaa !9
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0)
  %29 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %21, i32 noundef %.01618)
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %29, i64 noundef 0)
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(8) %30)
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0)
  store double %32, ptr %33, align 8, !tbaa !9
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1)
  %35 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %21, i32 noundef %.01618)
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %35, i64 noundef 1)
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull align 8 dereferenceable(8) %36)
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1)
  store double %38, ptr %39, align 8, !tbaa !9
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 1)
  %41 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %21, i32 noundef %.01618)
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %41, i64 noundef 1)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull align 8 dereferenceable(8) %42)
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 1)
  store double %44, ptr %45, align 8, !tbaa !9
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2)
  %47 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %21, i32 noundef %.01618)
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %47, i64 noundef 2)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef nonnull align 8 dereferenceable(8) %48)
  %50 = load double, ptr %49, align 8, !tbaa !9
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2)
  store double %50, ptr %51, align 8, !tbaa !9
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 2)
  %53 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192) %21, i32 noundef %.01618)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32) %53, i64 noundef 2)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull align 8 dereferenceable(8) %54)
  %56 = load double, ptr %55, align 8, !tbaa !9
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5Vec3DixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 2)
  store double %56, ptr %57, align 8, !tbaa !9
  %58 = add nuw nsw i32 %.01618, 1
  %exitcond.not = icmp eq i32 %58, 3
  br i1 %exitcond.not, label %59, label %.preheader, !llvm.loop !11

59:                                               ; preds = %.preheader
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP8TriangleSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %61 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP8TriangleSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br i1 %61, label %.lr.ph, label %._crit_edge
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DmiERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DplERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Vec3DdvEd(ptr dead_on_unwind noalias writable sret(%class.Vec3D) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Vec3DC2ERK5Vec4D(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5Vec3DC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorI8TriangleSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK8TriangleixEi(ptr noundef nonnull align 8 dereferenceable(192), i32 noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5Vec4DixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress 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 = { inlinehint 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 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 = { inlinehint 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 = !{i64 0, i64 24, !6, i64 24, i64 24, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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