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

; 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.R4Matrix = type { [4 x [4 x double]] }
%class.R3Vector = type { [3 x double] }
%class.R3Point = type { [3 x double] }
%class.R3Ray = type { %class.R3Line }
%class.R3Line = type { %class.R3Point, %class.R3Vector }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.RNFlags = type { i64 }

@RN_EPSILON = external global double, align 8
@R4identity_matrix = external global %class.R4Matrix, align 8
@R3negz_vector = external global %class.R3Vector, align 8
@R3null_vector = external global %class.R3Vector, 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) #2

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z11RNIsGreaterddd(double noundef, double noundef, double noundef) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z12RNIsPositivedd(double noundef, double noundef) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z12RNIsNegativedd(double noundef, double noundef) #4

declare void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #5

; Function Attrs: nounwind
declare double @sqrt(double noundef) #5

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #3

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

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

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

declare void @_ZN5R3RayC1ERKS_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3

declare void @_ZN5R3Ray9TransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

declare void @_ZNK5R3Ray5PointEd(ptr dead_on_unwind writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(48), double noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z12R3IntersectsRK5R3RayRK6R3ConeP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(160) %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #6 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %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 %class.R3Ray, align 8
  %13 = alloca %class.R3Affine, align 8
  %14 = alloca %class.R3Vector, align 8
  %15 = alloca %class.R3Vector, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  %25 = alloca i32, align 4
  %26 = alloca double, align 8
  %27 = alloca double, align 8
  %28 = alloca double, align 8
  %29 = alloca double, align 8
  %30 = alloca %class.R3Point, align 8
  %31 = alloca %class.R3Point, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #7
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN5R3RayC1ERKS_(ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef nonnull align 8 dereferenceable(48) %32)
  call void @llvm.lifetime.start.p0(i64 272, ptr %13) #7
  call void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272) %13, ptr noundef nonnull align 8 dereferenceable(128) @R4identity_matrix, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = invoke noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %33)
          to label %35 unwind label %148

35:                                               ; preds = %5
  %36 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span3EndEv(ptr noundef nonnull align 8 dereferenceable(80) %34)
          to label %37 unwind label %148

37:                                               ; preds = %35
  invoke void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %36)
          to label %38 unwind label %148

38:                                               ; preds = %37
  invoke void @_ZngRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %39 unwind label %148

39:                                               ; preds = %38
  invoke void @_ZN8R3Affine9TranslateERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(272) %13, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %40 unwind label %148

40:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = invoke noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %41)
          to label %43 unwind label %152

43:                                               ; preds = %40
  %44 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80) %42)
          to label %45 unwind label %152

45:                                               ; preds = %43
  invoke void @_ZN8R3Affine6RotateERK8R3VectorS2_(ptr noundef nonnull align 8 dereferenceable(272) %13, ptr noundef nonnull align 8 dereferenceable(24) %44, ptr noundef nonnull align 8 dereferenceable(24) @R3negz_vector)
          to label %46 unwind label %152

46:                                               ; preds = %45
  invoke void @_ZN5R3Ray9TransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %47 unwind label %152

47:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = invoke noundef double @_ZNK6R3Cone6RadiusEv(ptr noundef nonnull align 8 dereferenceable(160) %48)
          to label %50 unwind label %156

50:                                               ; preds = %47
  store double %49, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %51 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %12)
          to label %52 unwind label %160

52:                                               ; preds = %50
  store ptr %51, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %53 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %12)
          to label %54 unwind label %164

54:                                               ; preds = %52
  store ptr %53, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %55 = load ptr, ptr %20, align 8, !tbaa !5
  %56 = invoke noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %55)
          to label %57 unwind label %168

57:                                               ; preds = %54
  %58 = load ptr, ptr %20, align 8, !tbaa !5
  %59 = invoke noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %58)
          to label %60 unwind label %168

60:                                               ; preds = %57
  %61 = load ptr, ptr %20, align 8, !tbaa !5
  %62 = invoke noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %61)
          to label %63 unwind label %168

63:                                               ; preds = %60
  %64 = load ptr, ptr %20, align 8, !tbaa !5
  %65 = invoke noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %64)
          to label %66 unwind label %168

66:                                               ; preds = %63
  %67 = fmul double %62, %65
  %68 = call double @llvm.fmuladd.f64(double %56, double %59, double %67)
  %69 = load double, ptr %18, align 8, !tbaa !9
  %70 = load double, ptr %18, align 8, !tbaa !9
  %71 = fmul double %69, %70
  %72 = load ptr, ptr %20, align 8, !tbaa !5
  %73 = invoke noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %72)
          to label %74 unwind label %168

74:                                               ; preds = %66
  %75 = fmul double %71, %73
  %76 = load ptr, ptr %20, align 8, !tbaa !5
  %77 = invoke noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %76)
          to label %78 unwind label %168

78:                                               ; preds = %74
  %79 = fneg double %75
  %80 = call double @llvm.fmuladd.f64(double %79, double %77, double %68)
  store double %80, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %81 = load ptr, ptr %19, align 8, !tbaa !5
  %82 = invoke noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %81)
          to label %83 unwind label %172

83:                                               ; preds = %78
  %84 = fmul double 2.000000e+00, %82
  %85 = load ptr, ptr %20, align 8, !tbaa !5
  %86 = invoke noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %85)
          to label %87 unwind label %172

87:                                               ; preds = %83
  %88 = load ptr, ptr %19, align 8, !tbaa !5
  %89 = invoke noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %88)
          to label %90 unwind label %172

90:                                               ; preds = %87
  %91 = fmul double 2.000000e+00, %89
  %92 = load ptr, ptr %20, align 8, !tbaa !5
  %93 = invoke noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %92)
          to label %94 unwind label %172

94:                                               ; preds = %90
  %95 = fmul double %91, %93
  %96 = call double @llvm.fmuladd.f64(double %84, double %86, double %95)
  %97 = load double, ptr %18, align 8, !tbaa !9
  %98 = fmul double 2.000000e+00, %97
  %99 = load double, ptr %18, align 8, !tbaa !9
  %100 = fmul double %98, %99
  %101 = load ptr, ptr %19, align 8, !tbaa !5
  %102 = invoke noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %101)
          to label %103 unwind label %172

103:                                              ; preds = %94
  %104 = fmul double %100, %102
  %105 = load ptr, ptr %20, align 8, !tbaa !5
  %106 = invoke noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %105)
          to label %107 unwind label %172

107:                                              ; preds = %103
  %108 = fneg double %104
  %109 = call double @llvm.fmuladd.f64(double %108, double %106, double %96)
  store double %109, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %110 = load ptr, ptr %19, align 8, !tbaa !5
  %111 = invoke noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %110)
          to label %112 unwind label %176

112:                                              ; preds = %107
  %113 = load ptr, ptr %19, align 8, !tbaa !5
  %114 = invoke noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %113)
          to label %115 unwind label %176

115:                                              ; preds = %112
  %116 = load ptr, ptr %19, align 8, !tbaa !5
  %117 = invoke noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %116)
          to label %118 unwind label %176

118:                                              ; preds = %115
  %119 = load ptr, ptr %19, align 8, !tbaa !5
  %120 = invoke noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %119)
          to label %121 unwind label %176

121:                                              ; preds = %118
  %122 = fmul double %117, %120
  %123 = call double @llvm.fmuladd.f64(double %111, double %114, double %122)
  %124 = load double, ptr %18, align 8, !tbaa !9
  %125 = load double, ptr %18, align 8, !tbaa !9
  %126 = fmul double %124, %125
  %127 = load ptr, ptr %19, align 8, !tbaa !5
  %128 = invoke noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %127)
          to label %129 unwind label %176

129:                                              ; preds = %121
  %130 = fmul double %126, %128
  %131 = load ptr, ptr %19, align 8, !tbaa !5
  %132 = invoke noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %131)
          to label %133 unwind label %176

