; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes (R3Mesh)

; 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.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }
%class.R3Span = type { %class.R3Ray, %class.R3Point, double }
%class.R3Ray = type { %class.R3Line }
%class.R3Line = type { %class.R3Point, %class.R3Vector }
%class.R3Plane = type { %class.R3Vector, double }
%class.R3MeshVertex = type { ptr, %class.RNArray.0, %class.R3Point, %class.R3Vector, %class.R2Point, %class.RNRgb, double, i32, %class.RNFlags, double, i32, ptr }
%class.RNArray.0 = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.R2Point = type { [2 x double] }
%class.RNRgb = type { [3 x double] }
%class.RNFlags = type { i64 }
%struct.R3MeshIntersection = type { i32, ptr, ptr, ptr, %class.R3Point, double }

@R3null_point = external global %class.R3Point, align 8

; 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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) #1 align 2

declare void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

declare noundef double @_Z10R3DistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

declare void @_ZmiRK7R3PointS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

declare void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

declare void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2

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

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

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

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

declare void @_ZmiRK7R3PointRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6R3Mesh8EdgeSpanEPK10R3MeshEdge(ptr dead_on_unwind noalias writable sret(%class.R3Span) align 8, ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, ptr noundef, i32 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6R3Mesh9FacePlaneEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #1 align 2

declare void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

declare noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6R3Mesh18ClosestPointOnFaceEPK10R3MeshFaceRK7R3PointP18R3MeshIntersection(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8 %0, ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef %4) #4 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 ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca double, align 8
  %14 = alloca %class.R3Point, align 8
  %15 = alloca %class.R3Vector, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %class.R3Point, align 8
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca %class.R3Point, align 8
  %24 = alloca %class.R3Point, align 8
  %25 = alloca %class.R3Vector, align 8
  %26 = alloca %class.R3Vector, align 8
  %27 = alloca %class.R3Plane, align 8
  %28 = alloca double, align 8
  %29 = alloca %class.R3Point, align 8
  %30 = alloca double, align 8
  %31 = alloca %class.R3Span, align 8
  %32 = alloca double, align 8
  store ptr %0, ptr %6, align 8
  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
  %33 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6R3Mesh9FacePlaneEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %34)
  store ptr %35, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Plane6NormalEv(ptr noundef nonnull align 8 dereferenceable(32) %36)
  store ptr %37, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %38, ptr noundef nonnull align 8 dereferenceable(24) %39)
  store double %40, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #5
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #5
  %42 = load double, ptr %13, align 8, !tbaa !9
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %15, double noundef %42, ptr noundef nonnull align 8 dereferenceable(24) %43)
  call void @_ZmiRK7R3PointRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) %41, ptr noundef nonnull align 8 dereferenceable(24) %15)
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #5
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) @R3null_point)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  store double 0x47EFFFFFE0000000, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %44

44:                                               ; preds = %80, %5
  %45 = load i32, ptr %19, align 4, !tbaa !11
  %46 = icmp slt i32 %45, 3
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %83

48:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load i32, ptr %19, align 4, !tbaa !11
  %51 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %49, i32 noundef %50)
  store ptr %51, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %52 = load ptr, ptr %20, align 8, !tbaa !5
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %52, ptr noundef %53, i32 noundef 1)
  store ptr %54, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %55 = load ptr, ptr %20, align 8, !tbaa !5
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %55, ptr noundef %56, i32 noundef 0)
  store ptr %57, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #5
  %58 = load ptr, ptr %21, align 8, !tbaa !5
  %59 = getelementptr inbounds %class.R3MeshVertex, ptr %58, i32 0, i32 2
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(24) %59)
  call void @llvm.lifetime.start.p0(i64 24, ptr %24) #5
  %60 = load ptr, ptr %22, align 8, !tbaa !5
  %61 = getelementptr inbounds %class.R3MeshVertex, ptr %60, i32 0, i32 2
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(24) %61)
  call void @llvm.lifetime.start.p0(i64 24, ptr %25) #5
  call void @_ZmiRK7R3PointS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %25, ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(24) %23)
  call void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25)
  call void @llvm.lifetime.start.p0(i64 24, ptr %26) #5
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %26, ptr noundef nonnull align 8 dereferenceable(24) %62, ptr noundef nonnull align 8 dereferenceable(24) %25)
  call void @llvm.lifetime.start.p0(i64 32, ptr %27) #5
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %27, ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(24) %26)
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %63 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %27, ptr noundef nonnull align 8 dereferenceable(24) %14)
  store double %63, ptr %28, align 8, !tbaa !9
  %64 = load double, ptr %28, align 8, !tbaa !9
  %65 = fcmp olt double %64, 0.000000e+00
  br i1 %65, label %66, label %79

66:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 24, ptr %29) #5
  %67 = load ptr, ptr %20, align 8, !tbaa !5
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZNK6R3Mesh18ClosestPointOnEdgeEPK10R3MeshEdgeRK7R3PointP18R3MeshIntersection(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %29, ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %67, ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #5
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = call noundef double @_Z17R3SquaredDistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24) %29, ptr noundef nonnull align 8 dereferenceable(24) %69)
  store double %70, ptr %30, align 8, !tbaa !9
  %71 = load double, ptr %30, align 8, !tbaa !9
  %72 = load double, ptr %18, align 8, !tbaa !9
  %73 = fcmp olt double %71, %72
  br i1 %73, label %74, label %78

74:                                               ; preds = %66
  %75 = load double, ptr %30, align 8, !tbaa !9
  store double %75, ptr %18, align 8, !tbaa !9
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %29)
  %77 = load ptr, ptr %20, align 8, !tbaa !5
  store ptr %77, ptr %16, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %74, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %29) #5
  br label %79

79:                                               ; preds = %78, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %19, align 4, !tbaa !11
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %19, align 4, !tbaa !11
  br label %44, !llvm.loop !13

83:                                               ; preds = %47
  %84 = load ptr, ptr %16, align 8, !tbaa !5
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %87

86:                                               ; preds = %83
  br label %88

87:                                               ; preds = %83
  br label %88

88:                                               ; preds = %87, %86
  %89 = phi ptr [ %17, %86 ], [ %14, %87 ]
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %89)
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %147

92:                                               ; preds = %88
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.R3MeshIntersection, ptr %94, i32 0, i32 3
  store ptr %93, ptr %95, align 8, !tbaa !15
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.R3MeshIntersection, ptr %96, i32 0, i32 4
  %98 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %97, ptr noundef nonnull align 8 dereferenceable(24) %0)
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = call noundef double @_Z10R3DistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %99)
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.R3MeshIntersection, ptr %101, i32 0, i32 5
  store double %100, ptr %102, align 8, !tbaa !19
  %103 = load ptr, ptr %16, align 8, !tbaa !5
  %104 = icmp ne ptr %103, null
  br i1 %104, label %105, label %139

105:                                              ; preds = %92
  %106 = load ptr, ptr %16, align 8, !tbaa !5
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.R3MeshIntersection, ptr %107, i32 0, i32 2
  store ptr %106, ptr %108, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 80, ptr %31) #5
  %109 = load ptr, ptr %16, align 8, !tbaa !5
  call void @_ZNK6R3Mesh8EdgeSpanEPK10R3MeshEdge(ptr dead_on_unwind writable sret(%class.R3Span) align 8 %31, ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %109)
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #5
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = call noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80) %31, ptr noundef nonnull align 8 dereferenceable(24) %110)
  store double %111, ptr %32, align 8, !tbaa !9
  %112 = load double, ptr %32, align 8, !tbaa !9
  %113 = fcmp ole double %112, 0.000000e+00
  br i1 %113, label %114, label %121

114:                                              ; preds = %105
  %115 = load ptr, ptr %10, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.R3MeshIntersection, ptr %115, i32 0, i32 0
  store i32 1, ptr %116, align 8, !tbaa !21
  %117 = load ptr, ptr %16, align 8, !tbaa !5
  %118 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %117, i32 noundef 0)
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.R3MeshIntersection, ptr %119, i32 0, i32 1
  store ptr %118, ptr %120, align 8, !tbaa !22
  br label %138

121:                                              ; preds = %105
  %122 = load double, ptr %32, align 8, !tbaa !9
  %123 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %31)
  %124 = fcmp oge double %122, %123
  br i1 %124, label %125, label %132

125:                                              ; preds = %121
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.R3MeshIntersection, ptr %126, i32 0, i32 0
  store i32 1, ptr %127, align 8, !tbaa !21
  %128 = load ptr, ptr %16, align 8, !tbaa !5
  %129 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %128, i32 noundef 1)
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.R3MeshIntersection, ptr %130, i32 0, i32 1
  store ptr %129, ptr %131, align 8, !tbaa !22
  br label %137

132:                                              ; preds = %121
  %133 = load ptr, ptr %10, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.R3MeshIntersection, ptr %133, i32 0, i32 0
  store i32 2, ptr %134, align 8, !tbaa !21
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.R3MeshIntersection, ptr %135, i32 0, i32 1
  store ptr null, ptr %136, align 8, !tbaa !22
  br label %137

137:                                              ; preds = %132, %125
  br label %138

138:                                              ; preds = %137, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %31) #5
  br label %146

139:                                              ; preds = %92
  %140 = load ptr, ptr %10, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.R3MeshIntersection, ptr %140, i32 0, i32 0
  store i32 3, ptr %141, align 8, !tbaa !21
  %142 = load ptr, ptr %10, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.R3MeshIntersection, ptr %142, i32 0, i32 1
  store ptr null, ptr %143, align 8, !tbaa !22
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.R3MeshIntersection, ptr %144, i32 0, i32 2
  store ptr null, ptr %145, align 8, !tbaa !20
  br label %146

146:                                              ; preds = %139, %138
  br label %147

147:                                              ; preds = %146, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  ret void
}

declare noundef double @_Z17R3SquaredDistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

declare noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24)) #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 = { "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 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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 24}
!16 = !{!"_ZTS18R3MeshIntersection", !17, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !18, i64 32, !10, i64 56}
!17 = !{!"_ZTS10R3MeshType", !7, i64 0}
!18 = !{!"_ZTS7R3Point", !7, i64 0}
!19 = !{!16, !10, i64 56}
!20 = !{!16, !6, i64 16}
!21 = !{!16, !17, i64 0}
!22 = !{!16, !6, i64 8}


; 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.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }
%class.R3Span = type { %class.R3Ray, %class.R3Point, double }
%class.R3Ray = type { %class.R3Line }
%class.R3Line = type { %class.R3Point, %class.R3Vector }
%class.R3Plane = type { %class.R3Vector, double }

@R3null_point = external global %class.R3Point, align 8

; 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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

declare void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

declare noundef double @_Z10R3DistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare void @_ZmiRK7R3PointS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

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

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

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

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare void @_ZmiRK7R3PointRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6R3Mesh8EdgeSpanEPK10R3MeshEdge(ptr dead_on_unwind noalias writable sret(%class.R3Span) align 8, ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6R3Mesh9FacePlaneEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #1 align 2

declare void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

declare noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6R3Mesh18ClosestPointOnFaceEPK10R3MeshFaceRK7R3PointP18R3MeshIntersection(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8 %0, ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef %4) local_unnamed_addr #4 align 2 {
  %6 = alloca %class.R3Point, align 8
  %7 = alloca %class.R3Vector, align 8
  %8 = alloca %class.R3Point, align 8
  %9 = alloca %class.R3Point, align 8
  %10 = alloca %class.R3Point, align 8
  %11 = alloca %class.R3Vector, align 8
  %12 = alloca %class.R3Vector, align 8
  %13 = alloca %class.R3Plane, align 8
  %14 = alloca %class.R3Point, align 8
  %15 = alloca %class.R3Span, align 8
  %16 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6R3Mesh9FacePlaneEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %2)
  %17 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Plane6NormalEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  %18 = tail call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %7, double noundef %18, ptr noundef nonnull align 8 dereferenceable(24) %17)
  call void @_ZmiRK7R3PointRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) @R3null_point)
  %19 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %2, i32 noundef 0)
  %20 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %19, ptr noundef %2, i32 noundef 1)
  %21 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %19, ptr noundef %2, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  %22 = getelementptr inbounds i8, ptr %20, i64 24
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %22)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #6
  %23 = getelementptr inbounds i8, ptr %21, i64 24
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %23)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #6
  call void @_ZmiRK7R3PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %9)
  call void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #6
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #6
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %12)
  %24 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %25 = fcmp olt double %24, 0.000000e+00
  br i1 %25, label %26, label %32

26:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #6
  call void @_ZNK6R3Mesh18ClosestPointOnEdgeEPK10R3MeshEdgeRK7R3PointP18R3MeshIntersection(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %14, ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %19, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef null)
  %27 = call noundef double @_Z17R3SquaredDistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %28 = fcmp olt double %27, 0x47EFFFFFE0000000
  br i1 %28, label %29, label %31

29:                                               ; preds = %26
  %30 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %14)
  br label %31

31:                                               ; preds = %29, %26
  %.152 = phi double [ %27, %29 ], [ 0x47EFFFFFE0000000, %26 ]
  %.1 = phi ptr [ %19, %29 ], [ null, %26 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  br label %32

32:                                               ; preds = %31, %5
  %.253 = phi double [ %.152, %31 ], [ 0x47EFFFFFE0000000, %5 ]
  %.2 = phi ptr [ %.1, %31 ], [ null, %5 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  %33 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %2, i32 noundef 1)
  %34 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %33, ptr noundef %2, i32 noundef 1)
  %35 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %33, ptr noundef %2, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  %36 = getelementptr inbounds i8, ptr %34, i64 24
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %36)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #6
  %37 = getelementptr inbounds i8, ptr %35, i64 24
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %37)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #6
  call void @_ZmiRK7R3PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %9)
  call void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #6
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #6
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %12)
  %38 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %39 = fcmp olt double %38, 0.000000e+00
  br i1 %39, label %40, label %46

40:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #6
  call void @_ZNK6R3Mesh18ClosestPointOnEdgeEPK10R3MeshEdgeRK7R3PointP18R3MeshIntersection(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %14, ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %33, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef null)
  %41 = call noundef double @_Z17R3SquaredDistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %42 = fcmp olt double %41, %.253
  br i1 %42, label %43, label %45

43:                                               ; preds = %40
  %44 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %14)
  br label %45

45:                                               ; preds = %43, %40
  %.152.1 = phi double [ %41, %43 ], [ %.253, %40 ]
  %.1.1 = phi ptr [ %33, %43 ], [ %.2, %40 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  br label %46

46:                                               ; preds = %45, %32
  %.253.1 = phi double [ %.152.1, %45 ], [ %.253, %32 ]
  %.2.1 = phi ptr [ %.1.1, %45 ], [ %.2, %32 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  %47 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %2, i32 noundef 2)
  %48 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %47, ptr noundef %2, i32 noundef 1)
  %49 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgePK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %47, ptr noundef %2, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  %50 = getelementptr inbounds i8, ptr %48, i64 24
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %50)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #6
  %51 = getelementptr inbounds i8, ptr %49, i64 24
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %51)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #6
  call void @_ZmiRK7R3PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %9)
  call void @_ZN8R3Vector9NormalizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #6
  call void @_ZrmRK8R3VectorS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %11)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #6
  call void @_ZN7R3PlaneC1ERK7R3PointRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %12)
  %52 = call noundef double @_Z16R3SignedDistanceRK7R3PlaneRK7R3Point(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %53 = fcmp olt double %52, 0.000000e+00
  br i1 %53, label %54, label %60

54:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #6
  call void @_ZNK6R3Mesh18ClosestPointOnEdgeEPK10R3MeshEdgeRK7R3PointP18R3MeshIntersection(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %14, ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef %47, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef null)
  %55 = call noundef double @_Z17R3SquaredDistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %56 = fcmp olt double %55, %.253.1
  br i1 %56, label %57, label %59

57:                                               ; preds = %54
  %58 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %14)
  br label %59

59:                                               ; preds = %57, %54
  %.1.2 = phi ptr [ %47, %57 ], [ %.2.1, %54 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  br label %60

60:                                               ; preds = %59, %46
  %.2.2 = phi ptr [ %.1.2, %59 ], [ %.2.1, %46 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  %.not = icmp eq ptr %.2.2, null
  %61 = select i1 %.not, ptr %6, ptr %8
  call void @_ZN7R3PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %61)
  %.not58 = icmp eq ptr %4, null
  br i1 %.not58, label %84, label %62

62:                                               ; preds = %60
  %63 = getelementptr inbounds i8, ptr %4, i64 24
  store ptr %2, ptr %63, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %4, i64 32
  %65 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %64, ptr noundef nonnull align 8 dereferenceable(24) %0)
  %66 = call noundef double @_Z10R3DistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %67 = getelementptr inbounds i8, ptr %4, i64 56
  store double %66, ptr %67, align 8, !tbaa !13
  br i1 %.not, label %82, label %68

68:                                               ; preds = %62
  %69 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %.2.2, ptr %69, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %15) #6
  call void @_ZNK6R3Mesh8EdgeSpanEPK10R3MeshEdge(ptr dead_on_unwind nonnull writable sret(%class.R3Span) align 8 %15, ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef nonnull %.2.2)
  %70 = call noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80) %15, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %71 = fcmp ugt double %70, 0.000000e+00
  br i1 %71, label %74, label %72

72:                                               ; preds = %68
  store i32 1, ptr %4, align 8, !tbaa !15
  %73 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef nonnull %.2.2, i32 noundef 0)
  br label %80

74:                                               ; preds = %68
  %75 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %15)
  %76 = fcmp ult double %70, %75
  br i1 %76, label %79, label %77

77:                                               ; preds = %74
  store i32 1, ptr %4, align 8, !tbaa !15
  %78 = call noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef nonnull %.2.2, i32 noundef 1)
  br label %80

79:                                               ; preds = %74
  store i32 2, ptr %4, align 8, !tbaa !15
  br label %80

80:                                               ; preds = %77, %79, %72
  %.sink = phi ptr [ %78, %77 ], [ null, %79 ], [ %73, %72 ]
  %81 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %.sink, ptr %81, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %15) #6
  br label %84

82:                                               ; preds = %62
  store i32 3, ptr %4, align 8, !tbaa !15
  %83 = getelementptr inbounds i8, ptr %4, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %83, i8 0, i64 16, i1 false)
  br label %84

84:                                               ; preds = %80, %82, %60
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  ret void
}

declare noundef double @_Z17R3SquaredDistanceRK7R3PointS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare noundef double @_ZNK6R3Span1TERK7R3Point(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

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

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 = { "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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 24}
!6 = !{!"_ZTS18R3MeshIntersection", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !12, i64 56}
!7 = !{!"_ZTS10R3MeshType", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTS7R3Point", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!6, !12, i64 56}
!14 = !{!6, !10, i64 16}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !10, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass