; LLVM IR from atlantis13579/Riemann :: Src/CollisionPrimitive (Cylinder3)

; 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.Maths::TVector3" = type { float, float, float }
%"class.Riemann::Cylinder3" = type { float, float, %"class.Maths::TVector3", %"class.Maths::TVector3" }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann9Cylinder312IntersectRayERKN5Maths8TVector3IfEES5_Pf(ptr noundef nonnull align 4 dereferenceable(32) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef %3) #0 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca %"class.Maths::TVector3", align 4
  %12 = alloca %"class.Maths::TVector3", align 4
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  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
  %15 = load ptr, ptr %6, align 8
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.Riemann::Cylinder3", ptr %15, i32 0, i32 0
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = call noundef zeroext i1 @_ZN7Riemann9Cylinder326IntersectRayInfinityLengthERKN5Maths8TVector3IfEES5_fPf(ptr noundef nonnull align 4 dereferenceable(12) %16, ptr noundef nonnull align 4 dereferenceable(12) %17, float noundef %19, ptr noundef %20)
  br i1 %21, label %22, label %23

22:                                               ; preds = %4
  store i1 false, ptr %5, align 1
  br label %111

23:                                               ; preds = %4
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.Maths::TVector3", ptr %24, i32 0, i32 1
  %26 = load float, ptr %25, align 4, !tbaa !13
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load float, ptr %27, align 4, !tbaa !14
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.Maths::TVector3", ptr %29, i32 0, i32 1
  %31 = load float, ptr %30, align 4, !tbaa !13
  %32 = call float @llvm.fmuladd.f32(float %28, float %31, float %26)
  %33 = call float @llvm.fabs.f32(float %32)
  %34 = getelementptr inbounds %"class.Riemann::Cylinder3", ptr %15, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !15
  %36 = fmul float %35, 5.000000e-01
  %37 = fcmp ole float %33, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %23
  store i1 true, ptr %5, align 1
  br label %111

39:                                               ; preds = %23
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.Maths::TVector3", ptr %40, i32 0, i32 1
  %42 = load float, ptr %41, align 4, !tbaa !13
  %43 = call float @llvm.fabs.f32(float %42)
  %44 = fcmp ogt float %43, 0x3EB0C6F7A0000000
  br i1 %44, label %45, label %110

45:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.Maths::TVector3", ptr %46, i32 0, i32 1
  %48 = load float, ptr %47, align 4, !tbaa !13
  %49 = fcmp olt float %48, 0.000000e+00
  br i1 %49, label %50, label %62

50:                                               ; preds = %45
  %51 = getelementptr inbounds %"class.Riemann::Cylinder3", ptr %15, i32 0, i32 1
  %52 = load float, ptr %51, align 4, !tbaa !15
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.Maths::TVector3", ptr %53, i32 0, i32 1
  %55 = load float, ptr %54, align 4, !tbaa !13
  %56 = fneg float %55
  %57 = call float @llvm.fmuladd.f32(float %52, float 5.000000e-01, float %56)
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.Maths::TVector3", ptr %58, i32 0, i32 1
  %60 = load float, ptr %59, align 4, !tbaa !13
  %61 = fdiv float %57, %60
  br label %74

62:                                               ; preds = %45
  %63 = getelementptr inbounds %"class.Riemann::Cylinder3", ptr %15, i32 0, i32 1
  %64 = load float, ptr %63, align 4, !tbaa !15
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %"class.Maths::TVector3", ptr %65, i32 0, i32 1
  %67 = load float, ptr %66, align 4, !tbaa !13
  %68 = call float @llvm.fmuladd.f32(float %64, float 5.000000e-01, float %67)
  %69 = fneg float %68
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %"class.Maths::TVector3", ptr %70, i32 0, i32 1
  %72 = load float, ptr %71, align 4, !tbaa !13
  %73 = fdiv float %69, %72
  br label %74

74:                                               ; preds = %62, %50
  %75 = phi float [ %61, %50 ], [ %73, %62 ]
  store float %75, ptr %10, align 4, !tbaa !14
  %76 = load float, ptr %10, align 4, !tbaa !14
  %77 = fcmp oge float %76, 0.000000e+00
  br i1 %77, label %78, label %106

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #4
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #4
  %80 = load float, ptr %10, align 4, !tbaa !14
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN5MathsmlIfEENS_8TVector3IT_EES2_RKS3_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %12, float noundef %80, ptr noundef nonnull align 4 dereferenceable(12) %81)
  call void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %11, ptr noundef nonnull align 4 dereferenceable(12) %79, ptr noundef nonnull align 4 dereferenceable(12) %12)
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %82 = getelementptr inbounds %"class.Maths::TVector3", ptr %11, i32 0, i32 0
  %83 = load float, ptr %82, align 4, !tbaa !16
  %84 = getelementptr inbounds %"class.Maths::TVector3", ptr %11, i32 0, i32 0
  %85 = load float, ptr %84, align 4, !tbaa !16
  %86 = getelementptr inbounds %"class.Maths::TVector3", ptr %11, i32 0, i32 2
  %87 = load float, ptr %86, align 4, !tbaa !17
  %88 = getelementptr inbounds %"class.Maths::TVector3", ptr %11, i32 0, i32 2
  %89 = load float, ptr %88, align 4, !tbaa !17
  %90 = fmul float %87, %89
  %91 = call float @llvm.fmuladd.f32(float %83, float %85, float %90)
  store float %91, ptr %13, align 4, !tbaa !14
  %92 = load float, ptr %13, align 4, !tbaa !14
  %93 = getelementptr inbounds %"class.Riemann::Cylinder3", ptr %15, i32 0, i32 0
  %94 = load float, ptr %93, align 4, !tbaa !9
  %95 = getelementptr inbounds %"class.Riemann::Cylinder3", ptr %15, i32 0, i32 0
  %96 = load float, ptr %95, align 4, !tbaa !9
  %97 = fmul float %94, %96
  %98 = fcmp ole float %92, %97
  br i1 %98, label %99, label %102

99:                                               ; preds = %78
  %100 = load float, ptr %10, align 4, !tbaa !14
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  store float %100, ptr %101, align 4, !tbaa !14
  store i1 true, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %103

102:                                              ; preds = %78
  store i32 0, ptr %14, align 4
  br label %103

103:                                              ; preds = %102, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #4
  %104 = load i32, ptr %14, align 4
  switch i32 %104, label %107 [
    i32 0, label %105
  ]

105:                                              ; preds = %103
  br label %106

106:                                              ; preds = %105, %74
  store i32 0, ptr %14, align 4
  br label %107

107:                                              ; preds = %106, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %108 = load i32, ptr %14, align 4
  switch i32 %108, label %113 [
    i32 0, label %109
    i32 1, label %111
  ]

109:                                              ; preds = %107
  br label %110

110:                                              ; preds = %109, %39
  store i1 false, ptr %5, align 1
  br label %111

111:                                              ; preds = %110, %107, %38, %22
  %112 = load i1, ptr %5, align 1
  ret i1 %112

113:                                              ; preds = %107
  unreachable
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5MathsmlIfEENS_8TVector3IT_EES2_RKS3_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, float noundef, ptr noundef nonnull align 4 dereferenceable(12)) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN7Riemann9Cylinder3E", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 20}
!11 = !{!"float", !7, i64 0}
!12 = !{!"_ZTSN5Maths8TVector3IfEE", !11, i64 0, !11, i64 4, !11, i64 8}
!13 = !{!12, !11, i64 4}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !11, i64 4}
!16 = !{!12, !11, i64 0}
!17 = !{!12, !11, 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"

%"class.Maths::TVector3" = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann9Cylinder312IntersectRayERKN5Maths8TVector3IfEES5_Pf(ptr nocapture noundef nonnull readonly align 4 dereferenceable(32) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef %3) local_unnamed_addr #0 align 2 {
  %5 = alloca %"class.Maths::TVector3", align 4
  %6 = alloca %"class.Maths::TVector3", align 4
  %7 = load float, ptr %0, align 4, !tbaa !5
  %8 = tail call noundef zeroext i1 @_ZN7Riemann9Cylinder326IntersectRayInfinityLengthERKN5Maths8TVector3IfEES5_fPf(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, float noundef %7, ptr noundef %3)
  br i1 %8, label %.thread, label %9

9:                                                ; preds = %4
  %10 = getelementptr inbounds i8, ptr %1, i64 4
  %11 = load float, ptr %10, align 4, !tbaa !11
  %12 = load float, ptr %3, align 4, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %2, i64 4
  %14 = load float, ptr %13, align 4, !tbaa !11
  %15 = tail call float @llvm.fmuladd.f32(float %12, float %14, float %11)
  %16 = tail call float @llvm.fabs.f32(float %15)
  %17 = getelementptr inbounds i8, ptr %0, i64 4
  %18 = load float, ptr %17, align 4, !tbaa !13
  %19 = fmul float %18, 5.000000e-01
  %20 = fcmp ugt float %16, %19
  br i1 %20, label %21, label %.thread

21:                                               ; preds = %9
  %22 = tail call float @llvm.fabs.f32(float %14)
  %23 = fcmp ogt float %22, 0x3EB0C6F7A0000000
  br i1 %23, label %24, label %.thread

24:                                               ; preds = %21
  %25 = fcmp olt float %14, 0.000000e+00
  br i1 %25, label %26, label %29

26:                                               ; preds = %24
  %27 = fneg float %11
  %28 = tail call float @llvm.fmuladd.f32(float %18, float 5.000000e-01, float %27)
  br label %32

29:                                               ; preds = %24
  %30 = tail call float @llvm.fmuladd.f32(float %18, float 5.000000e-01, float %11)
  %31 = fneg float %30
  br label %32

32:                                               ; preds = %29, %26
  %.pn = phi float [ %28, %26 ], [ %31, %29 ]
  %33 = fdiv float %.pn, %14
  %34 = fcmp ult float %33, 0.000000e+00
  br i1 %34, label %.thread, label %35

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #4
  call void @_ZN5MathsmlIfEENS_8TVector3IT_EES2_RKS3_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %6, float noundef %33, ptr noundef nonnull align 4 dereferenceable(12) %2)
  call void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %5, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #4
  %36 = load float, ptr %5, align 4, !tbaa !14
  %37 = getelementptr inbounds i8, ptr %5, i64 8
  %38 = load float, ptr %37, align 4, !tbaa !15
  %39 = fmul float %38, %38
  %40 = call float @llvm.fmuladd.f32(float %36, float %36, float %39)
  %41 = load float, ptr %0, align 4, !tbaa !5
  %42 = fmul float %41, %41
  %43 = fcmp ugt float %40, %42
  br i1 %43, label %.critedge, label %44

.critedge:                                        ; preds = %35
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #4
  br label %.thread

44:                                               ; preds = %35
  store float %33, ptr %3, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #4
  br label %.thread

.thread:                                          ; preds = %32, %.critedge, %21, %44, %9, %4
  %.3 = phi i1 [ true, %44 ], [ false, %4 ], [ true, %9 ], [ false, %21 ], [ false, %.critedge ], [ false, %32 ]
  ret i1 %.3
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #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: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector3IfEplERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5MathsmlIfEENS_8TVector3IT_EES2_RKS3_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, float noundef, ptr noundef nonnull align 4 dereferenceable(12)) 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

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 speculatable willreturn memory(none) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTSN7Riemann9Cylinder3E", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 20}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN5Maths8TVector3IfEE", !7, i64 0, !7, i64 4, !7, i64 8}
!11 = !{!10, !7, i64 4}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!10, !7, i64 0}
!15 = !{!10, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass