; LLVM IR from weicao/cascadb :: src/cache (cache)

; 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.cascadb::Cache::CacheKey" = type { %"class.std::__cxx11::basic_string", i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.cascadb::Cache::TableSettings" = type { ptr, ptr, %struct.timeval }
%struct.timeval = type { i64, i64 }
%"struct.std::_Rb_tree_iterator.12" = type { ptr }
%"class.cascadb::Cache" = type { %"class.cascadb::Options", %"class.cascadb::RWLock", %"class.std::map", %"class.cascadb::Mutex", i64, %"class.cascadb::RWLock", %"class.std::map.0", %"class.cascadb::Mutex", i8, ptr }
%"class.cascadb::Options" = type <{ ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, i8, [3 x i8] }>
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, cascadb::Cache::TableSettings>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, cascadb::Cache::TableSettings>>, 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>, cascadb::Cache::TableSettings>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, cascadb::Cache::TableSettings>>, std::less<std::__cxx11::basic_string<char>>>::_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.cascadb::RWLock" = type { %union.pthread_rwlock_t }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%"class.std::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<cascadb::Cache::CacheKey, std::pair<const cascadb::Cache::CacheKey, cascadb::Node *>, std::_Select1st<std::pair<const cascadb::Cache::CacheKey, cascadb::Node *>>, std::less<cascadb::Cache::CacheKey>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<cascadb::Cache::CacheKey, std::pair<const cascadb::Cache::CacheKey, cascadb::Node *>, std::_Select1st<std::pair<const cascadb::Cache::CacheKey, cascadb::Node *>>, std::less<cascadb::Cache::CacheKey>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.cascadb::Mutex" = type { i8, %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 }

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE = external hidden unnamed_addr constant [61 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [33 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

; 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

declare void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56)) #2

declare void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb5Cache18get_table_settingsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS0_13TableSettingsE(ptr noundef nonnull align 8 dereferenceable(432), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7cascadb4Node3refEv(ptr noundef nonnull align 8 dereferenceable(200)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2, ptr noundef %3) #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"class.cascadb::Cache::CacheKey", align 8
  %10 = alloca %"struct.cascadb::Cache::TableSettings", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %14 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %15 = load ptr, ptr %5, align 8
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = call noundef i32 @_ZN7cascadb4Node3refEv(ptr noundef nonnull align 8 dereferenceable(200) %16)
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %4
  br label %22

20:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.1, i32 noundef 182, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE) #6
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %19
  call void @llvm.lifetime.start.p0(i64 40, ptr %9) #7
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load i64, ptr %7, align 8, !tbaa !9
  call void @_ZN7cascadb5Cache8CacheKeyC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef nonnull align 8 dereferenceable(32) %23, i64 noundef %24)
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #7
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = invoke noundef zeroext i1 @_ZN7cascadb5Cache18get_table_settingsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS0_13TableSettingsE(ptr noundef nonnull align 8 dereferenceable(432) %15, ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %27 unwind label %29

27:                                               ; preds = %22
  br i1 %26, label %33, label %28

28:                                               ; preds = %27
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 187, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE) #6
  unreachable

29:                                               ; preds = %70, %68, %64, %46, %43, %39, %38, %33, %22
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %11, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %12, align 4
  br label %73

33:                                               ; preds = %27
  %34 = invoke noundef zeroext i1 @_ZN7cascadb5Cache10must_evictEv(ptr noundef nonnull align 8 dereferenceable(432) %15)
          to label %35 unwind label %29

35:                                               ; preds = %33
  br i1 %34, label %36, label %46

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %44, %36
  br label %38

38:                                               ; preds = %37
  invoke void @_ZN7cascadb5Cache5evictEv(ptr noundef nonnull align 8 dereferenceable(432) %15)
          to label %39 unwind label %29

39:                                               ; preds = %38
  %40 = invoke noundef zeroext i1 @_ZN7cascadb5Cache10must_evictEv(ptr noundef nonnull align 8 dereferenceable(432) %15)
          to label %41 unwind label %29

