; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Collision/Shape/MeshShape.ll (ZN3JPH17MeshShapeSettings8SanitizeEv)

; 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::UnorderedSet" = type { %"class.JPH::HashTable.base", [4 x i8] }
%"class.JPH::HashTable.base" = type <{ ptr, ptr, i32, i32, i32 }>
%"class.JPH::TriangleCodecIndexed8BitPackSOA4Flags::ValidationContext" = type { ptr, %"class.JPH::AABox" }
%"class.JPH::AABox" = type { %"class.JPH::Vec3", %"class.JPH::Vec3" }
%"class.JPH::Vec3" = type { %union.anon.14 }
%union.anon.14 = type { <4 x float> }
%"struct.std::pair" = type { %"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::iterator", i8, [7 x i8] }
%"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::iterator" = type { %"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::IteratorBase.base", [4 x i8] }
%"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::IteratorBase.base" = type <{ ptr, i32 }>
%"class.JPH::IndexedTriangle" = type { %"class.JPH::IndexedTriangleNoMaterial", i32, i32 }
%"class.JPH::IndexedTriangleNoMaterial" = type { [3 x i32] }
%"class.JPH::MeshShapeSettings" = type { %"class.JPH::ShapeSettings", %"class.JPH::Array", %"class.JPH::Array.5", %"class.JPH::Array.8", i32, float, i8, i32 }
%"class.JPH::ShapeSettings" = type { %"class.JPH::SerializableObject", %"class.JPH::RefTarget", i64, %"class.JPH::Result" }
%"class.JPH::SerializableObject" = type { ptr }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::Result" = type <{ %union.anon, i8, [7 x i8] }>
%union.anon = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char, std::char_traits<char>, JPH::STLAllocator<char>>::_Alloc_hider", i64, %union.anon.2 }
%"struct.std::__cxx11::basic_string<char, std::char_traits<char>, JPH::STLAllocator<char>>::_Alloc_hider" = type { ptr }
%union.anon.2 = type { i64, [8 x i8] }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::Array.5" = type { i64, i64, ptr }
%"class.JPH::Array.8" = type { i64, i64, ptr }

; 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 @_ZN3JPH17MeshShapeSettings8SanitizeEv(ptr noundef nonnull align 8 dereferenceable(152) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.JPH::UnorderedSet", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.JPH::TriangleCodecIndexed8BitPackSOA4Flags::ValidationContext", align 16
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca %"class.JPH::IndexedTriangle", align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #6
  call void @_ZN3JPH12UnorderedSetINS_15IndexedTriangleENS_4HashIS1_EESt8equal_toIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(28) %3) #6
  %12 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 2
  %13 = invoke noundef i64 @_ZNK3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %14 unwind label %29

14:                                               ; preds = %1
  %15 = trunc i64 %13 to i32
  invoke void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE7reserveEj(ptr noundef nonnull align 8 dereferenceable(28) %3, i32 noundef %15)
          to label %16 unwind label %29

16:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #6
  %17 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 2
  %18 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 1
  invoke void @_ZN3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContextC2ERKNS_5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS3_EEEERKNS2_INS_6Float3ENS4_IS9_EEEE(ptr noundef nonnull align 16 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %18)
          to label %19 unwind label %33

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %20 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 2
  %21 = invoke noundef i64 @_ZNK3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
          to label %22 unwind label %37

22:                                               ; preds = %19
  %23 = trunc i64 %21 to i32
  %24 = sub nsw i32 %23, 1
  store i32 %24, ptr %7, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %85, %22
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp sge i32 %26, 0
  br i1 %27, label %41, label %28

28:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %90

29:                                               ; preds = %14, %1
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %4, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %5, align 4
  br label %92

33:                                               ; preds = %16
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %4, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %5, align 4
  br label %91

37:                                               ; preds = %19
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %4, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %5, align 4
  br label %89

41:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %42 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 2
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %42, i64 noundef %44)
          to label %46 unwind label %76

46:                                               ; preds = %41
  store ptr %45, ptr %8, align 8, !tbaa !5
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 20, ptr %10) #6
  %49 = invoke noundef zeroext i1 @_ZNK3JPH25IndexedTriangleNoMaterial12IsDegenerateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEE(ptr noundef nonnull align 4 dereferenceable(12) %47, ptr noundef nonnull align 8 dereferenceable(24) %48)
          to label %50 unwind label %76

50:                                               ; preds = %46
  br i1 %49, label %63, label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = invoke noundef zeroext i1 @_ZNK3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContext12IsDegenerateERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(48) %6, ptr noundef nonnull align 4 dereferenceable(20) %52)
          to label %54 unwind label %76

54:                                               ; preds = %51
  br i1 %53, label %63, label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZNK3JPH15IndexedTriangle19GetLowestIndexFirstEv(ptr dead_on_unwind writable sret(%"class.JPH::IndexedTriangle") align 4 %10, ptr noundef nonnull align 4 dereferenceable(20) %56)
          to label %57 unwind label %80

57:                                               ; preds = %55
  invoke void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE6insertERKS1_(ptr dead_on_unwind writable sret(%"struct.std::pair") align 8 %9, ptr noundef nonnull align 8 dereferenceable(28) %3, ptr noundef nonnull align 4 dereferenceable(20) %10)
          to label %58 unwind label %80

58:                                               ; preds = %57
  %59 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %60 = load i8, ptr %59, align 8, !tbaa !11, !range !16, !noundef !17
  %61 = trunc i8 %60 to i1
  %62 = xor i1 %61, true
  br label %63

63:                                               ; preds = %58, %54, %50
  %64 = phi i1 [ true, %54 ], [ true, %50 ], [ %62, %58 ]
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  br i1 %64, label %65, label %84

65:                                               ; preds = %63
  %66 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 2
  %67 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %66)
          to label %68 unwind label %76

68:                                               ; preds = %65
  %69 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 2
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef %71)
          to label %73 unwind label %76

73:                                               ; preds = %68
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %72, ptr align 4 %67, i64 20, i1 false)
  %74 = getelementptr inbounds %"class.JPH::MeshShapeSettings", ptr %11, i32 0, i32 2
  invoke void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %74)
          to label %75 unwind label %76

75:                                               ; preds = %73
  br label %84

76:                                               ; preds = %73, %68, %65, %51, %46, %41
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %4, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %5, align 4
  br label %88

80:                                               ; preds = %57, %55
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %4, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  br label %88

84:                                               ; preds = %75, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %7, align 4, !tbaa !9
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr %7, align 4, !tbaa !9
  br label %25, !llvm.loop !18

88:                                               ; preds = %80, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %89

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

90:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #6
  call void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #6
  ret void

91:                                               ; preds = %89, %33
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #6
  br label %92

92:                                               ; preds = %91, %29
  call void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #6
  br label %93

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE7reserveEj(ptr noundef nonnull align 8 dereferenceable(28), i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContextC2ERKNS_5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS3_EEEERKNS2_INS_6Float3ENS4_IS9_EEEE(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH25IndexedTriangleNoMaterial12IsDegenerateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEE(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContext12IsDegenerateERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(20)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE6insertERKS1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair") align 8, ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 4 dereferenceable(20)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH15IndexedTriangle19GetLowestIndexFirstEv(ptr dead_on_unwind noalias writable sret(%"class.JPH::IndexedTriangle") align 4, ptr noundef nonnull align 4 dereferenceable(20)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 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) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(28)) 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 = { 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !15, i64 16}
!12 = !{!"_ZTSSt4pairIN3JPH9HashTableINS0_15IndexedTriangleES2_NS0_18UnorderedSetDetailIS2_EENS0_4HashIS2_EESt8equal_toIS2_EE8iteratorEbE", !13, i64 0, !15, i64 16}
!13 = !{!"_ZTSN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE8iteratorE", !14, i64 0}
!14 = !{!"_ZTSN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE12IteratorBaseIS8_NS8_8iteratorEEE", !6, i64 0, !10, i64 8}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"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::UnorderedSet" = type { %"class.JPH::HashTable.base", [4 x i8] }
%"class.JPH::HashTable.base" = type <{ ptr, ptr, i32, i32, i32 }>
%"class.JPH::TriangleCodecIndexed8BitPackSOA4Flags::ValidationContext" = type { ptr, %"class.JPH::AABox" }
%"class.JPH::AABox" = type { %"class.JPH::Vec3", %"class.JPH::Vec3" }
%"class.JPH::Vec3" = type { %union.anon.14 }
%union.anon.14 = type { <4 x float> }
%"struct.std::pair" = type { %"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::iterator", i8, [7 x i8] }
%"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::iterator" = type { %"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::IteratorBase.base", [4 x i8] }
%"class.JPH::HashTable<JPH::IndexedTriangle, JPH::IndexedTriangle, JPH::UnorderedSetDetail<JPH::IndexedTriangle>, JPH::Hash<JPH::IndexedTriangle>, std::equal_to<JPH::IndexedTriangle>>::IteratorBase.base" = type <{ ptr, i32 }>
%"class.JPH::IndexedTriangle" = type { %"class.JPH::IndexedTriangleNoMaterial", i32, i32 }
%"class.JPH::IndexedTriangleNoMaterial" = type { [3 x i32] }

; 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 @_ZN3JPH17MeshShapeSettings8SanitizeEv(ptr noundef nonnull align 8 dereferenceable(152) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.JPH::UnorderedSet", align 8
  %3 = alloca %"class.JPH::TriangleCodecIndexed8BitPackSOA4Flags::ValidationContext", align 16
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"class.JPH::IndexedTriangle", align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #6
  call void @_ZN3JPH12UnorderedSetINS_15IndexedTriangleENS_4HashIS1_EESt8equal_toIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(28) %2) #6
  %6 = getelementptr inbounds i8, ptr %0, i64 88
  %7 = call noundef i64 @_ZNK3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %8 = trunc i64 %7 to i32
  invoke void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE7reserveEj(ptr noundef nonnull align 8 dereferenceable(28) %2, i32 noundef %8)
          to label %9 unwind label %17

9:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #6
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  invoke void @_ZN3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContextC2ERKNS_5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS3_EEEERKNS2_INS_6Float3ENS4_IS9_EEEE(ptr noundef nonnull align 16 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %11 unwind label %19

11:                                               ; preds = %9
  %12 = call noundef i64 @_ZNK3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %13 = trunc i64 %12 to i32
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %11
  %15 = getelementptr inbounds i8, ptr %4, i64 16
  %16 = and i64 %12, 2147483647
  br label %21

._crit_edge:                                      ; preds = %43, %11
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #6
  call void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %2) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  ret void

17:                                               ; preds = %1
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %46

19:                                               ; preds = %9
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %45

21:                                               ; preds = %.lr.ph, %43
  %indvars.iv = phi i64 [ %16, %.lr.ph ], [ %indvars.iv.next, %43 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %22 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv.next)
          to label %23 unwind label %39

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %5) #6
  %24 = invoke noundef zeroext i1 @_ZNK3JPH25IndexedTriangleNoMaterial12IsDegenerateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEE(ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %25 unwind label %39

25:                                               ; preds = %23
  br i1 %24, label %.critedge, label %26

26:                                               ; preds = %25
  %27 = invoke noundef zeroext i1 @_ZNK3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContext12IsDegenerateERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(48) %3, ptr noundef nonnull align 4 dereferenceable(20) %22)
          to label %28 unwind label %39

28:                                               ; preds = %26
  br i1 %27, label %.critedge, label %29

29:                                               ; preds = %28
  invoke void @_ZNK3JPH15IndexedTriangle19GetLowestIndexFirstEv(ptr dead_on_unwind nonnull writable sret(%"class.JPH::IndexedTriangle") align 4 %5, ptr noundef nonnull align 4 dereferenceable(20) %22)
          to label %30 unwind label %41

30:                                               ; preds = %29
  invoke void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE6insertERKS1_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair") align 8 %4, ptr noundef nonnull align 8 dereferenceable(28) %2, ptr noundef nonnull align 4 dereferenceable(20) %5)
          to label %31 unwind label %41

31:                                               ; preds = %30
  %32 = load i8, ptr %15, align 8, !tbaa !5, !range !14, !noundef !15
  %33 = trunc nuw i8 %32 to i1
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br i1 %33, label %43, label %34

.critedge:                                        ; preds = %25, %28
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %34

34:                                               ; preds = %.critedge, %31
  %35 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %36 unwind label %39

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv.next)
          to label %38 unwind label %39

38:                                               ; preds = %36
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %37, ptr noundef nonnull align 4 dereferenceable(20) %35, i64 20, i1 false)
  invoke void @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %43 unwind label %39

39:                                               ; preds = %38, %36, %34, %26, %23, %21
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %45

41:                                               ; preds = %30, %29
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %45

43:                                               ; preds = %38, %31
  %44 = icmp ugt i64 %indvars.iv, 1
  br i1 %44, label %21, label %._crit_edge, !llvm.loop !16

45:                                               ; preds = %39, %41, %19
  %.pn.pn = phi { ptr, i32 } [ %20, %19 ], [ %40, %39 ], [ %42, %41 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #6
  br label %46

46:                                               ; preds = %45, %17
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %45 ], [ %18, %17 ]
  call void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %2) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn.pn.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContextC2ERKNS_5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS3_EEEERKNS2_INS_6Float3ENS4_IS9_EEEE(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH25IndexedTriangleNoMaterial12IsDegenerateERKNS_5ArrayINS_6Float3ENS_12STLAllocatorIS2_EEEE(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH37TriangleCodecIndexed8BitPackSOA4Flags17ValidationContext12IsDegenerateERKNS_15IndexedTriangleE(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE6insertERKS1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair") align 8, ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH15IndexedTriangle19GetLowestIndexFirstEv(ptr dead_on_unwind noalias writable sret(%"class.JPH::IndexedTriangle") align 4, ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZN3JPH5ArrayINS_15IndexedTriangleENS_12STLAllocatorIS1_EEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 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) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(28)) 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 = { 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !13, i64 16}
!6 = !{!"_ZTSSt4pairIN3JPH9HashTableINS0_15IndexedTriangleES2_NS0_18UnorderedSetDetailIS2_EENS0_4HashIS2_EESt8equal_toIS2_EE8iteratorEbE", !7, i64 0, !13, i64 16}
!7 = !{!"_ZTSN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE8iteratorE", !8, i64 0}
!8 = !{!"_ZTSN3JPH9HashTableINS_15IndexedTriangleES1_NS_18UnorderedSetDetailIS1_EENS_4HashIS1_EESt8equal_toIS1_EE12IteratorBaseIS8_NS8_8iteratorEEE", !9, i64 0, !12, i64 8}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"bool", !10, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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