; LLVM IR from atlantis13579/Riemann :: Src/CollisionPrimitive (Sphere3)

; 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.Maths::TVector3" = type { float, float, float }
%"class.Riemann::Sphere3" = type { %"class.Maths::TVector3", float }
%"class.Maths::Matrix3" = type { [3 x [3 x float]] }

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEmlEf(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), float noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN7Riemann7Sphere311EncapsulateERKN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(12)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann7Sphere327ComputeBoundingSphere_EigenEPKN5Maths8TVector3IfEEi(ptr dead_on_unwind noalias writable sret(%"class.Riemann::Sphere3") align 4 %0, ptr noundef %1, i32 noundef %2) #5 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca [3 x float], align 4
  %8 = alloca [3 x %"class.Maths::TVector3"], align 16
  %9 = alloca %"class.Maths::Matrix3", align 4
  %10 = alloca %"class.Maths::TVector3", align 4
  %11 = alloca float, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca i32, align 4
  %17 = alloca float, align 4
  %18 = alloca %"class.Maths::TVector3", align 4
  %19 = alloca %"class.Maths::TVector3", align 4
  %20 = alloca float, align 4
  %21 = alloca %"class.Maths::TVector3", align 4
  %22 = alloca %"class.Maths::TVector3", align 4
  %23 = alloca %"class.Maths::TVector3", align 4
  %24 = alloca %"class.Maths::TVector3", align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 36, ptr %8) #6
  %26 = getelementptr inbounds [3 x %"class.Maths::TVector3"], ptr %8, i32 0, i32 0
  %27 = getelementptr inbounds %"class.Maths::TVector3", ptr %26, i64 3
  br label %28

28:                                               ; preds = %28, %3
  %29 = phi ptr [ %26, %3 ], [ %30, %28 ]
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %29)
  %30 = getelementptr inbounds %"class.Maths::TVector3", ptr %29, i64 1
  %31 = icmp eq ptr %30, %27
  br i1 %31, label %32, label %28

32:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 36, ptr %9) #6
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN5Maths7Matrix323ComputeCovarianceMatrixEPKNS_8TVector3IfEEi(ptr dead_on_unwind writable sret(%"class.Maths::Matrix3") align 4 %9, ptr noundef %33, i32 noundef %34)
  %35 = getelementptr inbounds [3 x float], ptr %7, i64 0, i64 0
  %36 = getelementptr inbounds [3 x %"class.Maths::TVector3"], ptr %8, i64 0, i64 0
  %37 = call noundef zeroext i1 @_ZNK5Maths7Matrix319SolveEigenSymmetricEPfPNS_8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(36) %9, ptr noundef %35, ptr noundef %36)
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #6
  %38 = getelementptr inbounds [3 x %"class.Maths::TVector3"], ptr %8, i64 0, i64 0
  call void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %39 = getelementptr inbounds [3 x float], ptr %7, i64 0, i64 0
  %40 = load float, ptr %39, align 4, !tbaa !11
  %41 = call float @llvm.fabs.f32(float %40)
  store float %41, ptr %11, align 4, !tbaa !11
  %42 = getelementptr inbounds [3 x float], ptr %7, i64 0, i64 1
  %43 = load float, ptr %42, align 4, !tbaa !11
  %44 = call float @llvm.fabs.f32(float %43)
  %45 = load float, ptr %11, align 4, !tbaa !11
  %46 = fcmp ogt float %44, %45
  br i1 %46, label %47, label %53

47:                                               ; preds = %32
  %48 = getelementptr inbounds [3 x %"class.Maths::TVector3"], ptr %8, i64 0, i64 1
  %49 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %48)
  %50 = getelementptr inbounds [3 x float], ptr %7, i64 0, i64 1
  %51 = load float, ptr %50, align 4, !tbaa !11
  %52 = call float @llvm.fabs.f32(float %51)
  store float %52, ptr %11, align 4, !tbaa !11
  br label %53

53:                                               ; preds = %47, %32
  %54 = getelementptr inbounds [3 x float], ptr %7, i64 0, i64 2
  %55 = load float, ptr %54, align 4, !tbaa !11
  %56 = call float @llvm.fabs.f32(float %55)
  %57 = load float, ptr %11, align 4, !tbaa !11
  %58 = fcmp ogt float %56, %57
  br i1 %58, label %59, label %65

59:                                               ; preds = %53
  %60 = getelementptr inbounds [3 x %"class.Maths::TVector3"], ptr %8, i64 0, i64 2
  %61 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %60)
  %62 = getelementptr inbounds [3 x float], ptr %7, i64 0, i64 2
  %63 = load float, ptr %62, align 4, !tbaa !11
  %64 = call float @llvm.fabs.f32(float %63)
  store float %64, ptr %11, align 4, !tbaa !11
  br label %65

65:                                               ; preds = %59, %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 -1, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 -1, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store float 0x47EFFFFFE0000000, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store float 0xC7EFFFFFE0000000, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %91, %65
  %67 = load i32, ptr %16, align 4, !tbaa !9
  %68 = load i32, ptr %6, align 4, !tbaa !9
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %94

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = load i32, ptr %16, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds %"class.Maths::TVector3", ptr %72, i64 %74
  %76 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %75, ptr noundef nonnull align 4 dereferenceable(12) %10)
  store float %76, ptr %17, align 4, !tbaa !11
  %77 = load float, ptr %17, align 4, !tbaa !11
  %78 = load float, ptr %14, align 4, !tbaa !11
  %79 = fcmp olt float %77, %78
  br i1 %79, label %80, label %83

80:                                               ; preds = %71
  %81 = load float, ptr %17, align 4, !tbaa !11
  store float %81, ptr %14, align 4, !tbaa !11
  %82 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %82, ptr %12, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %80, %71
  %84 = load float, ptr %17, align 4, !tbaa !11
  %85 = load float, ptr %15, align 4, !tbaa !11
  %86 = fcmp ogt float %84, %85
  br i1 %86, label %87, label %90

87:                                               ; preds = %83
  %88 = load float, ptr %17, align 4, !tbaa !11
  store float %88, ptr %15, align 4, !tbaa !11
  %89 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %89, ptr %13, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %87, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %16, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %16, align 4, !tbaa !9
  br label %66, !llvm.loop !13

94:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #6
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = load i32, ptr %12, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds %"class.Maths::TVector3", ptr %95, i64 %97
  call void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %18, ptr noundef nonnull align 4 dereferenceable(12) %98)
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #6
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = load i32, ptr %13, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds %"class.Maths::TVector3", ptr %99, i64 %101
  call void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(12) %102)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #6
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %21, ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(12) %18)
  call void @llvm.lifetime.start.p0(i64 12, ptr %22) #6
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %22, ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(12) %18)
  %103 = call noundef float @_ZN5Maths10DotProductIfEET_RKNS_8TVector3IS1_EES5_(ptr noundef nonnull align 4 dereferenceable(12) %21, ptr noundef nonnull align 4 dereferenceable(12) %22)
  %104 = call float @sqrtf(float noundef %103) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #6
  store float %104, ptr %20, align 4, !tbaa !11
  call void @_ZN7Riemann7Sphere3C2Ev(ptr noundef nonnull align 4 dereferenceable(16) %0)
  %105 = load float, ptr %20, align 4, !tbaa !11
  %106 = fmul float %105, 5.000000e-01
  %107 = getelementptr inbounds %"class.Riemann::Sphere3", ptr %0, i32 0, i32 1
  store float %106, ptr %107, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr %24) #6
  call void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %24, ptr noundef nonnull align 4 dereferenceable(12) %18, ptr noundef nonnull align 4 dereferenceable(12) %19)
  call void @_ZNK5Maths8TVector3IfEmlEf(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %23, ptr noundef nonnull align 4 dereferenceable(12) %24, float noundef 5.000000e-01)
  %108 = getelementptr inbounds %"class.Riemann::Sphere3", ptr %0, i32 0, i32 0
  %109 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %108, ptr noundef nonnull align 4 dereferenceable(12) %23)
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 0, ptr %25, align 4, !tbaa !9
  br label %110

110:                                              ; preds = %121, %94
  %111 = load i32, ptr %25, align 4, !tbaa !9
  %112 = load i32, ptr %6, align 4, !tbaa !9
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %124