41:                                               ; preds = %39
  br i1 %40, label %43, label %42

42:                                               ; preds = %41
  br label %45

43:                                               ; preds = %41
  invoke void @_ZN7cascadb6usleepEj(i32 noundef 1000)
          to label %44 unwind label %29

44:                                               ; preds = %43
  br label %37, !llvm.loop !11

45:                                               ; preds = %42
  br label %46

46:                                               ; preds = %45, %35
  %47 = getelementptr inbounds %"class.cascadb::Cache", ptr %15, i32 0, i32 5
  invoke void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56) %47)
          to label %48 unwind label %29

48:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %49 = getelementptr inbounds %"class.cascadb::Cache", ptr %15, i32 0, i32 6
  %50 = invoke ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE4findERS8_(ptr noundef nonnull align 8 dereferenceable(48) %49, ptr noundef nonnull align 8 dereferenceable(40) %9)
          to label %51 unwind label %59

51:                                               ; preds = %48
  %52 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.12", ptr %13, i32 0, i32 0
  store ptr %50, ptr %52, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %53 = getelementptr inbounds %"class.cascadb::Cache", ptr %15, i32 0, i32 6
  %54 = call ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %53) #7
  %55 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.12", ptr %14, i32 0, i32 0
  store ptr %54, ptr %55, align 8
  %56 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  br i1 %56, label %57, label %58

57:                                               ; preds = %51
  br label %64

58:                                               ; preds = %51
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.1, i32 noundef 201, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE) #6
  unreachable

59:                                               ; preds = %48
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %11, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %73

63:                                               ; No predecessors!
  br label %64

64:                                               ; preds = %63, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = getelementptr inbounds %"class.cascadb::Cache", ptr %15, i32 0, i32 6
  %67 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEEixERS8_(ptr noundef nonnull align 8 dereferenceable(48) %66, ptr noundef nonnull align 8 dereferenceable(40) %9)
          to label %68 unwind label %29

68:                                               ; preds = %64
  store ptr %65, ptr %67, align 8, !tbaa !5
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN7cascadb4Node7inc_refEv(ptr noundef nonnull align 8 dereferenceable(200) %69)
          to label %70 unwind label %29

70:                                               ; preds = %68
  %71 = getelementptr inbounds %"class.cascadb::Cache", ptr %15, i32 0, i32 5
  invoke void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %71)
          to label %72 unwind label %29

72:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @_ZN7cascadb5Cache8CacheKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %9) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #7
  ret void

73:                                               ; preds = %59, %29
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @_ZN7cascadb5Cache8CacheKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %9) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #7
  br label %74

74:                                               ; preds = %73
  %75 = load ptr, ptr %11, align 8
  %76 = load i32, ptr %12, align 4
  %77 = insertvalue { ptr, i32 } poison, ptr %75, 0
  %78 = insertvalue { ptr, i32 } %77, i32 %76, 1
  resume { ptr, i32 } %78
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb5Cache8CacheKeyC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb5Cache10must_evictEv(ptr noundef nonnull align 8 dereferenceable(432)) #3 align 2

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

declare void @_ZN7cascadb6usleepEj(i32 noundef) #2

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

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { noreturn nounwind }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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.cascadb::Cache::CacheKey" = type { %"class.std::__cxx11::basic_string", i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.cascadb::Cache::TableSettings" = type { ptr, ptr, %struct.timeval }
%struct.timeval = type { i64, i64 }
%"struct.std::_Rb_tree_iterator.12" = type { ptr }

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE = external hidden unnamed_addr constant [61 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [33 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

; 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

declare void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #2

declare void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb5Cache18get_table_settingsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS0_13TableSettingsE(ptr noundef nonnull align 8 dereferenceable(432), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7cascadb4Node3refEv(ptr noundef nonnull align 8 dereferenceable(200)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2, ptr noundef nonnull %3) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.cascadb::Cache::CacheKey", align 8
  %6 = alloca %"struct.cascadb::Cache::TableSettings", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %9 = tail call noundef i32 @_ZN7cascadb4Node3refEv(ptr noundef nonnull align 8 dereferenceable(200) %3)
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %12, label %11

11:                                               ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i32 noundef 182, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE) #6
  unreachable

12:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #7
  call void @_ZN7cascadb5Cache8CacheKeyC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  %13 = invoke noundef zeroext i1 @_ZN7cascadb5Cache18get_table_settingsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS0_13TableSettingsE(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %14 unwind label %.loopexit.split-lp

14:                                               ; preds = %12
  br i1 %13, label %16, label %15

15:                                               ; preds = %14
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 187, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE) #6
  unreachable

.loopexit:                                        ; preds = %.preheader, %19, %22
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %38

.loopexit.split-lp:                               ; preds = %12, %16, %.loopexit10, %33, %35, %36
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %38

16:                                               ; preds = %14
  %17 = invoke noundef zeroext i1 @_ZN7cascadb5Cache10must_evictEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
          to label %18 unwind label %.loopexit.split-lp

18:                                               ; preds = %16
  br i1 %17, label %.preheader, label %.loopexit10

.preheader:                                       ; preds = %18, %22
  invoke void @_ZN7cascadb5Cache5evictEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
          to label %19 unwind label %.loopexit

19:                                               ; preds = %.preheader
  %20 = invoke noundef zeroext i1 @_ZN7cascadb5Cache10must_evictEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
          to label %21 unwind label %.loopexit

21:                                               ; preds = %19
  br i1 %20, label %22, label %.loopexit10

22:                                               ; preds = %21
  invoke void @_ZN7cascadb6usleepEj(i32 noundef 1000)
          to label %.preheader unwind label %.loopexit, !llvm.loop !5

.loopexit10:                                      ; preds = %21, %18
  %23 = getelementptr inbounds i8, ptr %0, i64 264
  invoke void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56) %23)
          to label %24 unwind label %.loopexit.split-lp

24:                                               ; preds = %.loopexit10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %25 = getelementptr inbounds i8, ptr %0, i64 320
  %26 = invoke ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE4findERS8_(ptr noundef nonnull align 8 dereferenceable(48) %25, ptr noundef nonnull align 8 dereferenceable(40) %5)
          to label %27 unwind label %31

27:                                               ; preds = %24
  store ptr %26, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %28 = call ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %25) #7
  store ptr %28, ptr %8, align 8
  %29 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br i1 %29, label %33, label %30

30:                                               ; preds = %27
  call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, i32 noundef 201, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb5Cache3putERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_4NodeE) #6
  unreachable

31:                                               ; preds = %24
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %38

33:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %34 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEEixERS8_(ptr noundef nonnull align 8 dereferenceable(48) %25, ptr noundef nonnull align 8 dereferenceable(40) %5)
          to label %35 unwind label %.loopexit.split-lp

35:                                               ; preds = %33
  store ptr %3, ptr %34, align 8, !tbaa !7
  invoke void @_ZN7cascadb4Node7inc_refEv(ptr noundef nonnull align 8 dereferenceable(200) %3)
          to label %36 unwind label %.loopexit.split-lp

36:                                               ; preds = %35
  invoke void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %23)
          to label %37 unwind label %.loopexit.split-lp

37:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  call void @_ZN7cascadb5Cache8CacheKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #7
  ret void

38:                                               ; preds = %.loopexit, %.loopexit.split-lp, %31
  %.pn = phi { ptr, i32 } [ %32, %31 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  call void @_ZN7cascadb5Cache8CacheKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #7
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb5Cache8CacheKeyC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb5Cache10must_evictEv(ptr noundef nonnull align 8 dereferenceable(432)) local_unnamed_addr #3 align 2

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

declare void @_ZN7cascadb6usleepEj(i32 noundef) local_unnamed_addr #2

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

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { noreturn nounwind }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}


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