; LLVM IR from heroseh/cgm :: cgm (CgmAabb3d_closest_pt_on_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_on_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 %union.CgmVec3, align 4
  %35 = alloca { <2 x float>, float }, align 4
  %36 = alloca { <2 x float>, float }, align 4
  %37 = alloca { <2 x float>, float }, align 8
  %38 = alloca float, align 4
  %39 = alloca { <2 x float>, float }, align 4
  %40 = alloca { <2 x float>, float }, align 4
  %41 = alloca { <2 x float>, float }, align 8
  %42 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 0
  store <2 x float> %1, ptr %42, align 4
  %43 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 1
  store float %2, ptr %43, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %10, i64 12, i1 false)
  %44 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 0
  store <2 x float> %3, ptr %44, align 4
  %45 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 1
  store float %4, ptr %45, 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
  %46 = getelementptr inbounds %struct.anon.0, ptr %16, i32 0, i32 0
  %47 = load ptr, ptr %13, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.anon.5, ptr %47, i32 0, i32 0
  %49 = load float, ptr %48, align 4, !tbaa !11
  store float %49, ptr %46, align 4, !tbaa !12
  %50 = getelementptr inbounds %struct.anon.0, ptr %16, i32 0, i32 1
  %51 = load ptr, ptr %13, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.anon.5, ptr %51, i32 0, i32 1
  %53 = load float, ptr %52, align 4, !tbaa !11
  store float %53, ptr %50, align 4, !tbaa !14
  %54 = getelementptr inbounds %struct.anon.0, ptr %16, i32 0, i32 2
  %55 = load ptr, ptr %13, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.anon.5, ptr %55, i32 0, i32 2
  %57 = load float, ptr %56, align 4, !tbaa !11
  store float %57, ptr %54, align 4, !tbaa !15
  %58 = getelementptr inbounds %union.CgmVec3, ptr %16, i64 1
  %59 = getelementptr inbounds %struct.anon.0, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %13, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.anon.5, ptr %60, i32 0, i32 3
  %62 = load float, ptr %61, align 4, !tbaa !11
  store float %62, ptr %59, align 4, !tbaa !12
  %63 = getelementptr inbounds %struct.anon.0, ptr %58, i32 0, i32 1
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.anon.5, ptr %64, i32 0, i32 1
  %66 = load float, ptr %65, align 4, !tbaa !11
  store float %66, ptr %63, align 4, !tbaa !14
  %67 = getelementptr inbounds %struct.anon.0, ptr %58, i32 0, i32 2
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.anon.5, ptr %68, i32 0, i32 2
  %70 = load float, ptr %69, align 4, !tbaa !11
  store float %70, ptr %67, align 4, !tbaa !15
  %71 = getelementptr inbounds %union.CgmVec3, ptr %16, i64 2
  %72 = getelementptr inbounds %struct.anon.0, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.anon.5, ptr %73, i32 0, i32 0
  %75 = load float, ptr %74, align 4, !tbaa !11
  store float %75, ptr %72, align 4, !tbaa !12
  %76 = getelementptr inbounds %struct.anon.0, ptr %71, i32 0, i32 1
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.anon.5, ptr %77, i32 0, i32 4
  %79 = load float, ptr %78, align 4, !tbaa !11
  store float %79, ptr %76, align 4, !tbaa !14
  %80 = getelementptr inbounds %struct.anon.0, ptr %71, i32 0, i32 2
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.anon.5, ptr %81, i32 0, i32 2
  %83 = load float, ptr %82, align 4, !tbaa !11
  store float %83, ptr %80, align 4, !tbaa !15
  %84 = getelementptr inbounds %union.CgmVec3, ptr %16, i64 3
  %85 = getelementptr inbounds %struct.anon.0, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.anon.5, ptr %86, i32 0, i32 0
  %88 = load float, ptr %87, align 4, !tbaa !11
  store float %88, ptr %85, align 4, !tbaa !12
  %89 = getelementptr inbounds %struct.anon.0, ptr %84, i32 0, i32 1
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.anon.5, ptr %90, i32 0, i32 1
  %92 = load float, ptr %91, align 4, !tbaa !11
  store float %92, ptr %89, align 4, !tbaa !14
  %93 = getelementptr inbounds %struct.anon.0, ptr %84, i32 0, i32 2
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.anon.5, ptr %94, i32 0, i32 5
  %96 = load float, ptr %95, align 4, !tbaa !11
  store float %96, ptr %93, align 4, !tbaa !15
  %97 = getelementptr inbounds %union.CgmVec3, ptr %16, i64 4
  %98 = getelementptr inbounds %struct.anon.0, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.anon.5, ptr %99, i32 0, i32 3
  %101 = load float, ptr %100, align 4, !tbaa !11
  store float %101, ptr %98, align 4, !tbaa !12
  %102 = getelementptr inbounds %struct.anon.0, ptr %97, i32 0, i32 1
  %103 = load ptr, ptr %13, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.anon.5, ptr %103, i32 0, i32 4
  %105 = load float, ptr %104, align 4, !tbaa !11
  store float %105, ptr %102, align 4, !tbaa !14
  %106 = getelementptr inbounds %struct.anon.0, ptr %97, i32 0, i32 2
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.anon.5, ptr %107, i32 0, i32 2
  %109 = load float, ptr %108, align 4, !tbaa !11
  store float %109, ptr %106, align 4, !tbaa !15
  %110 = getelementptr inbounds %union.CgmVec3, ptr %16, i64 5
  %111 = getelementptr inbounds %struct.anon.0, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %13, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.anon.5, ptr %112, i32 0, i32 0
  %114 = load float, ptr %113, align 4, !tbaa !11
  store float %114, ptr %111, align 4, !tbaa !12
  %115 = getelementptr inbounds %struct.anon.0, ptr %110, i32 0, i32 1
  %116 = load ptr, ptr %13, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.anon.5, ptr %116, i32 0, i32 4
  %118 = load float, ptr %117, align 4, !tbaa !11
  store float %118, ptr %115, align 4, !tbaa !14
  %119 = getelementptr inbounds %struct.anon.0, ptr %110, i32 0, i32 2
  %120 = load ptr, ptr %13, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.anon.5, ptr %120, i32 0, i32 5
  %122 = load float, ptr %121, align 4, !tbaa !11
  store float %122, ptr %119, align 4, !tbaa !15
  %123 = getelementptr inbounds %union.CgmVec3, ptr %16, i64 6
  %124 = getelementptr inbounds %struct.anon.0, ptr %123, i32 0, i32 0
  %125 = load ptr, ptr %13, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.anon.5, ptr %125, i32 0, i32 3
  %127 = load float, ptr %126, align 4, !tbaa !11
  store float %127, ptr %124, align 4, !tbaa !12
  %128 = getelementptr inbounds %struct.anon.0, ptr %123, i32 0, i32 1
  %129 = load ptr, ptr %13, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.anon.5, ptr %129, i32 0, i32 1
  %131 = load float, ptr %130, align 4, !tbaa !11
  store float %131, ptr %128, align 4, !tbaa !14
  %132 = getelementptr inbounds %struct.anon.0, ptr %123, i32 0, i32 2
  %133 = load ptr, ptr %13, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.anon.5, ptr %133, i32 0, i32 5
  %135 = load float, ptr %134, align 4, !tbaa !11
  store float %135, ptr %132, align 4, !tbaa !15
  %136 = getelementptr inbounds %union.CgmVec3, ptr %16, i64 7
  %137 = getelementptr inbounds %struct.anon.0, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %13, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.anon.5, ptr %138, i32 0, i32 3
  %140 = load float, ptr %139, align 4, !tbaa !11
  store float %140, ptr %137, align 4, !tbaa !12
  %141 = getelementptr inbounds %struct.anon.0, ptr %136, i32 0, i32 1
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.anon.5, ptr %142, i32 0, i32 4
  %144 = load float, ptr %143, align 4, !tbaa !11
  store float %144, ptr %141, align 4, !tbaa !14
  %145 = getelementptr inbounds %struct.anon.0, ptr %136, i32 0, i32 2
  %146 = load ptr, ptr %13, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.anon.5, ptr %146, i32 0, i32 5
  %148 = load float, ptr %147, align 4, !tbaa !11
  store float %148, ptr %145, 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 %149

149:                                              ; preds = %222, %7
  %150 = load i32, ptr %18, align 4, !tbaa !16
  %151 = icmp ult i32 %150, 8
  br i1 %151, label %153, label %152

152:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %225

153:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #4
  %154 = load i32, ptr %18, align 4, !tbaa !16
  %155 = zext i32 %154 to i64
  %156 = getelementptr inbounds [8 x %union.CgmVec3], ptr %16, i64 0, i64 %155
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %156, 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)
  %157 = getelementptr inbounds { <2 x float>, float }, ptr %21, i32 0, i32 0
  %158 = load <2 x float>, ptr %157, align 4
  %159 = getelementptr inbounds { <2 x float>, float }, ptr %21, i32 0, i32 1
  %160 = load float, ptr %159, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %9, i64 12, i1 false)
  %161 = getelementptr inbounds { <2 x float>, float }, ptr %22, i32 0, i32 0
  %162 = load <2 x float>, ptr %161, align 4
  %163 = getelementptr inbounds { <2 x float>, float }, ptr %22, i32 0, i32 1
  %164 = load float, ptr %163, align 4
  %165 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %158, float %160, <2 x float> %162, float %164)
  %166 = getelementptr inbounds %union.CgmVec3, ptr %20, i32 0, i32 0
  store { <2 x float>, float } %165, ptr %23, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %166, 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)
  %167 = getelementptr inbounds { <2 x float>, float }, ptr %25, i32 0, i32 0
  %168 = load <2 x float>, ptr %167, align 4
  %169 = getelementptr inbounds { <2 x float>, float }, ptr %25, i32 0, i32 1
  %170 = load float, ptr %169, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %11, i64 12, i1 false)
  %171 = getelementptr inbounds { <2 x float>, float }, ptr %26, i32 0, i32 0
  %172 = load <2 x float>, ptr %171, align 4
  %173 = getelementptr inbounds { <2 x float>, float }, ptr %26, i32 0, i32 1
  %174 = load float, ptr %173, align 4
  %175 = call float @CgmVec3_dot(<2 x float> %168, float %170, <2 x float> %172, float %174)
  store float %175, ptr %24, align 4, !tbaa !9
  %176 = load float, ptr %24, align 4, !tbaa !9
  %177 = load float, ptr %14, align 4, !tbaa !9
  %178 = load float, ptr %15, align 4, !tbaa !9
  %179 = call float @cgm_clamp(float noundef %176, float noundef %177, float noundef %178)
  store float %179, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #4
  %180 = 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)
  %181 = getelementptr inbounds { <2 x float>, float }, ptr %29, i32 0, i32 0
  %182 = load <2 x float>, ptr %181, align 4
  %183 = getelementptr inbounds { <2 x float>, float }, ptr %29, i32 0, i32 1
  %184 = load float, ptr %183, align 4
  %185 = call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %182, float %184, float noundef %180)
  %186 = getelementptr inbounds %union.CgmVec3, ptr %28, i32 0, i32 0
  store { <2 x float>, float } %185, ptr %30, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %186, 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)
  %187 = getelementptr inbounds { <2 x float>, float }, ptr %31, i32 0, i32 0
  %188 = load <2 x float>, ptr %187, align 4
  %189 = getelementptr inbounds { <2 x float>, float }, ptr %31, i32 0, i32 1
  %190 = load float, ptr %189, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %28, i64 12, i1 false)
  %191 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 0
  %192 = load <2 x float>, ptr %191, align 4
  %193 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 1
  %194 = load float, ptr %193, align 4
  %195 = call { <2 x float>, float } @CgmVec3_add(<2 x float> %188, float %190, <2 x float> %192, float %194)
  %196 = getelementptr inbounds %union.CgmVec3, ptr %27, i32 0, i32 0
  store { <2 x float>, float } %195, ptr %33, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %196, ptr align 8 %33, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %34) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %19, i64 12, i1 false)
  %197 = getelementptr inbounds { <2 x float>, float }, ptr %35, i32 0, i32 0
  %198 = load <2 x float>, ptr %197, align 4
  %199 = getelementptr inbounds { <2 x float>, float }, ptr %35, i32 0, i32 1
  %200 = load float, ptr %199, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %27, i64 12, i1 false)
  %201 = getelementptr inbounds { <2 x float>, float }, ptr %36, i32 0, i32 0
  %202 = load <2 x float>, ptr %201, align 4
  %203 = getelementptr inbounds { <2 x float>, float }, ptr %36, i32 0, i32 1
  %204 = load float, ptr %203, align 4
  %205 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %198, float %200, <2 x float> %202, float %204)
  %206 = getelementptr inbounds %union.CgmVec3, ptr %34, i32 0, i32 0
  store { <2 x float>, float } %205, ptr %37, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %206, ptr align 8 %37, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %34, i64 12, i1 false)
  %207 = getelementptr inbounds { <2 x float>, float }, ptr %39, i32 0, i32 0
  %208 = load <2 x float>, ptr %207, align 4
  %209 = getelementptr inbounds { <2 x float>, float }, ptr %39, i32 0, i32 1
  %210 = load float, ptr %209, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %34, i64 12, i1 false)
  %211 = getelementptr inbounds { <2 x float>, float }, ptr %40, i32 0, i32 0
  %212 = load <2 x float>, ptr %211, align 4
  %213 = getelementptr inbounds { <2 x float>, float }, ptr %40, i32 0, i32 1
  %214 = load float, ptr %213, align 4
  %215 = call float @CgmVec3_dot(<2 x float> %208, float %210, <2 x float> %212, float %214)
  store float %215, ptr %38, align 4, !tbaa !9
  %216 = load float, ptr %38, align 4, !tbaa !9
  %217 = load float, ptr %17, align 4, !tbaa !9
  %218 = fcmp olt float %216, %217
  br i1 %218, label %219, label %221

219:                                              ; preds = %153
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %27, i64 12, i1 false), !tbaa.struct !18
  %220 = load float, ptr %38, align 4, !tbaa !9
  store float %220, ptr %17, align 4, !tbaa !9
  br label %221

221:                                              ; preds = %219, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %34) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #4
  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 %222

222:                                              ; preds = %221
  %223 = load i32, ptr %18, align 4, !tbaa !16
  %224 = add i32 %223, 1
  store i32 %224, ptr %18, align 4, !tbaa !16
  br label %149, !llvm.loop !19

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

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"

%union.CgmVec3 = type { %struct.anon.0 }
%struct.anon.0 = type { float, float, float }

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

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

; Function Attrs: mustprogress 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) 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_dot(<2 x float>, float, <2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local { <2 x float>, float } @CgmAabb3d_closest_pt_on_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 #2 {
  %8 = alloca [8 x %union.CgmVec3], align 16
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %8) #3
  %9 = load <4 x float>, ptr %0, align 4, !tbaa !5
  store <4 x float> %9, ptr %8, align 16, !tbaa !8
  %10 = getelementptr inbounds i8, ptr %8, i64 16
  %11 = extractelement <4 x float> %9, i64 1
  store float %11, ptr %10, align 16, !tbaa !10
  %12 = getelementptr inbounds i8, ptr %8, i64 20
  %13 = extractelement <4 x float> %9, i64 2
  store float %13, ptr %12, align 4, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %8, i64 24
  %15 = extractelement <4 x float> %9, i64 0
  store float %15, ptr %14, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %8, i64 28
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = getelementptr inbounds i8, ptr %8, i64 32
  store float %13, ptr %18, align 16, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %8, i64 36
  %20 = shufflevector <4 x float> %9, <4 x float> poison, <2 x i32> <i32 0, i32 1>
  store <2 x float> %20, ptr %19, align 4, !tbaa !8
  %21 = getelementptr inbounds i8, ptr %8, i64 44
  %22 = getelementptr inbounds i8, ptr %8, i64 48
  %23 = extractelement <4 x float> %9, i64 3
  store float %23, ptr %22, align 16, !tbaa !13
  %24 = getelementptr inbounds i8, ptr %8, i64 52
  %25 = getelementptr inbounds i8, ptr %8, i64 56
  store float %13, ptr %25, align 8, !tbaa !12
  %26 = getelementptr inbounds i8, ptr %8, i64 60
  store float %15, ptr %26, align 4, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %8, i64 64
  %28 = load <2 x float>, ptr %17, align 4, !tbaa !5
  %29 = extractelement <2 x float> %28, i64 0
  store float %29, ptr %16, align 4, !tbaa !10
  %30 = extractelement <2 x float> %28, i64 1
  store float %30, ptr %21, align 4, !tbaa !12
  store float %29, ptr %24, align 4, !tbaa !10
  store <2 x float> %28, ptr %27, align 16, !tbaa !8
  %31 = getelementptr inbounds i8, ptr %8, i64 72
  store float %23, ptr %31, align 8, !tbaa !13
  %32 = getelementptr inbounds i8, ptr %8, i64 76
  store float %11, ptr %32, align 4, !tbaa !10
  %33 = getelementptr inbounds i8, ptr %8, i64 80
  store float %30, ptr %33, align 16, !tbaa !12
  %34 = getelementptr inbounds i8, ptr %8, i64 84
  store float %23, ptr %34, align 4, !tbaa !13
  %35 = getelementptr inbounds i8, ptr %8, i64 88
  store <2 x float> %28, ptr %35, align 8, !tbaa !8
  br label %37

36:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %8) #3
  %.fca.0.insert = insertvalue { <2 x float>, float } poison, <2 x float> %.sroa.088.1, 0
  %.fca.1.insert = insertvalue { <2 x float>, float } %.fca.0.insert, float %.sroa.289.1, 1
  ret { <2 x float>, float } %.fca.1.insert

37:                                               ; preds = %7, %37
  %indvars.iv = phi i64 [ 0, %7 ], [ %indvars.iv.next, %37 ]
  %.sroa.289.095 = phi float [ undef, %7 ], [ %.sroa.289.1, %37 ]
  %.sroa.088.094 = phi <2 x float> [ undef, %7 ], [ %.sroa.088.1, %37 ]
  %.093 = phi float [ 0x7FF0000000000000, %7 ], [ %.1, %37 ]
  %38 = getelementptr inbounds [8 x %union.CgmVec3], ptr %8, i64 0, i64 %indvars.iv
  %.sroa.047.0.copyload = load <2 x float>, ptr %38, align 4
  %.sroa.549.0..sroa_idx = getelementptr inbounds i8, ptr %38, i64 8
  %.sroa.549.0.copyload = load float, ptr %.sroa.549.0..sroa_idx, align 4, !tbaa !5
  %39 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.047.0.copyload, float %.sroa.549.0.copyload, <2 x float> %1, float %2)
  %.fca.0.extract38 = extractvalue { <2 x float>, float } %39, 0
  %.fca.1.extract39 = extractvalue { <2 x float>, float } %39, 1
  %40 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract38, float %.fca.1.extract39, <2 x float> %3, float %4)
  %41 = tail call float @cgm_clamp(float noundef %40, float noundef %5, float noundef %6)
  %42 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %3, float %4, float noundef %41)
  %.fca.0.extract22 = extractvalue { <2 x float>, float } %42, 0
  %.fca.1.extract23 = extractvalue { <2 x float>, float } %42, 1
  %43 = tail call { <2 x float>, float } @CgmVec3_add(<2 x float> %1, float %2, <2 x float> %.fca.0.extract22, float %.fca.1.extract23)
  %.fca.0.extract14 = extractvalue { <2 x float>, float } %43, 0
  %.fca.1.extract15 = extractvalue { <2 x float>, float } %43, 1
  %44 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.047.0.copyload, float %.sroa.549.0.copyload, <2 x float> %.fca.0.extract14, float %.fca.1.extract15)
  %.fca.0.extract = extractvalue { <2 x float>, float } %44, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %44, 1
  %45 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract, float %.fca.1.extract, <2 x float> %.fca.0.extract, float %.fca.1.extract)
  %46 = fcmp olt float %45, %.093
  %.1 = select i1 %46, float %45, float %.093
  %.sroa.088.1 = select i1 %46, <2 x float> %.fca.0.extract14, <2 x float> %.sroa.088.094
  %.sroa.289.1 = select i1 %46, float %.fca.1.extract15, float %.sroa.289.095
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 8
  br i1 %exitcond.not, label %36, label %37, !llvm.loop !14
}

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"float", !6, i64 0}
!10 = !{!11, !9, i64 4}
!11 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8}
!12 = !{!11, !9, i64 8}
!13 = !{!11, !9, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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