115:                                              ; preds = %110
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = load i32, ptr %25, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds %"class.Maths::TVector3", ptr %116, i64 %118
  %120 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN7Riemann7Sphere311EncapsulateERKN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(12) %119)
  br label %121

121:                                              ; preds = %115
  %122 = load i32, ptr %25, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %25, align 4, !tbaa !9
  br label %110, !llvm.loop !18

124:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 36, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 36, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #6
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Maths7Matrix323ComputeCovarianceMatrixEPKNS_8TVector3IfEEi(ptr dead_on_unwind noalias writable sret(%"class.Maths::Matrix3") align 4, ptr noundef, i32 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5Maths7Matrix319SolveEigenSymmetricEPfPNS_8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(36), ptr noundef, ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN5Maths10DotProductIfEET_RKNS_8TVector3IS1_EES5_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann7Sphere3C2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nounwind "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { 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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !12, i64 12}
!16 = !{!"_ZTSN7Riemann7Sphere3E", !17, i64 0, !12, i64 12}
!17 = !{!"_ZTSN5Maths8TVector3IfEE", !12, i64 0, !12, i64 4, !12, i64 8}
!18 = distinct !{!18, !14}


; 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.Maths::TVector3" = type { float, float, float }
%"class.Riemann::Sphere3" = type { %"class.Maths::TVector3", float }
%"class.Maths::Matrix3" = type { [3 x [3 x float]] }

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEmlEf(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), float noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @sqrtf(float noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN7Riemann7Sphere311EncapsulateERKN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann7Sphere327ComputeBoundingSphere_EigenEPKN5Maths8TVector3IfEEi(ptr dead_on_unwind noalias writable sret(%"class.Riemann::Sphere3") align 4 %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #5 align 2 {
  %4 = alloca [3 x float], align 8
  %5 = alloca [3 x %"class.Maths::TVector3"], align 16
  %6 = alloca %"class.Maths::Matrix3", align 4
  %7 = alloca %"class.Maths::TVector3", align 4
  %8 = alloca %"class.Maths::TVector3", align 4
  %9 = alloca %"class.Maths::TVector3", align 4
  %10 = alloca %"class.Maths::TVector3", align 4
  %11 = alloca %"class.Maths::TVector3", align 4
  %12 = alloca %"class.Maths::TVector3", align 4
  %13 = alloca %"class.Maths::TVector3", align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %5) #7
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %5)
  %.ptr.1 = getelementptr inbounds i8, ptr %5, i64 12
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %5, i64 24
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %6) #7
  call void @_ZN5Maths7Matrix323ComputeCovarianceMatrixEPKNS_8TVector3IfEEi(ptr dead_on_unwind nonnull writable sret(%"class.Maths::Matrix3") align 4 %6, ptr noundef %1, i32 noundef %2)
  %14 = call noundef zeroext i1 @_ZNK5Maths7Matrix319SolveEigenSymmetricEPfPNS_8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(36) %6, ptr noundef nonnull %4, ptr noundef nonnull %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #7
  call void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %5)
  %15 = load <2 x float>, ptr %4, align 8, !tbaa !5
  %16 = call <2 x float> @llvm.fabs.v2f32(<2 x float> %15)
  %17 = extractelement <2 x float> %16, i64 0
  %18 = extractelement <2 x float> %16, i64 1
  %19 = fcmp ogt float %18, %17
  br i1 %19, label %20, label %25

20:                                               ; preds = %3
  %21 = getelementptr inbounds i8, ptr %4, i64 4
  %22 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %23 = load float, ptr %21, align 4, !tbaa !5
  %24 = call float @llvm.fabs.f32(float %23)
  br label %25

25:                                               ; preds = %20, %3
  %.026 = phi float [ %24, %20 ], [ %17, %3 ]
  %26 = getelementptr inbounds i8, ptr %4, i64 8
  %27 = load float, ptr %26, align 8, !tbaa !5
  %28 = call float @llvm.fabs.f32(float %27)
  %29 = fcmp ogt float %28, %.026
  br i1 %29, label %30, label %32

30:                                               ; preds = %25
  %31 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  br label %32

32:                                               ; preds = %30, %25
  %33 = icmp sgt i32 %2, 0
  br i1 %33, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %32
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.lr.ph

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %34 = sext i32 %.1 to i64
  %35 = sext i32 %.134 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %32
  %.033.lcssa = phi i64 [ -1, %32 ], [ %35, %._crit_edge.loopexit ]
  %.027.lcssa = phi i64 [ -1, %32 ], [ %34, %._crit_edge.loopexit ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  %36 = getelementptr inbounds %"class.Maths::TVector3", ptr %1, i64 %.027.lcssa
  call void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %36)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #7
  %37 = getelementptr inbounds %"class.Maths::TVector3", ptr %1, i64 %.033.lcssa
  call void @_ZN5Maths8TVector3IfEC2ERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %37)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #7
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %10, ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %8)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #7
  call void @_ZNK5Maths8TVector3IfEmiERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %11, ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %8)
  %38 = call noundef float @_ZN5Maths10DotProductIfEET_RKNS_8TVector3IS1_EES5_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %11)
  %39 = call float @sqrtf(float noundef %38) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #7
  call void @_ZN7Riemann7Sphere3C2Ev(ptr noundef nonnull align 4 dereferenceable(16) %0)
  %40 = fmul float %39, 5.000000e-01
  %41 = getelementptr inbounds i8, ptr %0, i64 12
  store float %40, ptr %41, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #7
  call void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %13, ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @_ZNK5Maths8TVector3IfEmlEf(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %12, ptr noundef nonnull align 4 dereferenceable(12) %13, float noundef 5.000000e-01)
  %42 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %12)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %12) #7
  br i1 %33, label %.lr.ph48.preheader, label %._crit_edge49

.lr.ph48.preheader:                               ; preds = %._crit_edge
  %wide.trip.count54 = zext nneg i32 %2 to i64
  br label %.lr.ph48

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.02744 = phi i32 [ -1, %.lr.ph.preheader ], [ %.1, %.lr.ph ]
  %.02942 = phi float [ 0xC7EFFFFFE0000000, %.lr.ph.preheader ], [ %.130, %.lr.ph ]
  %.03141 = phi float [ 0x47EFFFFFE0000000, %.lr.ph.preheader ], [ %.132, %.lr.ph ]
  %.03340 = phi i32 [ -1, %.lr.ph.preheader ], [ %.134, %.lr.ph ]
  %43 = getelementptr inbounds %"class.Maths::TVector3", ptr %1, i64 %indvars.iv
  %44 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %43, ptr noundef nonnull align 4 dereferenceable(12) %7)
  %45 = fcmp olt float %44, %.03141
  %.132 = select i1 %45, float %44, float %.03141
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  %.1 = select i1 %45, i32 %46, i32 %.02744
  %47 = fcmp ogt float %44, %.02942
  %.134 = select i1 %47, i32 %46, i32 %.03340
  %.130 = select i1 %47, float %44, float %.02942
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !12

._crit_edge49:                                    ; preds = %.lr.ph48, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  ret void

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %.lr.ph48
  %indvars.iv51 = phi i64 [ 0, %.lr.ph48.preheader ], [ %indvars.iv.next52, %.lr.ph48 ]
  %48 = getelementptr inbounds %"class.Maths::TVector3", ptr %1, i64 %indvars.iv51
  %49 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN7Riemann7Sphere311EncapsulateERKN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(12) %48)
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond55.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count54
  br i1 %exitcond55.not, label %._crit_edge49, label %.lr.ph48, !llvm.loop !14
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Maths7Matrix323ComputeCovarianceMatrixEPKNS_8TVector3IfEEi(ptr dead_on_unwind noalias writable sret(%"class.Maths::Matrix3") align 4, ptr noundef, i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5Maths7Matrix319SolveEigenSymmetricEPfPNS_8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(36), ptr noundef, ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN5Maths10DotProductIfEET_RKNS_8TVector3IS1_EES5_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann7Sphere3C2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #5 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fabs.v2f32(<2 x float>) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 nofree nounwind willreturn memory(write) "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 12}
!10 = !{!"_ZTSN7Riemann7Sphere3E", !11, i64 0, !6, i64 12}
!11 = !{!"_ZTSN5Maths8TVector3IfEE", !6, i64 0, !6, i64 4, !6, i64 8}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass