; LLVM IR from zig-gamedev/zphysics :: libs/Jolt/TriangleSplitter (TriangleSplitterFixedLeafSize)

; 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.JPH::TriangleGrouperClosestCentroid" = type { %"class.JPH::TriangleGrouper" }
%"class.JPH::TriangleGrouper" = type { ptr }
%"class.JPH::TriangleSplitterFixedLeafSize" = type { %"class.JPH::TriangleSplitter", i32, i32, i32, i32 }
%"class.JPH::TriangleSplitter" = type { ptr, ptr, ptr, %"class.JPH::Array", %"class.JPH::Array.0" }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::Array.0" = type { i64, i64, ptr }

@_ZTVN3JPH29TriangleSplitterFixedLeafSizeE = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; 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: mustprogress uwtable
define dso_local void @_ZN3JPH29TriangleSplitterFixedLeafSizeC2ERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEEjjjj(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"class.JPH::TriangleGrouperClosestCentroid", align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %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
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  store i32 %6, ptr %14, align 4, !tbaa !9
  %23 = load ptr, ptr %8, align 8
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3JPH16TriangleSplitterC2ERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEE(ptr noundef nonnull align 8 dereferenceable(72) %23, ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(24) %25)
  store ptr getelementptr inbounds inrange(-16, 32) ({ [6 x ptr] }, ptr @_ZTVN3JPH29TriangleSplitterFixedLeafSizeE, i32 0, i32 0, i32 2), ptr %23, align 8, !tbaa !11
  %26 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 1
  %27 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %27, ptr %26, align 8, !tbaa !13
  %28 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 2
  %29 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %29, ptr %28, align 4, !tbaa !19
  %30 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 3
  %31 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %31, ptr %30, align 8, !tbaa !20
  %32 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 4
  %33 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %33, ptr %32, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @_ZN3JPH30TriangleGrouperClosestCentroidC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !13
  %38 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %23, i32 0, i32 4
  invoke void @_ZN3JPH30TriangleGrouperClosestCentroid5GroupERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEEiRNS1_IjNS3_IjEEEE(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %35, i32 noundef %37, ptr noundef nonnull align 8 dereferenceable(24) %38)
          to label %39 unwind label %66

39:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = invoke noundef i64 @_ZNK3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %40)
          to label %42 unwind label %70

42:                                               ; preds = %39
  %43 = trunc i64 %41 to i32
  store i32 %43, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %44 = load i32, ptr %18, align 4, !tbaa !9
  %45 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 1
  %46 = load i32, ptr %45, align 8, !tbaa !13
  %47 = add i32 %44, %46
  %48 = sub i32 %47, 1
  %49 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 1
  %50 = load i32, ptr %49, align 8, !tbaa !13
  %51 = udiv i32 %48, %50
  store i32 %51, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %52 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %23, i32 0, i32 4
  %53 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %52)
          to label %54 unwind label %74

54:                                               ; preds = %42
  %55 = load i32, ptr %53, align 4, !tbaa !9
  store i32 %55, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %56 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %56, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %57 = load i32, ptr %19, align 4, !tbaa !9
  %58 = getelementptr inbounds %"class.JPH::TriangleSplitterFixedLeafSize", ptr %23, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !13
  %60 = mul i32 %57, %59
  store i32 %60, ptr %22, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %81, %54
  %62 = load i32, ptr %21, align 4, !tbaa !9
  %63 = load i32, ptr %22, align 4, !tbaa !9
  %64 = icmp ult i32 %62, %63
  br i1 %64, label %78, label %65

65:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %88

66:                                               ; preds = %7
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %16, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %17, align 4
  br label %91

70:                                               ; preds = %39
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %16, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %17, align 4
  br label %90

74:                                               ; preds = %42
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %16, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %17, align 4
  br label %89

78:                                               ; preds = %61
  %79 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %23, i32 0, i32 4
  invoke void @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE9push_backERKj(ptr noundef nonnull align 8 dereferenceable(24) %79, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %80 unwind label %84

80:                                               ; preds = %78
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %21, align 4, !tbaa !9
  %83 = add i32 %82, 1
  store i32 %83, ptr %21, align 4, !tbaa !9
  br label %61, !llvm.loop !22

84:                                               ; preds = %78
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %16, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %89

88:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @_ZN3JPH15TriangleGrouperD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  ret void

89:                                               ; preds = %84, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %90

90:                                               ; preds = %89, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %91

91:                                               ; preds = %90, %66
  call void @_ZN3JPH15TriangleGrouperD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @_ZN3JPH16TriangleSplitterD2Ev(ptr noundef nonnull align 8 dereferenceable(72) %23) #6
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr %16, align 8
  %94 = load i32, ptr %17, align 4
  %95 = insertvalue { ptr, i32 } poison, ptr %93, 0
  %96 = insertvalue { ptr, i32 } %95, i32 %94, 1
  resume { ptr, i32 } %96
}

declare void @_ZN3JPH16TriangleSplitterC2ERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH30TriangleGrouperClosestCentroidC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

declare void @_ZN3JPH30TriangleGrouperClosestCentroid5GroupERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEEiRNS1_IjNS3_IjEEEE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH15TriangleGrouperD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TriangleSplitterD2Ev(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #5 align 2

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 = { "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 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 72}
!14 = !{!"_ZTSN3JPH29TriangleSplitterFixedLeafSizeE", !15, i64 0, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84}
!15 = !{!"_ZTSN3JPH16TriangleSplitterE", !6, i64 8, !6, i64 16, !16, i64 24, !18, i64 48}
!16 = !{!"_ZTSN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEE", !17, i64 0, !17, i64 8, !6, i64 16}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSN3JPH5ArrayIjNS_12STLAllocatorIjEEEE", !17, i64 0, !17, i64 8, !6, i64 16}
!19 = !{!14, !10, i64 76}
!20 = !{!14, !10, i64 80}
!21 = !{!14, !10, i64 84}
!22 = distinct !{!22, !23}
!23 = !{!"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"

%"class.JPH::TriangleGrouperClosestCentroid" = type { %"class.JPH::TriangleGrouper" }
%"class.JPH::TriangleGrouper" = type { ptr }

@_ZTVN3JPH29TriangleSplitterFixedLeafSizeE = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; 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: mustprogress uwtable
define dso_local void @_ZN3JPH29TriangleSplitterFixedLeafSizeC2ERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEEjjjj(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"class.JPH::TriangleGrouperClosestCentroid", align 8
  %9 = alloca i32, align 4
  tail call void @_ZN3JPH16TriangleSplitterC2ERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2)
  store ptr getelementptr inbounds inrange(-16, 32) (i8, ptr @_ZTVN3JPH29TriangleSplitterFixedLeafSizeE, i64 16), ptr %0, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 %3, ptr %10, align 8, !tbaa !8
  %11 = getelementptr inbounds i8, ptr %0, i64 76
  store i32 %4, ptr %11, align 4, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 %5, ptr %12, align 8, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %0, i64 84
  store i32 %6, ptr %13, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @_ZN3JPH30TriangleGrouperClosestCentroidC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %14 = load i32, ptr %10, align 8, !tbaa !8
  %15 = getelementptr inbounds i8, ptr %0, i64 48
  invoke void @_ZN3JPH30TriangleGrouperClosestCentroid5GroupERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEEiRNS1_IjNS3_IjEEEE(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef %14, ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %16 unwind label %29

16:                                               ; preds = %7
  %17 = call noundef i64 @_ZNK3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %18 = load i32, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  %19 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %20 unwind label %31

20:                                               ; preds = %16
  %21 = trunc i64 %17 to i32
  %22 = add i32 %21, -1
  %23 = add i32 %22, %18
  %24 = udiv i32 %23, %18
  %25 = load i32, ptr %19, align 4, !tbaa !20
  store i32 %25, ptr %9, align 4, !tbaa !20
  %26 = load i32, ptr %10, align 8, !tbaa !8
  %27 = mul i32 %26, %24
  %28 = icmp ugt i32 %27, %21
  br i1 %28, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %33, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @_ZN3JPH15TriangleGrouperD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  ret void

29:                                               ; preds = %7
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %39

31:                                               ; preds = %16
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %38

.lr.ph:                                           ; preds = %20, %33
  %.01722 = phi i32 [ %34, %33 ], [ %21, %20 ]
  invoke void @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE9push_backERKj(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %33 unwind label %36

33:                                               ; preds = %.lr.ph
  %34 = add nuw i32 %.01722, 1
  %35 = icmp ult i32 %34, %27
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !21

36:                                               ; preds = %.lr.ph
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %38

38:                                               ; preds = %36, %31
  %.pn = phi { ptr, i32 } [ %37, %36 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %39

39:                                               ; preds = %38, %29
  %.pn.pn = phi { ptr, i32 } [ %.pn, %38 ], [ %30, %29 ]
  call void @_ZN3JPH15TriangleGrouperD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @_ZN3JPH16TriangleSplitterD2Ev(ptr noundef nonnull align 8 dereferenceable(72) %0) #6
  resume { ptr, i32 } %.pn.pn
}

declare void @_ZN3JPH16TriangleSplitterC2ERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH30TriangleGrouperClosestCentroidC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

declare void @_ZN3JPH30TriangleGrouperClosestCentroid5GroupERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEERKNS1_INS_15IndexedTriangleENS3_IS8_EEEEiRNS1_IjNS3_IjEEEE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH15TriangleGrouperD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TriangleSplitterD2Ev(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #5 align 2

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 = { "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 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !16, i64 72}
!9 = !{!"_ZTSN3JPH29TriangleSplitterFixedLeafSizeE", !10, i64 0, !16, i64 72, !16, i64 76, !16, i64 80, !16, i64 84}
!10 = !{!"_ZTSN3JPH16TriangleSplitterE", !11, i64 8, !11, i64 16, !13, i64 24, !15, i64 48}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"_ZTSN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!14 = !{!"long", !12, i64 0}
!15 = !{!"_ZTSN3JPH5ArrayIjNS_12STLAllocatorIjEEEE", !14, i64 0, !14, i64 8, !11, i64 16}
!16 = !{!"int", !12, i64 0}
!17 = !{!9, !16, i64 76}
!18 = !{!9, !16, i64 80}
!19 = !{!9, !16, i64 84}
!20 = !{!16, !16, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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