; LLVM IR from zig-gamedev/zphysics :: libs/Jolt/AABBTree (AABBTreeBuilder)

; 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.JPH::TriangleSplitter::Range" = type { i32, i32 }
%"struct.JPH::AssertLastParam" = type { i8 }
%"class.JPH::AABBTreeBuilder" = type <{ ptr, i32, [4 x i8] }>
%"class.JPH::AABBTreeBuilder::Node" = type <{ %"class.JPH::AABox", %"class.JPH::Array", [2 x ptr], [8 x i8] }>
%"class.JPH::AABox" = type { %"class.JPH::Vec3", %"class.JPH::Vec3" }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::Array" = type { i64, i64, ptr }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@_ZN3JPH5TraceE = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH15AABBTreeBuilder4NodedlEPv(ptr noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN3JPH15AABBTreeBuilder13BuildInternalERKNS_16TriangleSplitter5RangeE(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"struct.JPH::TriangleSplitter::Range", align 4
  %7 = alloca %"struct.JPH::TriangleSplitter::Range", align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.JPH::AssertLastParam", align 1
  %10 = alloca %"struct.JPH::TriangleSplitter::Range", align 4
  %11 = alloca %"struct.JPH::TriangleSplitter::Range", align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %19 = load ptr, ptr %4, align 8
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %20)
  %22 = getelementptr inbounds %"class.JPH::AABBTreeBuilder", ptr %19, i32 0, i32 1
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = icmp ugt i32 %21, %23
  br i1 %24, label %25, label %97

25:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %26 = getelementptr inbounds %"class.JPH::AABBTreeBuilder", ptr %19, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %27, align 8, !tbaa !13
  %30 = getelementptr inbounds ptr, ptr %29, i64 3
  %31 = load ptr, ptr %30, align 8
  %32 = call noundef zeroext i1 %31(ptr noundef nonnull align 8 dereferenceable(72) %27, ptr noundef nonnull align 4 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %7)
  br i1 %32, label %67, label %33

33:                                               ; preds = %25
  %34 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %35)
  %37 = getelementptr inbounds %"class.JPH::AABBTreeBuilder", ptr %19, i32 0, i32 1
  %38 = load i32, ptr %37, align 8, !tbaa !9
  call void (ptr, ...) %34(ptr noundef @.str.2, i32 noundef %36, i32 noundef %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %39)
  %41 = udiv i32 %40, 2
  store i32 %41, ptr %8, align 4, !tbaa !15
  br label %42

42:                                               ; preds = %33
  %43 = load i32, ptr %8, align 4, !tbaa !15
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %48, label %45

45:                                               ; preds = %42
  %46 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 211)
  br i1 %46, label %47, label %48

47:                                               ; preds = %45
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !16
  br label %48

48:                                               ; preds = %47, %45, %42
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 4, !tbaa !17
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 4, !tbaa !17
  %57 = load i32, ptr %8, align 4, !tbaa !15
  %58 = add i32 %56, %57
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %10, i32 noundef %53, i32 noundef %58)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %59, i32 0, i32 0
  %61 = load i32, ptr %60, align 4, !tbaa !17
  %62 = load i32, ptr %8, align 4, !tbaa !15
  %63 = add i32 %61, %62
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !20
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %11, i32 noundef %63, i32 noundef %66)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %67

67:                                               ; preds = %50, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %68 = call noundef ptr @_ZN3JPH15AABBTreeBuilder4NodenwEm(i64 noundef 80)
  invoke void @_ZN3JPH15AABBTreeBuilder4NodeC1Ev(ptr noundef nonnull align 16 dereferenceable(72) %68)
          to label %69 unwind label %93

69:                                               ; preds = %67
  store ptr %68, ptr %12, align 8, !tbaa !5
  %70 = call noundef ptr @_ZN3JPH15AABBTreeBuilder13BuildInternalERKNS_16TriangleSplitter5RangeE(ptr noundef nonnull align 8 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(8) %6)
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %71, i32 0, i32 2
  %73 = getelementptr inbounds [2 x ptr], ptr %72, i64 0, i64 0
  store ptr %70, ptr %73, align 8, !tbaa !5
  %74 = call noundef ptr @_ZN3JPH15AABBTreeBuilder13BuildInternalERKNS_16TriangleSplitter5RangeE(ptr noundef nonnull align 8 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(8) %7)
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %75, i32 0, i32 2
  %77 = getelementptr inbounds [2 x ptr], ptr %76, i64 0, i64 1
  store ptr %74, ptr %77, align 8, !tbaa !5
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %78, i32 0, i32 2
  %80 = getelementptr inbounds [2 x ptr], ptr %79, i64 0, i64 0
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  %82 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %83, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %84, ptr align 16 %82, i64 32, i1 false), !tbaa.struct !21
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %87, i32 0, i32 2
  %89 = getelementptr inbounds [2 x ptr], ptr %88, i64 0, i64 1
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  %91 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %90, i32 0, i32 0
  call void @_ZN3JPH5AABox11EncapsulateERKS0_(ptr noundef nonnull align 16 dereferenceable(32) %86, ptr noundef nonnull align 16 dereferenceable(32) %91)
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %92, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %139

93:                                               ; preds = %67
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %13, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %14, align 4
  call void @_ZN3JPH15AABBTreeBuilder4NodedlEPv(ptr noundef %68) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %141

97:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %98 = call noundef ptr @_ZN3JPH15AABBTreeBuilder4NodenwEm(i64 noundef 80)
  invoke void @_ZN3JPH15AABBTreeBuilder4NodeC1Ev(ptr noundef nonnull align 16 dereferenceable(72) %98)
          to label %99 unwind label %115

99:                                               ; preds = %97
  store ptr %98, ptr %15, align 8, !tbaa !5
  %100 = load ptr, ptr %15, align 8, !tbaa !5
  %101 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %102)
  %104 = zext i32 %103 to i64
  call void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %101, i64 noundef %104)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %105, i32 0, i32 0
  %107 = load i32, ptr %106, align 4, !tbaa !17
  store i32 %107, ptr %16, align 4, !tbaa !15
  br label %108

108:                                              ; preds = %134, %99
  %109 = load i32, ptr %16, align 4, !tbaa !15
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %110, i32 0, i32 1
  %112 = load i32, ptr %111, align 4, !tbaa !20
  %113 = icmp ult i32 %109, %112
  br i1 %113, label %119, label %114

114:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %137

115:                                              ; preds = %97
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %13, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %14, align 4
  call void @_ZN3JPH15AABBTreeBuilder4NodedlEPv(ptr noundef %98) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %141

119:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %120 = getelementptr inbounds %"class.JPH::AABBTreeBuilder", ptr %19, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !12
  %122 = load i32, ptr %16, align 4, !tbaa !15
  %123 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3JPH16TriangleSplitter11GetTriangleEj(ptr noundef nonnull align 8 dereferenceable(72) %121, i32 noundef %122)
  store ptr %123, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %124 = getelementptr inbounds %"class.JPH::AABBTreeBuilder", ptr %19, i32 0, i32 0
  %125 = load ptr, ptr %124, align 8, !tbaa !12
  %126 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH16TriangleSplitter11GetVerticesEv(ptr noundef nonnull align 8 dereferenceable(72) %125)
  store ptr %126, ptr %18, align 8, !tbaa !5
  %127 = load ptr, ptr %15, align 8, !tbaa !5
  %128 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %127, i32 0, i32 1
  %129 = load ptr, ptr %17, align 8, !tbaa !5
  call void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %128, ptr noundef nonnull align 4 dereferenceable(16) %129)
  %130 = load ptr, ptr %15, align 8, !tbaa !5
  %131 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %130, i32 0, i32 0
  %132 = load ptr, ptr %18, align 8, !tbaa !5
  %133 = load ptr, ptr %17, align 8, !tbaa !5
  call void @_ZN3JPH5AABox11EncapsulateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(32) %131, ptr noundef nonnull align 8 dereferenceable(24) %132, ptr noundef nonnull align 4 dereferenceable(16) %133)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %134

134:                                              ; preds = %119
  %135 = load i32, ptr %16, align 4, !tbaa !15
  %136 = add i32 %135, 1
  store i32 %136, ptr %16, align 4, !tbaa !15
  br label %108, !llvm.loop !23

137:                                              ; preds = %114
  %138 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %138, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %139

139:                                              ; preds = %137, %69
  %140 = load ptr, ptr %3, align 8
  ret ptr %140

141:                                              ; preds = %115, %93
  %142 = load ptr, ptr %13, align 8
  %143 = load i32, ptr %14, align 4
  %144 = insertvalue { ptr, i32 } poison, ptr %142, 0
  %145 = insertvalue { ptr, i32 } %144, i32 %143, 1
  resume { ptr, i32 } %145
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #4 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) #5

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN3JPH15AABBTreeBuilder4NodenwEm(i64 noundef) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH5AABox11EncapsulateERKS0_(ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 16 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3JPH16TriangleSplitter11GetTriangleEj(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH16TriangleSplitter11GetVerticesEv(ptr noundef nonnull align 8 dereferenceable(72)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH5AABox11EncapsulateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

declare void @_ZN3JPH15AABBTreeBuilder4NodeC1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline 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 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 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { alwaysinline 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 #7 = { 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 8}
!10 = !{!"_ZTSN3JPH15AABBTreeBuilderE", !6, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{i64 2156863213}
!17 = !{!18, !11, i64 0}
!18 = !{!"_ZTSN3JPH16TriangleSplitter5RangeE", !11, i64 0, !11, i64 4}
!19 = !{i64 0, i64 4, !15, i64 4, i64 4, !15}
!20 = !{!18, !11, i64 4}
!21 = !{i64 0, i64 16, !22, i64 16, i64 16, !22}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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.JPH::TriangleSplitter::Range" = type { i32, i32 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@_ZN3JPH5TraceE = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH15AABBTreeBuilder4NodedlEPv(ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN3JPH15AABBTreeBuilder13BuildInternalERKNS_16TriangleSplitter5RangeE(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"struct.JPH::TriangleSplitter::Range", align 8
  %4 = alloca %"struct.JPH::TriangleSplitter::Range", align 8
  %5 = alloca %"struct.JPH::TriangleSplitter::Range", align 8
  %6 = alloca %"struct.JPH::TriangleSplitter::Range", align 8
  %7 = tail call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = icmp ugt i32 %7, %9
  br i1 %10, label %11, label %45

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %12 = load ptr, ptr %0, align 8, !tbaa !11
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %13, i64 24
  %15 = load ptr, ptr %14, align 8
  %16 = call noundef zeroext i1 %15(ptr noundef nonnull align 8 dereferenceable(72) %12, ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %4)
  br i1 %16, label %35, label %17

17:                                               ; preds = %11
  %18 = load ptr, ptr @_ZN3JPH5TraceE, align 8, !tbaa !14
  %19 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %20 = load i32, ptr %8, align 8, !tbaa !5
  call void (ptr, ...) %18(ptr noundef nonnull @.str.2, i32 noundef %19, i32 noundef %20)
  %21 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %22 = lshr i32 %21, 1
  %.not = icmp ult i32 %21, 2
  br i1 %.not, label %23, label %26

23:                                               ; preds = %17
  %24 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 211)
  br i1 %24, label %25, label %26

25:                                               ; preds = %23
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !15
  br label %26

26:                                               ; preds = %25, %23, %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %27 = load i32, ptr %1, align 4, !tbaa !16
  %28 = add i32 %27, %22
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef %27, i32 noundef %28)
  %29 = load i64, ptr %5, align 8
  store i64 %29, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %30 = load i32, ptr %1, align 4, !tbaa !16
  %31 = add i32 %30, %22
  %32 = getelementptr inbounds i8, ptr %1, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !18
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %6, i32 noundef %31, i32 noundef %33)
  %34 = load i64, ptr %6, align 8
  store i64 %34, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %35

35:                                               ; preds = %26, %11
  %36 = call noundef ptr @_ZN3JPH15AABBTreeBuilder4NodenwEm(i64 noundef 80)
  invoke void @_ZN3JPH15AABBTreeBuilder4NodeC1Ev(ptr noundef nonnull align 16 dereferenceable(72) %36)
          to label %37 unwind label %43

37:                                               ; preds = %35
  %38 = call noundef ptr @_ZN3JPH15AABBTreeBuilder13BuildInternalERKNS_16TriangleSplitter5RangeE(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(8) %3)
  %39 = getelementptr inbounds i8, ptr %36, i64 56
  store ptr %38, ptr %39, align 8, !tbaa !14
  %40 = call noundef ptr @_ZN3JPH15AABBTreeBuilder13BuildInternalERKNS_16TriangleSplitter5RangeE(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %41 = getelementptr inbounds i8, ptr %36, i64 64
  store ptr %40, ptr %41, align 8, !tbaa !14
  %42 = load ptr, ptr %39, align 8, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %36, ptr noundef nonnull align 16 dereferenceable(32) %42, i64 32, i1 false), !tbaa.struct !19
  call void @_ZN3JPH5AABox11EncapsulateERKS0_(ptr noundef nonnull align 16 dereferenceable(32) %36, ptr noundef nonnull align 16 dereferenceable(32) %40)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %.loopexit

43:                                               ; preds = %35
  %44 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH15AABBTreeBuilder4NodedlEPv(ptr noundef %36) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %64

45:                                               ; preds = %2
  %46 = tail call noundef ptr @_ZN3JPH15AABBTreeBuilder4NodenwEm(i64 noundef 80)
  invoke void @_ZN3JPH15AABBTreeBuilder4NodeC1Ev(ptr noundef nonnull align 16 dereferenceable(72) %46)
          to label %47 unwind label %55

47:                                               ; preds = %45
  %48 = getelementptr inbounds i8, ptr %46, i64 32
  %49 = tail call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %50 = zext i32 %49 to i64
  tail call void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %50)
  %51 = load i32, ptr %1, align 4, !tbaa !16
  %52 = getelementptr inbounds i8, ptr %1, i64 4
  %53 = load i32, ptr %52, align 4, !tbaa !18
  %54 = icmp ult i32 %51, %53
  br i1 %54, label %.lr.ph, label %.loopexit

55:                                               ; preds = %45
  %56 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN3JPH15AABBTreeBuilder4NodedlEPv(ptr noundef %46) #7
  br label %64

.lr.ph:                                           ; preds = %47, %.lr.ph
  %.03538 = phi i32 [ %61, %.lr.ph ], [ %51, %47 ]
  %57 = load ptr, ptr %0, align 8, !tbaa !11
  %58 = tail call noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3JPH16TriangleSplitter11GetTriangleEj(ptr noundef nonnull align 8 dereferenceable(72) %57, i32 noundef %.03538)
  %59 = load ptr, ptr %0, align 8, !tbaa !11
  %60 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH16TriangleSplitter11GetVerticesEv(ptr noundef nonnull align 8 dereferenceable(72) %59)
  tail call void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %48, ptr noundef nonnull align 4 dereferenceable(16) %58)
  tail call void @_ZN3JPH5AABox11EncapsulateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(32) %46, ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 4 dereferenceable(16) %58)
  %61 = add nuw i32 %.03538, 1
  %62 = load i32, ptr %52, align 4, !tbaa !18
  %63 = icmp ult i32 %61, %62
  br i1 %63, label %.lr.ph, label %.loopexit, !llvm.loop !21

.loopexit:                                        ; preds = %.lr.ph, %47, %37
  %.0 = phi ptr [ %36, %37 ], [ %46, %47 ], [ %46, %.lr.ph ]
  ret ptr %.0

64:                                               ; preds = %55, %43
  %.pn = phi { ptr, i32 } [ %44, %43 ], [ %56, %55 ]
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #4 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) #5

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN3JPH15AABBTreeBuilder4NodenwEm(i64 noundef) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH5AABox11EncapsulateERKS0_(ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 16 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNK3JPH16TriangleSplitter11GetTriangleEj(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3JPH16TriangleSplitter11GetVerticesEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH5AABox11EncapsulateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3 align 2

declare void @_ZN3JPH15AABBTreeBuilder4NodeC1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline 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 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 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { alwaysinline 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 #7 = { 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, !10, i64 8}
!6 = !{!"_ZTSN3JPH15AABBTreeBuilderE", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"vtable pointer", !9, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{i64 2156863213}
!16 = !{!17, !10, i64 0}
!17 = !{!"_ZTSN3JPH16TriangleSplitter5RangeE", !10, i64 0, !10, i64 4}
!18 = !{!17, !10, i64 4}
!19 = !{i64 0, i64 16, !20, i64 16, i64 16, !20}
!20 = !{!8, !8, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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