; LLVM IR from jrouwe/JoltPhysics :: Jolt/Geometry (ConvexHullBuilder)

; 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.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"struct.JPH::AssertLastParam" = type { i8 }
%"class.JPH::ConvexHullBuilder" = type { ptr, %"class.JPH::Array.2", %"class.JPH::Array.5" }
%"class.JPH::Array.2" = type { i64, i64, ptr }
%"class.JPH::Array.5" = type { i64, i64, ptr }
%"class.JPH::ConvexHullBuilder::Face" = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Array", ptr, float, i8, [11 x i8] }>
%"class.JPH::Array" = type { i64, i64, ptr }

@.str.1 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [18 x i8], align 1

; 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: 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) #1

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #3

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

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH17ConvexHullBuilder19GetDistanceToEdgeSqENS_4Vec3EPKNS0_4FaceE(ptr noundef nonnull align 8 dereferenceable(56), double, double, ptr noundef) #6 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH17ConvexHullBuilder25DetermineCoplanarDistanceEv(ptr noundef nonnull align 8 dereferenceable(56)) #6 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH17ConvexHullBuilder17DetermineMaxErrorERPNS0_4FaceERfRiS4_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4) #6 align 2 {
  %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 float, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.JPH::Vec3", align 16
  %17 = alloca float, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca float, align 4
  %24 = alloca %"struct.JPH::AssertLastParam", align 1
  %25 = alloca float, align 4
  %26 = alloca %"class.JPH::Vec3", align 16
  %27 = alloca %"class.JPH::Vec3", align 16
  %28 = alloca float, align 4
  %29 = alloca %"class.JPH::Vec3", align 16
  %30 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %31 = load ptr, ptr %6, align 8
  %32 = call noundef float @_ZNK3JPH17ConvexHullBuilder25DetermineCoplanarDistanceEv(ptr noundef nonnull align 8 dereferenceable(56) %31)
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  store float %32, ptr %33, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store float 0.000000e+00, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 -1, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %34

34:                                               ; preds = %143, %5
  %35 = load i32, ptr %14, align 4, !tbaa !11
  %36 = getelementptr inbounds %"class.JPH::ConvexHullBuilder", ptr %31, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !13
  %38 = call noundef i64 @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %37)
  %39 = trunc i64 %38 to i32
  %40 = icmp slt i32 %35, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %34
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %146

42:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #8
  %43 = getelementptr inbounds %"class.JPH::ConvexHullBuilder", ptr %31, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = load i32, ptr %14, align 4, !tbaa !11
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %46)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 %47, i64 16, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store float 0x47EFFFFFE0000000, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %48 = getelementptr inbounds %"class.JPH::ConvexHullBuilder", ptr %31, i32 0, i32 1
  store ptr %48, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %49 = load ptr, ptr %19, align 8, !tbaa !5
  %50 = call noundef ptr @_ZNK3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %49)
  store ptr %50, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %51 = load ptr, ptr %19, align 8, !tbaa !5
  %52 = call noundef ptr @_ZNK3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %51)
  store ptr %52, ptr %21, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %126, %42
  %54 = load ptr, ptr %20, align 8, !tbaa !5
  %55 = load ptr, ptr %21, align 8, !tbaa !5
  %56 = icmp ne ptr %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %129

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %59 = load ptr, ptr %20, align 8, !tbaa !5
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  store ptr %60, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  %61 = load ptr, ptr %22, align 8, !tbaa !5
  %62 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %61, i32 0, i32 0
  %63 = call noundef float @_ZNK3JPH4Vec36LengthEv(ptr noundef nonnull align 16 dereferenceable(16) %62)
  store float %63, ptr %23, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %58
  %65 = load float, ptr %23, align 4, !tbaa !9
  %66 = fcmp ogt float %65, 0.000000e+00
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.36, ptr noundef @.str.1, i32 noundef 1331)
  br i1 %68, label %69, label %70

69:                                               ; preds = %67
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #8, !srcloc !20
  br label %70

70:                                               ; preds = %69, %67, %64
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  %73 = load ptr, ptr %22, align 8, !tbaa !5
  %74 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %22, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %75, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %27, ptr align 16 %76, i64 16, i1 false), !tbaa.struct !18
  %77 = getelementptr inbounds { double, double }, ptr %27, i32 0, i32 0
  %78 = load double, ptr %77, align 16
  %79 = getelementptr inbounds { double, double }, ptr %27, i32 0, i32 1
  %80 = load double, ptr %79, align 8
  %81 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %16, double %78, double %80)
  %82 = getelementptr inbounds %"class.JPH::Vec3", ptr %26, i32 0, i32 0
  %83 = getelementptr inbounds %union.anon, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds { double, double }, ptr %83, i32 0, i32 0
  %85 = extractvalue { double, double } %81, 0
  store double %85, ptr %84, align 16
  %86 = getelementptr inbounds { double, double }, ptr %83, i32 0, i32 1
  %87 = extractvalue { double, double } %81, 1
  store double %87, ptr %86, align 8
  %88 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 0
  %89 = load double, ptr %88, align 16
  %90 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 1
  %91 = load double, ptr %90, align 8
  %92 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %74, double %89, double %91)
  %93 = load float, ptr %23, align 4, !tbaa !9
  %94 = fdiv float %92, %93
  store float %94, ptr %25, align 4, !tbaa !9
  %95 = load float, ptr %25, align 4, !tbaa !9
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = load float, ptr %96, align 4, !tbaa !9
  %98 = fneg float %97
  %99 = fcmp ogt float %95, %98
  br i1 %99, label %100, label %125

100:                                              ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %29, ptr align 16 %16, i64 16, i1 false), !tbaa.struct !18
  %101 = load ptr, ptr %22, align 8, !tbaa !5
  %102 = getelementptr inbounds { double, double }, ptr %29, i32 0, i32 0
  %103 = load double, ptr %102, align 16
  %104 = getelementptr inbounds { double, double }, ptr %29, i32 0, i32 1
  %105 = load double, ptr %104, align 8
  %106 = call noundef float @_ZNK3JPH17ConvexHullBuilder19GetDistanceToEdgeSqENS_4Vec3EPKNS0_4FaceE(ptr noundef nonnull align 8 dereferenceable(56) %31, double %103, double %105, ptr noundef %101)
  store float %106, ptr %28, align 4, !tbaa !9
  %107 = load float, ptr %28, align 4, !tbaa !9
  %108 = load float, ptr %17, align 4, !tbaa !9
  %109 = fcmp olt float %107, %108
  br i1 %109, label %110, label %113

110:                                              ; preds = %100
  %111 = load float, ptr %28, align 4, !tbaa !9
  store float %111, ptr %17, align 4, !tbaa !9
  %112 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %112, ptr %18, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %110, %100
  %114 = load float, ptr %28, align 4, !tbaa !9
  %115 = fcmp oeq float %114, 0.000000e+00
  br i1 %115, label %116, label %124

116:                                              ; preds = %113
  %117 = load float, ptr %25, align 4, !tbaa !9
  %118 = load float, ptr %11, align 4, !tbaa !9
  %119 = fcmp ogt float %117, %118
  br i1 %119, label %120, label %124

120:                                              ; preds = %116
  %121 = load float, ptr %25, align 4, !tbaa !9
  store float %121, ptr %11, align 4, !tbaa !9
  %122 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %122, ptr %12, align 8, !tbaa !5
  %123 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %123, ptr %13, align 4, !tbaa !11
  br label %124

124:                                              ; preds = %120, %116, %113
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  br label %125

125:                                              ; preds = %124, %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %20, align 8, !tbaa !5
  %128 = getelementptr inbounds ptr, ptr %127, i32 1
  store ptr %128, ptr %20, align 8, !tbaa !5
  br label %53

129:                                              ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  %130 = load float, ptr %17, align 4, !tbaa !9
  %131 = call noundef float @_ZSt4sqrtf(float noundef %130)
  store float %131, ptr %30, align 4, !tbaa !9
  %132 = load ptr, ptr %18, align 8, !tbaa !5
  %133 = icmp ne ptr %132, null
  br i1 %133, label %134, label %142

134:                                              ; preds = %129
  %135 = load float, ptr %30, align 4, !tbaa !9
  %136 = load float, ptr %11, align 4, !tbaa !9
  %137 = fcmp ogt float %135, %136
  br i1 %137, label %138, label %142

138:                                              ; preds = %134
  %139 = load float, ptr %30, align 4, !tbaa !9
  store float %139, ptr %11, align 4, !tbaa !9
  %140 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %140, ptr %12, align 8, !tbaa !5
  %141 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %141, ptr %13, align 4, !tbaa !11
  br label %142

142:                                              ; preds = %138, %134, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #8
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %14, align 4, !tbaa !11
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %14, align 4, !tbaa !11
  br label %34, !llvm.loop !21

146:                                              ; preds = %41
  %147 = load ptr, ptr %12, align 8, !tbaa !5
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %147, ptr %148, align 8, !tbaa !5
  %149 = load float, ptr %11, align 4, !tbaa !9
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  store float %149, ptr %150, align 4, !tbaa !9
  %151 = load i32, ptr %13, align 4, !tbaa !11
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %151, ptr %152, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH4Vec36LengthEv(ptr noundef nonnull align 16 dereferenceable(16)) #7 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 = { 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 #4 = { 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 #5 = { alwaysinline 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 #6 = { 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 #7 = { alwaysinline 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 #8 = { 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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSN3JPH17ConvexHullBuilderE", !6, i64 0, !15, i64 8, !17, i64 32}
!15 = !{!"_ZTSN3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEEE", !16, i64 0, !16, i64 8, !6, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN3JPH5ArrayINS_17ConvexHullBuilder8CoplanarENS_12STLAllocatorIS2_EEEE", !16, i64 0, !16, i64 8, !6, i64 16}
!18 = !{i64 0, i64 16, !19}
!19 = !{!7, !7, i64 0}
!20 = !{i64 2157058440}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; 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.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

@.str.1 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [18 x i8], align 1

; 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 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) #1

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH17ConvexHullBuilder19GetDistanceToEdgeSqENS_4Vec3EPKNS0_4FaceE(ptr noundef nonnull align 8 dereferenceable(56), double, double, ptr noundef) local_unnamed_addr #6 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH17ConvexHullBuilder25DetermineCoplanarDistanceEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #6 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH17ConvexHullBuilder17DetermineMaxErrorERPNS0_4FaceERfRiS4_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %1, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %2, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %3, ptr nocapture noundef nonnull align 4 dereferenceable(4) %4) local_unnamed_addr #6 align 2 {
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = tail call noundef float @_ZNK3JPH17ConvexHullBuilder25DetermineCoplanarDistanceEv(ptr noundef nonnull align 8 dereferenceable(56) %0)
  store float %7, ptr %4, align 4, !tbaa !5
  %8 = load ptr, ptr %0, align 8, !tbaa !9
  %9 = tail call noundef i64 @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %10 = trunc i64 %9 to i32
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph84, label %._crit_edge85

.lr.ph84:                                         ; preds = %5
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  br label %13

._crit_edge85:                                    ; preds = %._crit_edge, %5
  %.050.lcssa = phi i32 [ -1, %5 ], [ %.454, %._crit_edge ]
  %.045.lcssa = phi ptr [ null, %5 ], [ %.449, %._crit_edge ]
  %.0.lcssa = phi float [ 0.000000e+00, %5 ], [ %.4, %._crit_edge ]
  store ptr %.045.lcssa, ptr %1, align 8, !tbaa !15
  store float %.0.lcssa, ptr %2, align 4, !tbaa !5
  store i32 %.050.lcssa, ptr %3, align 4, !tbaa !16
  ret void

13:                                               ; preds = %.lr.ph84, %._crit_edge
  %indvars.iv = phi i64 [ 0, %.lr.ph84 ], [ %indvars.iv.next, %._crit_edge ]
  %.082 = phi float [ 0.000000e+00, %.lr.ph84 ], [ %.4, %._crit_edge ]
  %.04581 = phi ptr [ null, %.lr.ph84 ], [ %.449, %._crit_edge ]
  %.05080 = phi i32 [ -1, %.lr.ph84 ], [ %.454, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  %14 = load ptr, ptr %0, align 8, !tbaa !9
  %15 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %indvars.iv)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %6, ptr noundef nonnull align 16 dereferenceable(16) %15, i64 16, i1 false), !tbaa.struct !18
  %16 = call noundef ptr @_ZNK3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %17 = call noundef ptr @_ZNK3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %.not68 = icmp eq ptr %16, %17
  br i1 %.not68, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %13
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph

._crit_edge:                                      ; preds = %47, %13
  %.059.lcssa = phi ptr [ null, %13 ], [ %.261, %47 ]
  %.056.lcssa = phi float [ 0x47EFFFFFE0000000, %13 ], [ %.258, %47 ]
  %.151.lcssa = phi i32 [ %.05080, %13 ], [ %.353, %47 ]
  %.146.lcssa = phi ptr [ %.04581, %13 ], [ %.348, %47 ]
  %.1.lcssa = phi float [ %.082, %13 ], [ %.3, %47 ]
  %19 = call noundef float @_ZSt4sqrtf(float noundef %.056.lcssa)
  %.not66 = icmp ne ptr %.059.lcssa, null
  %20 = fcmp ogt float %19, %.1.lcssa
  %or.cond67 = select i1 %.not66, i1 %20, i1 false
  %21 = trunc nuw nsw i64 %indvars.iv to i32
  %.454 = select i1 %or.cond67, i32 %21, i32 %.151.lcssa
  %.449 = select i1 %or.cond67, ptr %.059.lcssa, ptr %.146.lcssa
  %.4 = select i1 %or.cond67, float %19, float %.1.lcssa
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load ptr, ptr %0, align 8, !tbaa !9
  %23 = call noundef i64 @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %sext = shl i64 %23, 32
  %24 = ashr exact i64 %sext, 32
  %25 = icmp slt i64 %indvars.iv.next, %24
  br i1 %25, label %13, label %._crit_edge85, !llvm.loop !20

.lr.ph:                                           ; preds = %.lr.ph.preheader, %47
  %.174 = phi float [ %.3, %47 ], [ %.082, %.lr.ph.preheader ]
  %.14673 = phi ptr [ %.348, %47 ], [ %.04581, %.lr.ph.preheader ]
  %.15172 = phi i32 [ %.353, %47 ], [ %.05080, %.lr.ph.preheader ]
  %.05671 = phi float [ %.258, %47 ], [ 0x47EFFFFFE0000000, %.lr.ph.preheader ]
  %.05970 = phi ptr [ %.261, %47 ], [ null, %.lr.ph.preheader ]
  %.06269 = phi ptr [ %48, %47 ], [ %16, %.lr.ph.preheader ]
  %26 = load ptr, ptr %.06269, align 8, !tbaa !15
  %27 = call noundef float @_ZNK3JPH4Vec36LengthEv(ptr noundef nonnull align 16 dereferenceable(16) %26)
  %28 = fcmp ogt float %27, 0.000000e+00
  br i1 %28, label %32, label %29

29:                                               ; preds = %.lr.ph
  %30 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.36, ptr noundef nonnull @.str.1, i32 noundef 1331)
  br i1 %30, label %31, label %32

31:                                               ; preds = %29
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #8, !srcloc !22
  br label %32

32:                                               ; preds = %31, %29, %.lr.ph
  %33 = getelementptr inbounds i8, ptr %26, i64 16
  %.sroa.05.0.copyload = load double, ptr %33, align 16
  %.sroa.26.0..sroa_idx = getelementptr inbounds i8, ptr %26, i64 24
  %.sroa.26.0.copyload = load double, ptr %.sroa.26.0..sroa_idx, align 8, !tbaa !19
  %34 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %6, double %.sroa.05.0.copyload, double %.sroa.26.0.copyload)
  %35 = extractvalue { double, double } %34, 0
  %36 = extractvalue { double, double } %34, 1
  %37 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %26, double %35, double %36)
  %38 = fdiv float %37, %27
  %39 = load float, ptr %4, align 4, !tbaa !5
  %40 = fneg float %39
  %41 = fcmp ogt float %38, %40
  br i1 %41, label %42, label %47

42:                                               ; preds = %32
  %.sroa.0.0.copyload = load double, ptr %6, align 16
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !19
  %43 = call noundef float @_ZNK3JPH17ConvexHullBuilder19GetDistanceToEdgeSqENS_4Vec3EPKNS0_4FaceE(ptr noundef nonnull align 8 dereferenceable(56) %0, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload, ptr noundef nonnull %26)
  %44 = fcmp olt float %43, %.05671
  %.160 = select i1 %44, ptr %26, ptr %.05970
  %.157 = select i1 %44, float %43, float %.05671
  %45 = fcmp oeq float %43, 0.000000e+00
  %46 = fcmp ogt float %38, %.174
  %or.cond = select i1 %45, i1 %46, i1 false
  %.252 = select i1 %or.cond, i32 %18, i32 %.15172
  %.247 = select i1 %or.cond, ptr %26, ptr %.14673
  %.2 = select i1 %or.cond, float %38, float %.174
  br label %47

47:                                               ; preds = %42, %32
  %.261 = phi ptr [ %.160, %42 ], [ %.05970, %32 ]
  %.258 = phi float [ %.157, %42 ], [ %.05671, %32 ]
  %.353 = phi i32 [ %.252, %42 ], [ %.15172, %32 ]
  %.348 = phi ptr [ %.247, %42 ], [ %.14673, %32 ]
  %.3 = phi float [ %.2, %42 ], [ %.174, %32 ]
  %48 = getelementptr inbounds i8, ptr %.06269, i64 8
  %.not = icmp eq ptr %48, %17
  br i1 %.not, label %._crit_edge, label %.lr.ph
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH4Vec36LengthEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 = { 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 #4 = { 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 #5 = { alwaysinline 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 #6 = { 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 #7 = { alwaysinline 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 #8 = { 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, !11, i64 0}
!10 = !{!"_ZTSN3JPH17ConvexHullBuilderE", !11, i64 0, !12, i64 8, !14, i64 32}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"_ZTSN3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEEE", !13, i64 0, !13, i64 8, !11, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN3JPH5ArrayINS_17ConvexHullBuilder8CoplanarENS_12STLAllocatorIS2_EEEE", !13, i64 0, !13, i64 8, !11, i64 16}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{i64 0, i64 16, !19}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{i64 2157058440}


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