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

; 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::HeightField3" = type { i32, i32, %"class.Maths::TAABB3", float, float, float, float, float, %"class.std::vector", ptr }
%"class.Maths::TAABB3" = type { %"class.Maths::TVector3", %"class.Maths::TVector3" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.Riemann::HeightFieldHitOption" = type { i8, float }
%"struct.Riemann::HeightFieldHitResult" = type { float, %"class.Maths::TVector3", i32, i32 }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann20HeightFieldHitResult12AddTestCountEi(ptr noundef nonnull align 4 dereferenceable(24), i32 noundef) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK7Riemann12HeightField315GetCellTriangleEiiPN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef, i32 noundef, ptr noundef) #3 align 2

declare noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann12HeightField313IntersectRayYERKN5Maths8TVector3IfEES5_RKNS_20HeightFieldHitOptionEPNS_20HeightFieldHitResultE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef %4) #3 align 2 {
  %6 = alloca i1, align 1
  %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 i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca float, align 4
  %17 = alloca [6 x %"class.Maths::TVector3"], align 16
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca float, 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
  %21 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.Maths::TVector3", ptr %22, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !9
  %25 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %21, i32 0, i32 2
  %26 = getelementptr inbounds %"class.Maths::TAABB3", ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %"class.Maths::TVector3", ptr %26, i32 0, i32 0
  %28 = load float, ptr %27, align 8, !tbaa !12
  %29 = fsub float %24, %28
  %30 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %21, i32 0, i32 5
  %31 = load float, ptr %30, align 8, !tbaa !20
  %32 = fmul float %29, %31
  %33 = fptosi float %32 to i32
  store i32 %33, ptr %12, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.Maths::TVector3", ptr %34, i32 0, i32 2
  %36 = load float, ptr %35, align 4, !tbaa !22
  %37 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %21, i32 0, i32 2
  %38 = getelementptr inbounds %"class.Maths::TAABB3", ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %"class.Maths::TVector3", ptr %38, i32 0, i32 2
  %40 = load float, ptr %39, align 8, !tbaa !23
  %41 = fsub float %36, %40
  %42 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %21, i32 0, i32 6
  %43 = load float, ptr %42, align 4, !tbaa !24
  %44 = fmul float %41, %43
  %45 = fptosi float %44 to i32
  store i32 %45, ptr %13, align 4, !tbaa !21
  %46 = load i32, ptr %12, align 4, !tbaa !21
  %47 = icmp slt i32 %46, 0
  br i1 %47, label %63, label %48

48:                                               ; preds = %5
  %49 = load i32, ptr %12, align 4, !tbaa !21
  %50 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %21, i32 0, i32 0
  %51 = load i32, ptr %50, align 8, !tbaa !25
  %52 = sub nsw i32 %51, 1
  %53 = icmp sge i32 %49, %52
  br i1 %53, label %63, label %54

54:                                               ; preds = %48
  %55 = load i32, ptr %13, align 4, !tbaa !21
  %56 = icmp slt i32 %55, 0
  br i1 %56, label %63, label %57

57:                                               ; preds = %54
  %58 = load i32, ptr %13, align 4, !tbaa !21
  %59 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %21, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !26
  %61 = sub nsw i32 %60, 1
  %62 = icmp sge i32 %58, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %57, %54, %48, %5
  store i1 false, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %130

64:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #5
  store i8 0, ptr %15, align 1, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store float 0x47EFFFFFE0000000, ptr %16, align 4, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 72, ptr %17) #5
  %65 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %17, i32 0, i32 0
  %66 = getelementptr inbounds %"class.Maths::TVector3", ptr %65, i64 6
  br label %67

67:                                               ; preds = %67, %64
  %68 = phi ptr [ %65, %64 ], [ %69, %67 ]
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %68)
  %69 = getelementptr inbounds %"class.Maths::TVector3", ptr %68, i64 1
  %70 = icmp eq ptr %69, %66
  br i1 %70, label %71, label %67

71:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %72 = load i32, ptr %12, align 4, !tbaa !21
  %73 = load i32, ptr %13, align 4, !tbaa !21
  %74 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %17, i64 0, i64 0
  %75 = call noundef i32 @_ZNK7Riemann12HeightField315GetCellTriangleEiiPN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(88) %21, i32 noundef %72, i32 noundef %73, ptr noundef %74)
  store i32 %75, ptr %18, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !21
  br label %76

76:                                               ; preds = %121, %71
  %77 = load i32, ptr %19, align 4, !tbaa !21
  %78 = load i32, ptr %18, align 4, !tbaa !21
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %76
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %124

81:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = load i32, ptr %19, align 4, !tbaa !21
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %17, i64 0, i64 %85
  %87 = load i32, ptr %19, align 4, !tbaa !21
  %88 = add nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %17, i64 0, i64 %89
  %91 = load i32, ptr %19, align 4, !tbaa !21
  %92 = add nsw i32 %91, 2
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %17, i64 0, i64 %93
  %95 = call noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12) %82, ptr noundef nonnull align 4 dereferenceable(12) %83, ptr noundef nonnull align 4 dereferenceable(12) %86, ptr noundef nonnull align 4 dereferenceable(12) %90, ptr noundef nonnull align 4 dereferenceable(12) %94, ptr noundef %20)
  br i1 %95, label %96, label %120

96:                                               ; preds = %81
  %97 = load float, ptr %20, align 4, !tbaa !29
  %98 = load float, ptr %16, align 4, !tbaa !29
  %99 = fcmp olt float %97, %98
  br i1 %99, label %100, label %120

100:                                              ; preds = %96
  %101 = load float, ptr %20, align 4, !tbaa !29
  store float %101, ptr %16, align 4, !tbaa !29
  %102 = load float, ptr %16, align 4, !tbaa !29
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = getelementptr inbounds %"struct.Riemann::HeightFieldHitOption", ptr %103, i32 0, i32 1
  %105 = load float, ptr %104, align 4, !tbaa !30
  %106 = fcmp olt float %102, %105
  br i1 %106, label %107, label %119

107:                                              ; preds = %100
  %108 = load float, ptr %16, align 4, !tbaa !29
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.Riemann::HeightFieldHitResult", ptr %109, i32 0, i32 0
  store float %108, ptr %110, align 4, !tbaa !32
  %111 = load i32, ptr %13, align 4, !tbaa !21
  %112 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %21, i32 0, i32 0
  %113 = load i32, ptr %112, align 8, !tbaa !25
  %114 = mul i32 %111, %113
  %115 = load i32, ptr %12, align 4, !tbaa !21
  %116 = add i32 %114, %115
  %117 = load ptr, ptr %11, align 8, !tbaa !5
  %118 = getelementptr inbounds %"struct.Riemann::HeightFieldHitResult", ptr %117, i32 0, i32 2
  store i32 %116, ptr %118, align 4, !tbaa !34
  store i8 1, ptr %15, align 1, !tbaa !27
  br label %119

119:                                              ; preds = %107, %100
  br label %120

120:                                              ; preds = %119, %96, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %19, align 4, !tbaa !21
  %123 = add nsw i32 %122, 3
  store i32 %123, ptr %19, align 4, !tbaa !21
  br label %76, !llvm.loop !35

124:                                              ; preds = %80
  %125 = load ptr, ptr %11, align 8, !tbaa !5
  %126 = load i32, ptr %18, align 4, !tbaa !21
  %127 = sdiv i32 %126, 3
  call void @_ZN7Riemann20HeightFieldHitResult12AddTestCountEi(ptr noundef nonnull align 4 dereferenceable(24) %125, i32 noundef %127)
  %128 = load i8, ptr %15, align 1, !tbaa !27, !range !37, !noundef !38
  %129 = trunc i8 %128 to i1
  store i1 %129, ptr %6, align 1
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #5
  br label %130

130:                                              ; preds = %124, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %131 = load i1, ptr %6, align 1
  ret i1 %131
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { "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++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN5Maths8TVector3IfEE", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"_ZTSN7Riemann12HeightField3E", !14, i64 0, !14, i64 4, !15, i64 8, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !16, i64 56, !6, i64 80}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN5Maths6TAABB3IfEE", !10, i64 0, !10, i64 12}
!16 = !{!"_ZTSSt6vectorIN7Riemann12HeightField38CellInfoESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIN7Riemann12HeightField38CellInfoESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN7Riemann12HeightField38CellInfoESaIS2_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN7Riemann12HeightField38CellInfoESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!13, !11, i64 40}
!21 = !{!14, !14, i64 0}
!22 = !{!10, !11, i64 8}
!23 = !{!13, !11, i64 16}
!24 = !{!13, !11, i64 44}
!25 = !{!13, !14, i64 0}
!26 = !{!13, !14, i64 4}
!27 = !{!28, !28, i64 0}
!28 = !{!"bool", !7, i64 0}
!29 = !{!11, !11, i64 0}
!30 = !{!31, !11, i64 4}
!31 = !{!"_ZTSN7Riemann20HeightFieldHitOptionE", !28, i64 0, !11, i64 4}
!32 = !{!33, !11, i64 0}
!33 = !{!"_ZTSN7Riemann20HeightFieldHitResultE", !11, i64 0, !10, i64 4, !14, i64 16, !14, i64 20}
!34 = !{!33, !14, i64 16}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{i8 0, i8 2}
!38 = !{}


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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann20HeightFieldHitResult12AddTestCountEi(ptr noundef nonnull align 4 dereferenceable(24), i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK7Riemann12HeightField315GetCellTriangleEiiPN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3 align 2

declare noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann12HeightField313IntersectRayYERKN5Maths8TVector3IfEES5_RKNS_20HeightFieldHitOptionEPNS_20HeightFieldHitResultE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %3, ptr noundef %4) local_unnamed_addr #3 align 2 {
  %6 = alloca [6 x %"class.Maths::TVector3"], align 16
  %7 = alloca float, align 4
  %8 = load float, ptr %1, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load float, ptr %9, align 8, !tbaa !10
  %11 = fsub float %8, %10
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  %13 = load float, ptr %12, align 8, !tbaa !19
  %14 = fmul float %11, %13
  %15 = fptosi float %14 to i32
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load float, ptr %16, align 4, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = load float, ptr %18, align 8, !tbaa !21
  %20 = fsub float %17, %19
  %21 = getelementptr inbounds i8, ptr %0, i64 44
  %22 = load float, ptr %21, align 4, !tbaa !22
  %23 = fmul float %20, %22
  %24 = fptosi float %23 to i32
  %25 = icmp slt i32 %15, 0
  br i1 %25, label %61, label %26

26:                                               ; preds = %5
  %27 = load i32, ptr %0, align 8, !tbaa !23
  %28 = add nsw i32 %27, -1
  %29 = icmp sle i32 %28, %15
  %30 = icmp slt i32 %24, 0
  %or.cond = select i1 %29, i1 true, i1 %30
  br i1 %or.cond, label %61, label %31

31:                                               ; preds = %26
  %32 = getelementptr inbounds i8, ptr %0, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !24
  %34 = add nsw i32 %33, -1
  %.not = icmp sgt i32 %34, %24
  br i1 %.not, label %35, label %61

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %6) #5
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
  %.ptr.1 = getelementptr inbounds i8, ptr %6, i64 12
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %6, i64 24
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %6, i64 36
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %6, i64 48
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %6, i64 60
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.5)
  %36 = call noundef i32 @_ZNK7Riemann12HeightField315GetCellTriangleEiiPN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(88) %0, i32 noundef %15, i32 noundef %24, ptr noundef nonnull %6)
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %35
  %38 = getelementptr inbounds i8, ptr %3, i64 4
  %39 = getelementptr inbounds i8, ptr %4, i64 16
  br label %41

._crit_edge:                                      ; preds = %58, %35
  %.031.lcssa = phi i1 [ false, %35 ], [ %.132, %58 ]
  %40 = sdiv i32 %36, 3
  call void @_ZN7Riemann20HeightFieldHitResult12AddTestCountEi(ptr noundef nonnull align 4 dereferenceable(24) %4, i32 noundef %40)
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %6) #5
  br label %61

41:                                               ; preds = %.lr.ph, %58
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %58 ]
  %.03039 = phi float [ 0x47EFFFFFE0000000, %.lr.ph ], [ %.1, %58 ]
  %.03138 = phi i1 [ false, %.lr.ph ], [ %.132, %58 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %42 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %6, i64 0, i64 %indvars.iv
  %43 = add nuw nsw i64 %indvars.iv, 1
  %44 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %6, i64 0, i64 %43
  %45 = add nuw nsw i64 %indvars.iv, 2
  %46 = getelementptr inbounds [6 x %"class.Maths::TVector3"], ptr %6, i64 0, i64 %45
  %47 = call noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %42, ptr noundef nonnull align 4 dereferenceable(12) %44, ptr noundef nonnull align 4 dereferenceable(12) %46, ptr noundef nonnull %7)
  br i1 %47, label %48, label %58

48:                                               ; preds = %41
  %49 = load float, ptr %7, align 4, !tbaa !25
  %50 = fcmp olt float %49, %.03039
  br i1 %50, label %51, label %58

51:                                               ; preds = %48
  %52 = load float, ptr %38, align 4, !tbaa !26
  %53 = fcmp olt float %49, %52
  br i1 %53, label %54, label %58

54:                                               ; preds = %51
  store float %49, ptr %4, align 4, !tbaa !29
  %55 = load i32, ptr %0, align 8, !tbaa !23
  %56 = mul i32 %55, %24
  %57 = add i32 %56, %15
  store i32 %57, ptr %39, align 4, !tbaa !31
  br label %58

58:                                               ; preds = %51, %54, %48, %41
  %.132 = phi i1 [ true, %54 ], [ %.03138, %51 ], [ %.03138, %48 ], [ %.03138, %41 ]
  %.1 = phi float [ %49, %54 ], [ %49, %51 ], [ %.03039, %48 ], [ %.03039, %41 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 3
  %59 = trunc nuw i64 %indvars.iv.next to i32
  %60 = icmp sgt i32 %36, %59
  br i1 %60, label %41, label %._crit_edge, !llvm.loop !32

61:                                               ; preds = %5, %26, %31, %._crit_edge
  %.029 = phi i1 [ %.031.lcssa, %._crit_edge ], [ false, %31 ], [ false, %26 ], [ false, %5 ]
  ret i1 %.029
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { "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, !7, i64 0}
!6 = !{!"_ZTSN5Maths8TVector3IfEE", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 8}
!11 = !{!"_ZTSN7Riemann12HeightField3E", !12, i64 0, !12, i64 4, !13, i64 8, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !14, i64 56, !18, i64 80}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSN5Maths6TAABB3IfEE", !6, i64 0, !6, i64 12}
!14 = !{!"_ZTSSt6vectorIN7Riemann12HeightField38CellInfoESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN7Riemann12HeightField38CellInfoESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN7Riemann12HeightField38CellInfoESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN7Riemann12HeightField38CellInfoESaIS2_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"any pointer", !8, i64 0}
!19 = !{!11, !7, i64 40}
!20 = !{!6, !7, i64 8}
!21 = !{!11, !7, i64 16}
!22 = !{!11, !7, i64 44}
!23 = !{!11, !12, i64 0}
!24 = !{!11, !12, i64 4}
!25 = !{!7, !7, i64 0}
!26 = !{!27, !7, i64 4}
!27 = !{!"_ZTSN7Riemann20HeightFieldHitOptionE", !28, i64 0, !7, i64 4}
!28 = !{!"bool", !8, i64 0}
!29 = !{!30, !7, i64 0}
!30 = !{!"_ZTSN7Riemann20HeightFieldHitResultE", !7, i64 0, !6, i64 4, !12, i64 16, !12, i64 20}
!31 = !{!30, !12, i64 16}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass