; 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> }
%"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 }
%"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::Edge" = type <{ ptr, ptr, ptr, i32, [4 x i8] }>

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

; Function Attrs: 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: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZNK3JPH17ConvexHullBuilder19GetDistanceToEdgeSqENS_4Vec3EPKNS0_4FaceE(ptr noundef nonnull align 8 dereferenceable(56) %0, double %1, double %2, ptr noundef %3) #4 align 2 {
  %5 = alloca %"class.JPH::Vec3", align 16
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %"class.JPH::Vec3", align 16
  %12 = alloca %"class.JPH::Vec3", align 16
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca %"class.JPH::Vec3", align 16
  %16 = alloca %"class.JPH::Vec3", align 16
  %17 = alloca %"class.JPH::Vec3", align 16
  %18 = alloca %"class.JPH::Vec3", align 16
  %19 = alloca i32, align 4
  %20 = alloca float, align 4
  %21 = alloca %"class.JPH::Vec3", align 16
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = alloca %"class.JPH::Vec3", align 16
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca %"class.JPH::Vec3", align 16
  %26 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 0
  store double %1, ptr %26, align 16
  %27 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 1
  store double %2, ptr %27, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %3, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  store i8 1, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store float 0x47EFFFFFE0000000, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %29, i32 0, i32 3
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  store ptr %31, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  %32 = getelementptr inbounds %"class.JPH::ConvexHullBuilder", ptr %28, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !18
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = call noundef ptr @_ZN3JPH17ConvexHullBuilder4Edge15GetPreviousEdgeEv(ptr noundef nonnull align 8 dereferenceable(28) %34)
  %36 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %35, i32 0, i32 3
  %37 = load i32, ptr %36, align 8, !tbaa !22
  %38 = sext i32 %37 to i64
  %39 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %38)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %39, i64 16, i1 false), !tbaa.struct !25
  br label %40

40:                                               ; preds = %134, %4
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %41 = getelementptr inbounds %"class.JPH::ConvexHullBuilder", ptr %28, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %43, i32 0, i32 3
  %45 = load i32, ptr %44, align 8, !tbaa !22
  %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) %42, i64 noundef %46)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 %47, i64 16, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %15, ptr align 16 %11, i64 16, i1 false), !tbaa.struct !25
  %48 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %49 = load double, ptr %48, align 16
  %50 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %51 = load double, ptr %50, align 8
  %52 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %49, double %51)
  %53 = getelementptr inbounds %"class.JPH::Vec3", ptr %14, i32 0, i32 0
  %54 = getelementptr inbounds %union.anon, ptr %53, i32 0, i32 0
  %55 = getelementptr inbounds { double, double }, ptr %54, i32 0, i32 0
  %56 = extractvalue { double, double } %52, 0
  store double %56, ptr %55, align 16
  %57 = getelementptr inbounds { double, double }, ptr %54, i32 0, i32 1
  %58 = extractvalue { double, double } %52, 1
  store double %58, ptr %57, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %17, ptr align 16 %11, i64 16, i1 false), !tbaa.struct !25
  %59 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 0
  %60 = load double, ptr %59, align 16
  %61 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 1
  %62 = load double, ptr %61, align 8
  %63 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %60, double %62)
  %64 = getelementptr inbounds %"class.JPH::Vec3", ptr %16, i32 0, i32 0
  %65 = getelementptr inbounds %union.anon, ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds { double, double }, ptr %65, i32 0, i32 0
  %67 = extractvalue { double, double } %63, 0
  store double %67, ptr %66, align 16
  %68 = getelementptr inbounds { double, double }, ptr %65, i32 0, i32 1
  %69 = extractvalue { double, double } %63, 1
  store double %69, ptr %68, align 8
  %70 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %71 = load double, ptr %70, align 16
  %72 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %73 = load double, ptr %72, align 8
  %74 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %14, double %71, double %73)
  %75 = getelementptr inbounds %"class.JPH::Vec3", ptr %13, i32 0, i32 0
  %76 = getelementptr inbounds %union.anon, ptr %75, i32 0, i32 0
  %77 = getelementptr inbounds { double, double }, ptr %76, i32 0, i32 0
  %78 = extractvalue { double, double } %74, 0
  store double %78, ptr %77, align 16
  %79 = getelementptr inbounds { double, double }, ptr %76, i32 0, i32 1
  %80 = extractvalue { double, double } %74, 1
  store double %80, ptr %79, align 8
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %81, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %18, ptr align 16 %82, i64 16, i1 false), !tbaa.struct !25
  %83 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %84 = load double, ptr %83, align 16
  %85 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %86 = load double, ptr %85, align 8
  %87 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %13, double %84, double %86)
  %88 = fcmp olt float %87, 0.000000e+00
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  br i1 %88, label %89, label %130

89:                                               ; preds = %40
  store i8 0, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %23, ptr align 16 %5, i64 16, i1 false), !tbaa.struct !25
  %90 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 0
  %91 = load double, ptr %90, align 16
  %92 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 1
  %93 = load double, ptr %92, align 8
  %94 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %11, double %91, double %93)
  %95 = getelementptr inbounds %"class.JPH::Vec3", ptr %22, i32 0, i32 0
  %96 = getelementptr inbounds %union.anon, ptr %95, i32 0, i32 0
  %97 = getelementptr inbounds { double, double }, ptr %96, i32 0, i32 0
  %98 = extractvalue { double, double } %94, 0
  store double %98, ptr %97, align 16
  %99 = getelementptr inbounds { double, double }, ptr %96, i32 0, i32 1
  %100 = extractvalue { double, double } %94, 1
  store double %100, ptr %99, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 16 %5, i64 16, i1 false), !tbaa.struct !25
  %101 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 0
  %102 = load double, ptr %101, align 16
  %103 = getelementptr inbounds { double, double }, ptr %25, i32 0, i32 1
  %104 = load double, ptr %103, align 8
  %105 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %102, double %104)
  %106 = getelementptr inbounds %"class.JPH::Vec3", ptr %24, i32 0, i32 0
  %107 = getelementptr inbounds %union.anon, ptr %106, i32 0, i32 0
  %108 = getelementptr inbounds { double, double }, ptr %107, i32 0, i32 0
  %109 = extractvalue { double, double } %105, 0
  store double %109, ptr %108, align 16
  %110 = getelementptr inbounds { double, double }, ptr %107, i32 0, i32 1
  %111 = extractvalue { double, double } %105, 1
  store double %111, ptr %110, align 8
  %112 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %113 = load double, ptr %112, align 16
  %114 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %115 = load double, ptr %114, align 8
  %116 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %117 = load double, ptr %116, align 16
  %118 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %119 = load double, ptr %118, align 8
  %120 = call { double, double } @_ZN3JPH12ClosestPoint21GetClosestPointOnLineENS_4Vec3ES1_Rj(double %113, double %115, double %117, double %119, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %121 = getelementptr inbounds %"class.JPH::Vec3", ptr %21, i32 0, i32 0
  %122 = getelementptr inbounds %union.anon, ptr %121, i32 0, i32 0
  %123 = getelementptr inbounds { double, double }, ptr %122, i32 0, i32 0
  %124 = extractvalue { double, double } %120, 0
  store double %124, ptr %123, align 16
  %125 = getelementptr inbounds { double, double }, ptr %122, i32 0, i32 1
  %126 = extractvalue { double, double } %120, 1
  store double %126, ptr %125, align 8
  %127 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %21)
  store float %127, ptr %20, align 4, !tbaa !11
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %129 = load float, ptr %128, align 4, !tbaa !11
  store float %129, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %130

130:                                              ; preds = %89, %40
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %12, i64 16, i1 false), !tbaa.struct !25
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %131, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !27
  store ptr %133, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %134

134:                                              ; preds = %130
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %136, i32 0, i32 3
  %138 = load ptr, ptr %137, align 8, !tbaa !13
  %139 = icmp ne ptr %135, %138
  br i1 %139, label %40, label %140, !llvm.loop !28

140:                                              ; preds = %134
  %141 = load i8, ptr %8, align 1, !tbaa !9, !range !30, !noundef !31
  %142 = trunc i8 %141 to i1
  br i1 %142, label %143, label %144

143:                                              ; preds = %140
  br label %146

144:                                              ; preds = %140
  %145 = load float, ptr %9, align 4, !tbaa !11
  br label %146

146:                                              ; preds = %144, %143
  %147 = phi float [ 0.000000e+00, %143 ], [ %145, %144 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  ret float %147
}

; 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) #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH12ClosestPoint21GetClosestPointOnLineENS_4Vec3ES1_Rj(double, double, double, double, ptr noundef nonnull align 4 dereferenceable(4)) #5

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 = { 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 #4 = { 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 = { 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 #6 = { 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 #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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 56}
!14 = !{!"_ZTSN3JPH17ConvexHullBuilder4FaceE", !15, i64 0, !15, i64 16, !16, i64 32, !6, i64 56, !12, i64 64, !10, i64 68}
!15 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!16 = !{!"_ZTSN3JPH5ArrayIiNS_12STLAllocatorIiEEEE", !17, i64 0, !17, i64 8, !6, i64 16}
!17 = !{!"long", !7, i64 0}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTSN3JPH17ConvexHullBuilderE", !6, i64 0, !20, i64 8, !21, i64 32}
!20 = !{!"_ZTSN3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEEE", !17, i64 0, !17, i64 8, !6, i64 16}
!21 = !{!"_ZTSN3JPH5ArrayINS_17ConvexHullBuilder8CoplanarENS_12STLAllocatorIS2_EEEE", !17, i64 0, !17, i64 8, !6, i64 16}
!22 = !{!23, !24, i64 24}
!23 = !{!"_ZTSN3JPH17ConvexHullBuilder4EdgeE", !6, i64 0, !6, i64 8, !6, i64 16, !24, i64 24}
!24 = !{!"int", !7, i64 0}
!25 = !{i64 0, i64 16, !26}
!26 = !{!7, !7, i64 0}
!27 = !{!23, !6, i64 8}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{i8 0, i8 2}
!31 = !{}


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

; 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: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 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 #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZNK3JPH17ConvexHullBuilder19GetDistanceToEdgeSqENS_4Vec3EPKNS0_4FaceE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(56) %0, double %1, double %2, ptr nocapture noundef readonly %3) local_unnamed_addr #4 align 2 {
  %5 = alloca %"class.JPH::Vec3", align 16
  %6 = alloca float, align 4
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca %"class.JPH::Vec3", align 16
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca %"class.JPH::Vec3", align 16
  store double %1, ptr %5, align 16
  %14 = getelementptr inbounds i8, ptr %5, i64 8
  store double %2, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store float 0x47EFFFFFE0000000, ptr %6, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %3, i64 56
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  %17 = load ptr, ptr %0, align 8, !tbaa !16
  %18 = tail call noundef ptr @_ZN3JPH17ConvexHullBuilder4Edge15GetPreviousEdgeEv(ptr noundef nonnull align 8 dereferenceable(28) %16)
  %19 = getelementptr inbounds i8, ptr %18, i64 24
  %20 = load i32, ptr %19, align 8, !tbaa !20
  %21 = sext i32 %20 to i64
  %22 = tail call noundef nonnull align 16 dereferenceable(16) ptr @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %21)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %7, ptr noundef nonnull align 16 dereferenceable(16) %22, i64 16, i1 false), !tbaa.struct !23
  %.sroa.214.0..sroa_idx = getelementptr inbounds i8, ptr %7, i64 8
  %23 = getelementptr inbounds i8, ptr %10, i64 8
  %24 = getelementptr inbounds i8, ptr %9, i64 8
  %.sroa.28.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %25 = getelementptr inbounds i8, ptr %13, i64 8
  br label %26

26:                                               ; preds = %56, %4
  %.022 = phi ptr [ %16, %4 ], [ %58, %56 ]
  %.0 = phi i1 [ true, %4 ], [ %.1, %56 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  %27 = load ptr, ptr %0, align 8, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %.022, i64 24
  %29 = load i32, ptr %28, align 8, !tbaa !20
  %30 = sext i32 %29 to i64
  %31 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNK3JPH5ArrayINS_4Vec3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef %30)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %8, ptr noundef nonnull align 16 dereferenceable(16) %31, i64 16, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  %.sroa.013.0.copyload = load double, ptr %7, align 16
  %.sroa.214.0.copyload = load double, ptr %.sroa.214.0..sroa_idx, align 8, !tbaa !24
  %32 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %8, double %.sroa.013.0.copyload, double %.sroa.214.0.copyload)
  %33 = extractvalue { double, double } %32, 0
  store double %33, ptr %10, align 16
  %34 = extractvalue { double, double } %32, 1
  store double %34, ptr %23, align 8
  %.sroa.09.0.copyload = load double, ptr %7, align 16
  %.sroa.210.0.copyload = load double, ptr %.sroa.214.0..sroa_idx, align 8, !tbaa !24
  %35 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.09.0.copyload, double %.sroa.210.0.copyload)
  %36 = extractvalue { double, double } %35, 0
  %37 = extractvalue { double, double } %35, 1
  %38 = call { double, double } @_ZNK3JPH4Vec35CrossES0_(ptr noundef nonnull align 16 dereferenceable(16) %10, double %36, double %37)
  %39 = extractvalue { double, double } %38, 0
  store double %39, ptr %9, align 16
  %40 = extractvalue { double, double } %38, 1
  store double %40, ptr %24, align 8
  %.sroa.07.0.copyload = load double, ptr %3, align 16
  %.sroa.28.0.copyload = load double, ptr %.sroa.28.0..sroa_idx, align 8, !tbaa !24
  %41 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %9, double %.sroa.07.0.copyload, double %.sroa.28.0.copyload)
  %42 = fcmp olt float %41, 0.000000e+00
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #7
  br i1 %42, label %43, label %56

43:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #7
  %.sroa.03.0.copyload = load double, ptr %5, align 16
  %.sroa.24.0.copyload = load double, ptr %14, align 8, !tbaa !24
  %44 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %7, double %.sroa.03.0.copyload, double %.sroa.24.0.copyload)
  %45 = extractvalue { double, double } %44, 0
  %46 = extractvalue { double, double } %44, 1
  %.sroa.0.0.copyload = load double, ptr %5, align 16
  %.sroa.2.0.copyload = load double, ptr %14, align 8, !tbaa !24
  %47 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %8, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %48 = extractvalue { double, double } %47, 0
  %49 = extractvalue { double, double } %47, 1
  %50 = call { double, double } @_ZN3JPH12ClosestPoint21GetClosestPointOnLineENS_4Vec3ES1_Rj(double %45, double %46, double %48, double %49, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %51 = extractvalue { double, double } %50, 0
  store double %51, ptr %13, align 16
  %52 = extractvalue { double, double } %50, 1
  store double %52, ptr %25, align 8
  %53 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %13)
  store float %53, ptr %12, align 4, !tbaa !5
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %55 = load float, ptr %54, align 4, !tbaa !5
  store float %55, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  br label %56

56:                                               ; preds = %43, %26
  %.1 = phi i1 [ false, %43 ], [ %.0, %26 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %7, ptr noundef nonnull align 16 dereferenceable(16) %8, i64 16, i1 false), !tbaa.struct !23
  %57 = getelementptr inbounds i8, ptr %.022, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  %59 = load ptr, ptr %15, align 8, !tbaa !9
  %.not = icmp eq ptr %58, %59
  br i1 %.not, label %60, label %26, !llvm.loop !26

60:                                               ; preds = %56
  %61 = load float, ptr %6, align 4
  %62 = select i1 %.1, float 0.000000e+00, float %61
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  ret float %62
}

; 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 #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH12ClosestPoint21GetClosestPointOnLineENS_4Vec3ES1_Rj(double, double, double, double, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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 = { 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 #4 = { 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 = { 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 #6 = { 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 #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, !14, i64 56}
!10 = !{!"_ZTSN3JPH17ConvexHullBuilder4FaceE", !11, i64 0, !11, i64 16, !12, i64 32, !14, i64 56, !6, i64 64, !15, i64 68}
!11 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!12 = !{!"_ZTSN3JPH5ArrayIiNS_12STLAllocatorIiEEEE", !13, i64 0, !13, i64 8, !14, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!17, !14, i64 0}
!17 = !{!"_ZTSN3JPH17ConvexHullBuilderE", !14, i64 0, !18, i64 8, !19, i64 32}
!18 = !{!"_ZTSN3JPH5ArrayIPNS_17ConvexHullBuilder4FaceENS_12STLAllocatorIS3_EEEE", !13, i64 0, !13, i64 8, !14, i64 16}
!19 = !{!"_ZTSN3JPH5ArrayINS_17ConvexHullBuilder8CoplanarENS_12STLAllocatorIS2_EEEE", !13, i64 0, !13, i64 8, !14, i64 16}
!20 = !{!21, !22, i64 24}
!21 = !{!"_ZTSN3JPH17ConvexHullBuilder4EdgeE", !14, i64 0, !14, i64 8, !14, i64 16, !22, i64 24}
!22 = !{!"int", !7, i64 0}
!23 = !{i64 0, i64 16, !24}
!24 = !{!7, !7, i64 0}
!25 = !{!21, !14, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass