; LLVM IR from heroseh/cgm :: cgm (cgm_3d_ray_vs_sphere)

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

%union.CgmVec3 = type { %struct.anon.0 }
%struct.anon.0 = type { float, float, float }
%struct.CgmSphere = type { %union.anon.7, float }
%union.anon.7 = type { %struct.anon.8 }
%struct.anon.8 = type { float, float, float }
%struct.CgmRay3d = type { %union.CgmVec3, %union.CgmVec3 }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_add(<2 x float>, float, <2 x float>, float) #4

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_sub(<2 x float>, float, <2 x float>, float) #4

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float>, float, float noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local float @CgmVec3_len(<2 x float>, float) #4

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_norm(<2 x float>, float) #4

; Function Attrs: nounwind uwtable
declare dso_local float @CgmVec3_dot(<2 x float>, float, <2 x float>, float) #4

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmRay3d_get_projected_pt(ptr noundef, float noundef, <2 x float>, float) #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @cgm_3d_ray_vs_sphere(ptr noundef %0, float noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #4 {
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %union.CgmVec3, align 4
  %13 = alloca { <2 x float>, float }, align 4
  %14 = alloca { <2 x float>, float }, align 4
  %15 = alloca { <2 x float>, float }, align 8
  %16 = alloca float, align 4
  %17 = alloca { <2 x float>, float }, align 4
  %18 = alloca { <2 x float>, float }, align 4
  %19 = alloca float, align 4
  %20 = alloca { <2 x float>, float }, align 4
  %21 = alloca { <2 x float>, float }, align 4
  %22 = alloca i32, align 4
  %23 = alloca %union.CgmVec3, align 4
  %24 = alloca %union.CgmVec3, align 4
  %25 = alloca { <2 x float>, float }, align 4
  %26 = alloca { <2 x float>, float }, align 4
  %27 = alloca { <2 x float>, float }, align 8
  %28 = alloca { <2 x float>, float }, align 4
  %29 = alloca { <2 x float>, float }, align 8
  %30 = alloca %union.CgmVec3, align 4
  %31 = alloca { <2 x float>, float }, align 4
  %32 = alloca { <2 x float>, float }, align 8
  %33 = alloca %union.CgmVec3, align 4
  %34 = alloca { <2 x float>, float }, align 4
  %35 = alloca { <2 x float>, float }, align 4
  %36 = alloca { <2 x float>, float }, align 8
  %37 = alloca float, align 4
  %38 = alloca { <2 x float>, float }, align 4
  %39 = alloca { <2 x float>, float }, align 4
  %40 = alloca float, align 4
  %41 = alloca %union.CgmVec3, align 4
  %42 = alloca { <2 x float>, float }, align 4
  %43 = alloca { <2 x float>, float }, align 4
  %44 = alloca { <2 x float>, float }, align 8
  %45 = alloca { <2 x float>, float }, align 4
  %46 = alloca %union.CgmVec3, align 4
  %47 = alloca %union.CgmVec3, align 4
  %48 = alloca %union.CgmVec3, align 4
  %49 = alloca %union.CgmVec3, align 4
  %50 = alloca { <2 x float>, float }, align 4
  %51 = alloca { <2 x float>, float }, align 8
  %52 = alloca { <2 x float>, float }, align 4
  %53 = alloca { <2 x float>, float }, align 4
  %54 = alloca { <2 x float>, float }, align 8
  %55 = alloca { <2 x float>, float }, align 4
  %56 = alloca { <2 x float>, float }, align 4
  %57 = alloca { <2 x float>, float }, align 8
  %58 = alloca { <2 x float>, float }, align 4
  %59 = alloca { <2 x float>, float }, align 8
  %60 = alloca %union.CgmVec3, align 4
  %61 = alloca { <2 x float>, float }, align 4
  %62 = alloca { <2 x float>, float }, align 8
  %63 = alloca %union.CgmVec3, align 4
  %64 = alloca { <2 x float>, float }, align 4
  %65 = alloca { <2 x float>, float }, align 4
  %66 = alloca { <2 x float>, float }, align 8
  %67 = alloca float, align 4
  %68 = alloca { <2 x float>, float }, align 4
  %69 = alloca { <2 x float>, float }, align 4
  %70 = alloca float, align 4
  %71 = alloca %union.CgmVec3, align 4
  %72 = alloca { <2 x float>, float }, align 4
  %73 = alloca { <2 x float>, float }, align 4
  %74 = alloca { <2 x float>, float }, align 8
  %75 = alloca float, align 4
  %76 = alloca { <2 x float>, float }, align 4
  %77 = alloca { <2 x float>, float }, align 4
  %78 = alloca float, align 4
  %79 = alloca %union.CgmVec3, align 4
  %80 = alloca %union.CgmVec3, align 4
  %81 = alloca %union.CgmVec3, align 4
  %82 = alloca %union.CgmVec3, align 4
  %83 = alloca { <2 x float>, float }, align 4
  %84 = alloca { <2 x float>, float }, align 8
  %85 = alloca { <2 x float>, float }, align 4
  %86 = alloca { <2 x float>, float }, align 4
  %87 = alloca { <2 x float>, float }, align 8
  %88 = alloca { <2 x float>, float }, align 4
  %89 = alloca { <2 x float>, float }, align 4
  %90 = alloca { <2 x float>, float }, align 8
  %91 = alloca { <2 x float>, float }, align 4
  %92 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store float %1, ptr %8, align 4, !tbaa !9
  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 12, ptr %12) #5
  %93 = load ptr, ptr %9, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.CgmSphere, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.CgmRay3d, ptr %95, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %94, i64 12, i1 false)
  %97 = getelementptr inbounds { <2 x float>, float }, ptr %13, i32 0, i32 0
  %98 = load <2 x float>, ptr %97, align 4
  %99 = getelementptr inbounds { <2 x float>, float }, ptr %13, i32 0, i32 1
  %100 = load float, ptr %99, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %96, i64 12, i1 false)
  %101 = getelementptr inbounds { <2 x float>, float }, ptr %14, i32 0, i32 0
  %102 = load <2 x float>, ptr %101, align 4
  %103 = getelementptr inbounds { <2 x float>, float }, ptr %14, i32 0, i32 1
  %104 = load float, ptr %103, align 4
  %105 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %98, float %100, <2 x float> %102, float %104)
  %106 = getelementptr inbounds %union.CgmVec3, ptr %12, i32 0, i32 0
  store { <2 x float>, float } %105, ptr %15, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %106, ptr align 8 %15, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %12, i64 12, i1 false)
  %107 = getelementptr inbounds { <2 x float>, float }, ptr %17, i32 0, i32 0
  %108 = load <2 x float>, ptr %107, align 4
  %109 = getelementptr inbounds { <2 x float>, float }, ptr %17, i32 0, i32 1
  %110 = load float, ptr %109, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %12, i64 12, i1 false)
  %111 = getelementptr inbounds { <2 x float>, float }, ptr %18, i32 0, i32 0
  %112 = load <2 x float>, ptr %111, align 4
  %113 = getelementptr inbounds { <2 x float>, float }, ptr %18, i32 0, i32 1
  %114 = load float, ptr %113, align 4
  %115 = call float @CgmVec3_dot(<2 x float> %108, float %110, <2 x float> %112, float %114)
  store float %115, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.CgmSphere, ptr %116, i32 0, i32 1
  %118 = load float, ptr %117, align 4, !tbaa !11
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.CgmSphere, ptr %119, i32 0, i32 1
  %121 = load float, ptr %120, align 4, !tbaa !11
  %122 = fmul float %118, %121
  store float %122, ptr %19, align 4, !tbaa !9
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.CgmRay3d, ptr %123, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %12, i64 12, i1 false)
  %125 = getelementptr inbounds { <2 x float>, float }, ptr %20, i32 0, i32 0
  %126 = load <2 x float>, ptr %125, align 4
  %127 = getelementptr inbounds { <2 x float>, float }, ptr %20, i32 0, i32 1
  %128 = load float, ptr %127, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %124, i64 12, i1 false)
  %129 = getelementptr inbounds { <2 x float>, float }, ptr %21, i32 0, i32 0
  %130 = load <2 x float>, ptr %129, align 4
  %131 = getelementptr inbounds { <2 x float>, float }, ptr %21, i32 0, i32 1
  %132 = load float, ptr %131, align 4
  %133 = call float @CgmVec3_dot(<2 x float> %126, float %128, <2 x float> %130, float %132)
  %134 = fcmp olt float %133, 0.000000e+00
  br i1 %134, label %135, label %306

135:                                              ; preds = %5
  %136 = load float, ptr %16, align 4, !tbaa !9
  %137 = load float, ptr %19, align 4, !tbaa !9
  %138 = fcmp ogt float %136, %137
  br i1 %138, label %139, label %140

139:                                              ; preds = %135
  store i8 0, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %456

140:                                              ; preds = %135
  %141 = load float, ptr %16, align 4, !tbaa !9
  %142 = load float, ptr %19, align 4, !tbaa !9
  %143 = fcmp oeq float %141, %142
  br i1 %143, label %144, label %175

144:                                              ; preds = %140
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = icmp ne ptr %145, null
  br i1 %146, label %147, label %149

147:                                              ; preds = %144
  %148 = load ptr, ptr %11, align 8, !tbaa !5
  store float 0.000000e+00, ptr %148, align 4, !tbaa !9
  br label %149

149:                                              ; preds = %147, %144
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = icmp ne ptr %150, null
  br i1 %151, label %152, label %174

152:                                              ; preds = %149
  %153 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #5
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.CgmRay3d, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %9, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.CgmSphere, ptr %156, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %155, i64 12, i1 false)
  %158 = getelementptr inbounds { <2 x float>, float }, ptr %25, i32 0, i32 0
  %159 = load <2 x float>, ptr %158, align 4
  %160 = getelementptr inbounds { <2 x float>, float }, ptr %25, i32 0, i32 1
  %161 = load float, ptr %160, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %157, i64 12, i1 false)
  %162 = getelementptr inbounds { <2 x float>, float }, ptr %26, i32 0, i32 0
  %163 = load <2 x float>, ptr %162, align 4
  %164 = getelementptr inbounds { <2 x float>, float }, ptr %26, i32 0, i32 1
  %165 = load float, ptr %164, align 4
  %166 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %159, float %161, <2 x float> %163, float %165)
  %167 = getelementptr inbounds %union.CgmVec3, ptr %24, i32 0, i32 0
  store { <2 x float>, float } %166, ptr %27, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %167, ptr align 8 %27, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %24, i64 12, i1 false)
  %168 = getelementptr inbounds { <2 x float>, float }, ptr %28, i32 0, i32 0
  %169 = load <2 x float>, ptr %168, align 4
  %170 = getelementptr inbounds { <2 x float>, float }, ptr %28, i32 0, i32 1
  %171 = load float, ptr %170, align 4
  %172 = call { <2 x float>, float } @CgmVec3_norm(<2 x float> %169, float %171)
  %173 = getelementptr inbounds %union.CgmVec3, ptr %23, i32 0, i32 0
  store { <2 x float>, float } %172, ptr %29, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %173, ptr align 8 %29, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %153, ptr align 4 %23, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #5
  br label %174

174:                                              ; preds = %152, %149
  br label %304

175:                                              ; preds = %140
  %176 = load float, ptr %8, align 4, !tbaa !9
  %177 = call float @llvm.fabs.f32(float %176) #6
  %178 = fcmp oeq float %177, 0x7FF0000000000000
  %179 = bitcast float %176 to i32
  %180 = icmp slt i32 %179, 0
  %181 = select i1 %180, i32 -1, i32 1
  %182 = select i1 %178, i32 %181, i32 0
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %191

184:                                              ; preds = %175
  %185 = load ptr, ptr %10, align 8, !tbaa !5
  %186 = icmp ne ptr %185, null
  br i1 %186, label %191, label %187

187:                                              ; preds = %184
  %188 = load ptr, ptr %11, align 8, !tbaa !5
  %189 = icmp ne ptr %188, null
  br i1 %189, label %191, label %190

190:                                              ; preds = %187
  store i8 1, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %456

191:                                              ; preds = %187, %184, %175
  call void @llvm.lifetime.start.p0(i64 12, ptr %30) #5
  %192 = load ptr, ptr %7, align 8, !tbaa !5
  %193 = load float, ptr %8, align 4, !tbaa !9
  %194 = load ptr, ptr %9, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.CgmSphere, ptr %194, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %195, i64 12, i1 false)
  %196 = getelementptr inbounds { <2 x float>, float }, ptr %31, i32 0, i32 0
  %197 = load <2 x float>, ptr %196, align 4
  %198 = getelementptr inbounds { <2 x float>, float }, ptr %31, i32 0, i32 1
  %199 = load float, ptr %198, align 4
  %200 = call { <2 x float>, float } @CgmRay3d_get_projected_pt(ptr noundef %192, float noundef %193, <2 x float> %197, float %199)
  %201 = getelementptr inbounds %union.CgmVec3, ptr %30, i32 0, i32 0
  store { <2 x float>, float } %200, ptr %32, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %201, ptr align 8 %32, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %33) #5
  %202 = load ptr, ptr %9, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.CgmSphere, ptr %202, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %30, i64 12, i1 false)
  %204 = getelementptr inbounds { <2 x float>, float }, ptr %34, i32 0, i32 0
  %205 = load <2 x float>, ptr %204, align 4
  %206 = getelementptr inbounds { <2 x float>, float }, ptr %34, i32 0, i32 1
  %207 = load float, ptr %206, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %203, i64 12, i1 false)
  %208 = getelementptr inbounds { <2 x float>, float }, ptr %35, i32 0, i32 0
  %209 = load <2 x float>, ptr %208, align 4
  %210 = getelementptr inbounds { <2 x float>, float }, ptr %35, i32 0, i32 1
  %211 = load float, ptr %210, align 4
  %212 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %205, float %207, <2 x float> %209, float %211)
  %213 = getelementptr inbounds %union.CgmVec3, ptr %33, i32 0, i32 0
  store { <2 x float>, float } %212, ptr %36, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %213, ptr align 8 %36, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %38, ptr align 4 %33, i64 12, i1 false)
  %214 = getelementptr inbounds { <2 x float>, float }, ptr %38, i32 0, i32 0
  %215 = load <2 x float>, ptr %214, align 4
  %216 = getelementptr inbounds { <2 x float>, float }, ptr %38, i32 0, i32 1
  %217 = load float, ptr %216, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %33, i64 12, i1 false)
  %218 = getelementptr inbounds { <2 x float>, float }, ptr %39, i32 0, i32 0
  %219 = load <2 x float>, ptr %218, align 4
  %220 = getelementptr inbounds { <2 x float>, float }, ptr %39, i32 0, i32 1
  %221 = load float, ptr %220, align 4
  %222 = call float @CgmVec3_dot(<2 x float> %215, float %217, <2 x float> %219, float %221)
  store float %222, ptr %37, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #5
  %223 = load float, ptr %19, align 4, !tbaa !9
  %224 = load float, ptr %37, align 4, !tbaa !9
  %225 = fsub float %223, %224
  %226 = call float @sqrtf(float noundef %225) #5
  store float %226, ptr %40, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %41) #5
  %227 = load ptr, ptr %7, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.CgmRay3d, ptr %227, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %42, ptr align 4 %30, i64 12, i1 false)
  %229 = getelementptr inbounds { <2 x float>, float }, ptr %42, i32 0, i32 0
  %230 = load <2 x float>, ptr %229, align 4
  %231 = getelementptr inbounds { <2 x float>, float }, ptr %42, i32 0, i32 1
  %232 = load float, ptr %231, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %43, ptr align 4 %228, i64 12, i1 false)
  %233 = getelementptr inbounds { <2 x float>, float }, ptr %43, i32 0, i32 0
  %234 = load <2 x float>, ptr %233, align 4
  %235 = getelementptr inbounds { <2 x float>, float }, ptr %43, i32 0, i32 1
  %236 = load float, ptr %235, align 4
  %237 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %230, float %232, <2 x float> %234, float %236)
  %238 = getelementptr inbounds %union.CgmVec3, ptr %41, i32 0, i32 0
  store { <2 x float>, float } %237, ptr %44, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %238, ptr align 8 %44, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %41, i64 12, i1 false)
  %239 = getelementptr inbounds { <2 x float>, float }, ptr %45, i32 0, i32 0
  %240 = load <2 x float>, ptr %239, align 4
  %241 = getelementptr inbounds { <2 x float>, float }, ptr %45, i32 0, i32 1
  %242 = load float, ptr %241, align 4
  %243 = call float @CgmVec3_len(<2 x float> %240, float %242)
  %244 = load float, ptr %40, align 4, !tbaa !9
  %245 = fsub float %244, %243
  store float %245, ptr %40, align 4, !tbaa !9
  %246 = load float, ptr %40, align 4, !tbaa !9
  %247 = load float, ptr %8, align 4, !tbaa !9
  %248 = fcmp ogt float %246, %247
  br i1 %248, label %249, label %250

249:                                              ; preds = %191
  store i8 0, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %301

250:                                              ; preds = %191
  %251 = load ptr, ptr %11, align 8, !tbaa !5
  %252 = icmp ne ptr %251, null
  br i1 %252, label %253, label %256

253:                                              ; preds = %250
  %254 = load float, ptr %40, align 4, !tbaa !9
  %255 = load ptr, ptr %11, align 8, !tbaa !5
  store float %254, ptr %255, align 4, !tbaa !9
  br label %256

256:                                              ; preds = %253, %250
  %257 = load ptr, ptr %10, align 8, !tbaa !5
  %258 = icmp ne ptr %257, null
  br i1 %258, label %259, label %300

259:                                              ; preds = %256
  %260 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %46) #5
  %261 = load ptr, ptr %7, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.CgmRay3d, ptr %261, i32 0, i32 0
  %263 = load ptr, ptr %7, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.CgmRay3d, ptr %263, i32 0, i32 1
  %265 = load float, ptr %40, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %50, ptr align 4 %264, i64 12, i1 false)
  %266 = getelementptr inbounds { <2 x float>, float }, ptr %50, i32 0, i32 0
  %267 = load <2 x float>, ptr %266, align 4
  %268 = getelementptr inbounds { <2 x float>, float }, ptr %50, i32 0, i32 1
  %269 = load float, ptr %268, align 4
  %270 = call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %267, float %269, float noundef %265)
  %271 = getelementptr inbounds %union.CgmVec3, ptr %49, i32 0, i32 0
  store { <2 x float>, float } %270, ptr %51, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %271, ptr align 8 %51, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %52, ptr align 4 %262, i64 12, i1 false)
  %272 = getelementptr inbounds { <2 x float>, float }, ptr %52, i32 0, i32 0
  %273 = load <2 x float>, ptr %272, align 4
  %274 = getelementptr inbounds { <2 x float>, float }, ptr %52, i32 0, i32 1
  %275 = load float, ptr %274, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %53, ptr align 4 %49, i64 12, i1 false)
  %276 = getelementptr inbounds { <2 x float>, float }, ptr %53, i32 0, i32 0
  %277 = load <2 x float>, ptr %276, align 4
  %278 = getelementptr inbounds { <2 x float>, float }, ptr %53, i32 0, i32 1
  %279 = load float, ptr %278, align 4
  %280 = call { <2 x float>, float } @CgmVec3_add(<2 x float> %273, float %275, <2 x float> %277, float %279)
  %281 = getelementptr inbounds %union.CgmVec3, ptr %48, i32 0, i32 0
  store { <2 x float>, float } %280, ptr %54, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %281, ptr align 8 %54, i64 12, i1 false)
  %282 = load ptr, ptr %9, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.CgmSphere, ptr %282, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %55, ptr align 4 %48, i64 12, i1 false)
  %284 = getelementptr inbounds { <2 x float>, float }, ptr %55, i32 0, i32 0
  %285 = load <2 x float>, ptr %284, align 4
  %286 = getelementptr inbounds { <2 x float>, float }, ptr %55, i32 0, i32 1
  %287 = load float, ptr %286, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %56, ptr align 4 %283, i64 12, i1 false)
  %288 = getelementptr inbounds { <2 x float>, float }, ptr %56, i32 0, i32 0
  %289 = load <2 x float>, ptr %288, align 4
  %290 = getelementptr inbounds { <2 x float>, float }, ptr %56, i32 0, i32 1
  %291 = load float, ptr %290, align 4
  %292 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %285, float %287, <2 x float> %289, float %291)
  %293 = getelementptr inbounds %union.CgmVec3, ptr %47, i32 0, i32 0
  store { <2 x float>, float } %292, ptr %57, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %293, ptr align 8 %57, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %58, ptr align 4 %47, i64 12, i1 false)
  %294 = getelementptr inbounds { <2 x float>, float }, ptr %58, i32 0, i32 0
  %295 = load <2 x float>, ptr %294, align 4
  %296 = getelementptr inbounds { <2 x float>, float }, ptr %58, i32 0, i32 1
  %297 = load float, ptr %296, align 4
  %298 = call { <2 x float>, float } @CgmVec3_norm(<2 x float> %295, float %297)
  %299 = getelementptr inbounds %union.CgmVec3, ptr %46, i32 0, i32 0
  store { <2 x float>, float } %298, ptr %59, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %299, ptr align 8 %59, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %260, ptr align 4 %46, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 12, ptr %46) #5
  br label %300

300:                                              ; preds = %259, %256
  store i32 0, ptr %22, align 4
  br label %301

301:                                              ; preds = %300, %249
  call void @llvm.lifetime.end.p0(i64 12, ptr %41) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %33) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %30) #5
  %302 = load i32, ptr %22, align 4
  switch i32 %302, label %456 [
    i32 0, label %303
  ]

303:                                              ; preds = %301
  br label %304

304:                                              ; preds = %303, %174
  br label %305

305:                                              ; preds = %304
  br label %455

306:                                              ; preds = %5
  call void @llvm.lifetime.start.p0(i64 12, ptr %60) #5
  %307 = load ptr, ptr %7, align 8, !tbaa !5
  %308 = load float, ptr %8, align 4, !tbaa !9
  %309 = load ptr, ptr %9, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.CgmSphere, ptr %309, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %61, ptr align 4 %310, i64 12, i1 false)
  %311 = getelementptr inbounds { <2 x float>, float }, ptr %61, i32 0, i32 0
  %312 = load <2 x float>, ptr %311, align 4
  %313 = getelementptr inbounds { <2 x float>, float }, ptr %61, i32 0, i32 1
  %314 = load float, ptr %313, align 4
  %315 = call { <2 x float>, float } @CgmRay3d_get_projected_pt(ptr noundef %307, float noundef %308, <2 x float> %312, float %314)
  %316 = getelementptr inbounds %union.CgmVec3, ptr %60, i32 0, i32 0
  store { <2 x float>, float } %315, ptr %62, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %316, ptr align 8 %62, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %63) #5
  %317 = load ptr, ptr %9, align 8, !tbaa !5
  %318 = getelementptr inbounds %struct.CgmSphere, ptr %317, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %64, ptr align 4 %60, i64 12, i1 false)
  %319 = getelementptr inbounds { <2 x float>, float }, ptr %64, i32 0, i32 0
  %320 = load <2 x float>, ptr %319, align 4
  %321 = getelementptr inbounds { <2 x float>, float }, ptr %64, i32 0, i32 1
  %322 = load float, ptr %321, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %65, ptr align 4 %318, i64 12, i1 false)
  %323 = getelementptr inbounds { <2 x float>, float }, ptr %65, i32 0, i32 0
  %324 = load <2 x float>, ptr %323, align 4
  %325 = getelementptr inbounds { <2 x float>, float }, ptr %65, i32 0, i32 1
  %326 = load float, ptr %325, align 4
  %327 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %320, float %322, <2 x float> %324, float %326)
  %328 = getelementptr inbounds %union.CgmVec3, ptr %63, i32 0, i32 0
  store { <2 x float>, float } %327, ptr %66, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %328, ptr align 8 %66, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %67) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %68, ptr align 4 %63, i64 12, i1 false)
  %329 = getelementptr inbounds { <2 x float>, float }, ptr %68, i32 0, i32 0
  %330 = load <2 x float>, ptr %329, align 4
  %331 = getelementptr inbounds { <2 x float>, float }, ptr %68, i32 0, i32 1
  %332 = load float, ptr %331, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %69, ptr align 4 %63, i64 12, i1 false)
  %333 = getelementptr inbounds { <2 x float>, float }, ptr %69, i32 0, i32 0
  %334 = load <2 x float>, ptr %333, align 4
  %335 = getelementptr inbounds { <2 x float>, float }, ptr %69, i32 0, i32 1
  %336 = load float, ptr %335, align 4
  %337 = call float @CgmVec3_dot(<2 x float> %330, float %332, <2 x float> %334, float %336)
  store float %337, ptr %67, align 4, !tbaa !9
  %338 = load float, ptr %67, align 4, !tbaa !9
  %339 = load float, ptr %19, align 4, !tbaa !9
  %340 = fcmp ogt float %338, %339
  br i1 %340, label %341, label %342

341:                                              ; preds = %306
  store i8 0, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %454

342:                                              ; preds = %306
  %343 = load float, ptr %8, align 4, !tbaa !9
  %344 = call float @llvm.fabs.f32(float %343) #6
  %345 = fcmp oeq float %344, 0x7FF0000000000000
  %346 = bitcast float %343 to i32
  %347 = icmp slt i32 %346, 0
  %348 = select i1 %347, i32 -1, i32 1
  %349 = select i1 %345, i32 %348, i32 0
  %350 = icmp ne i32 %349, 0
  br i1 %350, label %351, label %358

351:                                              ; preds = %342
  %352 = load ptr, ptr %10, align 8, !tbaa !5
  %353 = icmp ne ptr %352, null
  br i1 %353, label %358, label %354

354:                                              ; preds = %351
  %355 = load ptr, ptr %11, align 8, !tbaa !5
  %356 = icmp ne ptr %355, null
  br i1 %356, label %358, label %357

357:                                              ; preds = %354
  store i8 1, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %454

358:                                              ; preds = %354, %351, %342
  call void @llvm.lifetime.start.p0(i64 4, ptr %70) #5
  %359 = load float, ptr %19, align 4, !tbaa !9
  %360 = load float, ptr %67, align 4, !tbaa !9
  %361 = fsub float %359, %360
  %362 = call float @sqrtf(float noundef %361) #5
  store float %362, ptr %70, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %71) #5
  %363 = load ptr, ptr %7, align 8, !tbaa !5
  %364 = getelementptr inbounds %struct.CgmRay3d, ptr %363, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %72, ptr align 4 %60, i64 12, i1 false)
  %365 = getelementptr inbounds { <2 x float>, float }, ptr %72, i32 0, i32 0
  %366 = load <2 x float>, ptr %365, align 4
  %367 = getelementptr inbounds { <2 x float>, float }, ptr %72, i32 0, i32 1
  %368 = load float, ptr %367, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %73, ptr align 4 %364, i64 12, i1 false)
  %369 = getelementptr inbounds { <2 x float>, float }, ptr %73, i32 0, i32 0
  %370 = load <2 x float>, ptr %369, align 4
  %371 = getelementptr inbounds { <2 x float>, float }, ptr %73, i32 0, i32 1
  %372 = load float, ptr %371, align 4
  %373 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %366, float %368, <2 x float> %370, float %372)
  %374 = getelementptr inbounds %union.CgmVec3, ptr %71, i32 0, i32 0
  store { <2 x float>, float } %373, ptr %74, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %374, ptr align 8 %74, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %75) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %76, ptr align 4 %71, i64 12, i1 false)
  %375 = getelementptr inbounds { <2 x float>, float }, ptr %76, i32 0, i32 0
  %376 = load <2 x float>, ptr %375, align 4
  %377 = getelementptr inbounds { <2 x float>, float }, ptr %76, i32 0, i32 1
  %378 = load float, ptr %377, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %77, ptr align 4 %71, i64 12, i1 false)
  %379 = getelementptr inbounds { <2 x float>, float }, ptr %77, i32 0, i32 0
  %380 = load <2 x float>, ptr %379, align 4
  %381 = getelementptr inbounds { <2 x float>, float }, ptr %77, i32 0, i32 1
  %382 = load float, ptr %381, align 4
  %383 = call float @CgmVec3_dot(<2 x float> %376, float %378, <2 x float> %380, float %382)
  store float %383, ptr %75, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %78) #5
  %384 = load float, ptr %75, align 4, !tbaa !9
  %385 = call float @sqrtf(float noundef %384) #5
  store float %385, ptr %78, align 4, !tbaa !9
  %386 = load float, ptr %16, align 4, !tbaa !9
  %387 = load float, ptr %19, align 4, !tbaa !9
  %388 = fcmp ogt float %386, %387
  br i1 %388, label %389, label %393

389:                                              ; preds = %358
  %390 = load float, ptr %70, align 4, !tbaa !9
  %391 = load float, ptr %78, align 4, !tbaa !9
  %392 = fsub float %391, %390
  store float %392, ptr %78, align 4, !tbaa !9
  br label %397

393:                                              ; preds = %358
  %394 = load float, ptr %70, align 4, !tbaa !9
  %395 = load float, ptr %78, align 4, !tbaa !9
  %396 = fadd float %395, %394
  store float %396, ptr %78, align 4, !tbaa !9
  br label %397

397:                                              ; preds = %393, %389
  %398 = load float, ptr %78, align 4, !tbaa !9
  %399 = load float, ptr %8, align 4, !tbaa !9
  %400 = fcmp ogt float %398, %399
  br i1 %400, label %401, label %402

401:                                              ; preds = %397
  store i8 0, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %453

402:                                              ; preds = %397
  %403 = load ptr, ptr %11, align 8, !tbaa !5
  %404 = icmp ne ptr %403, null
  br i1 %404, label %405, label %408

405:                                              ; preds = %402
  %406 = load float, ptr %78, align 4, !tbaa !9
  %407 = load ptr, ptr %11, align 8, !tbaa !5
  store float %406, ptr %407, align 4, !tbaa !9
  br label %408

408:                                              ; preds = %405, %402
  %409 = load ptr, ptr %10, align 8, !tbaa !5
  %410 = icmp ne ptr %409, null
  br i1 %410, label %411, label %452

411:                                              ; preds = %408
  %412 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %79) #5
  %413 = load ptr, ptr %7, align 8, !tbaa !5
  %414 = getelementptr inbounds %struct.CgmRay3d, ptr %413, i32 0, i32 0
  %415 = load ptr, ptr %7, align 8, !tbaa !5
  %416 = getelementptr inbounds %struct.CgmRay3d, ptr %415, i32 0, i32 1
  %417 = load float, ptr %78, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %83, ptr align 4 %416, i64 12, i1 false)
  %418 = getelementptr inbounds { <2 x float>, float }, ptr %83, i32 0, i32 0
  %419 = load <2 x float>, ptr %418, align 4
  %420 = getelementptr inbounds { <2 x float>, float }, ptr %83, i32 0, i32 1
  %421 = load float, ptr %420, align 4
  %422 = call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %419, float %421, float noundef %417)
  %423 = getelementptr inbounds %union.CgmVec3, ptr %82, i32 0, i32 0
  store { <2 x float>, float } %422, ptr %84, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %423, ptr align 8 %84, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %85, ptr align 4 %414, i64 12, i1 false)
  %424 = getelementptr inbounds { <2 x float>, float }, ptr %85, i32 0, i32 0
  %425 = load <2 x float>, ptr %424, align 4
  %426 = getelementptr inbounds { <2 x float>, float }, ptr %85, i32 0, i32 1
  %427 = load float, ptr %426, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %86, ptr align 4 %82, i64 12, i1 false)
  %428 = getelementptr inbounds { <2 x float>, float }, ptr %86, i32 0, i32 0
  %429 = load <2 x float>, ptr %428, align 4
  %430 = getelementptr inbounds { <2 x float>, float }, ptr %86, i32 0, i32 1
  %431 = load float, ptr %430, align 4
  %432 = call { <2 x float>, float } @CgmVec3_add(<2 x float> %425, float %427, <2 x float> %429, float %431)
  %433 = getelementptr inbounds %union.CgmVec3, ptr %81, i32 0, i32 0
  store { <2 x float>, float } %432, ptr %87, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %433, ptr align 8 %87, i64 12, i1 false)
  %434 = load ptr, ptr %9, align 8, !tbaa !5
  %435 = getelementptr inbounds %struct.CgmSphere, ptr %434, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %88, ptr align 4 %81, i64 12, i1 false)
  %436 = getelementptr inbounds { <2 x float>, float }, ptr %88, i32 0, i32 0
  %437 = load <2 x float>, ptr %436, align 4
  %438 = getelementptr inbounds { <2 x float>, float }, ptr %88, i32 0, i32 1
  %439 = load float, ptr %438, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %89, ptr align 4 %435, i64 12, i1 false)
  %440 = getelementptr inbounds { <2 x float>, float }, ptr %89, i32 0, i32 0
  %441 = load <2 x float>, ptr %440, align 4
  %442 = getelementptr inbounds { <2 x float>, float }, ptr %89, i32 0, i32 1
  %443 = load float, ptr %442, align 4
  %444 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %437, float %439, <2 x float> %441, float %443)
  %445 = getelementptr inbounds %union.CgmVec3, ptr %80, i32 0, i32 0
  store { <2 x float>, float } %444, ptr %90, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %445, ptr align 8 %90, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %91, ptr align 4 %80, i64 12, i1 false)
  %446 = getelementptr inbounds { <2 x float>, float }, ptr %91, i32 0, i32 0
  %447 = load <2 x float>, ptr %446, align 4
  %448 = getelementptr inbounds { <2 x float>, float }, ptr %91, i32 0, i32 1
  %449 = load float, ptr %448, align 4
  %450 = call { <2 x float>, float } @CgmVec3_norm(<2 x float> %447, float %449)
  %451 = getelementptr inbounds %union.CgmVec3, ptr %79, i32 0, i32 0
  store { <2 x float>, float } %450, ptr %92, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %451, ptr align 8 %92, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %412, ptr align 4 %79, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 12, ptr %79) #5
  br label %452

452:                                              ; preds = %411, %408
  store i8 1, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %453

453:                                              ; preds = %452, %401
  call void @llvm.lifetime.end.p0(i64 4, ptr %78) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %75) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %71) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %70) #5
  br label %454

454:                                              ; preds = %453, %357, %341
  call void @llvm.lifetime.end.p0(i64 4, ptr %67) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %63) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %60) #5
  br label %456

455:                                              ; preds = %305
  store i8 1, ptr %6, align 1
  store i32 1, ptr %22, align 4
  br label %456

456:                                              ; preds = %455, %454, %301, %190, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #5
  %457 = load i8, ptr %6, align 1
  ret i8 %457
}

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

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 12}
!12 = !{!"CgmSphere", !7, i64 0, !10, i64 12}
!13 = !{i64 0, i64 12, !14}
!14 = !{!7, !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"

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

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

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_add(<2 x float>, float, <2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_sub(<2 x float>, float, <2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float>, float, float noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local float @CgmVec3_len(<2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmVec3_norm(<2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local float @CgmVec3_dot(<2 x float>, float, <2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, float } @CgmRay3d_get_projected_pt(ptr noundef, float noundef, <2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @cgm_3d_ray_vs_sphere(ptr noundef %0, float noundef %1, ptr nocapture noundef readonly %2, ptr noundef writeonly %3, ptr noundef writeonly %4) local_unnamed_addr #2 {
  %.sroa.0204.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.2205.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.2205.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %.sroa.0202.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.2203.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.2203.0.copyload = load float, ptr %.sroa.2203.0..sroa_idx, align 4
  %6 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.0204.0.copyload, float %.sroa.2205.0.copyload, <2 x float> %.sroa.0202.0.copyload, float %.sroa.2203.0.copyload)
  %.fca.0.extract198 = extractvalue { <2 x float>, float } %6, 0
  %.fca.1.extract199 = extractvalue { <2 x float>, float } %6, 1
  %7 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract198, float %.fca.1.extract199, <2 x float> %.fca.0.extract198, float %.fca.1.extract199)
  %8 = getelementptr inbounds i8, ptr %2, i64 12
  %9 = load float, ptr %8, align 4, !tbaa !5
  %10 = fmul float %9, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 12
  %.sroa.0181.0.copyload = load <2 x float>, ptr %11, align 4
  %.sroa.2182.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 20
  %.sroa.2182.0.copyload = load float, ptr %.sroa.2182.0..sroa_idx, align 4
  %12 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract198, float %.fca.1.extract199, <2 x float> %.sroa.0181.0.copyload, float %.sroa.2182.0.copyload)
  %13 = fcmp olt float %12, 0.000000e+00
  br i1 %13, label %14, label %45

14:                                               ; preds = %5
  %15 = fcmp ogt float %7, %10
  br i1 %15, label %.critedge, label %16

16:                                               ; preds = %14
  %17 = fcmp oeq float %7, %10
  br i1 %17, label %18, label %23

18:                                               ; preds = %16
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %20, label %19

19:                                               ; preds = %18
  store float 0.000000e+00, ptr %4, align 4, !tbaa !10
  br label %20

20:                                               ; preds = %19, %18
  %.not265 = icmp eq ptr %3, null
  br i1 %.not265, label %.critedge, label %21

21:                                               ; preds = %20
  %.sroa.0175.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.2176.0.copyload = load float, ptr %.sroa.2203.0..sroa_idx, align 4
  %.sroa.0173.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.2174.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %22 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.0175.0.copyload, float %.sroa.2176.0.copyload, <2 x float> %.sroa.0173.0.copyload, float %.sroa.2174.0.copyload)
  br label %.critedge.sink.split

23:                                               ; preds = %16
  %24 = tail call float @llvm.fabs.f32(float %1) #3
  %25 = fcmp une float %24, 0x7FF0000000000000
  %26 = icmp ne ptr %3, null
  %or.cond = or i1 %25, %26
  %27 = icmp ne ptr %4, null
  %or.cond3 = or i1 %or.cond, %27
  br i1 %or.cond3, label %28, label %.critedge

28:                                               ; preds = %23
  %.sroa.0158.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.2159.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %29 = tail call { <2 x float>, float } @CgmRay3d_get_projected_pt(ptr noundef nonnull %0, float noundef %1, <2 x float> %.sroa.0158.0.copyload, float %.sroa.2159.0.copyload)
  %.fca.0.extract154 = extractvalue { <2 x float>, float } %29, 0
  %.fca.1.extract155 = extractvalue { <2 x float>, float } %29, 1
  %.sroa.0147.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.2148.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %30 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.fca.0.extract154, float %.fca.1.extract155, <2 x float> %.sroa.0147.0.copyload, float %.sroa.2148.0.copyload)
  %.fca.0.extract143 = extractvalue { <2 x float>, float } %30, 0
  %.fca.1.extract144 = extractvalue { <2 x float>, float } %30, 1
  %31 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract143, float %.fca.1.extract144, <2 x float> %.fca.0.extract143, float %.fca.1.extract144)
  %32 = fsub float %10, %31
  %33 = tail call float @sqrtf(float noundef %32) #4
  %.sroa.0128.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.2129.0.copyload = load float, ptr %.sroa.2203.0..sroa_idx, align 4
  %34 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.fca.0.extract154, float %.fca.1.extract155, <2 x float> %.sroa.0128.0.copyload, float %.sroa.2129.0.copyload)
  %.fca.0.extract124 = extractvalue { <2 x float>, float } %34, 0
  %.fca.1.extract125 = extractvalue { <2 x float>, float } %34, 1
  %35 = tail call float @CgmVec3_len(<2 x float> %.fca.0.extract124, float %.fca.1.extract125)
  %36 = fsub float %33, %35
  %37 = fcmp ule float %36, %1
  br i1 %37, label %38, label %.critedge

38:                                               ; preds = %28
  br i1 %27, label %39, label %40

39:                                               ; preds = %38
  store float %36, ptr %4, align 4, !tbaa !10
  br label %40

40:                                               ; preds = %39, %38
  br i1 %26, label %41, label %.critedge

41:                                               ; preds = %40
  %.sroa.0112.0.copyload = load <2 x float>, ptr %11, align 4
  %.sroa.2113.0.copyload = load float, ptr %.sroa.2182.0..sroa_idx, align 4
  %42 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %.sroa.0112.0.copyload, float %.sroa.2113.0.copyload, float noundef %36)
  %.fca.0.extract108 = extractvalue { <2 x float>, float } %42, 0
  %.fca.1.extract109 = extractvalue { <2 x float>, float } %42, 1
  %.sroa.0106.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.2107.0.copyload = load float, ptr %.sroa.2203.0..sroa_idx, align 4
  %43 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %.sroa.0106.0.copyload, float %.sroa.2107.0.copyload, <2 x float> %.fca.0.extract108, float %.fca.1.extract109)
  %.fca.0.extract100 = extractvalue { <2 x float>, float } %43, 0
  %.fca.1.extract101 = extractvalue { <2 x float>, float } %43, 1
  %.sroa.096.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.297.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %44 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.fca.0.extract100, float %.fca.1.extract101, <2 x float> %.sroa.096.0.copyload, float %.sroa.297.0.copyload)
  br label %.critedge.sink.split

45:                                               ; preds = %5
  %.sroa.081.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.282.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %46 = tail call { <2 x float>, float } @CgmRay3d_get_projected_pt(ptr noundef nonnull %0, float noundef %1, <2 x float> %.sroa.081.0.copyload, float %.sroa.282.0.copyload)
  %.fca.0.extract77 = extractvalue { <2 x float>, float } %46, 0
  %.fca.1.extract78 = extractvalue { <2 x float>, float } %46, 1
  %.sroa.070.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.271.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %47 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.fca.0.extract77, float %.fca.1.extract78, <2 x float> %.sroa.070.0.copyload, float %.sroa.271.0.copyload)
  %.fca.0.extract66 = extractvalue { <2 x float>, float } %47, 0
  %.fca.1.extract67 = extractvalue { <2 x float>, float } %47, 1
  %48 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract66, float %.fca.1.extract67, <2 x float> %.fca.0.extract66, float %.fca.1.extract67)
  %49 = fcmp ogt float %48, %10
  br i1 %49, label %.critedge, label %50

50:                                               ; preds = %45
  %51 = tail call float @llvm.fabs.f32(float %1) #3
  %52 = fcmp une float %51, 0x7FF0000000000000
  %53 = icmp ne ptr %3, null
  %or.cond5 = or i1 %52, %53
  %54 = icmp ne ptr %4, null
  %or.cond7 = or i1 %or.cond5, %54
  br i1 %or.cond7, label %55, label %.critedge

55:                                               ; preds = %50
  %56 = fsub float %10, %48
  %57 = tail call float @sqrtf(float noundef %56) #4
  %.sroa.052.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.253.0.copyload = load float, ptr %.sroa.2203.0..sroa_idx, align 4
  %58 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.fca.0.extract77, float %.fca.1.extract78, <2 x float> %.sroa.052.0.copyload, float %.sroa.253.0.copyload)
  %.fca.0.extract48 = extractvalue { <2 x float>, float } %58, 0
  %.fca.1.extract49 = extractvalue { <2 x float>, float } %58, 1
  %59 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract48, float %.fca.1.extract49, <2 x float> %.fca.0.extract48, float %.fca.1.extract49)
  %60 = tail call float @sqrtf(float noundef %59) #4
  %61 = fcmp ogt float %7, %10
  %62 = fneg float %57
  %.0254.p = select i1 %61, float %62, float %57
  %.0254 = fadd float %.0254.p, %60
  %63 = fcmp ogt float %.0254, %1
  br i1 %63, label %.critedge, label %64

64:                                               ; preds = %55
  br i1 %54, label %65, label %66

65:                                               ; preds = %64
  store float %.0254, ptr %4, align 4, !tbaa !10
  br label %66

66:                                               ; preds = %65, %64
  br i1 %53, label %67, label %.critedge

67:                                               ; preds = %66
  %.sroa.030.0.copyload = load <2 x float>, ptr %11, align 4
  %.sroa.231.0.copyload = load float, ptr %.sroa.2182.0..sroa_idx, align 4
  %68 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %.sroa.030.0.copyload, float %.sroa.231.0.copyload, float noundef %.0254)
  %.fca.0.extract26 = extractvalue { <2 x float>, float } %68, 0
  %.fca.1.extract27 = extractvalue { <2 x float>, float } %68, 1
  %.sroa.024.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.225.0.copyload = load float, ptr %.sroa.2203.0..sroa_idx, align 4
  %69 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %.sroa.024.0.copyload, float %.sroa.225.0.copyload, <2 x float> %.fca.0.extract26, float %.fca.1.extract27)
  %.fca.0.extract18 = extractvalue { <2 x float>, float } %69, 0
  %.fca.1.extract19 = extractvalue { <2 x float>, float } %69, 1
  %.sroa.014.0.copyload = load <2 x float>, ptr %2, align 4
  %.sroa.215.0.copyload = load float, ptr %.sroa.2205.0..sroa_idx, align 4
  %70 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.fca.0.extract18, float %.fca.1.extract19, <2 x float> %.sroa.014.0.copyload, float %.sroa.215.0.copyload)
  br label %.critedge.sink.split

.critedge.sink.split:                             ; preds = %67, %41, %21
  %.sink267 = phi { <2 x float>, float } [ %22, %21 ], [ %44, %41 ], [ %70, %67 ]
  %.fca.0.extract169 = extractvalue { <2 x float>, float } %.sink267, 0
  %.fca.1.extract170 = extractvalue { <2 x float>, float } %.sink267, 1
  %71 = tail call { <2 x float>, float } @CgmVec3_norm(<2 x float> %.fca.0.extract169, float %.fca.1.extract170)
  %.fca.0.extract163 = extractvalue { <2 x float>, float } %71, 0
  %.fca.1.extract164 = extractvalue { <2 x float>, float } %71, 1
  store <2 x float> %.fca.0.extract163, ptr %3, align 4
  %.sroa.4180.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store float %.fca.1.extract164, ptr %.sroa.4180.0..sroa_idx, align 4, !tbaa !11
  br label %.critedge

.critedge:                                        ; preds = %.critedge.sink.split, %20, %40, %28, %45, %50, %66, %55, %23, %14
  %.3 = phi i8 [ 0, %14 ], [ 1, %23 ], [ 0, %45 ], [ 1, %50 ], [ 0, %55 ], [ 1, %66 ], [ 0, %28 ], [ 1, %40 ], [ 1, %20 ], [ 1, %.critedge.sink.split ]
  ret i8 %.3
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { memory(none) }
attributes #4 = { 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, !9, i64 12}
!6 = !{!"CgmSphere", !7, i64 0, !9, i64 12}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"float", !7, i64 0}
!10 = !{!9, !9, i64 0}
!11 = !{!7, !7, i64 0}


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