; LLVM IR from BrunoLevy/learn-fpga :: FemtoRV/FIRMWARE/CPP_EXAMPLES (tinyrt_cpp)

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

%struct.vec = type { float, float, float }
%struct.Sphere = type { %struct.vec, float, %struct.Material }
%struct.Material = type { float, %struct.vec.0, %struct.vec, float }
%struct.vec.0 = type { float, float, float, float }

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZmiILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float>, float, ptr noundef nonnull align 4 dereferenceable(12)) #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.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZmlILm3EffE3vecIXT_ET0_ERKS2_RKT1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZplILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float>, float, ptr noundef nonnull align 4 dereferenceable(12)) #6

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z15scene_intersectRK3vecILm3EfES2_RKSt6vectorI6SphereSaIS4_EERS0_S9_R8Material(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(36) %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca float, align 4
  %14 = alloca i64, align 8
  %15 = alloca float, align 4
  %16 = alloca %struct.vec, align 4
  %17 = alloca %struct.vec, align 4
  %18 = alloca %struct.vec, align 4
  %19 = alloca { <2 x float>, float }, align 8
  %20 = alloca { <2 x float>, float }, align 4
  %21 = alloca { <2 x float>, float }, align 8
  %22 = alloca %struct.vec, align 4
  %23 = alloca %struct.vec, align 4
  %24 = alloca { <2 x float>, float }, align 4
  %25 = alloca { <2 x float>, float }, align 8
  %26 = alloca float, align 4
  %27 = alloca float, align 4
  %28 = alloca %struct.vec, align 4
  %29 = alloca %struct.vec, align 4
  %30 = alloca %struct.vec, align 4
  %31 = alloca { <2 x float>, float }, align 8
  %32 = alloca { <2 x float>, float }, align 4
  %33 = alloca { <2 x float>, float }, align 8
  %34 = alloca %struct.vec, align 4
  %35 = alloca %struct.vec, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %36 = call noundef float @_ZNSt14numeric_limitsIfE3maxEv() #8
  store float %36, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %37

37:                                               ; preds = %83, %6
  %38 = load i64, ptr %14, align 8, !tbaa !11
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = call noundef i64 @_ZNKSt6vectorI6SphereSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %39) #8
  %41 = icmp ult i64 %38, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %86

43:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = load i64, ptr %14, align 8, !tbaa !11
  %46 = call noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %45) #8
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = call noundef zeroext i1 @_ZNK6Sphere13ray_intersectERK3vecILm3EfES3_Rf(ptr noundef nonnull align 4 dereferenceable(52) %46, ptr noundef nonnull align 4 dereferenceable(12) %47, ptr noundef nonnull align 4 dereferenceable(12) %48, ptr noundef nonnull align 4 dereferenceable(4) %15)
  br i1 %49, label %50, label %82

50:                                               ; preds = %43
  %51 = load float, ptr %15, align 4, !tbaa !9
  %52 = load float, ptr %13, align 4, !tbaa !9
  %53 = fcmp olt float %51, %52
  br i1 %53, label %54, label %82

54:                                               ; preds = %50
  %55 = load float, ptr %15, align 4, !tbaa !9
  store float %55, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #8
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %56, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #8
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = call { <2 x float>, float } @_ZmlILm3EffE3vecIXT_ET0_ERKS2_RKT1_(ptr noundef nonnull align 4 dereferenceable(12) %57, ptr noundef nonnull align 4 dereferenceable(4) %15)
  store { <2 x float>, float } %58, ptr %19, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 8 %19, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %17, i64 12, i1 false)
  %59 = getelementptr inbounds { <2 x float>, float }, ptr %20, i32 0, i32 0
  %60 = load <2 x float>, ptr %59, align 4
  %61 = getelementptr inbounds { <2 x float>, float }, ptr %20, i32 0, i32 1
  %62 = load float, ptr %61, align 4
  %63 = call { <2 x float>, float } @_ZplILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float> %60, float %62, ptr noundef nonnull align 4 dereferenceable(12) %18)
  store { <2 x float>, float } %63, ptr %21, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 8 %21, i64 12, i1 false)
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %64, ptr align 4 %16, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %22) #8
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %65, i64 12, i1 false), !tbaa.struct !13
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = load i64, ptr %14, align 8, !tbaa !11
  %68 = call noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %66, i64 noundef %67) #8
  %69 = getelementptr inbounds %struct.Sphere, ptr %68, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %23, i64 12, i1 false)
  %70 = getelementptr inbounds { <2 x float>, float }, ptr %24, i32 0, i32 0
  %71 = load <2 x float>, ptr %70, align 4
  %72 = getelementptr inbounds { <2 x float>, float }, ptr %24, i32 0, i32 1
  %73 = load float, ptr %72, align 4
  %74 = call { <2 x float>, float } @_ZmiILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float> %71, float %73, ptr noundef nonnull align 4 dereferenceable(12) %69)
  store { <2 x float>, float } %74, ptr %25, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 8 %25, i64 12, i1 false)
  %75 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3vecILm3EfE9normalizeEf(ptr noundef nonnull align 4 dereferenceable(12) %22, float noundef 1.000000e+00)
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %76, ptr align 4 %75, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #8
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = load i64, ptr %14, align 8, !tbaa !11
  %79 = call noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %77, i64 noundef %78) #8
  %80 = getelementptr inbounds %struct.Sphere, ptr %79, i32 0, i32 2
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %81, ptr align 4 %80, i64 36, i1 false), !tbaa.struct !14
  br label %82

82:                                               ; preds = %54, %50, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %83

83:                                               ; preds = %82
  %84 = load i64, ptr %14, align 8, !tbaa !11
  %85 = add i64 %84, 1
  store i64 %85, ptr %14, align 8, !tbaa !11
  br label %37, !llvm.loop !15

86:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  %87 = call noundef float @_ZNSt14numeric_limitsIfE3maxEv() #8
  store float %87, ptr %26, align 4, !tbaa !9
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.vec, ptr %88, i32 0, i32 1
  %90 = load float, ptr %89, align 4, !tbaa !17
  %91 = fpext float %90 to double
  %92 = call double @llvm.fabs.f64(double %91)
  %93 = fcmp ogt double %92, 1.000000e-03
  br i1 %93, label %94, label %157

94:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.vec, ptr %95, i32 0, i32 1
  %97 = load float, ptr %96, align 4, !tbaa !17
  %98 = fadd float %97, 4.000000e+00
  %99 = fneg float %98
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.vec, ptr %100, i32 0, i32 1
  %102 = load float, ptr %101, align 4, !tbaa !17
  %103 = fdiv float %99, %102
  store float %103, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %28) #8
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %104, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 12, ptr %30) #8
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = call { <2 x float>, float } @_ZmlILm3EffE3vecIXT_ET0_ERKS2_RKT1_(ptr noundef nonnull align 4 dereferenceable(12) %105, ptr noundef nonnull align 4 dereferenceable(4) %27)
  store { <2 x float>, float } %106, ptr %31, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 8 %31, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %29, i64 12, i1 false)
  %107 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 0
  %108 = load <2 x float>, ptr %107, align 4
  %109 = getelementptr inbounds { <2 x float>, float }, ptr %32, i32 0, i32 1
  %110 = load float, ptr %109, align 4
  %111 = call { <2 x float>, float } @_ZplILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float> %108, float %110, ptr noundef nonnull align 4 dereferenceable(12) %30)
  store { <2 x float>, float } %111, ptr %33, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 8 %33, i64 12, i1 false)
  call void @llvm.lifetime.end.p0(i64 12, ptr %30) #8
  %112 = load float, ptr %27, align 4, !tbaa !9
  %113 = fcmp ogt float %112, 0.000000e+00
  br i1 %113, label %114, label %156

114:                                              ; preds = %94
  %115 = getelementptr inbounds %struct.vec, ptr %28, i32 0, i32 0
  %116 = load float, ptr %115, align 4, !tbaa !19
  %117 = fpext float %116 to double
  %118 = call double @llvm.fabs.f64(double %117)
  %119 = fcmp olt double %118, 1.000000e+01
  br i1 %119, label %120, label %156

120:                                              ; preds = %114
  %121 = getelementptr inbounds %struct.vec, ptr %28, i32 0, i32 2
  %122 = load float, ptr %121, align 4, !tbaa !20
  %123 = fcmp olt float %122, -1.000000e+01
  br i1 %123, label %124, label %156

124:                                              ; preds = %120
  %125 = getelementptr inbounds %struct.vec, ptr %28, i32 0, i32 2
  %126 = load float, ptr %125, align 4, !tbaa !20
  %127 = fcmp ogt float %126, -3.000000e+01
  br i1 %127, label %128, label %156

128:                                              ; preds = %124
  %129 = load float, ptr %27, align 4, !tbaa !9
  %130 = load float, ptr %13, align 4, !tbaa !9
  %131 = fcmp olt float %129, %130
  br i1 %131, label %132, label %156

132:                                              ; preds = %128
  %133 = load float, ptr %27, align 4, !tbaa !9
  store float %133, ptr %26, align 4, !tbaa !9
  %134 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %134, ptr align 4 %28, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 12, ptr %34) #8
  call void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %34, float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef 0.000000e+00)
  %135 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %135, ptr align 4 %34, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 12, ptr %34) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %35) #8
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.vec, ptr %136, i32 0, i32 0
  %138 = load float, ptr %137, align 4, !tbaa !19
  %139 = fpext float %138 to double
  %140 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %139, double 1.000000e+03)
  %141 = fptosi double %140 to i32
  %142 = load ptr, ptr %10, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.vec, ptr %142, i32 0, i32 2
  %144 = load float, ptr %143, align 4, !tbaa !20
  %145 = fpext float %144 to double
  %146 = fmul double 5.000000e-01, %145
  %147 = fptosi double %146 to i32
  %148 = add nsw i32 %141, %147
  %149 = and i32 %148, 1
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %152

151:                                              ; preds = %132
  call void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %35, float noundef 0x3FD3333340000000, float noundef 0x3FD3333340000000, float noundef 0x3FD3333340000000)
  br label %153

152:                                              ; preds = %132
  call void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %35, float noundef 0x3FD3333340000000, float noundef 0x3FC99999A0000000, float noundef 0x3FB99999A0000000)
  br label %153

153:                                              ; preds = %152, %151
  %154 = load ptr, ptr %12, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.Material, ptr %154, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %155, ptr align 4 %35, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 12, ptr %35) #8
  br label %156

156:                                              ; preds = %153, %128, %124, %120, %114, %94
  call void @llvm.lifetime.end.p0(i64 12, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %157

157:                                              ; preds = %156, %86
  %158 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %26)
  %159 = load float, ptr %158, align 4, !tbaa !9
  %160 = fcmp olt float %159, 1.000000e+03
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  ret i1 %160
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNSt14numeric_limitsIfE3maxEv() #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI6SphereSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6Sphere13ray_intersectERK3vecILm3EfES3_Rf(ptr noundef nonnull align 4 dereferenceable(52), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN3vecILm3EfE9normalizeEf(ptr noundef nonnull align 4 dereferenceable(12), float noundef) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9}
!14 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 12, i64 4, !9, i64 16, i64 4, !9, i64 20, i64 4, !9, i64 24, i64 4, !9, i64 28, i64 4, !9, i64 32, i64 4, !9}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !10, i64 4}
!18 = !{!"_ZTS3vecILm3EfE", !10, i64 0, !10, i64 4, !10, i64 8}
!19 = !{!18, !10, i64 0}
!20 = !{!18, !10, i64 8}


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

%struct.vec = type { float, float, float }

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZmiILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float>, float, ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0

; Function Attrs: mustprogress 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZmlILm3EffE3vecIXT_ET0_ERKS2_RKT1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { <2 x float>, float } @_ZplILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float>, float, ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z15scene_intersectRK3vecILm3EfES2_RKSt6vectorI6SphereSaIS4_EERS0_S9_R8Material(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr nocapture noundef nonnull align 4 dereferenceable(12) %3, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(12) %4, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(36) %5) local_unnamed_addr #0 {
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca %struct.vec, align 8
  %10 = alloca %struct.vec, align 8
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca %struct.vec, align 8
  %14 = alloca %struct.vec, align 4
  %15 = alloca %struct.vec, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  %16 = tail call noundef float @_ZNSt14numeric_limitsIfE3maxEv() #9
  store float %16, ptr %7, align 4, !tbaa !5
  %17 = tail call noundef i64 @_ZNKSt6vectorI6SphereSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #9
  %.not66 = icmp eq i64 %17, 0
  br i1 %.not66, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %6
  %.sroa.235.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.233.0..sroa_idx = getelementptr inbounds i8, ptr %9, i64 8
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %.sroa.219.0..sroa_idx = getelementptr inbounds i8, ptr %10, i64 8
  br label %25

._crit_edge:                                      ; preds = %40, %6
  %18 = phi float [ %16, %6 ], [ %41, %40 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #9
  %19 = call noundef float @_ZNSt14numeric_limitsIfE3maxEv() #9
  store float %19, ptr %11, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %1, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = call float @llvm.fabs.f32(float %21)
  %23 = fpext float %22 to double
  %24 = fcmp ogt double %23, 1.000000e-03
  br i1 %24, label %45, label %78

25:                                               ; preds = %.lr.ph, %40
  %26 = phi float [ %16, %.lr.ph ], [ %41, %40 ]
  %.065 = phi i64 [ 0, %.lr.ph ], [ %42, %40 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #9
  %27 = call noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.065) #9
  %28 = call noundef zeroext i1 @_ZNK6Sphere13ray_intersectERK3vecILm3EfES3_Rf(ptr noundef nonnull align 4 dereferenceable(52) %27, ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(4) %8)
  br i1 %28, label %29, label %40

29:                                               ; preds = %25
  %30 = load float, ptr %8, align 4, !tbaa !5
  %31 = fcmp olt float %30, %26
  br i1 %31, label %32, label %40

32:                                               ; preds = %29
  store float %30, ptr %7, align 4, !tbaa !5
  %.sroa.034.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.235.0.copyload = load float, ptr %.sroa.235.0..sroa_idx, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #9
  %33 = call { <2 x float>, float } @_ZmlILm3EffE3vecIXT_ET0_ERKS2_RKT1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %.fca.0.extract30 = extractvalue { <2 x float>, float } %33, 0
  %.fca.1.extract31 = extractvalue { <2 x float>, float } %33, 1
  store <2 x float> %.fca.0.extract30, ptr %9, align 8
  store float %.fca.1.extract31, ptr %.sroa.233.0..sroa_idx, align 8
  %34 = call { <2 x float>, float } @_ZplILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float> %.sroa.034.0.copyload, float %.sroa.235.0.copyload, ptr noundef nonnull align 4 dereferenceable(12) %9)
  %.fca.0.extract24 = extractvalue { <2 x float>, float } %34, 0
  %.fca.1.extract25 = extractvalue { <2 x float>, float } %34, 1
  store <2 x float> %.fca.0.extract24, ptr %3, align 4
  store float %.fca.1.extract25, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #9
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #9
  %35 = call noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.065) #9
  %36 = call { <2 x float>, float } @_ZmiILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float> %.fca.0.extract24, float %.fca.1.extract25, ptr noundef nonnull align 4 dereferenceable(12) %35)
  %.fca.0.extract16 = extractvalue { <2 x float>, float } %36, 0
  %.fca.1.extract17 = extractvalue { <2 x float>, float } %36, 1
  store <2 x float> %.fca.0.extract16, ptr %10, align 8
  store float %.fca.1.extract17, ptr %.sroa.219.0..sroa_idx, align 8
  %37 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3vecILm3EfE9normalizeEf(ptr noundef nonnull align 4 dereferenceable(12) %10, float noundef 1.000000e+00)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %37, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #9
  %38 = call noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.065) #9
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(36) %5, ptr noundef nonnull align 4 dereferenceable(36) %39, i64 36, i1 false), !tbaa.struct !12
  br label %40

40:                                               ; preds = %32, %29, %25
  %41 = phi float [ %30, %32 ], [ %26, %29 ], [ %26, %25 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  %42 = add nuw i64 %.065, 1
  %43 = call noundef i64 @_ZNKSt6vectorI6SphereSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #9
  %44 = icmp ult i64 %42, %43
  br i1 %44, label %25, label %._crit_edge, !llvm.loop !13

45:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #9
  %46 = getelementptr inbounds i8, ptr %0, i64 4
  %47 = load float, ptr %46, align 4, !tbaa !9
  %48 = fadd float %47, 4.000000e+00
  %49 = fneg float %48
  %50 = fdiv float %49, %21
  store float %50, ptr %12, align 4, !tbaa !5
  %.sroa.012.0.copyload = load <2 x float>, ptr %0, align 4
  %.sroa.213.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.213.0.copyload = load float, ptr %.sroa.213.0..sroa_idx, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #9
  %51 = call { <2 x float>, float } @_ZmlILm3EffE3vecIXT_ET0_ERKS2_RKT1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %.fca.0.extract8 = extractvalue { <2 x float>, float } %51, 0
  %.fca.1.extract9 = extractvalue { <2 x float>, float } %51, 1
  store <2 x float> %.fca.0.extract8, ptr %13, align 8
  %.sroa.211.0..sroa_idx = getelementptr inbounds i8, ptr %13, i64 8
  store float %.fca.1.extract9, ptr %.sroa.211.0..sroa_idx, align 8
  %52 = call { <2 x float>, float } @_ZplILm3EfE3vecIXT_ET0_ES2_RKS2_(<2 x float> %.sroa.012.0.copyload, float %.sroa.213.0.copyload, ptr noundef nonnull align 4 dereferenceable(12) %13)
  %.fca.0.extract = extractvalue { <2 x float>, float } %52, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %52, 1
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #9
  %53 = load float, ptr %12, align 4, !tbaa !5
  %54 = fcmp ogt float %53, 0.000000e+00
  br i1 %54, label %55, label %77

55:                                               ; preds = %45
  %.sroa.014.0.vec.extract = extractelement <2 x float> %.fca.0.extract, i64 0
  %56 = call float @llvm.fabs.f32(float %.sroa.014.0.vec.extract)
  %57 = fcmp olt float %56, 1.000000e+01
  %58 = fcmp olt float %.fca.1.extract, -1.000000e+01
  %59 = fcmp ogt float %.fca.1.extract, -3.000000e+01
  %60 = and i1 %58, %59
  %or.cond5 = select i1 %57, i1 %60, i1 false
  %61 = fcmp olt float %53, %18
  %or.cond = select i1 %or.cond5, i1 %61, i1 false
  br i1 %or.cond, label %62, label %77

62:                                               ; preds = %55
  store float %53, ptr %11, align 4, !tbaa !5
  store <2 x float> %.fca.0.extract, ptr %3, align 4
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store float %.fca.1.extract, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %14) #9
  call void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %14, float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef 0.000000e+00)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %14, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %14) #9
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %15) #9
  %63 = load float, ptr %3, align 4, !tbaa !15
  %64 = fpext float %63 to double
  %65 = call double @llvm.fmuladd.f64(double %64, double 5.000000e-01, double 1.000000e+03)
  %66 = fptosi double %65 to i32
  %67 = load float, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !16
  %68 = fpext float %67 to double
  %69 = fmul double %68, 5.000000e-01
  %70 = fptosi double %69 to i32
  %71 = add nsw i32 %70, %66
  %72 = and i32 %71, 1
  %.not = icmp eq i32 %72, 0
  br i1 %.not, label %74, label %73

73:                                               ; preds = %62
  call void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %15, float noundef 0x3FD3333340000000, float noundef 0x3FD3333340000000, float noundef 0x3FD3333340000000)
  br label %75

74:                                               ; preds = %62
  call void @_ZN3vecILm3EfEC2Efff(ptr noundef nonnull align 4 dereferenceable(12) %15, float noundef 0x3FD3333340000000, float noundef 0x3FC99999A0000000, float noundef 0x3FB99999A0000000)
  br label %75

75:                                               ; preds = %74, %73
  %76 = getelementptr inbounds i8, ptr %5, i64 20
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %76, ptr noundef nonnull align 4 dereferenceable(12) %15, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %15) #9
  br label %77

77:                                               ; preds = %75, %55, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #9
  br label %78

78:                                               ; preds = %77, %._crit_edge
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %80 = load float, ptr %79, align 4, !tbaa !5
  %81 = fcmp olt float %80, 1.000000e+03
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  ret i1 %81
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNSt14numeric_limitsIfE3maxEv() local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI6SphereSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(52) ptr @_ZNKSt6vectorI6SphereSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6Sphere13ray_intersectERK3vecILm3EfES3_Rf(ptr noundef nonnull align 4 dereferenceable(52), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN3vecILm3EfE9normalizeEf(ptr noundef nonnull align 4 dereferenceable(12), float noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

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

attributes #0 = { mustprogress 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress 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 #7 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"_ZTS3vecILm3EfE", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!12 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5, i64 16, i64 4, !5, i64 20, i64 4, !5, i64 24, i64 4, !5, i64 28, i64 4, !5, i64 32, i64 4, !5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass