; 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"

%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.cascadb::ScopedMutex" = type { i8, ptr }
%"struct.std::_Rb_tree_iterator.12" = type { ptr }
%"class.cascadb::LoggerFormat" = type { ptr, %"class.std::__cxx11::basic_ostringstream" }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { 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] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"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 }
%"struct.std::pair" = type { %"class.cascadb::Cache::CacheKey", ptr }
%"class.cascadb::Cache::CacheKey" = type { %"class.std::__cxx11::basic_string", i64 }

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@_ZN7cascadb14g_logger_levelE = external global i32, align 4
@_ZN7cascadb8g_loggerE = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb5Cache9del_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb = external hidden unnamed_addr constant [58 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [17 x i8], align 1

; 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) #0

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef) unnamed_addr #4 align 2

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

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #6

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb5Cache11flush_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(432), ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #4 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb5Cache9del_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i1 noundef zeroext %2) #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %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
  %12 = alloca i64, align 8
  %13 = alloca %"class.cascadb::ScopedMutex", align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %17 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %18 = alloca ptr, align 8
  %19 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %20 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %21 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %22 = alloca %"class.cascadb::LoggerFormat", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %23 = zext i1 %2 to i8
  store i8 %23, ptr %6, align 1, !tbaa !9
  %24 = load ptr, ptr %4, align 8
  %25 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %29

27:                                               ; preds = %3
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN7cascadb5Cache11flush_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(432) %24, ptr noundef nonnull align 8 dereferenceable(32) %28)
  br label %29

29:                                               ; preds = %27, %3
  %30 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 1
  call void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56) %30)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %31 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 2
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsESt4lessIS5_ESaISt4pairIKS5_S8_EEE4findERSC_(ptr noundef nonnull align 8 dereferenceable(48) %31, ptr noundef nonnull align 8 dereferenceable(32) %32)
  %34 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %7, i32 0, i32 0
  store ptr %33, ptr %34, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %35 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 2
  %36 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsESt4lessIS5_ESaISt4pairIKS5_S8_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %35) #9
  %37 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %8, i32 0, i32 0
  store ptr %36, ptr %37, align 8
  %38 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsEEESE_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  br i1 %38, label %39, label %41

39:                                               ; preds = %29
  %40 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 1
  call void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %40)
  store i32 1, ptr %9, align 4
  br label %154

41:                                               ; preds = %29
  %42 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %7, i64 8, i1 false), !tbaa.struct !13
  %43 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8
  %45 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsESt4lessIS5_ESaISt4pairIKS5_S8_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISD_E(ptr noundef nonnull align 8 dereferenceable(48) %42, ptr %44)
  %46 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %11, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  %47 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 1
  call void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %47)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  store i64 0, ptr %12, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #9
  %48 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 7
  call void @_ZN7cascadb11ScopedMutexC2EPNS_5MutexE(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef %48)
  %49 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 5
  invoke void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56) %49)
          to label %50 unwind label %60

50:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %51 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 6
  %52 = call ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %51) #9
  %53 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.12", ptr %16, i32 0, i32 0
  store ptr %52, ptr %53, align 8
  br label %54

54:                                               ; preds = %102, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %55 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 6
  %56 = call ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %55) #9
  %57 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.12", ptr %17, i32 0, i32 0
  store ptr %56, ptr %57, align 8
  %58 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br i1 %58, label %64, label %59

59:                                               ; preds = %54
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  br label %105

60:                                               ; preds = %107, %105, %41
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %14, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %15, align 4
  br label %157

64:                                               ; preds = %54
  %65 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #9
  %66 = getelementptr inbounds %"struct.std::pair", ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %"class.cascadb::Cache::CacheKey", ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = call noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32) %67, ptr noundef nonnull align 8 dereferenceable(32) %68) #9
  br i1 %69, label %70, label %101

70:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %71 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #9
  %72 = getelementptr inbounds %"struct.std::pair", ptr %71, i32 0, i32 1
  %73 = load ptr, ptr %72, align 8, !tbaa !16
  store ptr %73, ptr %18, align 8, !tbaa !5
  %74 = load ptr, ptr %18, align 8, !tbaa !5
  %75 = invoke noundef i32 @_ZN7cascadb4Node3refEv(ptr noundef nonnull align 8 dereferenceable(200) %74)
          to label %76 unwind label %80

76:                                               ; preds = %70
  %77 = icmp eq i32 %75, 0
  br i1 %77, label %78, label %79

78:                                               ; preds = %76
  br label %85

79:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.1, i32 noundef 166, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb5Cache9del_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb) #10
  unreachable

80:                                               ; preds = %92, %70
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %14, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  br label %157

84:                                               ; No predecessors!
  br label %85

85:                                               ; preds = %84, %78
  %86 = load ptr, ptr %18, align 8, !tbaa !5
  %87 = icmp eq ptr %86, null
  br i1 %87, label %92, label %88

88:                                               ; preds = %85
  %89 = load ptr, ptr %86, align 8, !tbaa !21
  %90 = getelementptr inbounds ptr, ptr %89, i64 1
  %91 = load ptr, ptr %90, align 8
  call void %91(ptr noundef nonnull align 8 dereferenceable(200) %86) #9
  br label %92

92:                                               ; preds = %88, %85
  %93 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %16, i64 8, i1 false), !tbaa.struct !13
  %94 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.12", ptr %19, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8
  %96 = invoke ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS9_E(ptr noundef nonnull align 8 dereferenceable(48) %93, ptr %95)
          to label %97 unwind label %80

97:                                               ; preds = %92
  %98 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.12", ptr %20, i32 0, i32 0
  store ptr %96, ptr %98, align 8
  %99 = load i64, ptr %12, align 8, !tbaa !14
  %100 = add i64 %99, 1
  store i64 %100, ptr %12, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %101

101:                                              ; preds = %97, %64
  br label %102

102:                                              ; preds = %101
  %103 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %16, i32 noundef 0) #9
  %104 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.12", ptr %21, i32 0, i32 0
  store ptr %103, ptr %104, align 8
  br label %54, !llvm.loop !23

105:                                              ; preds = %59
  %106 = getelementptr inbounds %"class.cascadb::Cache", ptr %24, i32 0, i32 5
  invoke void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %106)
          to label %107 unwind label %60

107:                                              ; preds = %105
  invoke void @_ZN7cascadb11ScopedMutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %108 unwind label %60

108:                                              ; preds = %107
  %109 = load i32, ptr @_ZN7cascadb14g_logger_levelE, align 4, !tbaa !25
  %110 = icmp sge i32 1, %109
  br i1 %110, label %111, label %153

111:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 384, ptr %22) #9
  %112 = load ptr, ptr @_ZN7cascadb8g_loggerE, align 8, !tbaa !5
  invoke void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384) %22, ptr noundef %112)
          to label %113 unwind label %144

113:                                              ; preds = %111
  %114 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7cascadb12LoggerFormat3getENS_11LoggerLevelE(ptr noundef nonnull align 8 dereferenceable(384) %22, i32 noundef 1)
          to label %115 unwind label %148

115:                                              ; preds = %113
  %116 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef @.str.2)
          to label %117 unwind label %148

117:                                              ; preds = %115
  %118 = call noundef ptr @strrchr(ptr noundef @.str.1, i32 noundef 47) #11
  %119 = icmp ne ptr %118, null
  br i1 %119, label %120, label %123

120:                                              ; preds = %117
  %121 = call noundef ptr @strrchr(ptr noundef @.str.1, i32 noundef 47) #11
  %122 = getelementptr inbounds i8, ptr %121, i64 1
  br label %124

123:                                              ; preds = %117
  br label %124

124:                                              ; preds = %123, %120
  %125 = phi ptr [ %122, %120 ], [ @.str.1, %123 ]
  %126 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %116, ptr noundef %125)
          to label %127 unwind label %148

127:                                              ; preds = %124
  %128 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %126, ptr noundef @.str.3)
          to label %129 unwind label %148

129:                                              ; preds = %127
  %130 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %128, i32 noundef 177)
          to label %131 unwind label %148

131:                                              ; preds = %129
  %132 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %130, ptr noundef @.str.2)
          to label %133 unwind label %148

133:                                              ; preds = %131
  %134 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef @.str.15)
          to label %135 unwind label %148

135:                                              ; preds = %133
  %136 = load i64, ptr %12, align 8, !tbaa !14
  %137 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %134, i64 noundef %136)
          to label %138 unwind label %148

138:                                              ; preds = %135
  %139 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %137, ptr noundef @.str.16)
          to label %140 unwind label %148

140:                                              ; preds = %138
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef nonnull align 8 dereferenceable(32) %141)
          to label %143 unwind label %148

143:                                              ; preds = %140
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %22) #9
  call void @llvm.lifetime.end.p0(i64 384, ptr %22) #9
  br label %153

144:                                              ; preds = %111
  %145 = landingpad { ptr, i32 }
          cleanup
  %146 = extractvalue { ptr, i32 } %145, 0
  store ptr %146, ptr %14, align 8
  %147 = extractvalue { ptr, i32 } %145, 1
  store i32 %147, ptr %15, align 4
  br label %152

148:                                              ; preds = %140, %138, %135, %133, %131, %129, %127, %124, %115, %113
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %14, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %15, align 4
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %22) #9
  br label %152

152:                                              ; preds = %148, %144
  call void @llvm.lifetime.end.p0(i64 384, ptr %22) #9
  br label %157

153:                                              ; preds = %143, %108
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  store i32 0, ptr %9, align 4
  br label %154

154:                                              ; preds = %153, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  %155 = load i32, ptr %9, align 4
  switch i32 %155, label %163 [
    i32 0, label %156
    i32 1, label %156
  ]

156:                                              ; preds = %154, %154
  ret void

157:                                              ; preds = %152, %80, %60
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  br label %158

158:                                              ; preds = %157
  %159 = load ptr, ptr %14, align 8
  %160 = load i32, ptr %15, align 4
  %161 = insertvalue { ptr, i32 } poison, ptr %159, 0
  %162 = insertvalue { ptr, i32 } %161, i32 %160, 1
  resume { ptr, i32 } %162

163:                                              ; preds = %154
  unreachable
}

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

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

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

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

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{i64 0, i64 8, !5}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !6, i64 40}
!17 = !{!"_ZTSSt4pairIKN7cascadb5Cache8CacheKeyEPNS0_4NodeEE", !18, i64 0, !6, i64 40}
!18 = !{!"_ZTSN7cascadb5Cache8CacheKeyE", !19, i64 0, !15, i64 32}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !15, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"vtable pointer", !8, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!26, !26, i64 0}
!26 = !{!"_ZTSN7cascadb11LoggerLevelE", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.cascadb::ScopedMutex" = type { i8, ptr }
%"struct.std::_Rb_tree_iterator.12" = type { ptr }
%"class.cascadb::LoggerFormat" = type { ptr, %"class.std::__cxx11::basic_ostringstream" }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { 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] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@_ZN7cascadb14g_logger_levelE = external local_unnamed_addr global i32, align 4
@_ZN7cascadb8g_loggerE = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb5Cache9del_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb = external hidden unnamed_addr constant [58 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [17 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #5

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #7

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb5Cache9del_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i1 noundef zeroext %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = alloca %"class.cascadb::ScopedMutex", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator.12", align 8
  %9 = alloca %"class.cascadb::LoggerFormat", align 8
  br i1 %2, label %10, label %11

10:                                               ; preds = %3
  tail call void @_ZN7cascadb5Cache11flush_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(32) %1)
  br label %11

11:                                               ; preds = %10, %3
  %12 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56) %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %13 = getelementptr inbounds i8, ptr %0, i64 160
  %14 = tail call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsESt4lessIS5_ESaISt4pairIKS5_S8_EEE4findERSC_(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr noundef nonnull align 8 dereferenceable(32) %1)
  store ptr %14, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %15 = tail call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsESt4lessIS5_ESaISt4pairIKS5_S8_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  store ptr %15, ptr %5, align 8
  %16 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsEEESE_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br i1 %16, label %17, label %18

17:                                               ; preds = %11
  call void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %12)
  br label %87

18:                                               ; preds = %11
  %.sroa.08.0.copyload = load ptr, ptr %4, align 8, !tbaa !5
  %19 = call ptr @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN7cascadb5Cache13TableSettingsESt4lessIS5_ESaISt4pairIKS5_S8_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorISD_E(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr %.sroa.08.0.copyload)
  call void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %12)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  %20 = getelementptr inbounds i8, ptr %0, i64 368
  call void @_ZN7cascadb11ScopedMutexC2EPNS_5MutexE(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull %20)
  %21 = getelementptr inbounds i8, ptr %0, i64 264
  invoke void @_ZN7cascadb6RWLock10write_lockEv(ptr noundef nonnull align 8 dereferenceable(56) %21)
          to label %22 unwind label %27

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %23 = getelementptr inbounds i8, ptr %0, i64 320
  %24 = call ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %23) #8
  store ptr %24, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %25 = call ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %23) #8
  store ptr %25, ptr %8, align 8
  %26 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br i1 %26, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %48, %22
  %.0.lcssa = phi i64 [ 0, %22 ], [ %.1, %48 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  invoke void @_ZN7cascadb6RWLock6unlockEv(ptr noundef nonnull align 8 dereferenceable(56) %21)
          to label %52 unwind label %27

27:                                               ; preds = %52, %._crit_edge, %18
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %88

.lr.ph:                                           ; preds = %22, %48
  %.025 = phi i64 [ %.1, %48 ], [ 0, %22 ]
  %29 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %30 = call noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32) %29, ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  br i1 %30, label %31, label %48

31:                                               ; preds = %.lr.ph
  %32 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %33 = getelementptr inbounds i8, ptr %32, i64 40
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = invoke noundef i32 @_ZN7cascadb4Node3refEv(ptr noundef nonnull align 8 dereferenceable(200) %34)
          to label %36 unwind label %39

36:                                               ; preds = %31
  %37 = icmp eq i32 %35, 0
  br i1 %37, label %41, label %38

38:                                               ; preds = %36
  call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i32 noundef 166, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb5Cache9del_tableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb) #9
  unreachable

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

41:                                               ; preds = %36
  %42 = load ptr, ptr %34, align 8, !tbaa !15
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  %44 = load ptr, ptr %43, align 8
  call void %44(ptr noundef nonnull align 8 dereferenceable(200) %34) #8
  %.sroa.02.0.copyload = load ptr, ptr %7, align 8, !tbaa !5
  %45 = invoke ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS9_E(ptr noundef nonnull align 8 dereferenceable(48) %23, ptr %.sroa.02.0.copyload)
          to label %46 unwind label %39

46:                                               ; preds = %41
  %47 = add i64 %.025, 1
  br label %48

48:                                               ; preds = %.lr.ph, %46
  %.1 = phi i64 [ %47, %46 ], [ %.025, %.lr.ph ]
  %49 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %50 = call ptr @_ZNSt3mapIN7cascadb5Cache8CacheKeyEPNS0_4NodeESt4lessIS2_ESaISt4pairIKS2_S4_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %23) #8
  store ptr %50, ptr %8, align 8
  %51 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKN7cascadb5Cache8CacheKeyEPNS1_4NodeEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br i1 %51, label %.lr.ph, label %._crit_edge, !llvm.loop !17

52:                                               ; preds = %._crit_edge
  invoke void @_ZN7cascadb11ScopedMutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %53 unwind label %27

53:                                               ; preds = %52
  %54 = load i32, ptr @_ZN7cascadb14g_logger_levelE, align 4, !tbaa !19
  %55 = icmp slt i32 %54, 2
  br i1 %55, label %56, label %86

56:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 384, ptr nonnull %9) #8
  %57 = load ptr, ptr @_ZN7cascadb8g_loggerE, align 8, !tbaa !5
  invoke void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384) %9, ptr noundef %57)
          to label %58 unwind label %81

58:                                               ; preds = %56
  %59 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7cascadb12LoggerFormat3getENS_11LoggerLevelE(ptr noundef nonnull align 8 dereferenceable(384) %9, i32 noundef 1)
          to label %60 unwind label %83

60:                                               ; preds = %58
  %61 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %59, ptr noundef nonnull @.str.2)
          to label %62 unwind label %83

62:                                               ; preds = %60
  %63 = call noundef ptr @strrchr(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 47) #10
  %.not = icmp eq ptr %63, null
  %64 = getelementptr inbounds i8, ptr %63, i64 1
  %spec.select = select i1 %.not, ptr @.str.1, ptr %64
  %65 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %61, ptr noundef nonnull %spec.select)
          to label %66 unwind label %83

66:                                               ; preds = %62
  %67 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef nonnull @.str.3)
          to label %68 unwind label %83

68:                                               ; preds = %66
  %69 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %67, i32 noundef 177)
          to label %70 unwind label %83

70:                                               ; preds = %68
  %71 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %69, ptr noundef nonnull @.str.2)
          to label %72 unwind label %83

72:                                               ; preds = %70
  %73 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %71, ptr noundef nonnull @.str.15)
          to label %74 unwind label %83

74:                                               ; preds = %72
  %75 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %73, i64 noundef %.0.lcssa)
          to label %76 unwind label %83

76:                                               ; preds = %74
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull @.str.16)
          to label %78 unwind label %83

78:                                               ; preds = %76
  %79 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %80 unwind label %83

80:                                               ; preds = %78
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %9) #8
  call void @llvm.lifetime.end.p0(i64 384, ptr nonnull %9) #8
  br label %86

81:                                               ; preds = %56
  %82 = landingpad { ptr, i32 }
          cleanup
  br label %85

83:                                               ; preds = %78, %76, %74, %72, %70, %68, %66, %62, %60, %58
  %84 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %9) #8
  br label %85

85:                                               ; preds = %83, %81
  %.pn = phi { ptr, i32 } [ %84, %83 ], [ %82, %81 ]
  call void @llvm.lifetime.end.p0(i64 384, ptr nonnull %9) #8
  br label %88

86:                                               ; preds = %80, %53
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  br label %87

87:                                               ; preds = %86, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  ret void

88:                                               ; preds = %85, %39, %27
  %.pn21 = phi { ptr, i32 } [ %40, %39 ], [ %.pn, %85 ], [ %28, %27 ]
  call void @_ZN7cascadb11ScopedMutexD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn21
}

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

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nofree nounwind willreturn memory(argmem: read) "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 = { "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 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind willreturn memory(read) }

!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, !6, i64 40}
!10 = !{!"_ZTSSt4pairIKN7cascadb5Cache8CacheKeyEPNS0_4NodeEE", !11, i64 0, !6, i64 40}
!11 = !{!"_ZTSN7cascadb5Cache8CacheKeyE", !12, i64 0, !14, i64 32}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !20, i64 0}
!20 = !{!"_ZTSN7cascadb11LoggerLevelE", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass