; LLVM IR from yuanming-hu/taichi_mpm :: external/partio/src/core/ParticleCaching.ll (ZN6Partio10freeCachedEPNS_13ParticlesDataE)

; 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.Partio::PartioMutex" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<Partio::ParticlesData *, std::pair<Partio::ParticlesData *const, int>, std::_Select1st<std::pair<Partio::ParticlesData *const, int>>, std::less<Partio::ParticlesData *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Partio::ParticlesData *, std::pair<Partio::ParticlesData *const, int>, std::_Select1st<std::pair<Partio::ParticlesData *const, int>>, std::less<Partio::ParticlesData *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_iterator.9" = type { ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.10" = type <{ ptr, i32, [4 x i8] }>
%"struct.std::pair" = type { %"class.std::__cxx11::basic_string", ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@_ZN6Partio12_GLOBAL__N_15mutexE = external hidden global %"class.Partio::PartioMutex", align 8
@_ZN6Partio20cachedParticlesCountE = external dso_local global %"class.std::map", align 8
@_ZN6Partio15cachedParticlesB5cxx11E = external dso_local global %"class.std::map.0", align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__._ZN6Partio10freeCachedEPNS_13ParticlesDataE = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6Partio11PartioMutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40)) #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEESE_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6Partio11PartioMutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Partio10freeCachedEPNS_13ParticlesDataE(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator.9", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator.9", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator.9", align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator.9", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %15, label %14

14:                                               ; preds = %1
  br label %77

15:                                               ; preds = %1
  call void @_ZN6Partio11PartioMutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) @_ZN6Partio12_GLOBAL__N_15mutexE)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %16 = call ptr @_ZNSt3mapIPN6Partio13ParticlesDataEiSt4lessIS2_ESaISt4pairIKS2_iEEE4findERS6_(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio20cachedParticlesCountE, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %17 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.9", ptr %3, i32 0, i32 0
  store ptr %16, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %18 = call ptr @_ZNSt3mapIPN6Partio13ParticlesDataEiSt4lessIS2_ESaISt4pairIKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio20cachedParticlesCountE) #6
  %19 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.9", ptr %4, i32 0, i32 0
  store ptr %18, ptr %19, align 8
  %20 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEES8_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br i1 %20, label %21, label %29

21:                                               ; preds = %15
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %28, label %24

24:                                               ; preds = %21
  %25 = load ptr, ptr %22, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 1
  %27 = load ptr, ptr %26, align 8
  call void %27(ptr noundef nonnull align 8 dereferenceable(8) %22) #6
  br label %28

28:                                               ; preds = %24, %21
  br label %75

29:                                               ; preds = %15
  %30 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %31 = getelementptr inbounds %"struct.std::pair.10", ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !11
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %31, align 8, !tbaa !11
  %34 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %35 = getelementptr inbounds %"struct.std::pair.10", ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 8, !tbaa !11
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %74

38:                                               ; preds = %29
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = icmp eq ptr %39, null
  br i1 %40, label %45, label %41

41:                                               ; preds = %38
  %42 = load ptr, ptr %39, align 8, !tbaa !9
  %43 = getelementptr inbounds ptr, ptr %42, i64 1
  %44 = load ptr, ptr %43, align 8
  call void %44(ptr noundef nonnull align 8 dereferenceable(8) %39) #6
  br label %45

45:                                               ; preds = %41, %38
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %3, i64 8, i1 false), !tbaa.struct !14
  %46 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.9", ptr %5, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8
  %48 = call ptr @_ZNSt3mapIPN6Partio13ParticlesDataEiSt4lessIS2_ESaISt4pairIKS2_iEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS7_E(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio20cachedParticlesCountE, ptr %47)
  %49 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.9", ptr %6, i32 0, i32 0
  store ptr %48, ptr %49, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %50 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio15cachedParticlesB5cxx11E) #6
  %51 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %7, i32 0, i32 0
  store ptr %50, ptr %51, align 8
  br label %52

52:                                               ; preds = %69, %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %53 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio15cachedParticlesB5cxx11E) #6
  %54 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %8, i32 0, i32 0
  store ptr %53, ptr %54, align 8
  %55 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEESE_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 2, ptr %9, align 4
  br label %71

57:                                               ; preds = %52
  %58 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !15
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = icmp eq ptr %60, %61
  br i1 %62, label %63, label %68

63:                                               ; preds = %57
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %7, i64 8, i1 false), !tbaa.struct !14
  %64 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8
  %66 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISD_E(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio15cachedParticlesB5cxx11E, ptr %65)
  %67 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %11, i32 0, i32 0
  store ptr %66, ptr %67, align 8
  store i32 5, ptr %9, align 4
  br label %71

68:                                               ; preds = %57
  br label %69

69:                                               ; preds = %68
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br label %52, !llvm.loop !20

71:                                               ; preds = %63, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %72 = load i32, ptr %9, align 4
  switch i32 %72, label %78 [
    i32 2, label %73
    i32 5, label %76
  ]

73:                                               ; preds = %71
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.4, i32 noundef 95, ptr noundef @__PRETTY_FUNCTION__._ZN6Partio10freeCachedEPNS_13ParticlesDataE) #7
  unreachable

74:                                               ; preds = %29
  br label %75

75:                                               ; preds = %74, %28
  br label %76

76:                                               ; preds = %75, %71
  call void @_ZN6Partio11PartioMutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) @_ZN6Partio12_GLOBAL__N_15mutexE)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %77

77:                                               ; preds = %76, %14
  ret void

78:                                               ; preds = %71
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEES8_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIPN6Partio13ParticlesDataEiSt4lessIS2_ESaISt4pairIKS2_iEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS7_E(ptr noundef nonnull align 8 dereferenceable(48), ptr) #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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { noreturn nounwind "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 }
attributes #7 = { noreturn 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSSt4pairIKPN6Partio13ParticlesDataEiE", !6, i64 0, !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{i64 0, i64 8, !5}
!15 = !{!16, !6, i64 32}
!16 = !{!"_ZTSSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEE", !17, i64 0, !6, i64 32}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !19, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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.Partio::PartioMutex" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<Partio::ParticlesData *, std::pair<Partio::ParticlesData *const, int>, std::_Select1st<std::pair<Partio::ParticlesData *const, int>>, std::less<Partio::ParticlesData *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Partio::ParticlesData *, std::pair<Partio::ParticlesData *const, int>, std::_Select1st<std::pair<Partio::ParticlesData *const, int>>, std::less<Partio::ParticlesData *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, Partio::ParticlesData *>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_iterator.9" = type { ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@_ZN6Partio12_GLOBAL__N_15mutexE = external hidden global %"class.Partio::PartioMutex", align 8
@_ZN6Partio20cachedParticlesCountE = external dso_local global %"class.std::map", align 8
@_ZN6Partio15cachedParticlesB5cxx11E = external dso_local global %"class.std::map.0", align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__._ZN6Partio10freeCachedEPNS_13ParticlesDataE = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6Partio11PartioMutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEESE_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6Partio11PartioMutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Partio10freeCachedEPNS_13ParticlesDataE(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator.9", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator.9", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %51, label %7

7:                                                ; preds = %1
  tail call void @_ZN6Partio11PartioMutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) @_ZN6Partio12_GLOBAL__N_15mutexE)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %8 = call ptr @_ZNSt3mapIPN6Partio13ParticlesDataEiSt4lessIS2_ESaISt4pairIKS2_iEEE4findERS6_(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio20cachedParticlesCountE, ptr noundef nonnull align 8 dereferenceable(8) %2)
  store ptr %8, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %9 = call ptr @_ZNSt3mapIPN6Partio13ParticlesDataEiSt4lessIS2_ESaISt4pairIKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio20cachedParticlesCountE) #5
  store ptr %9, ptr %4, align 8
  %10 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEES8_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br i1 %10, label %11, label %18

11:                                               ; preds = %7
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %50, label %14

14:                                               ; preds = %11
  %15 = load ptr, ptr %12, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8
  call void %17(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  br label %50

18:                                               ; preds = %7
  %19 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr %20, align 8, !tbaa !11
  %23 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = load i32, ptr %24, align 8, !tbaa !11
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %50

27:                                               ; preds = %18
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %34, label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %28, align 8, !tbaa !9
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  %33 = load ptr, ptr %32, align 8
  call void %33(ptr noundef nonnull align 8 dereferenceable(8) %28) #5
  br label %34

34:                                               ; preds = %30, %27
  %.sroa.03.0.copyload = load ptr, ptr %3, align 8, !tbaa !5
  %35 = call ptr @_ZNSt3mapIPN6Partio13ParticlesDataEiSt4lessIS2_ESaISt4pairIKS2_iEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS7_E(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio20cachedParticlesCountE, ptr %.sroa.03.0.copyload)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %36 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio15cachedParticlesB5cxx11E) #5
  store ptr %36, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %37 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio15cachedParticlesB5cxx11E) #5
  store ptr %37, ptr %6, align 8
  %38 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEESE_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br i1 %38, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %34, %44
  %39 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  %40 = getelementptr inbounds i8, ptr %39, i64 32
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = icmp eq ptr %41, %42
  br i1 %43, label %48, label %44

44:                                               ; preds = %.lr.ph
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %46 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio15cachedParticlesB5cxx11E) #5
  store ptr %46, ptr %6, align 8
  %47 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEEESE_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !19

48:                                               ; preds = %.lr.ph
  %.sroa.01.0.copyload = load ptr, ptr %5, align 8, !tbaa !5
  %49 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataESt4lessIS5_ESaISt4pairIKS5_S8_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISD_E(ptr noundef nonnull align 8 dereferenceable(48) @_ZN6Partio15cachedParticlesB5cxx11E, ptr %.sroa.01.0.copyload)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %50

._crit_edge:                                      ; preds = %44, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, i32 noundef 95, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6Partio10freeCachedEPNS_13ParticlesDataE) #6
  unreachable

50:                                               ; preds = %48, %14, %11, %18
  call void @_ZN6Partio11PartioMutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) @_ZN6Partio12_GLOBAL__N_15mutexE)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %51

51:                                               ; preds = %1, %50
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKPN6Partio13ParticlesDataEiEES8_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSSt4pairIKPN6Partio13ParticlesDataEiE", !6, i64 0, !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 32}
!15 = !{!"_ZTSSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN6Partio13ParticlesDataEE", !16, i64 0, !6, i64 32}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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