; LLVM IR from fogleman/CellularForms :: tracer/src/sphere.ll (ZNK6Sphere3HitERK3RayddR7HitInfo)

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

%class.Vec3 = type { double, double, double }
%class.Sphere = type { %class.Hittable, %class.Vec3, double, %"class.std::shared_ptr" }
%class.Hittable = type { ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%struct.HitInfo = type { double, %class.Vec3, %class.Vec3, %"class.std::shared_ptr" }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK6Sphere3HitERK3RayddR7HitInfo(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, double noundef %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(72) %4) unnamed_addr #0 align 2 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %class.Vec3, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca %class.Vec3, align 8
  %19 = alloca %class.Vec3, align 8
  %20 = alloca %class.Vec3, align 8
  %21 = alloca i32, align 4
  %22 = alloca %class.Vec3, align 8
  %23 = alloca %class.Vec3, align 8
  %24 = alloca %class.Vec3, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store double %2, ptr %9, align 8, !tbaa !9
  store double %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #8
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray6OriginEv(ptr noundef nonnull align 8 dereferenceable(48) %26)
  %28 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 1
  call void @_ZmiRK4Vec3S1_(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %27, ptr noundef nonnull align 8 dereferenceable(24) %28)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48) %29)
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48) %31)
  %33 = call noundef double @_Z3DotRK4Vec3S1_(ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 8 dereferenceable(24) %32)
  store double %33, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48) %34)
  %36 = call noundef double @_Z3DotRK4Vec3S1_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %35)
  store double %36, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %37 = call noundef double @_Z3DotRK4Vec3S1_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %12)
  %38 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 2
  %39 = load double, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 2
  %41 = load double, ptr %40, align 8, !tbaa !11
  %42 = fneg double %39
  %43 = call double @llvm.fmuladd.f64(double %42, double %41, double %37)
  store double %43, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %44 = load double, ptr %14, align 8, !tbaa !9
  %45 = load double, ptr %14, align 8, !tbaa !9
  %46 = load double, ptr %13, align 8, !tbaa !9
  %47 = load double, ptr %15, align 8, !tbaa !9
  %48 = fmul double %46, %47
  %49 = fneg double %48
  %50 = call double @llvm.fmuladd.f64(double %44, double %45, double %49)
  store double %50, ptr %16, align 8, !tbaa !9
  %51 = load double, ptr %16, align 8, !tbaa !9
  %52 = fcmp ogt double %51, 0.000000e+00
  br i1 %52, label %53, label %137

53:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %54 = load double, ptr %14, align 8, !tbaa !9
  %55 = fneg double %54
  %56 = load double, ptr %14, align 8, !tbaa !9
  %57 = load double, ptr %14, align 8, !tbaa !9
  %58 = load double, ptr %13, align 8, !tbaa !9
  %59 = load double, ptr %15, align 8, !tbaa !9
  %60 = fmul double %58, %59
  %61 = fneg double %60
  %62 = call double @llvm.fmuladd.f64(double %56, double %57, double %61)
  %63 = call double @sqrt(double noundef %62) #8
  %64 = fsub double %55, %63
  %65 = load double, ptr %13, align 8, !tbaa !9
  %66 = fdiv double %64, %65
  store double %66, ptr %17, align 8, !tbaa !9
  %67 = load double, ptr %17, align 8, !tbaa !9
  %68 = load double, ptr %10, align 8, !tbaa !9
  %69 = fcmp olt double %67, %68
  br i1 %69, label %70, label %93

70:                                               ; preds = %53
  %71 = load double, ptr %17, align 8, !tbaa !9
  %72 = load double, ptr %9, align 8, !tbaa !9
  %73 = fcmp ogt double %71, %72
  br i1 %73, label %74, label %93

74:                                               ; preds = %70
  %75 = load double, ptr %17, align 8, !tbaa !9
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.HitInfo, ptr %76, i32 0, i32 0
  store double %75, ptr %77, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #8
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = load double, ptr %17, align 8, !tbaa !9
  call void @_ZNK3Ray2AtEd(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %18, ptr noundef nonnull align 8 dereferenceable(48) %78, double noundef %79)
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.HitInfo, ptr %80, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %81, ptr align 8 %18, i64 24, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #8
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.HitInfo, ptr %82, i32 0, i32 1
  %84 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 1
  call void @_ZmiRK4Vec3S1_(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %20, ptr noundef nonnull align 8 dereferenceable(24) %83, ptr noundef nonnull align 8 dereferenceable(24) %84)
  %85 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 2
  %86 = load double, ptr %85, align 8, !tbaa !11
  call void @_ZdvRK4Vec3d(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %19, ptr noundef nonnull align 8 dereferenceable(24) %20, double noundef %86)
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.HitInfo, ptr %87, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %88, ptr align 8 %19, i64 24, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #8
  %89 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 3
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.HitInfo, ptr %90, i32 0, i32 3
  %92 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrI8MaterialEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %91, ptr noundef nonnull align 8 dereferenceable(16) %89) #8
  store i1 true, ptr %6, align 1
  store i32 1, ptr %21, align 4
  br label %134

93:                                               ; preds = %70, %53
  %94 = load double, ptr %14, align 8, !tbaa !9
  %95 = fneg double %94
  %96 = load double, ptr %14, align 8, !tbaa !9
  %97 = load double, ptr %14, align 8, !tbaa !9
  %98 = load double, ptr %13, align 8, !tbaa !9
  %99 = load double, ptr %15, align 8, !tbaa !9
  %100 = fmul double %98, %99
  %101 = fneg double %100
  %102 = call double @llvm.fmuladd.f64(double %96, double %97, double %101)
  %103 = call double @sqrt(double noundef %102) #8
  %104 = fadd double %95, %103
  %105 = load double, ptr %13, align 8, !tbaa !9
  %106 = fdiv double %104, %105
  store double %106, ptr %17, align 8, !tbaa !9
  %107 = load double, ptr %17, align 8, !tbaa !9
  %108 = load double, ptr %10, align 8, !tbaa !9
  %109 = fcmp olt double %107, %108
  br i1 %109, label %110, label %133

110:                                              ; preds = %93
  %111 = load double, ptr %17, align 8, !tbaa !9
  %112 = load double, ptr %9, align 8, !tbaa !9
  %113 = fcmp ogt double %111, %112
  br i1 %113, label %114, label %133

114:                                              ; preds = %110
  %115 = load double, ptr %17, align 8, !tbaa !9
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.HitInfo, ptr %116, i32 0, i32 0
  store double %115, ptr %117, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #8
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  %119 = load double, ptr %17, align 8, !tbaa !9
  call void @_ZNK3Ray2AtEd(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %22, ptr noundef nonnull align 8 dereferenceable(48) %118, double noundef %119)
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.HitInfo, ptr %120, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %121, ptr align 8 %22, i64 24, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %24) #8
  %122 = load ptr, ptr %11, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.HitInfo, ptr %122, i32 0, i32 1
  %124 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 1
  call void @_ZmiRK4Vec3S1_(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %24, ptr noundef nonnull align 8 dereferenceable(24) %123, ptr noundef nonnull align 8 dereferenceable(24) %124)
  %125 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 2
  %126 = load double, ptr %125, align 8, !tbaa !11
  call void @_ZdvRK4Vec3d(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %23, ptr noundef nonnull align 8 dereferenceable(24) %24, double noundef %126)
  %127 = load ptr, ptr %11, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.HitInfo, ptr %127, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %128, ptr align 8 %23, i64 24, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #8
  %129 = getelementptr inbounds %class.Sphere, ptr %25, i32 0, i32 3
  %130 = load ptr, ptr %11, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.HitInfo, ptr %130, i32 0, i32 3
  %132 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrI8MaterialEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %131, ptr noundef nonnull align 8 dereferenceable(16) %129) #8
  store i1 true, ptr %6, align 1
  store i32 1, ptr %21, align 4
  br label %134

133:                                              ; preds = %110, %93
  store i32 0, ptr %21, align 4
  br label %134

134:                                              ; preds = %133, %114, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  %135 = load i32, ptr %21, align 4
  switch i32 %135, label %138 [
    i32 0, label %136
  ]

136:                                              ; preds = %134
  br label %137

137:                                              ; preds = %136, %5
  store i1 false, ptr %6, align 1
  store i32 1, ptr %21, align 4
  br label %138

138:                                              ; preds = %137, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #8
  %139 = load i1, ptr %6, align 1
  ret i1 %139
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmiRK4Vec3S1_(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray6OriginEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Ray2AtEd(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(48), double noundef) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZdvRK4Vec3d(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrI8MaterialEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"_ZTS6Sphere", !13, i64 0, !14, i64 8, !10, i64 32, !15, i64 40}
!13 = !{!"_ZTS8Hittable"}
!14 = !{!"_ZTS4Vec3", !10, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!"_ZTSSt10shared_ptrI8MaterialE", !16, i64 0}
!16 = !{!"_ZTSSt12__shared_ptrI8MaterialLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!18 = !{!19, !10, i64 0}
!19 = !{!"_ZTS7HitInfo", !10, i64 0, !14, i64 8, !14, i64 32, !15, i64 56}
!20 = !{i64 0, i64 8, !9, i64 8, i64 8, !9, i64 16, i64 8, !9}


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

%class.Vec3 = type { double, double, double }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK6Sphere3HitERK3RayddR7HitInfo(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(48) %1, double noundef %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(72) %4) unnamed_addr #0 align 2 {
  %6 = alloca %class.Vec3, align 8
  %7 = alloca %class.Vec3, align 8
  %8 = alloca %class.Vec3, align 8
  %9 = alloca %class.Vec3, align 8
  %10 = alloca %class.Vec3, align 8
  %11 = alloca %class.Vec3, align 8
  %12 = alloca %class.Vec3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #8
  %13 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray6OriginEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZmiRK4Vec3S1_(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(24) %14)
  %15 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %16 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %17 = call noundef double @_Z3DotRK4Vec3S1_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %16)
  %18 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %19 = call noundef double @_Z3DotRK4Vec3S1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %18)
  %20 = call noundef double @_Z3DotRK4Vec3S1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %6)
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = fneg double %22
  %24 = call double @llvm.fmuladd.f64(double %23, double %22, double %20)
  %25 = fneg double %17
  %26 = fmul double %24, %25
  %27 = call double @llvm.fmuladd.f64(double %19, double %19, double %26)
  %28 = fcmp ogt double %27, 0.000000e+00
  br i1 %28, label %29, label %.critedge

29:                                               ; preds = %5
  %30 = fneg double %19
  %31 = call double @sqrt(double noundef %27) #8
  %32 = fsub double %30, %31
  %33 = fdiv double %32, %17
  %34 = fcmp olt double %33, %3
  %35 = fcmp ogt double %33, %2
  %or.cond = and i1 %34, %35
  br i1 %or.cond, label %36, label %40

36:                                               ; preds = %29
  store double %33, ptr %4, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #8
  call void @_ZNK3Ray2AtEd(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %7, ptr noundef nonnull align 8 dereferenceable(48) %1, double noundef %33)
  %37 = getelementptr inbounds i8, ptr %4, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(24) %7, i64 24, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #8
  call void @_ZmiRK4Vec3S1_(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(24) %14)
  %38 = load double, ptr %21, align 8, !tbaa !5
  call void @_ZdvRK4Vec3d(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %9, double noundef %38)
  %39 = getelementptr inbounds i8, ptr %4, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 8 dereferenceable(24) %8, i64 24, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #8
  br label %.critedge.sink.split

40:                                               ; preds = %29
  %41 = call double @sqrt(double noundef %27) #8
  %42 = fsub double %41, %19
  %43 = fdiv double %42, %17
  %44 = fcmp olt double %43, %3
  %45 = fcmp ogt double %43, %2
  %or.cond51 = and i1 %44, %45
  br i1 %or.cond51, label %46, label %.critedge

46:                                               ; preds = %40
  store double %43, ptr %4, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #8
  call void @_ZNK3Ray2AtEd(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %10, ptr noundef nonnull align 8 dereferenceable(48) %1, double noundef %43)
  %47 = getelementptr inbounds i8, ptr %4, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(24) %10, i64 24, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #8
  call void @_ZmiRK4Vec3S1_(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(24) %14)
  %48 = load double, ptr %21, align 8, !tbaa !5
  call void @_ZdvRK4Vec3d(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) %12, double noundef %48)
  %49 = getelementptr inbounds i8, ptr %4, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %49, ptr noundef nonnull align 8 dereferenceable(24) %11, i64 24, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #8
  br label %.critedge.sink.split

.critedge.sink.split:                             ; preds = %46, %36
  %50 = getelementptr inbounds i8, ptr %0, i64 40
  %51 = getelementptr inbounds i8, ptr %4, i64 56
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrI8MaterialEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %51, ptr noundef nonnull align 8 dereferenceable(16) %50) #8
  br label %.critedge

.critedge:                                        ; preds = %.critedge.sink.split, %5, %40
  %.1 = phi i1 [ false, %40 ], [ false, %5 ], [ true, %.critedge.sink.split ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  ret i1 %.1
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmiRK4Vec3S1_(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray6OriginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Ray9DirectionEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Ray2AtEd(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(48), double noundef) local_unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZdvRK4Vec3d(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrI8MaterialEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !9, i64 32}
!6 = !{!"_ZTS6Sphere", !7, i64 0, !8, i64 8, !9, i64 32, !12, i64 40}
!7 = !{!"_ZTS8Hittable"}
!8 = !{!"_ZTS4Vec3", !9, i64 0, !9, i64 8, !9, i64 16}
!9 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSSt10shared_ptrI8MaterialE", !13, i64 0}
!13 = !{!"_ZTSSt12__shared_ptrI8MaterialLN9__gnu_cxx12_Lock_policyE2EE", !14, i64 0, !15, i64 8}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !14, i64 0}
!16 = !{!17, !9, i64 0}
!17 = !{!"_ZTS7HitInfo", !9, i64 0, !8, i64 8, !8, i64 32, !12, i64 56}
!18 = !{i64 0, i64 8, !19, i64 8, i64 8, !19, i64 16, i64 8, !19}
!19 = !{!9, !9, i64 0}


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