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

; 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.Riemann::LeafNode" = type { i32 }
%"class.Riemann::StaticMesh" = type { i32, i32, %"class.std::vector", %"class.std::vector.0", %"class.std::vector", %"class.std::vector", %"class.Maths::TAABB3", i8, %"class.std::__cxx11::basic_string", ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<unsigned short, std::allocator<unsigned short>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned short, std::allocator<unsigned short>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned short, std::allocator<unsigned short>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned short, std::allocator<unsigned short>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Maths::TVector3<float>, std::allocator<Maths::TVector3<float>>>::_Vector_impl" }
%"struct.std::_Vector_base<Maths::TVector3<float>, std::allocator<Maths::TVector3<float>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Maths::TVector3<float>, std::allocator<Maths::TVector3<float>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Maths::TVector3<float>, std::allocator<Maths::TVector3<float>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Maths::TAABB3" = type { %"class.Maths::TVector3", %"class.Maths::TVector3" }
%"class.Maths::TVector3" = type { float, float, float }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.Riemann::TriMeshHitOption" = type { i8, i8, float }
%"struct.Riemann::TriMeshHitResult" = 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann12TriangleMesh15RayIntersectTriEjRKN5Maths8TVector3IfEES5_RKNS_16TriMeshHitOptionEPNS_16TriMeshHitResultE(ptr noundef nonnull align 8 dereferenceable(192) %0, i32 noundef %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef %5) #1 align 2 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"struct.Riemann::LeafNode", align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca float, align 4
  %28 = alloca i8, align 1
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %30 = load i32, ptr %9, align 4, !tbaa !9
  call void @_ZN7Riemann8LeafNodeC2Ej(ptr noundef nonnull align 4 dereferenceable(4) %14, i32 noundef %30)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %31 = call noundef i32 @_ZNK7Riemann8LeafNode15GetNumTrianglesEv(ptr noundef nonnull align 4 dereferenceable(4) %14)
  store i32 %31, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %32 = call noundef i32 @_ZNK7Riemann8LeafNode16GetTriangleIndexEv(ptr noundef nonnull align 4 dereferenceable(4) %14)
  store i32 %32, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #4
  store i8 0, ptr %17, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %104, %6
  %34 = load i32, ptr %18, align 4, !tbaa !9
  %35 = load i32, ptr %15, align 4, !tbaa !9
  %36 = icmp ult i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 2, ptr %19, align 4
  br label %107

38:                                               ; preds = %33
  %39 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN7Riemann16TriMeshHitResult12AddTestCountEi(ptr noundef nonnull align 4 dereferenceable(24) %39, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %40 = load i32, ptr %16, align 4, !tbaa !9
  %41 = load i32, ptr %18, align 4, !tbaa !9
  %42 = add i32 %40, %41
  store i32 %42, ptr %23, align 4, !tbaa !9
  %43 = load i32, ptr %23, align 4, !tbaa !9
  call void @_ZNK7Riemann10StaticMesh14GetVertIndicesEjRjS1_S1_(ptr noundef nonnull align 8 dereferenceable(184) %29, i32 noundef %43, ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %22)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %44 = getelementptr inbounds %"class.Riemann::StaticMesh", ptr %29, i32 0, i32 9
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = load i32, ptr %20, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds %"class.Maths::TVector3", ptr %45, i64 %47
  store ptr %48, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %49 = getelementptr inbounds %"class.Riemann::StaticMesh", ptr %29, i32 0, i32 9
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %51 = load i32, ptr %21, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds %"class.Maths::TVector3", ptr %50, i64 %52
  store ptr %53, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %54 = getelementptr inbounds %"class.Riemann::StaticMesh", ptr %29, i32 0, i32 9
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = load i32, ptr %22, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds %"class.Maths::TVector3", ptr %55, i64 %57
  store ptr %58, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %28) #4
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = load ptr, ptr %24, align 8, !tbaa !5
  %62 = load ptr, ptr %25, align 8, !tbaa !5
  %63 = load ptr, ptr %26, align 8, !tbaa !5
  %64 = call noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12) %59, ptr noundef nonnull align 4 dereferenceable(12) %60, ptr noundef nonnull align 4 dereferenceable(12) %61, ptr noundef nonnull align 4 dereferenceable(12) %62, ptr noundef nonnull align 4 dereferenceable(12) %63, ptr noundef %27)
  %65 = zext i1 %64 to i8
  store i8 %65, ptr %28, align 1, !tbaa !11
  %66 = load i8, ptr %28, align 1, !tbaa !11, !range !29, !noundef !30
  %67 = trunc i8 %66 to i1
  br i1 %67, label %68, label %74

68:                                               ; preds = %38
  %69 = load float, ptr %27, align 4, !tbaa !31
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.Riemann::TriMeshHitOption", ptr %70, i32 0, i32 2
  %72 = load float, ptr %71, align 4, !tbaa !32
  %73 = fcmp ogt float %69, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %68, %38
  store i32 4, ptr %19, align 4
  br label %101

75:                                               ; preds = %68
  store i8 1, ptr %17, align 1, !tbaa !11
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %"struct.Riemann::TriMeshHitOption", ptr %76, i32 0, i32 0
  %78 = load i8, ptr %77, align 4, !tbaa !34, !range !29, !noundef !30
  %79 = trunc i8 %78 to i1
  br i1 %79, label %87, label %80

80:                                               ; preds = %75
  %81 = load float, ptr %27, align 4, !tbaa !31
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = getelementptr inbounds %"struct.Riemann::TriMeshHitResult", ptr %82, i32 0, i32 0
  store float %81, ptr %83, align 4, !tbaa !35
  %84 = load i32, ptr %23, align 4, !tbaa !9
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.Riemann::TriMeshHitResult", ptr %85, i32 0, i32 2
  store i32 %84, ptr %86, align 4, !tbaa !37
  store i1 true, ptr %7, align 1
  store i32 1, ptr %19, align 4
  br label %101

87:                                               ; preds = %75
  %88 = load float, ptr %27, align 4, !tbaa !31
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.Riemann::TriMeshHitResult", ptr %89, i32 0, i32 0
  %91 = load float, ptr %90, align 4, !tbaa !35
  %92 = fcmp olt float %88, %91
  br i1 %92, label %93, label %100

93:                                               ; preds = %87
  %94 = load float, ptr %27, align 4, !tbaa !31
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  %96 = getelementptr inbounds %"struct.Riemann::TriMeshHitResult", ptr %95, i32 0, i32 0
  store float %94, ptr %96, align 4, !tbaa !35
  %97 = load i32, ptr %23, align 4, !tbaa !9
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.Riemann::TriMeshHitResult", ptr %98, i32 0, i32 2
  store i32 %97, ptr %99, align 4, !tbaa !37
  br label %100

100:                                              ; preds = %93, %87
  store i32 0, ptr %19, align 4
  br label %101

101:                                              ; preds = %100, %80, %74
  call void @llvm.lifetime.end.p0(i64 1, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  %102 = load i32, ptr %19, align 4
  switch i32 %102, label %107 [
    i32 0, label %103
    i32 4, label %104
  ]

103:                                              ; preds = %101
  br label %104

104:                                              ; preds = %103, %101
  %105 = load i32, ptr %18, align 4, !tbaa !9
  %106 = add i32 %105, 1
  store i32 %106, ptr %18, align 4, !tbaa !9
  br label %33, !llvm.loop !38

107:                                              ; preds = %101, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  %108 = load i32, ptr %19, align 4
  switch i32 %108, label %112 [
    i32 2, label %109
  ]

109:                                              ; preds = %107
  %110 = load i8, ptr %17, align 1, !tbaa !11, !range !29, !noundef !30
  %111 = trunc i8 %110 to i1
  store i1 %111, ptr %7, align 1
  store i32 1, ptr %19, align 4
  br label %112

112:                                              ; preds = %109, %107
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %113 = load i1, ptr %7, align 1
  ret i1 %113
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann8LeafNode15GetNumTrianglesEv(ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann8LeafNode16GetTriangleIndexEv(ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Riemann10StaticMesh14GetVertIndicesEjRjS1_S1_(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1 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) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { "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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 168}
!14 = !{!"_ZTSN7Riemann10StaticMeshE", !10, i64 0, !10, i64 4, !15, i64 8, !19, i64 32, !15, i64 56, !15, i64 80, !23, i64 104, !7, i64 128, !26, i64 136, !6, i64 168, !6, i64 176}
!15 = !{!"_ZTSSt6vectorIN5Maths8TVector3IfEESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN5Maths8TVector3IfEESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN5Maths8TVector3IfEESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN5Maths8TVector3IfEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSSt6vectorItSaItEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseItSaItEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseItSaItEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseItSaItEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTSN5Maths6TAABB3IfEE", !24, i64 0, !24, i64 12}
!24 = !{!"_ZTSN5Maths8TVector3IfEE", !25, i64 0, !25, i64 4, !25, i64 8}
!25 = !{!"float", !7, i64 0}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !27, i64 0, !28, i64 8, !7, i64 16}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!28 = !{!"long", !7, i64 0}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!25, !25, i64 0}
!32 = !{!33, !25, i64 4}
!33 = !{!"_ZTSN7Riemann16TriMeshHitOptionE", !12, i64 0, !12, i64 1, !25, i64 4}
!34 = !{!33, !12, i64 0}
!35 = !{!36, !25, i64 0}
!36 = !{!"_ZTSN7Riemann16TriMeshHitResultE", !25, i64 0, !24, i64 4, !10, i64 16, !10, i64 20}
!37 = !{!36, !10, i64 16}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}


; 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.Riemann::LeafNode" = type { i32 }
%"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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann12TriangleMesh15RayIntersectTriEjRKN5Maths8TVector3IfEES5_RKNS_16TriMeshHitOptionEPNS_16TriMeshHitResultE(ptr noundef nonnull align 8 dereferenceable(192) %0, i32 noundef %1, ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %4, ptr noundef %5) local_unnamed_addr #1 align 2 {
  %7 = alloca %"struct.Riemann::LeafNode", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  call void @_ZN7Riemann8LeafNodeC2Ej(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %1)
  %12 = call noundef i32 @_ZNK7Riemann8LeafNode15GetNumTrianglesEv(ptr noundef nonnull align 4 dereferenceable(4) %7)
  %13 = call noundef i32 @_ZNK7Riemann8LeafNode16GetTriangleIndexEv(ptr noundef nonnull align 4 dereferenceable(4) %7)
  %.not41.not = icmp eq i32 %12, 0
  br i1 %.not41.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %6
  %14 = getelementptr inbounds i8, ptr %0, i64 168
  %15 = getelementptr inbounds i8, ptr %4, i64 4
  %16 = getelementptr inbounds i8, ptr %5, i64 16
  br label %17

17:                                               ; preds = %.lr.ph, %42
  %.02743 = phi i1 [ false, %.lr.ph ], [ %.128.ph, %42 ]
  %.03042 = phi i32 [ 0, %.lr.ph ], [ %43, %42 ]
  call void @_ZN7Riemann16TriMeshHitResult12AddTestCountEi(ptr noundef nonnull align 4 dereferenceable(24) %5, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #4
  %18 = add i32 %.03042, %13
  call void @_ZNK7Riemann10StaticMesh14GetVertIndicesEjRjS1_S1_(ptr noundef nonnull align 8 dereferenceable(184) %0, i32 noundef %18, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %19 = load ptr, ptr %14, align 8, !tbaa !5
  %20 = load i32, ptr %8, align 4, !tbaa !25
  %21 = zext i32 %20 to i64
  %22 = getelementptr inbounds %"class.Maths::TVector3", ptr %19, i64 %21
  %23 = load i32, ptr %9, align 4, !tbaa !25
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds %"class.Maths::TVector3", ptr %19, i64 %24
  %26 = load i32, ptr %10, align 4, !tbaa !25
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds %"class.Maths::TVector3", ptr %19, i64 %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #4
  %29 = call noundef zeroext i1 @_ZN7Riemann9Triangle320RayIntersectTriangleERKN5Maths8TVector3IfEES5_S5_S5_S5_Pf(ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 4 dereferenceable(12) %25, ptr noundef nonnull align 4 dereferenceable(12) %28, ptr noundef nonnull %11)
  br i1 %29, label %30, label %42

30:                                               ; preds = %17
  %31 = load float, ptr %11, align 4, !tbaa !26
  %32 = load float, ptr %15, align 4, !tbaa !27
  %33 = fcmp ogt float %31, %32
  br i1 %33, label %42, label %34

34:                                               ; preds = %30
  %35 = load i8, ptr %4, align 4, !tbaa !30, !range !31, !noundef !32
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %37, label %41

37:                                               ; preds = %34
  %38 = load float, ptr %5, align 4, !tbaa !33
  %39 = fcmp olt float %31, %38
  br i1 %39, label %40, label %42

40:                                               ; preds = %37
  store float %31, ptr %5, align 4, !tbaa !33
  store i32 %18, ptr %16, align 4, !tbaa !35
  br label %42

41:                                               ; preds = %34
  store float %31, ptr %5, align 4, !tbaa !33
  store i32 %18, ptr %16, align 4, !tbaa !35
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %.loopexit

42:                                               ; preds = %30, %17, %40, %37
  %.128.ph = phi i1 [ true, %37 ], [ true, %40 ], [ %.02743, %17 ], [ %.02743, %30 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  %43 = add nuw i32 %.03042, 1
  %exitcond.not = icmp eq i32 %43, %12
  br i1 %exitcond.not, label %.loopexit, label %17, !llvm.loop !36

.loopexit:                                        ; preds = %42, %6, %41
  %.not38 = phi i1 [ true, %41 ], [ false, %6 ], [ %.128.ph, %42 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  ret i1 %.not38
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann8LeafNode15GetNumTrianglesEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann8LeafNode16GetTriangleIndexEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Riemann10StaticMesh14GetVertIndicesEjRjS1_S1_(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 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 #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { "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, !14, i64 168}
!6 = !{!"_ZTSN7Riemann10StaticMeshE", !7, i64 0, !7, i64 4, !10, i64 8, !15, i64 32, !10, i64 56, !10, i64 80, !19, i64 104, !8, i64 128, !22, i64 136, !14, i64 168, !14, i64 176}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorIN5Maths8TVector3IfEESaIS2_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseIN5Maths8TVector3IfEESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIN5Maths8TVector3IfEESaIS2_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN5Maths8TVector3IfEESaIS2_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"_ZTSSt6vectorItSaItEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseItSaItEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseItSaItEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseItSaItEE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!19 = !{!"_ZTSN5Maths6TAABB3IfEE", !20, i64 0, !20, i64 12}
!20 = !{!"_ZTSN5Maths8TVector3IfEE", !21, i64 0, !21, i64 4, !21, i64 8}
!21 = !{!"float", !8, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !24, i64 8, !8, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !14, i64 0}
!24 = !{!"long", !8, i64 0}
!25 = !{!7, !7, i64 0}
!26 = !{!21, !21, i64 0}
!27 = !{!28, !21, i64 4}
!28 = !{!"_ZTSN7Riemann16TriMeshHitOptionE", !29, i64 0, !29, i64 1, !21, i64 4}
!29 = !{!"bool", !8, i64 0}
!30 = !{!28, !29, i64 0}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!34, !21, i64 0}
!34 = !{!"_ZTSN7Riemann16TriMeshHitResultE", !21, i64 0, !20, i64 4, !7, i64 16, !7, i64 20}
!35 = !{!34, !7, i64 16}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}


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