; LLVM IR from heroseh/cgm :: cgm (cgm_3d_aabb_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 }

; 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.copysign.f32(float, float) #2

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

; 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_dot(<2 x float>, float, <2 x float>, float) #4

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @cgm_3d_aabb_vs_pt(ptr noundef, <2 x float>, float, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @cgm_3d_aabb_vs_sphere(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #4 {
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca { <2 x float>, float }, align 4
  %11 = alloca %union.CgmVec3, align 4
  %12 = alloca %union.CgmVec3, align 4
  %13 = alloca { <2 x float>, float }, align 8
  %14 = alloca { <2 x float>, float }, align 4
  %15 = alloca { <2 x float>, float }, align 4
  %16 = alloca { <2 x float>, float }, align 8
  %17 = alloca %union.CgmVec3, align 4
  %18 = alloca { <2 x float>, float }, align 4
  %19 = alloca { <2 x float>, float }, align 8
  %20 = alloca %union.CgmVec3, align 4
  %21 = alloca { <2 x float>, float }, align 8
  %22 = alloca %union.CgmVec3, align 4
  %23 = alloca { <2 x float>, float }, align 4
  %24 = alloca { <2 x float>, float }, align 4
  %25 = alloca { <2 x float>, float }, align 8
  %26 = alloca %union.CgmVec3, align 4
  %27 = alloca float, align 4
  %28 = alloca %union.CgmVec3, align 4
  %29 = alloca %union.CgmVec3, align 4
  %30 = alloca %union.CgmVec3, align 4
  %31 = alloca %union.CgmVec3, 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 float, align 4
  %42 = alloca i32, align 4
  %43 = alloca float, align 4
  %44 = alloca %union.CgmVec3, align 4
  %45 = alloca { <2 x float>, float }, align 4
  %46 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.CgmSphere, ptr %48, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %49, i64 12, i1 false)
  %50 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 0
  %51 = load <2 x float>, ptr %50, align 4
  %52 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 1
  %53 = load float, ptr %52, align 4
  %54 = call zeroext i8 @cgm_3d_aabb_vs_pt(ptr noundef %47, <2 x float> %51, float %53, ptr noundef null, ptr noundef null)
  %55 = icmp ne i8 %54, 0
  br i1 %55, label %56, label %168

56:                                               ; preds = %4
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %63, label %59

59:                                               ; preds = %56
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  store i8 1, ptr %5, align 1
  br label %248

63:                                               ; preds = %59, %56
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.CgmSphere, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = call { <2 x float>, float } @CgmAabb3d_center(ptr noundef %66)
  %68 = getelementptr inbounds %union.CgmVec3, ptr %12, i32 0, i32 0
  store { <2 x float>, float } %67, ptr %13, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %68, ptr align 8 %13, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %65, i64 12, i1 false)
  %69 = getelementptr inbounds { <2 x float>, float }, ptr %14, i32 0, i32 0
  %70 = load <2 x float>, ptr %69, align 4
  %71 = getelementptr inbounds { <2 x float>, float }, ptr %14, i32 0, i32 1
  %72 = load float, ptr %71, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %12, i64 12, i1 false)
  %73 = getelementptr inbounds { <2 x float>, float }, ptr %15, i32 0, i32 0
  %74 = load <2 x float>, ptr %73, align 4
  %75 = getelementptr inbounds { <2 x float>, float }, ptr %15, i32 0, i32 1
  %76 = load float, ptr %75, align 4
  %77 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %70, float %72, <2 x float> %74, float %76)
  %78 = getelementptr inbounds %union.CgmVec3, ptr %11, i32 0, i32 0
  store { <2 x float>, float } %77, ptr %16, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %78, ptr align 8 %16, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %11, i64 12, i1 false)
  %79 = getelementptr inbounds { <2 x float>, float }, ptr %18, i32 0, i32 0
  %80 = load <2 x float>, ptr %79, align 4
  %81 = getelementptr inbounds { <2 x float>, float }, ptr %18, i32 0, i32 1
  %82 = load float, ptr %81, align 4
  %83 = call { <2 x float>, float } @CgmVec3_abs(<2 x float> %80, float %82)
  %84 = getelementptr inbounds %union.CgmVec3, ptr %17, i32 0, i32 0
  store { <2 x float>, float } %83, ptr %19, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %84, ptr align 8 %19, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %20) #5
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = call { <2 x float>, float } @CgmAabb3d_half_size(ptr noundef %85)
  %87 = getelementptr inbounds %union.CgmVec3, ptr %20, i32 0, i32 0
  store { <2 x float>, float } %86, ptr %21, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %87, ptr align 8 %21, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %22) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %20, i64 12, i1 false)
  %88 = getelementptr inbounds { <2 x float>, float }, ptr %23, i32 0, i32 0
  %89 = load <2 x float>, ptr %88, align 4
  %90 = getelementptr inbounds { <2 x float>, float }, ptr %23, i32 0, i32 1
  %91 = load float, ptr %90, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %17, i64 12, i1 false)
  %92 = getelementptr inbounds { <2 x float>, float }, ptr %24, i32 0, i32 0
  %93 = load <2 x float>, ptr %92, align 4
  %94 = getelementptr inbounds { <2 x float>, float }, ptr %24, i32 0, i32 1
  %95 = load float, ptr %94, align 4
  %96 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %89, float %91, <2 x float> %93, float %95)
  %97 = getelementptr inbounds %union.CgmVec3, ptr %22, i32 0, i32 0
  store { <2 x float>, float } %96, ptr %25, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %97, ptr align 8 %25, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %26) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  %98 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 0
  %99 = load float, ptr %98, align 4, !tbaa !9
  %100 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 1
  %101 = load float, ptr %100, align 4, !tbaa !9
  %102 = fcmp olt float %99, %101
  br i1 %102, label %103, label %119

103:                                              ; preds = %63
  %104 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 0
  %105 = load float, ptr %104, align 4, !tbaa !9
  %106 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 2
  %107 = load float, ptr %106, align 4, !tbaa !9
  %108 = fcmp olt float %105, %107
  br i1 %108, label %109, label %119

109:                                              ; preds = %103
  %110 = getelementptr inbounds %struct.anon.0, ptr %28, i32 0, i32 0
  %111 = getelementptr inbounds %struct.anon.0, ptr %11, i32 0, i32 0
  %112 = load float, ptr %111, align 4, !tbaa !9
  %113 = fneg float %112
  %114 = call float @llvm.copysign.f32(float 1.000000e+00, float %113)
  store float %114, ptr %110, align 4, !tbaa !10
  %115 = getelementptr inbounds %struct.anon.0, ptr %28, i32 0, i32 1
  store float 0.000000e+00, ptr %115, align 4, !tbaa !13
  %116 = getelementptr inbounds %struct.anon.0, ptr %28, i32 0, i32 2
  store float 0.000000e+00, ptr %116, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %28, i64 12, i1 false), !tbaa.struct !15
  %117 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 0
  %118 = load float, ptr %117, align 4, !tbaa !9
  store float %118, ptr %27, align 4, !tbaa !16
  br label %152

119:                                              ; preds = %103, %63
  %120 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 1
  %121 = load float, ptr %120, align 4, !tbaa !9
  %122 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 0
  %123 = load float, ptr %122, align 4, !tbaa !9
  %124 = fcmp olt float %121, %123
  br i1 %124, label %125, label %141

125:                                              ; preds = %119
  %126 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 1
  %127 = load float, ptr %126, align 4, !tbaa !9
  %128 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 2
  %129 = load float, ptr %128, align 4, !tbaa !9
  %130 = fcmp olt float %127, %129
  br i1 %130, label %131, label %141

131:                                              ; preds = %125
  %132 = getelementptr inbounds %struct.anon.0, ptr %29, i32 0, i32 0
  store float 0.000000e+00, ptr %132, align 4, !tbaa !10
  %133 = getelementptr inbounds %struct.anon.0, ptr %29, i32 0, i32 1
  %134 = getelementptr inbounds %struct.anon.0, ptr %11, i32 0, i32 1
  %135 = load float, ptr %134, align 4, !tbaa !9
  %136 = fneg float %135
  %137 = call float @llvm.copysign.f32(float 1.000000e+00, float %136)
  store float %137, ptr %133, align 4, !tbaa !13
  %138 = getelementptr inbounds %struct.anon.0, ptr %29, i32 0, i32 2
  store float 0.000000e+00, ptr %138, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %29, i64 12, i1 false), !tbaa.struct !15
  %139 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 1
  %140 = load float, ptr %139, align 4, !tbaa !9
  store float %140, ptr %27, align 4, !tbaa !16
  br label %151

141:                                              ; preds = %125, %119
  %142 = getelementptr inbounds %struct.anon.0, ptr %30, i32 0, i32 0
  store float 0.000000e+00, ptr %142, align 4, !tbaa !10
  %143 = getelementptr inbounds %struct.anon.0, ptr %30, i32 0, i32 1
  store float 0.000000e+00, ptr %143, align 4, !tbaa !13
  %144 = getelementptr inbounds %struct.anon.0, ptr %30, i32 0, i32 2
  %145 = getelementptr inbounds %struct.anon.0, ptr %11, i32 0, i32 2
  %146 = load float, ptr %145, align 4, !tbaa !9
  %147 = fneg float %146
  %148 = call float @llvm.copysign.f32(float 1.000000e+00, float %147)
  store float %148, ptr %144, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %30, i64 12, i1 false), !tbaa.struct !15
  %149 = getelementptr inbounds %struct.anon.0, ptr %22, i32 0, i32 2
  %150 = load float, ptr %149, align 4, !tbaa !9
  store float %150, ptr %27, align 4, !tbaa !16
  br label %151

151:                                              ; preds = %141, %131
  br label %152

152:                                              ; preds = %151, %109
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  %154 = icmp ne ptr %153, null
  br i1 %154, label %155, label %162

155:                                              ; preds = %152
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.CgmSphere, ptr %156, i32 0, i32 1
  %158 = load float, ptr %157, align 4, !tbaa !17
  %159 = load float, ptr %27, align 4, !tbaa !16
  %160 = fadd float %158, %159
  %161 = load ptr, ptr %9, align 8, !tbaa !5
  store float %160, ptr %161, align 4, !tbaa !16
  br label %162

162:                                              ; preds = %155, %152
  %163 = load ptr, ptr %8, align 8, !tbaa !5
  %164 = icmp ne ptr %163, null
  br i1 %164, label %165, label %167

165:                                              ; preds = %162
  %166 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %166, ptr align 4 %26, i64 12, i1 false), !tbaa.struct !15
  br label %167

167:                                              ; preds = %165, %162
  store i8 1, ptr %5, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #5
  br label %248

168:                                              ; preds = %4
  call void @llvm.lifetime.start.p0(i64 12, ptr %31) #5
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.CgmSphere, ptr %170, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %171, i64 12, i1 false)
  %172 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 0
  %173 = load <2 x float>, ptr %172, align 4
  %174 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 1
  %175 = load float, ptr %174, align 4
  %176 = call { <2 x float>, float } @CgmAabb3d_clamp_pt(ptr noundef %169, <2 x float> %173, float %175)
  %177 = getelementptr inbounds %union.CgmVec3, ptr %31, i32 0, i32 0
  store { <2 x float>, float } %176, ptr %33, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %177, ptr align 8 %33, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %34) #5
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.CgmSphere, ptr %178, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %179, i64 12, i1 false)
  %180 = getelementptr inbounds { <2 x float>, float }, ptr %35, i32 0, i32 0
  %181 = load <2 x float>, ptr %180, align 4
  %182 = getelementptr inbounds { <2 x float>, float }, ptr %35, i32 0, i32 1
  %183 = load float, ptr %182, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %31, i64 12, i1 false)
  %184 = getelementptr inbounds { <2 x float>, float }, ptr %36, i32 0, i32 0
  %185 = load <2 x float>, ptr %184, align 4
  %186 = getelementptr inbounds { <2 x float>, float }, ptr %36, i32 0, i32 1
  %187 = load float, ptr %186, align 4
  %188 = call { <2 x float>, float } @CgmVec3_sub(<2 x float> %181, float %183, <2 x float> %185, float %187)
  %189 = getelementptr inbounds %union.CgmVec3, ptr %34, i32 0, i32 0
  store { <2 x float>, float } %188, ptr %37, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %189, ptr align 8 %37, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %34, i64 12, i1 false)
  %190 = getelementptr inbounds { <2 x float>, float }, ptr %39, i32 0, i32 0
  %191 = load <2 x float>, ptr %190, align 4
  %192 = getelementptr inbounds { <2 x float>, float }, ptr %39, i32 0, i32 1
  %193 = load float, ptr %192, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %34, i64 12, i1 false)
  %194 = getelementptr inbounds { <2 x float>, float }, ptr %40, i32 0, i32 0
  %195 = load <2 x float>, ptr %194, align 4
  %196 = getelementptr inbounds { <2 x float>, float }, ptr %40, i32 0, i32 1
  %197 = load float, ptr %196, align 4
  %198 = call float @CgmVec3_dot(<2 x float> %191, float %193, <2 x float> %195, float %197)
  store float %198, ptr %38, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #5
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.CgmSphere, ptr %199, i32 0, i32 1
  %201 = load float, ptr %200, align 4, !tbaa !17
  %202 = load ptr, ptr %7, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.CgmSphere, ptr %202, i32 0, i32 1
  %204 = load float, ptr %203, align 4, !tbaa !17
  %205 = fmul float %201, %204
  store float %205, ptr %41, align 4, !tbaa !16
  %206 = load float, ptr %38, align 4, !tbaa !16
  %207 = load float, ptr %41, align 4, !tbaa !16
  %208 = fcmp ole float %206, %207
  br i1 %208, label %209, label %243

209:                                              ; preds = %168
  %210 = load ptr, ptr %9, align 8, !tbaa !5
  %211 = icmp ne ptr %210, null
  br i1 %211, label %216, label %212

212:                                              ; preds = %209
  %213 = load ptr, ptr %8, align 8, !tbaa !5
  %214 = icmp ne ptr %213, null
  br i1 %214, label %216, label %215

215:                                              ; preds = %212
  store i8 1, ptr %5, align 1
  store i32 1, ptr %42, align 4
  br label %244

216:                                              ; preds = %212, %209
  call void @llvm.lifetime.start.p0(i64 4, ptr %43) #5
  %217 = load float, ptr %38, align 4, !tbaa !16
  %218 = call float @sqrtf(float noundef %217) #5
  store float %218, ptr %43, align 4, !tbaa !16
  %219 = load ptr, ptr %9, align 8, !tbaa !5
  %220 = icmp ne ptr %219, null
  br i1 %220, label %221, label %228

221:                                              ; preds = %216
  %222 = load ptr, ptr %7, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.CgmSphere, ptr %222, i32 0, i32 1
  %224 = load float, ptr %223, align 4, !tbaa !17
  %225 = load float, ptr %43, align 4, !tbaa !16
  %226 = fsub float %224, %225
  %227 = load ptr, ptr %9, align 8, !tbaa !5
  store float %226, ptr %227, align 4, !tbaa !16
  br label %228

228:                                              ; preds = %221, %216
  %229 = load ptr, ptr %8, align 8, !tbaa !5
  %230 = icmp ne ptr %229, null
  br i1 %230, label %231, label %242

231:                                              ; preds = %228
  %232 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %44) #5
  %233 = load float, ptr %43, align 4, !tbaa !16
  %234 = fdiv float 1.000000e+00, %233
  %235 = fneg float %234
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %34, i64 12, i1 false)
  %236 = getelementptr inbounds { <2 x float>, float }, ptr %45, i32 0, i32 0
  %237 = load <2 x float>, ptr %236, align 4
  %238 = getelementptr inbounds { <2 x float>, float }, ptr %45, i32 0, i32 1
  %239 = load float, ptr %238, align 4
  %240 = call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %237, float %239, float noundef %235)
  %241 = getelementptr inbounds %union.CgmVec3, ptr %44, i32 0, i32 0
  store { <2 x float>, float } %240, ptr %46, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %241, ptr align 8 %46, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %232, ptr align 4 %44, i64 12, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 12, ptr %44) #5
  br label %242

242:                                              ; preds = %231, %228
  store i8 1, ptr %5, align 1
  store i32 1, ptr %42, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %43) #5
  br label %244

243:                                              ; preds = %168
  store i32 0, ptr %42, align 4
  br label %244

244:                                              ; preds = %243, %242, %215
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %34) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %31) #5
  %245 = load i32, ptr %42, align 4
  switch i32 %245, label %250 [
    i32 0, label %246
    i32 1, label %248
  ]

246:                                              ; preds = %244
  br label %247

247:                                              ; preds = %246
  store i8 0, ptr %5, align 1
  br label %248

248:                                              ; preds = %247, %244, %167, %62
  %249 = load i8, ptr %5, align 1
  ret i8 %249

250:                                              ; preds = %244
  unreachable
}

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 }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 0}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"float", !7, i64 0}
!13 = !{!11, !12, i64 4}
!14 = !{!11, !12, i64 8}
!15 = !{i64 0, i64 12, !9}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !12, i64 12}
!18 = !{!"CgmSphere", !7, i64 0, !12, i64 12}


; 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.copysign.f32(float, 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_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
declare dso_local { <2 x float>, float } @CgmVec3_abs(<2 x float>, float) local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @cgm_3d_aabb_vs_pt(ptr noundef, <2 x float>, float, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @cgm_3d_aabb_vs_sphere(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef writeonly %2, ptr noundef writeonly %3) local_unnamed_addr #2 {
  %.sroa.099.0.copyload = load <2 x float>, ptr %1, align 4
  %.sroa.2100.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.2100.0.copyload = load float, ptr %.sroa.2100.0..sroa_idx, align 4
  %5 = tail call zeroext i8 @cgm_3d_aabb_vs_pt(ptr noundef %0, <2 x float> %.sroa.099.0.copyload, float %.sroa.2100.0.copyload, ptr noundef null, ptr noundef null)
  %.not = icmp eq i8 %5, 0
  br i1 %.not, label %36, label %6

6:                                                ; preds = %4
  %7 = icmp ne ptr %3, null
  %8 = icmp ne ptr %2, null
  %or.cond = or i1 %8, %7
  br i1 %or.cond, label %9, label %57

9:                                                ; preds = %6
  %10 = tail call { <2 x float>, float } @CgmAabb3d_center(ptr noundef %0)
  %.fca.0.extract90 = extractvalue { <2 x float>, float } %10, 0
  %.fca.1.extract91 = extractvalue { <2 x float>, float } %10, 1
  %.sroa.088.0.copyload = load <2 x float>, ptr %1, align 4
  %.sroa.289.0.copyload = load float, ptr %.sroa.2100.0..sroa_idx, align 4
  %11 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.088.0.copyload, float %.sroa.289.0.copyload, <2 x float> %.fca.0.extract90, float %.fca.1.extract91)
  %.fca.0.extract82 = extractvalue { <2 x float>, float } %11, 0
  %.fca.1.extract83 = extractvalue { <2 x float>, float } %11, 1
  %12 = tail call { <2 x float>, float } @CgmVec3_abs(<2 x float> %.fca.0.extract82, float %.fca.1.extract83)
  %.fca.0.extract74 = extractvalue { <2 x float>, float } %12, 0
  %.fca.1.extract75 = extractvalue { <2 x float>, float } %12, 1
  %13 = tail call { <2 x float>, float } @CgmAabb3d_half_size(ptr noundef %0)
  %.fca.0.extract68 = extractvalue { <2 x float>, float } %13, 0
  %.fca.1.extract69 = extractvalue { <2 x float>, float } %13, 1
  %14 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.fca.0.extract68, float %.fca.1.extract69, <2 x float> %.fca.0.extract74, float %.fca.1.extract75)
  %.fca.0.extract45 = extractvalue { <2 x float>, float } %14, 0
  %.fca.1.extract46 = extractvalue { <2 x float>, float } %14, 1
  %.sroa.053.0.vec.extract = extractelement <2 x float> %.fca.0.extract45, i64 0
  %.sroa.053.4.vec.extract = extractelement <2 x float> %.fca.0.extract45, i64 1
  %15 = fcmp olt float %.sroa.053.0.vec.extract, %.sroa.053.4.vec.extract
  %16 = fcmp olt float %.sroa.053.0.vec.extract, %.fca.1.extract46
  %or.cond132 = select i1 %15, i1 %16, i1 false
  br i1 %or.cond132, label %17, label %20

17:                                               ; preds = %9
  %.sroa.096.0.vec.extract = extractelement <2 x float> %.fca.0.extract82, i64 0
  %18 = fneg float %.sroa.096.0.vec.extract
  %19 = tail call float @llvm.copysign.f32(float 1.000000e+00, float %18)
  br label %29

20:                                               ; preds = %9
  %21 = fcmp olt float %.sroa.053.4.vec.extract, %.sroa.053.0.vec.extract
  %22 = fcmp olt float %.sroa.053.4.vec.extract, %.fca.1.extract46
  %or.cond133 = select i1 %21, i1 %22, i1 false
  br i1 %or.cond133, label %23, label %26

23:                                               ; preds = %20
  %.sroa.096.4.vec.extract = extractelement <2 x float> %.fca.0.extract82, i64 1
  %24 = fneg float %.sroa.096.4.vec.extract
  %25 = tail call float @llvm.copysign.f32(float 1.000000e+00, float %24)
  br label %29

26:                                               ; preds = %20
  %27 = fneg float %.fca.1.extract83
  %28 = tail call float @llvm.copysign.f32(float 1.000000e+00, float %27)
  br label %29

29:                                               ; preds = %23, %26, %17
  %.0126 = phi float [ %.sroa.053.0.vec.extract, %17 ], [ %.sroa.053.4.vec.extract, %23 ], [ %.fca.1.extract46, %26 ]
  %.sroa.043.0 = phi float [ %19, %17 ], [ 0.000000e+00, %23 ], [ 0.000000e+00, %26 ]
  %.sroa.644.0 = phi float [ 0.000000e+00, %17 ], [ %25, %23 ], [ 0.000000e+00, %26 ]
  %.sroa.9.0 = phi float [ 0.000000e+00, %17 ], [ 0.000000e+00, %23 ], [ %28, %26 ]
  br i1 %7, label %30, label %34

30:                                               ; preds = %29
  %31 = getelementptr inbounds i8, ptr %1, i64 12
  %32 = load float, ptr %31, align 4, !tbaa !5
  %33 = fadd float %.0126, %32
  store float %33, ptr %3, align 4, !tbaa !10
  br label %34

34:                                               ; preds = %30, %29
  br i1 %8, label %35, label %57

35:                                               ; preds = %34
  store float %.sroa.043.0, ptr %2, align 4
  %.sroa.644.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 4
  store float %.sroa.644.0, ptr %.sroa.644.0..sroa_idx, align 4
  %.sroa.9.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  store float %.sroa.9.0, ptr %.sroa.9.0..sroa_idx, align 4, !tbaa !11
  br label %57

36:                                               ; preds = %4
  %.sroa.030.0.copyload = load <2 x float>, ptr %1, align 4
  %.sroa.231.0.copyload = load float, ptr %.sroa.2100.0..sroa_idx, align 4
  %37 = tail call { <2 x float>, float } @CgmAabb3d_clamp_pt(ptr noundef %0, <2 x float> %.sroa.030.0.copyload, float %.sroa.231.0.copyload)
  %.fca.0.extract26 = extractvalue { <2 x float>, float } %37, 0
  %.fca.1.extract27 = extractvalue { <2 x float>, float } %37, 1
  %.sroa.021.0.copyload = load <2 x float>, ptr %1, align 4
  %.sroa.222.0.copyload = load float, ptr %.sroa.2100.0..sroa_idx, align 4
  %38 = tail call { <2 x float>, float } @CgmVec3_sub(<2 x float> %.sroa.021.0.copyload, float %.sroa.222.0.copyload, <2 x float> %.fca.0.extract26, float %.fca.1.extract27)
  %.fca.0.extract15 = extractvalue { <2 x float>, float } %38, 0
  %.fca.1.extract16 = extractvalue { <2 x float>, float } %38, 1
  %39 = tail call float @CgmVec3_dot(<2 x float> %.fca.0.extract15, float %.fca.1.extract16, <2 x float> %.fca.0.extract15, float %.fca.1.extract16)
  %40 = getelementptr inbounds i8, ptr %1, i64 12
  %41 = load float, ptr %40, align 4, !tbaa !5
  %42 = fmul float %41, %41
  %43 = fcmp ole float %39, %42
  br i1 %43, label %44, label %56

44:                                               ; preds = %36
  %45 = icmp ne ptr %3, null
  %46 = icmp ne ptr %2, null
  %or.cond3 = or i1 %46, %45
  br i1 %or.cond3, label %47, label %56

47:                                               ; preds = %44
  %48 = tail call float @sqrtf(float noundef %39) #3
  br i1 %45, label %49, label %52

49:                                               ; preds = %47
  %50 = load float, ptr %40, align 4, !tbaa !5
  %51 = fsub float %50, %48
  store float %51, ptr %3, align 4, !tbaa !10
  br label %52

52:                                               ; preds = %49, %47
  br i1 %46, label %53, label %56

53:                                               ; preds = %52
  %54 = fdiv float -1.000000e+00, %48
  %55 = tail call { <2 x float>, float } @CgmVec3_mul_scalar(<2 x float> %.fca.0.extract15, float %.fca.1.extract16, float noundef %54)
  %.fca.0.extract = extractvalue { <2 x float>, float } %55, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %55, 1
  store <2 x float> %.fca.0.extract, ptr %2, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  store float %.fca.1.extract, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %36, %52, %53, %44
  %spec.select = zext i1 %43 to i8
  br label %57

57:                                               ; preds = %56, %34, %35, %6
  %.1 = phi i8 [ 1, %6 ], [ 1, %35 ], [ 1, %34 ], [ %spec.select, %56 ]
  ret i8 %.1
}

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 = { 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,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass