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

; 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.anon.5 = type { float, float, float, float, float, float }

; Function Attrs: nounwind uwtable
declare dso_local float @cgm_clamp(float noundef, float noundef, float noundef) #0

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

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

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

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

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

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

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

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

142:                                              ; preds = %196, %7
  %143 = load i32, ptr %18, align 4, !tbaa !16
  %144 = icmp ult i32 %143, 8
  br i1 %144, label %146, label %145

145:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %199

146:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #4
  %147 = load i32, ptr %18, align 4, !tbaa !16
  %148 = zext i32 %147 to i64
  %149 = getelementptr inbounds [8 x %union.CgmVec3], ptr %16, i64 0, i64 %148
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %149, i64 12, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.start.p0(i64 12, ptr %20) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %19, i64 12, i1 false)
  %150 = getelementptr inbounds { <2 x float>, float }, ptr %21, i32 0, i32 0
  %151 = load <2 x float>, ptr %150, align 4
  %152 = getelementptr inbounds { <2 x float>, float }, ptr %21, i32 0, i32 1
  %153 = load float, ptr %152, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %9, i64 12, i1 false)
  %154 = getelementptr inbounds { <2 x float>, float }, ptr %22, i32 0, i32 0
  %155 = load <2 x float>, ptr %154, align 4
  %156 = getelementptr inbounds { <2 x float>, float }, ptr %22, i32 0, i32 1
  %157 = load float, ptr %156, align 4
  %158 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %151, float %153, <2 x float> %155, float %157)
  %159 = getelementptr inbounds %union.CgmVec3, ptr %20, i32 0, i32 0
  store { <2 x float>, float } %158, ptr %23, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %159, ptr align 8 %23, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %20, i64 12, i1 false)
  %160 = getelementptr inbounds { <2 x float>, float }, ptr %25, i32 0, i32 0
  %161 = load <2 x float>, ptr %160, align 4
  %162 = getelementptr inbounds { <2 x float>, float }, ptr %25, i32 0, i32 1
  %163 = load float, ptr %162, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %11, i64 12, i1 false)
  %164 = getelementptr inbounds { <2 x float>, float }, ptr %26, i32 0, i32 0
  %165 = load <2 x float>, ptr %164, align 4
  %166 = getelementptr inbounds { <2 x float>, float }, ptr %26, i32 0, i32 1
  %167 = load float, ptr %166, align 4
  %168 = call float @CgmVec3_dot(<2 x float> %161, float %163, <2 x float> %165, float %167)
  store float %168, ptr %24, align 4, !tbaa !9
  %169 = load float, ptr %24, align 4, !tbaa !9
  %170 = load float, ptr %14, align 4, !tbaa !9
  %171 = load float, ptr %15, align 4, !tbaa !9
  %172 = call float @cgm_clamp(float noundef %169, float noundef %170, float noundef %171)
  store float %172, ptr %24, align 4, !tbaa !9
  %173 = load float, ptr %24, align 4, !tbaa !9
  %174 = load float, ptr %17, align 4, !tbaa !9
  %175 = fcmp olt float %173, %174
  br i1 %175, label %176, label %195

176:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #4
  %177 = load float, ptr %24, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %11, i64 12, i1 false)
  %178 = getelementptr inbounds { <2 x float>, float }, ptr %29, i32 0, i32 0
  %179 = load <2 x float>, ptr %178, align 4
  %180 = getelementptr inbounds { <2 x float>, float }, ptr %29, i32 0, i32 1
  %181 = load float, ptr %180, align 4
  %182 = call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %179, float %181, float noundef %177)
  %183 = getelementptr inbounds %union.CgmVec3, ptr %28, i32 0, i32 0
  store { <2 x float>, float } %182, ptr %30, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %183, ptr align 8 %30, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %9, i64 12, i1 false)
  %184 = getelementptr inbounds { <2 x float>, float }, ptr %31, i32 0, i32 0
  %185 = load <2 x float>, ptr %184, align 4
  %186 = getelementptr inbounds { <2 x float>, float }, ptr %31, i32 0, i32 1
  %187 = load float, ptr %186, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %28, i64 12, i1 false)
  %188 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 0
  %189 = load <2 x float>, ptr %188, align 4
  %190 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 1
  %191 = load float, ptr %190, align 4
  %192 = call { <2 x float>, float } @CgmVec3_add(<2 x float> %185, float %187, <2 x float> %189, float %191)
  %193 = getelementptr inbounds %union.CgmVec3, ptr %27, i32 0, i32 0
  store { <2 x float>, float } %192, ptr %33, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %193, ptr align 8 %33, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %27, i64 12, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #4
  %194 = load float, ptr %24, align 4, !tbaa !9
  store float %194, ptr %17, align 4, !tbaa !9
  br label %195

195:                                              ; preds = %176, %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #4
  br label %196

196:                                              ; preds = %195
  %197 = load i32, ptr %18, align 4, !tbaa !16
  %198 = add i32 %197, 1
  store i32 %198, ptr %18, align 4, !tbaa !16
  br label %142, !llvm.loop !19

199:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr %16) #4
  %200 = getelementptr inbounds %union.CgmVec3, ptr %8, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %34, ptr align 4 %200, i64 12, i1 false)
  %201 = load { <2 x float>, float }, ptr %34, align 8
  ret { <2 x float>, float } %201
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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, !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 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 0}
!13 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8}
!14 = !{!13, !10, i64 4}
!15 = !{!13, !10, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{i64 0, i64 12, !11}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
declare dso_local float @cgm_clamp(float noundef, float noundef, float noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local { <2 x float>, float } @CgmAabb3d_closest_pt_along_ray(ptr nocapture noundef readonly %0, <2 x float> %1, float %2, <2 x float> %3, float %4, float noundef %5, float noundef %6) local_unnamed_addr #1 {
  %8 = load float, ptr %0, align 4, !tbaa !5
  %.sroa.0.0.vec.insert = insertelement <2 x float> <float poison, float undef>, float %8, i64 0
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load float, ptr %9, align 4, !tbaa !5
  %.sroa.0.4.vec.insert = insertelement <2 x float> %.sroa.0.0.vec.insert, float %10, i64 1
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load float, ptr %13, align 4, !tbaa !5
  %.sroa.7.12.vec.insert = insertelement <2 x float> <float poison, float undef>, float %14, i64 0
  %.sroa.7.16.vec.insert = insertelement <2 x float> %.sroa.7.12.vec.insert, float %10, i64 1
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load float, ptr %15, align 4, !tbaa !5
  %.sroa.12.28.vec.insert = insertelement <2 x float> %.sroa.0.0.vec.insert, float %16, i64 1
  %17 = getelementptr inbounds i8, ptr %0, i64 20
  %18 = load float, ptr %17, align 4, !tbaa !5
  %.sroa.22.52.vec.insert = insertelement <2 x float> %.sroa.7.12.vec.insert, float %16, i64 1
  %19 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.0.4.vec.insert, float %12, <2 x float> %1, float %2)
  %.fca.0.extract23 = extractvalue { <2 x float>, float } %19, 0
  %.fca.1.extract24 = extractvalue { <2 x float>, float } %19, 1
  %20 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23, float %.fca.1.extract24, <2 x float> %3, float %4)
  %21 = tail call float @cgm_clamp(float noundef %20, float noundef %5, float noundef %6)
  %22 = fcmp ueq float %21, 0x7FF0000000000000
  br i1 %22, label %26, label %23

23:                                               ; preds = %7
  %24 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %21)
  %.fca.0.extract7 = extractvalue { <2 x float>, float } %24, 0
  %.fca.1.extract8 = extractvalue { <2 x float>, float } %24, 1
  %25 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7, float %.fca.1.extract8)
  %.fca.0.extract = extractvalue { <2 x float>, float } %25, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %25, 1
  br label %26

26:                                               ; preds = %23, %7
  %.1 = phi float [ %21, %23 ], [ 0x7FF0000000000000, %7 ]
  %.sroa.073.1 = phi <2 x float> [ %.fca.0.extract, %23 ], [ undef, %7 ]
  %.sroa.274.1 = phi float [ %.fca.1.extract, %23 ], [ undef, %7 ]
  %27 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.7.16.vec.insert, float %12, <2 x float> %1, float %2)
  %.fca.0.extract23.1 = extractvalue { <2 x float>, float } %27, 0
  %.fca.1.extract24.1 = extractvalue { <2 x float>, float } %27, 1
  %28 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23.1, float %.fca.1.extract24.1, <2 x float> %3, float %4)
  %29 = tail call float @cgm_clamp(float noundef %28, float noundef %5, float noundef %6)
  %30 = fcmp olt float %29, %.1
  br i1 %30, label %31, label %34

31:                                               ; preds = %26
  %32 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %29)
  %.fca.0.extract7.1 = extractvalue { <2 x float>, float } %32, 0
  %.fca.1.extract8.1 = extractvalue { <2 x float>, float } %32, 1
  %33 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7.1, float %.fca.1.extract8.1)
  %.fca.0.extract.1 = extractvalue { <2 x float>, float } %33, 0
  %.fca.1.extract.1 = extractvalue { <2 x float>, float } %33, 1
  br label %34

34:                                               ; preds = %31, %26
  %.1.1 = phi float [ %29, %31 ], [ %.1, %26 ]
  %.sroa.073.1.1 = phi <2 x float> [ %.fca.0.extract.1, %31 ], [ %.sroa.073.1, %26 ]
  %.sroa.274.1.1 = phi float [ %.fca.1.extract.1, %31 ], [ %.sroa.274.1, %26 ]
  %35 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.12.28.vec.insert, float %12, <2 x float> %1, float %2)
  %.fca.0.extract23.2 = extractvalue { <2 x float>, float } %35, 0
  %.fca.1.extract24.2 = extractvalue { <2 x float>, float } %35, 1
  %36 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23.2, float %.fca.1.extract24.2, <2 x float> %3, float %4)
  %37 = tail call float @cgm_clamp(float noundef %36, float noundef %5, float noundef %6)
  %38 = fcmp olt float %37, %.1.1
  br i1 %38, label %39, label %42

39:                                               ; preds = %34
  %40 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %37)
  %.fca.0.extract7.2 = extractvalue { <2 x float>, float } %40, 0
  %.fca.1.extract8.2 = extractvalue { <2 x float>, float } %40, 1
  %41 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7.2, float %.fca.1.extract8.2)
  %.fca.0.extract.2 = extractvalue { <2 x float>, float } %41, 0
  %.fca.1.extract.2 = extractvalue { <2 x float>, float } %41, 1
  br label %42

42:                                               ; preds = %39, %34
  %.1.2 = phi float [ %37, %39 ], [ %.1.1, %34 ]
  %.sroa.073.1.2 = phi <2 x float> [ %.fca.0.extract.2, %39 ], [ %.sroa.073.1.1, %34 ]
  %.sroa.274.1.2 = phi float [ %.fca.1.extract.2, %39 ], [ %.sroa.274.1.1, %34 ]
  %43 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.0.4.vec.insert, float %18, <2 x float> %1, float %2)
  %.fca.0.extract23.3 = extractvalue { <2 x float>, float } %43, 0
  %.fca.1.extract24.3 = extractvalue { <2 x float>, float } %43, 1
  %44 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23.3, float %.fca.1.extract24.3, <2 x float> %3, float %4)
  %45 = tail call float @cgm_clamp(float noundef %44, float noundef %5, float noundef %6)
  %46 = fcmp olt float %45, %.1.2
  br i1 %46, label %47, label %50

47:                                               ; preds = %42
  %48 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %45)
  %.fca.0.extract7.3 = extractvalue { <2 x float>, float } %48, 0
  %.fca.1.extract8.3 = extractvalue { <2 x float>, float } %48, 1
  %49 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7.3, float %.fca.1.extract8.3)
  %.fca.0.extract.3 = extractvalue { <2 x float>, float } %49, 0
  %.fca.1.extract.3 = extractvalue { <2 x float>, float } %49, 1
  br label %50

50:                                               ; preds = %47, %42
  %.1.3 = phi float [ %45, %47 ], [ %.1.2, %42 ]
  %.sroa.073.1.3 = phi <2 x float> [ %.fca.0.extract.3, %47 ], [ %.sroa.073.1.2, %42 ]
  %.sroa.274.1.3 = phi float [ %.fca.1.extract.3, %47 ], [ %.sroa.274.1.2, %42 ]
  %51 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.22.52.vec.insert, float %12, <2 x float> %1, float %2)
  %.fca.0.extract23.4 = extractvalue { <2 x float>, float } %51, 0
  %.fca.1.extract24.4 = extractvalue { <2 x float>, float } %51, 1
  %52 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23.4, float %.fca.1.extract24.4, <2 x float> %3, float %4)
  %53 = tail call float @cgm_clamp(float noundef %52, float noundef %5, float noundef %6)
  %54 = fcmp olt float %53, %.1.3
  br i1 %54, label %55, label %58

55:                                               ; preds = %50
  %56 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %53)
  %.fca.0.extract7.4 = extractvalue { <2 x float>, float } %56, 0
  %.fca.1.extract8.4 = extractvalue { <2 x float>, float } %56, 1
  %57 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7.4, float %.fca.1.extract8.4)
  %.fca.0.extract.4 = extractvalue { <2 x float>, float } %57, 0
  %.fca.1.extract.4 = extractvalue { <2 x float>, float } %57, 1
  br label %58

58:                                               ; preds = %55, %50
  %.1.4 = phi float [ %53, %55 ], [ %.1.3, %50 ]
  %.sroa.073.1.4 = phi <2 x float> [ %.fca.0.extract.4, %55 ], [ %.sroa.073.1.3, %50 ]
  %.sroa.274.1.4 = phi float [ %.fca.1.extract.4, %55 ], [ %.sroa.274.1.3, %50 ]
  %59 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.12.28.vec.insert, float %18, <2 x float> %1, float %2)
  %.fca.0.extract23.5 = extractvalue { <2 x float>, float } %59, 0
  %.fca.1.extract24.5 = extractvalue { <2 x float>, float } %59, 1
  %60 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23.5, float %.fca.1.extract24.5, <2 x float> %3, float %4)
  %61 = tail call float @cgm_clamp(float noundef %60, float noundef %5, float noundef %6)
  %62 = fcmp olt float %61, %.1.4
  br i1 %62, label %63, label %66

63:                                               ; preds = %58
  %64 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %61)
  %.fca.0.extract7.5 = extractvalue { <2 x float>, float } %64, 0
  %.fca.1.extract8.5 = extractvalue { <2 x float>, float } %64, 1
  %65 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7.5, float %.fca.1.extract8.5)
  %.fca.0.extract.5 = extractvalue { <2 x float>, float } %65, 0
  %.fca.1.extract.5 = extractvalue { <2 x float>, float } %65, 1
  br label %66

66:                                               ; preds = %63, %58
  %.1.5 = phi float [ %61, %63 ], [ %.1.4, %58 ]
  %.sroa.073.1.5 = phi <2 x float> [ %.fca.0.extract.5, %63 ], [ %.sroa.073.1.4, %58 ]
  %.sroa.274.1.5 = phi float [ %.fca.1.extract.5, %63 ], [ %.sroa.274.1.4, %58 ]
  %67 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.7.16.vec.insert, float %18, <2 x float> %1, float %2)
  %.fca.0.extract23.6 = extractvalue { <2 x float>, float } %67, 0
  %.fca.1.extract24.6 = extractvalue { <2 x float>, float } %67, 1
  %68 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23.6, float %.fca.1.extract24.6, <2 x float> %3, float %4)
  %69 = tail call float @cgm_clamp(float noundef %68, float noundef %5, float noundef %6)
  %70 = fcmp olt float %69, %.1.5
  br i1 %70, label %71, label %74

71:                                               ; preds = %66
  %72 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %69)
  %.fca.0.extract7.6 = extractvalue { <2 x float>, float } %72, 0
  %.fca.1.extract8.6 = extractvalue { <2 x float>, float } %72, 1
  %73 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7.6, float %.fca.1.extract8.6)
  %.fca.0.extract.6 = extractvalue { <2 x float>, float } %73, 0
  %.fca.1.extract.6 = extractvalue { <2 x float>, float } %73, 1
  br label %74

74:                                               ; preds = %71, %66
  %.1.6 = phi float [ %69, %71 ], [ %.1.5, %66 ]
  %.sroa.073.1.6 = phi <2 x float> [ %.fca.0.extract.6, %71 ], [ %.sroa.073.1.5, %66 ]
  %.sroa.274.1.6 = phi float [ %.fca.1.extract.6, %71 ], [ %.sroa.274.1.5, %66 ]
  %75 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.22.52.vec.insert, float %18, <2 x float> %1, float %2)
  %.fca.0.extract23.7 = extractvalue { <2 x float>, float } %75, 0
  %.fca.1.extract24.7 = extractvalue { <2 x float>, float } %75, 1
  %76 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract23.7, float %.fca.1.extract24.7, <2 x float> %3, float %4)
  %77 = tail call float @cgm_clamp(float noundef %76, float noundef %5, float noundef %6)
  %78 = fcmp olt float %77, %.1.6
  br i1 %78, label %79, label %82

79:                                               ; preds = %74
  %80 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %77)
  %.fca.0.extract7.7 = extractvalue { <2 x float>, float } %80, 0
  %.fca.1.extract8.7 = extractvalue { <2 x float>, float } %80, 1
  %81 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract7.7, float %.fca.1.extract8.7)
  %.fca.0.extract.7 = extractvalue { <2 x float>, float } %81, 0
  %.fca.1.extract.7 = extractvalue { <2 x float>, float } %81, 1
  br label %82

82:                                               ; preds = %79, %74
  %.sroa.073.1.7 = phi <2 x float> [ %.fca.0.extract.7, %79 ], [ %.sroa.073.1.6, %74 ]
  %.sroa.274.1.7 = phi float [ %.fca.1.extract.7, %79 ], [ %.sroa.274.1.6, %74 ]
  %.fca.0.insert = insertvalue { <2 x float>, float } poison, <2 x float> %.sroa.073.1.7, 0
  %.fca.1.insert = insertvalue { <2 x float>, float } %.fca.0.insert, float %.sroa.274.1.7, 1
  ret { <2 x float>, float } %.fca.1.insert
}

attributes #0 = { 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 #1 = { 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" }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


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