133:                                              ; preds = %129
  %134 = fneg double %130
  %135 = call double @llvm.fmuladd.f64(double %134, double %132, double %123)
  store double %135, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %136 = load double, ptr %21, align 8, !tbaa !9
  %137 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %138 = invoke noundef i32 @_Z8RNIsZerodd(double noundef %136, double noundef %137)
          to label %139 unwind label %180

139:                                              ; preds = %133
  %140 = icmp ne i32 %138, 0
  br i1 %140, label %141, label %190

141:                                              ; preds = %139
  %142 = load double, ptr %22, align 8, !tbaa !9
  %143 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %144 = invoke noundef i32 @_Z8RNIsZerodd(double noundef %142, double noundef %143)
          to label %145 unwind label %180

145:                                              ; preds = %141
  %146 = icmp ne i32 %144, 0
  br i1 %146, label %147, label %184

147:                                              ; preds = %145
  store i32 0, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %331

148:                                              ; preds = %39, %38, %37, %35, %5
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %16, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  br label %340

152:                                              ; preds = %46, %45, %43, %40
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %16, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %17, align 4
  br label %340

156:                                              ; preds = %47
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %16, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %17, align 4
  br label %339

160:                                              ; preds = %50
  %161 = landingpad { ptr, i32 }
          cleanup
  %162 = extractvalue { ptr, i32 } %161, 0
  store ptr %162, ptr %16, align 8
  %163 = extractvalue { ptr, i32 } %161, 1
  store i32 %163, ptr %17, align 4
  br label %338

164:                                              ; preds = %52
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %16, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %17, align 4
  br label %337

168:                                              ; preds = %74, %66, %63, %60, %57, %54
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %16, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %17, align 4
  br label %336

172:                                              ; preds = %103, %94, %90, %87, %83, %78
  %173 = landingpad { ptr, i32 }
          cleanup
  %174 = extractvalue { ptr, i32 } %173, 0
  store ptr %174, ptr %16, align 8
  %175 = extractvalue { ptr, i32 } %173, 1
  store i32 %175, ptr %17, align 4
  br label %335

176:                                              ; preds = %129, %121, %118, %115, %112, %107
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %16, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %17, align 4
  br label %334

180:                                              ; preds = %251, %141, %133
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %16, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %17, align 4
  br label %333

184:                                              ; preds = %145
  %185 = load double, ptr %23, align 8, !tbaa !9
  %186 = fneg double %185
  %187 = load double, ptr %22, align 8, !tbaa !9
  %188 = fdiv double %186, %187
  store double %188, ptr %24, align 8, !tbaa !9
  br label %189

189:                                              ; preds = %184
  br label %251

190:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %191 = load double, ptr %22, align 8, !tbaa !9
  %192 = load double, ptr %22, align 8, !tbaa !9
  %193 = load double, ptr %21, align 8, !tbaa !9
  %194 = fmul double 4.000000e+00, %193
  %195 = load double, ptr %23, align 8, !tbaa !9
  %196 = fmul double %194, %195
  %197 = fneg double %196
  %198 = call double @llvm.fmuladd.f64(double %191, double %192, double %197)
  store double %198, ptr %26, align 8, !tbaa !9
  %199 = load double, ptr %26, align 8, !tbaa !9
  %200 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %201 = invoke noundef i32 @_Z12RNIsNegativedd(double noundef %199, double noundef %200)
          to label %202 unwind label %205

202:                                              ; preds = %190
  %203 = icmp ne i32 %201, 0
  br i1 %203, label %204, label %209

204:                                              ; preds = %202
  store i32 0, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %248

205:                                              ; preds = %209, %190
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %16, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %333

209:                                              ; preds = %202
  %210 = load double, ptr %26, align 8, !tbaa !9
  %211 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %212 = invoke noundef i32 @_Z12RNIsPositivedd(double noundef %210, double noundef %211)
          to label %213 unwind label %205

213:                                              ; preds = %209
  %214 = icmp ne i32 %212, 0
  br i1 %214, label %215, label %241

215:                                              ; preds = %213
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %216 = load double, ptr %26, align 8, !tbaa !9
  %217 = call double @sqrt(double noundef %216) #7
  store double %217, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %218 = load double, ptr %22, align 8, !tbaa !9
  %219 = fneg double %218
  %220 = load double, ptr %27, align 8, !tbaa !9
  %221 = fsub double %219, %220
  %222 = fmul double 5.000000e-01, %221
  %223 = load double, ptr %21, align 8, !tbaa !9
  %224 = fdiv double %222, %223
  store double %224, ptr %28, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %225 = load double, ptr %22, align 8, !tbaa !9
  %226 = fneg double %225
  %227 = load double, ptr %27, align 8, !tbaa !9
  %228 = fadd double %226, %227
  %229 = fmul double 5.000000e-01, %228
  %230 = load double, ptr %21, align 8, !tbaa !9
  %231 = fdiv double %229, %230
  store double %231, ptr %29, align 8, !tbaa !9
  %232 = load double, ptr %28, align 8, !tbaa !9
  %233 = load double, ptr %29, align 8, !tbaa !9
  %234 = fcmp olt double %232, %233
  br i1 %234, label %235, label %237

235:                                              ; preds = %215
  %236 = load double, ptr %28, align 8, !tbaa !9
  br label %239

237:                                              ; preds = %215
  %238 = load double, ptr %29, align 8, !tbaa !9
  br label %239

239:                                              ; preds = %237, %235
  %240 = phi double [ %236, %235 ], [ %238, %237 ]
  store double %240, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %246

241:                                              ; preds = %213
  %242 = load double, ptr %22, align 8, !tbaa !9
  %243 = fmul double -5.000000e-01, %242
  %244 = load double, ptr %21, align 8, !tbaa !9
  %245 = fdiv double %243, %244
  store double %245, ptr %24, align 8, !tbaa !9
  br label %246

246:                                              ; preds = %241, %239
  br label %247

247:                                              ; preds = %246
  store i32 0, ptr %25, align 4
  br label %248

248:                                              ; preds = %247, %204
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  %249 = load i32, ptr %25, align 4
  switch i32 %249, label %331 [
    i32 0, label %250
  ]

250:                                              ; preds = %248
  br label %251

251:                                              ; preds = %250, %189
  %252 = load double, ptr %24, align 8, !tbaa !9
  %253 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %254 = invoke noundef i32 @_Z12RNIsNegativedd(double noundef %252, double noundef %253)
          to label %255 unwind label %180

255:                                              ; preds = %251
  %256 = icmp ne i32 %254, 0
  br i1 %256, label %257, label %258

257:                                              ; preds = %255
  store i32 0, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %331

258:                                              ; preds = %255
  call void @llvm.lifetime.start.p0(i64 24, ptr %30) #7
  %259 = load double, ptr %24, align 8, !tbaa !9
  invoke void @_ZNK5R3Ray5PointEd(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %30, ptr noundef nonnull align 8 dereferenceable(48) %12, double noundef %259)
          to label %260 unwind label %268

260:                                              ; preds = %258
  %261 = invoke noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %30)
          to label %262 unwind label %268

262:                                              ; preds = %260
  %263 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %264 = invoke noundef i32 @_Z12RNIsNegativedd(double noundef %261, double noundef %263)
          to label %265 unwind label %268

265:                                              ; preds = %262
  %266 = icmp ne i32 %264, 0
  br i1 %266, label %267, label %272

267:                                              ; preds = %265
  store i32 0, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %329

268:                                              ; preds = %294, %292, %289, %287, %285, %279, %277, %274, %272, %262, %260, %258
  %269 = landingpad { ptr, i32 }
          cleanup
  %270 = extractvalue { ptr, i32 } %269, 0
  store ptr %270, ptr %16, align 8
  %271 = extractvalue { ptr, i32 } %269, 1
  store i32 %271, ptr %17, align 4
  br label %330

272:                                              ; preds = %265
  %273 = invoke noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %30)
          to label %274 unwind label %268

274:                                              ; preds = %272
  %275 = load ptr, ptr %8, align 8, !tbaa !5
  %276 = invoke noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %275)
          to label %277 unwind label %268

277:                                              ; preds = %274
  %278 = invoke noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %276)
          to label %279 unwind label %268

279:                                              ; preds = %277
  %280 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %281 = invoke noundef i32 @_Z11RNIsGreaterddd(double noundef %273, double noundef %278, double noundef %280)
          to label %282 unwind label %268

282:                                              ; preds = %279
  %283 = icmp ne i32 %281, 0
  br i1 %283, label %284, label %285

284:                                              ; preds = %282
  store i32 0, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %329

285:                                              ; preds = %282
  %286 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %12)
          to label %287 unwind label %268

287:                                              ; preds = %285
  %288 = invoke noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %286)
          to label %289 unwind label %268

289:                                              ; preds = %287
  %290 = load ptr, ptr %8, align 8, !tbaa !5
  %291 = invoke noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %290)
          to label %292 unwind label %268

292:                                              ; preds = %289
  %293 = invoke noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %291)
          to label %294 unwind label %268

294:                                              ; preds = %292
  %295 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %296 = invoke noundef i32 @_Z11RNIsGreaterddd(double noundef %288, double noundef %293, double noundef %295)
          to label %297 unwind label %268

297:                                              ; preds = %294
  %298 = icmp ne i32 %296, 0
  br i1 %298, label %299, label %300

299:                                              ; preds = %297
  br label %300

300:                                              ; preds = %299, %297
  call void @llvm.lifetime.start.p0(i64 24, ptr %31) #7
  %301 = load ptr, ptr %7, align 8, !tbaa !5
  %302 = load double, ptr %24, align 8, !tbaa !9
  invoke void @_ZNK5R3Ray5PointEd(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %31, ptr noundef nonnull align 8 dereferenceable(48) %301, double noundef %302)
          to label %303 unwind label %310

303:                                              ; preds = %300
  invoke void @_ZN7R3Point16InverseTransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(24) %31, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %304 unwind label %310

304:                                              ; preds = %303
  %305 = load ptr, ptr %11, align 8, !tbaa !5
  %306 = icmp ne ptr %305, null
  br i1 %306, label %307, label %314

307:                                              ; preds = %304
  %308 = load double, ptr %24, align 8, !tbaa !9
  %309 = load ptr, ptr %11, align 8, !tbaa !5
  store double %308, ptr %309, align 8, !tbaa !9
  br label %314

310:                                              ; preds = %324, %317, %303, %300
  %311 = landingpad { ptr, i32 }
          cleanup
  %312 = extractvalue { ptr, i32 } %311, 0
  store ptr %312, ptr %16, align 8
  %313 = extractvalue { ptr, i32 } %311, 1
  store i32 %313, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  br label %330

314:                                              ; preds = %307, %304
  %315 = load ptr, ptr %9, align 8, !tbaa !5
  %316 = icmp ne ptr %315, null
  br i1 %316, label %317, label %321

317:                                              ; preds = %314
  %318 = load ptr, ptr %9, align 8, !tbaa !5
  %319 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %318, ptr noundef nonnull align 8 dereferenceable(24) %31)
          to label %320 unwind label %310

320:                                              ; preds = %317
  br label %321

321:                                              ; preds = %320, %314
  %322 = load ptr, ptr %10, align 8, !tbaa !5
  %323 = icmp ne ptr %322, null
  br i1 %323, label %324, label %328

324:                                              ; preds = %321
  %325 = load ptr, ptr %10, align 8, !tbaa !5
  %326 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %325, ptr noundef nonnull align 8 dereferenceable(24) @R3null_vector)
          to label %327 unwind label %310

327:                                              ; preds = %324
  br label %328

328:                                              ; preds = %327, %321
  store i32 1, ptr %6, align 4
  store i32 1, ptr %25, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  br label %329

329:                                              ; preds = %328, %284, %267
  call void @llvm.lifetime.end.p0(i64 24, ptr %30) #7
  br label %331

330:                                              ; preds = %310, %268
  call void @llvm.lifetime.end.p0(i64 24, ptr %30) #7
  br label %333

331:                                              ; preds = %329, %257, %248, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %13) #7
  call void @llvm.lifetime.end.p0(i64 272, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #7
  %332 = load i32, ptr %6, align 4
  ret i32 %332

333:                                              ; preds = %330, %205, %180
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %334

334:                                              ; preds = %333, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %335

335:                                              ; preds = %334, %172
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %336

336:                                              ; preds = %335, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %337

337:                                              ; preds = %336, %164
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %338

338:                                              ; preds = %337, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %339

339:                                              ; preds = %338, %156
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %340

340:                                              ; preds = %339, %152, %148
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %13) #7
  call void @llvm.lifetime.end.p0(i64 272, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #7
  br label %341

341:                                              ; preds = %340
  %342 = load ptr, ptr %16, align 8
  %343 = load i32, ptr %17, align 4
  %344 = insertvalue { ptr, i32 } poison, ptr %342, 0
  %345 = insertvalue { ptr, i32 } %344, i32 %343, 1
  resume { ptr, i32 } %345
}

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

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

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

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

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

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

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

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

declare void @_ZN7R3Point16InverseTransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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}


; 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.R4Matrix = type { [4 x [4 x double]] }
%class.R3Vector = type { [3 x double] }
%class.R3Point = type { [3 x double] }
%class.R3Ray = type { %class.R3Line }
%class.R3Line = type { %class.R3Point, %class.R3Vector }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.RNFlags = type { i64 }

@RN_EPSILON = external local_unnamed_addr global double, align 8
@R4identity_matrix = external global %class.R4Matrix, align 8
@R3negz_vector = external global %class.R3Vector, align 8
@R3null_vector = external global %class.R3Vector, 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) local_unnamed_addr #2

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

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

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 #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z11RNIsGreaterddd(double noundef, double noundef, double noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z12RNIsPositivedd(double noundef, double noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z12RNIsNegativedd(double noundef, double noundef) local_unnamed_addr #4

declare void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #6

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3

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

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

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

declare void @_ZN5R3RayC1ERKS_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3

declare void @_ZN5R3Ray9TransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

declare void @_ZNK5R3Ray5PointEd(ptr dead_on_unwind writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(48), double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z12R3IntersectsRK5R3RayRK6R3ConeP7R3PointP8R3VectorPd(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(160) %1, ptr noundef %2, ptr noundef %3, ptr noundef writeonly %4) local_unnamed_addr #7 personality ptr @__gxx_personality_v0 {
  %6 = alloca %class.R3Ray, align 8
  %7 = alloca %class.R3Affine, align 8
  %8 = alloca %class.R3Vector, align 8
  %9 = alloca %class.R3Vector, align 8
  %10 = alloca %class.R3Point, align 8
  %11 = alloca %class.R3Point, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #8
  call void @_ZN5R3RayC1ERKS_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(48) %0)
  call void @llvm.lifetime.start.p0(i64 272, ptr nonnull %7) #8
  call void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272) %7, ptr noundef nonnull align 8 dereferenceable(128) @R4identity_matrix, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #8
  %12 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %1)
  %13 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span3EndEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
  invoke void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) %13)
          to label %14 unwind label %67

14:                                               ; preds = %5
  invoke void @_ZngRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %15 unwind label %67

15:                                               ; preds = %14
  invoke void @_ZN8R3Affine9TranslateERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(272) %7, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %16 unwind label %67

16:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #8
  %17 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %1)
  %18 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Span6VectorEv(ptr noundef nonnull align 8 dereferenceable(80) %17)
  invoke void @_ZN8R3Affine6RotateERK8R3VectorS2_(ptr noundef nonnull align 8 dereferenceable(272) %7, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(24) @R3negz_vector)
          to label %19 unwind label %69

19:                                               ; preds = %16
  invoke void @_ZN5R3Ray9TransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %20 unwind label %69

20:                                               ; preds = %19
  %21 = call noundef double @_ZNK6R3Cone6RadiusEv(ptr noundef nonnull align 8 dereferenceable(160) %1)
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %6)
  %23 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray6VectorEv(ptr noundef nonnull align 8 dereferenceable(48) %6)
  %24 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %25 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %26 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %27 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %28 = fmul double %26, %27
  %29 = call double @llvm.fmuladd.f64(double %24, double %25, double %28)
  %30 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %31 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %32 = fneg double %21
  %33 = fmul double %21, %32
  %34 = fmul double %33, %30
  %35 = call double @llvm.fmuladd.f64(double %34, double %31, double %29)
  %36 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %37 = fmul double %36, 2.000000e+00
  %38 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %39 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %40 = fmul double %39, 2.000000e+00
  %41 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %42 = fmul double %40, %41
  %43 = call double @llvm.fmuladd.f64(double %37, double %38, double %42)
  %44 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %45 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %46 = fmul double %21, -2.000000e+00
  %47 = fmul double %21, %46
  %48 = fmul double %47, %44
  %49 = call double @llvm.fmuladd.f64(double %48, double %45, double %43)
  %50 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %51 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %52 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %53 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %54 = fmul double %52, %53
  %55 = call double @llvm.fmuladd.f64(double %50, double %51, double %54)
  %56 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %57 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %58 = fmul double %33, %56
  %59 = call double @llvm.fmuladd.f64(double %58, double %57, double %55)
  %60 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %61 = invoke noundef i32 @_Z8RNIsZerodd(double noundef %35, double noundef %60)
          to label %62 unwind label %71

62:                                               ; preds = %20
  %.not = icmp eq i32 %61, 0
  br i1 %.not, label %76, label %63

63:                                               ; preds = %62
  %64 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %65 = invoke noundef i32 @_Z8RNIsZerodd(double noundef %49, double noundef %64)
          to label %66 unwind label %71

66:                                               ; preds = %63
  %.not81 = icmp eq i32 %65, 0
  br i1 %.not81, label %73, label %142

67:                                               ; preds = %15, %14, %5
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #8
  br label %143

69:                                               ; preds = %19, %16
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %143

71:                                               ; preds = %63, %20
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %143

73:                                               ; preds = %66
  %74 = fneg double %59
  %75 = fdiv double %74, %49
  br label %.thread

76:                                               ; preds = %62
  %77 = fmul double %35, -4.000000e+00
  %78 = fmul double %77, %59
  %79 = call double @llvm.fmuladd.f64(double %49, double %49, double %78)
  %80 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %81 = call noundef i32 @_Z12RNIsNegativedd(double noundef %79, double noundef %80)
  %.not79 = icmp eq i32 %81, 0
  br i1 %.not79, label %82, label %142

82:                                               ; preds = %76
  %83 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %84 = call noundef i32 @_Z12RNIsPositivedd(double noundef %79, double noundef %83)
  %.not80 = icmp eq i32 %84, 0
  br i1 %.not80, label %101, label %85

85:                                               ; preds = %82
  %86 = call double @sqrt(double noundef %79) #8
  %87 = fneg double %49
  %88 = insertelement <2 x double> poison, double %87, i64 0
  %89 = insertelement <2 x double> %88, double %86, i64 1
  %90 = insertelement <2 x double> poison, double %86, i64 0
  %91 = insertelement <2 x double> %90, double %49, i64 1
  %92 = fsub <2 x double> %89, %91
  %93 = fmul <2 x double> %92, <double 5.000000e-01, double 5.000000e-01>
  %94 = insertelement <2 x double> poison, double %35, i64 0
  %95 = shufflevector <2 x double> %94, <2 x double> poison, <2 x i32> zeroinitializer
  %96 = fdiv <2 x double> %93, %95
  %97 = extractelement <2 x double> %96, i64 0
  %98 = extractelement <2 x double> %96, i64 1
  %99 = fcmp olt double %97, %98
  %100 = select i1 %99, double %97, double %98
  br label %.thread

101:                                              ; preds = %82
  %102 = fmul double %49, -5.000000e-01
  %103 = fdiv double %102, %35
  br label %.thread

.thread:                                          ; preds = %85, %101, %73
  %.275 = phi double [ %75, %73 ], [ %103, %101 ], [ %100, %85 ]
  %104 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %105 = call noundef i32 @_Z12RNIsNegativedd(double noundef %.275, double noundef %104)
  %.not82 = icmp eq i32 %105, 0
  br i1 %.not82, label %106, label %142

106:                                              ; preds = %.thread
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #8
  invoke void @_ZNK5R3Ray5PointEd(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %10, ptr noundef nonnull align 8 dereferenceable(48) %6, double noundef %.275)
          to label %107 unwind label %111

107:                                              ; preds = %106
  %108 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %109 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %110 = call noundef i32 @_Z12RNIsNegativedd(double noundef %108, double noundef %109)
  %.not83 = icmp eq i32 %110, 0
  br i1 %.not83, label %113, label %140

111:                                              ; preds = %120, %113, %106
  %112 = landingpad { ptr, i32 }
          cleanup
  br label %141

113:                                              ; preds = %107
  %114 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %115 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %1)
  %116 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %115)
  %117 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %118 = invoke noundef i32 @_Z11RNIsGreaterddd(double noundef %114, double noundef %116, double noundef %117)
          to label %119 unwind label %111

119:                                              ; preds = %113
  %.not84 = icmp eq i32 %118, 0
  br i1 %.not84, label %120, label %140

120:                                              ; preds = %119
  %121 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3Ray5StartEv(ptr noundef nonnull align 8 dereferenceable(48) %6)
  %122 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %121)
  %123 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNK6R3Cone4AxisEv(ptr noundef nonnull align 8 dereferenceable(160) %1)
  %124 = call noundef double @_ZNK6R3Span6LengthEv(ptr noundef nonnull align 8 dereferenceable(80) %123)
  %125 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %126 = invoke noundef i32 @_Z11RNIsGreaterddd(double noundef %122, double noundef %124, double noundef %125)
          to label %127 unwind label %111

127:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #8
  invoke void @_ZNK5R3Ray5PointEd(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %11, ptr noundef nonnull align 8 dereferenceable(48) %0, double noundef %.275)
          to label %128 unwind label %131

128:                                              ; preds = %127
  invoke void @_ZN7R3Point16InverseTransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %129 unwind label %131

129:                                              ; preds = %128
  %.not85 = icmp eq ptr %4, null
  br i1 %.not85, label %133, label %130

130:                                              ; preds = %129
  store double %.275, ptr %4, align 8, !tbaa !5
  br label %133

131:                                              ; preds = %137, %134, %128, %127
  %132 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #8
  br label %141

133:                                              ; preds = %130, %129
  %.not86 = icmp eq ptr %2, null
  br i1 %.not86, label %136, label %134

134:                                              ; preds = %133
  %135 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %136 unwind label %131

136:                                              ; preds = %134, %133
  %.not87 = icmp eq ptr %3, null
  br i1 %.not87, label %139, label %137

137:                                              ; preds = %136
  %138 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectoraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) @R3null_vector)
          to label %139 unwind label %131

139:                                              ; preds = %137, %136
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #8
  br label %140

140:                                              ; preds = %119, %107, %139
  %.1 = phi i32 [ 1, %139 ], [ 0, %107 ], [ 0, %119 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #8
  br label %142

141:                                              ; preds = %131, %111
  %.pn = phi { ptr, i32 } [ %132, %131 ], [ %112, %111 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #8
  br label %143

142:                                              ; preds = %76, %.thread, %66, %140
  %.2 = phi i32 [ %.1, %140 ], [ 0, %66 ], [ 0, %.thread ], [ 0, %76 ]
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %7) #8
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #8
  ret i32 %.2

143:                                              ; preds = %71, %141, %69, %67
  %.pn.pn.pn = phi { ptr, i32 } [ %70, %69 ], [ %68, %67 ], [ %.pn, %141 ], [ %72, %71 ]
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %7) #8
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #8
  resume { ptr, i32 } %.pn.pn.pn
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3Affine9TranslateERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3Affine6RotateERK8R3VectorS2_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

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

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

declare void @_ZN7R3Point16InverseTransformERK16R3Transformation(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass