; LLVM IR from weicao/cascadb :: src/tree/node.ll (ZN7cascadb9InnerNode13maybe_cascadeEv)

; 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::InnerNode" = type { %"class.cascadb::DataNode.base", i8, i64, ptr, %"class.cascadb::Slice", i32, i32, i32, i16, %"class.std::vector", i64, i64, i64 }
%"class.cascadb::DataNode.base" = type <{ %"class.cascadb::Node", ptr, i32 }>
%"class.cascadb::Node" = type { ptr, %"class.std::__cxx11::basic_string", i64, %"class.cascadb::Mutex", i8, i8, i8, %struct.timeval, %struct.timeval, i32, i32, %"class.cascadb::RWLock" }
%"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.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.timeval = type { i64, i64 }
%"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.cascadb::Slice" = type <{ ptr, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl" }
%"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl" = type { %"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cascadb::Pivot, std::allocator<cascadb::Pivot>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.cascadb::DataNode" = type <{ %"class.cascadb::Node", ptr, i32, [4 x i8] }>
%"class.cascadb::Tree" = type { %"class.std::__cxx11::basic_string", %"class.cascadb::Options", ptr, ptr, ptr, ptr, ptr, 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] }>

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv = external hidden unnamed_addr constant [41 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb9InnerNode13maybe_cascadeEv(ptr noundef nonnull align 8 dereferenceable(312) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 -1, ptr %3, align 4, !tbaa !9
  %9 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %8, i32 0, i32 11
  %10 = load i64, ptr %9, align 8, !tbaa !11
  %11 = getelementptr inbounds %"class.cascadb::DataNode", ptr %8, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !29
  %13 = getelementptr inbounds %"class.cascadb::Tree", ptr %12, i32 0, i32 1
  %14 = getelementptr inbounds %"class.cascadb::Options", ptr %13, i32 0, i32 6
  %15 = load i64, ptr %14, align 8, !tbaa !30
  %16 = icmp uge i64 %10, %15
  br i1 %16, label %17, label %19

17:                                               ; preds = %1
  %18 = call noundef i32 @_ZN7cascadb9InnerNode18find_msgbuf_maxcntEv(ptr noundef nonnull align 8 dereferenceable(312) %8)
  store i32 %18, ptr %3, align 4, !tbaa !9
  br label %34

19:                                               ; preds = %1
  %20 = load ptr, ptr %8, align 8, !tbaa !34
  %21 = getelementptr inbounds ptr, ptr %20, i64 2
  %22 = load ptr, ptr %21, align 8
  %23 = call noundef i64 %22(ptr noundef nonnull align 8 dereferenceable(312) %8)
  %24 = getelementptr inbounds %"class.cascadb::DataNode", ptr %8, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !29
  %26 = getelementptr inbounds %"class.cascadb::Tree", ptr %25, i32 0, i32 1
  %27 = getelementptr inbounds %"class.cascadb::Options", ptr %26, i32 0, i32 2
  %28 = load i64, ptr %27, align 8, !tbaa !36
  %29 = icmp uge i64 %23, %28
  br i1 %29, label %30, label %32

30:                                               ; preds = %19
  %31 = call noundef i32 @_ZN7cascadb9InnerNode17find_msgbuf_maxszEv(ptr noundef nonnull align 8 dereferenceable(312) %8)
  store i32 %31, ptr %3, align 4, !tbaa !9
  br label %33

32:                                               ; preds = %19
  call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %8)
  store i32 1, ptr %4, align 4
  br label %102

33:                                               ; preds = %30
  br label %34

34:                                               ; preds = %33, %17
  %35 = load i32, ptr %3, align 4, !tbaa !9
  %36 = icmp sge i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  br label %40

38:                                               ; preds = %34
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 324, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv) #6
  unreachable

39:                                               ; No predecessors!
  br label %40

40:                                               ; preds = %39, %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %41 = load i32, ptr %3, align 4, !tbaa !9
  %42 = call noundef ptr @_ZN7cascadb9InnerNode6msgbufEi(ptr noundef nonnull align 8 dereferenceable(312) %8, i32 noundef %41)
  store ptr %42, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %43 = load i32, ptr %3, align 4, !tbaa !9
  %44 = call noundef i64 @_ZN7cascadb9InnerNode5childEi(ptr noundef nonnull align 8 dereferenceable(312) %8, i32 noundef %43)
  store i64 %44, ptr %6, align 8, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  %45 = load i64, ptr %6, align 8, !tbaa !37
  %46 = icmp eq i64 %45, 0
  br i1 %46, label %47, label %61

47:                                               ; preds = %40
  %48 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %8, i32 0, i32 1
  %49 = load i8, ptr %48, align 4, !tbaa !38, !range !39, !noundef !40
  %50 = trunc i8 %49 to i1
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  br label %54

52:                                               ; preds = %47
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 331, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv) #6
  unreachable

53:                                               ; No predecessors!
  br label %54

54:                                               ; preds = %53, %51
  %55 = getelementptr inbounds %"class.cascadb::DataNode", ptr %8, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !29
  %57 = call noundef ptr @_ZN7cascadb4Tree13new_leaf_nodeEv(ptr noundef nonnull align 8 dereferenceable(184) %56)
  store ptr %57, ptr %7, align 8, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !9
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = call noundef i64 @_ZN7cascadb4Node3nidEv(ptr noundef nonnull align 8 dereferenceable(200) %59)
  call void @_ZN7cascadb9InnerNode9set_childEim(ptr noundef nonnull align 8 dereferenceable(312) %8, i32 noundef %58, i64 noundef %60)
  br label %66

61:                                               ; preds = %40
  %62 = getelementptr inbounds %"class.cascadb::DataNode", ptr %8, i32 0, i32 1
  %63 = load ptr, ptr %62, align 8, !tbaa !29
  %64 = load i64, ptr %6, align 8, !tbaa !37
  %65 = call noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184) %63, i64 noundef %64, i1 noundef zeroext false)
  store ptr %65, ptr %7, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %61, %54
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %66
  br label %72

70:                                               ; preds = %66
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 337, ptr noundef @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv) #6
  unreachable

71:                                               ; No predecessors!
  br label %72

72:                                               ; preds = %71, %69
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load ptr, ptr %73, align 8, !tbaa !34
  %76 = getelementptr inbounds ptr, ptr %75, i64 6
  %77 = load ptr, ptr %76, align 8
  %78 = call noundef zeroext i1 %77(ptr noundef nonnull align 8 dereferenceable(212) %73, ptr noundef %74, ptr noundef %8)
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7cascadb4Node7dec_refEv(ptr noundef nonnull align 8 dereferenceable(200) %79)
  call void @_ZN7cascadb4Node9read_lockEv(ptr noundef nonnull align 8 dereferenceable(200) %8)
  %80 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %8, i32 0, i32 11
  %81 = load i64, ptr %80, align 8, !tbaa !11
  %82 = getelementptr inbounds %"class.cascadb::DataNode", ptr %8, i32 0, i32 1
  %83 = load ptr, ptr %82, align 8, !tbaa !29
  %84 = getelementptr inbounds %"class.cascadb::Tree", ptr %83, i32 0, i32 1
  %85 = getelementptr inbounds %"class.cascadb::Options", ptr %84, i32 0, i32 6
  %86 = load i64, ptr %85, align 8, !tbaa !30
  %87 = icmp uge i64 %81, %86
  br i1 %87, label %99, label %88

88:                                               ; preds = %72
  %89 = load ptr, ptr %8, align 8, !tbaa !34
  %90 = getelementptr inbounds ptr, ptr %89, i64 2
  %91 = load ptr, ptr %90, align 8
  %92 = call noundef i64 %91(ptr noundef nonnull align 8 dereferenceable(312) %8)
  %93 = getelementptr inbounds %"class.cascadb::DataNode", ptr %8, i32 0, i32 1
  %94 = load ptr, ptr %93, align 8, !tbaa !29
  %95 = getelementptr inbounds %"class.cascadb::Tree", ptr %94, i32 0, i32 1
  %96 = getelementptr inbounds %"class.cascadb::Options", ptr %95, i32 0, i32 2
  %97 = load i64, ptr %96, align 8, !tbaa !36
  %98 = icmp uge i64 %92, %97
  br i1 %98, label %99, label %100

99:                                               ; preds = %88, %72
  call void @_ZN7cascadb9InnerNode13maybe_cascadeEv(ptr noundef nonnull align 8 dereferenceable(312) %8)
  br label %101

100:                                              ; preds = %88
  call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %8)
  br label %101

101:                                              ; preds = %100, %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  store i32 0, ptr %4, align 4
  br label %102

102:                                              ; preds = %101, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %103 = load i32, ptr %4, align 4
  switch i32 %103, label %105 [
    i32 0, label %104
    i32 1, label %104
  ]

104:                                              ; preds = %102, %102
  ret void

105:                                              ; preds = %102
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN7cascadb9InnerNode5childEi(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb9InnerNode9set_childEim(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef, i64 noundef) #3 align 2

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

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

declare noundef ptr @_ZN7cascadb4Tree13new_leaf_nodeEv(ptr noundef nonnull align 8 dereferenceable(184)) #4

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

declare noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184), i64 noundef, i1 noundef zeroext) #4

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

attributes #0 = { nocallback nofree nosync 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 = { 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = !{!"int", !7, i64 0}
!11 = !{!12, !17, i64 296}
!12 = !{!"_ZTSN7cascadb9InnerNodeE", !13, i64 0, !19, i64 212, !17, i64 216, !6, i64 224, !23, i64 232, !10, i64 248, !10, i64 252, !10, i64 256, !24, i64 260, !25, i64 264, !17, i64 288, !17, i64 296, !17, i64 304}
!13 = !{!"_ZTSN7cascadb8DataNodeE", !14, i64 0, !6, i64 200, !22, i64 208}
!14 = !{!"_ZTSN7cascadb4NodeE", !15, i64 8, !17, i64 40, !18, i64 48, !19, i64 96, !19, i64 97, !19, i64 98, !20, i64 104, !20, i64 120, !10, i64 136, !10, i64 140, !21, i64 144}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !17, i64 8, !7, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSN7cascadb5MutexE", !19, i64 0, !7, i64 8}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTS7timeval", !17, i64 0, !17, i64 8}
!21 = !{!"_ZTSN7cascadb6RWLockE", !7, i64 0}
!22 = !{!"_ZTSN7cascadb10NodeStatusE", !7, i64 0}
!23 = !{!"_ZTSN7cascadb5SliceE", !6, i64 0, !10, i64 8}
!24 = !{!"short", !7, i64 0}
!25 = !{!"_ZTSSt6vectorIN7cascadb5PivotESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIN7cascadb5PivotESaIS1_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!13, !6, i64 200}
!30 = !{!31, !17, i64 80}
!31 = !{!"_ZTSN7cascadb4TreeE", !15, i64 0, !32, i64 32, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!32 = !{!"_ZTSN7cascadb7OptionsE", !6, i64 0, !6, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !17, i64 48, !17, i64 56, !17, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !33, i64 96, !19, i64 100}
!33 = !{!"_ZTSN7cascadb8CompressE", !7, i64 0}
!34 = !{!35, !35, i64 0}
!35 = !{!"vtable pointer", !8, i64 0}
!36 = !{!31, !17, i64 48}
!37 = !{!17, !17, i64 0}
!38 = !{!12, !19, i64 212}
!39 = !{i8 0, i8 2}
!40 = !{}


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

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv = external hidden unnamed_addr constant [41 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cascadb9InnerNode13maybe_cascadeEv(ptr noundef nonnull align 8 dereferenceable(312) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 296
  %3 = getelementptr inbounds i8, ptr %0, i64 200
  %4 = getelementptr inbounds i8, ptr %0, i64 212
  %.pre = load ptr, ptr %3, align 8, !tbaa !5
  br label %tailrecurse

tailrecurse:                                      ; preds = %tailrecurse.backedge, %1
  %5 = phi ptr [ %.pre, %1 ], [ %.be, %tailrecurse.backedge ]
  %6 = load i64, ptr %2, align 8, !tbaa !20
  %7 = getelementptr inbounds i8, ptr %5, i64 80
  %8 = load i64, ptr %7, align 8, !tbaa !28
  %.not = icmp ult i64 %6, %8
  br i1 %.not, label %11, label %9

9:                                                ; preds = %tailrecurse
  %10 = tail call noundef i32 @_ZN7cascadb9InnerNode18find_msgbuf_maxcntEv(ptr noundef nonnull align 8 dereferenceable(312) %0)
  br label %21

11:                                               ; preds = %tailrecurse
  %12 = load ptr, ptr %0, align 8, !tbaa !32
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %14 = load ptr, ptr %13, align 8
  %15 = tail call noundef i64 %14(ptr noundef nonnull align 8 dereferenceable(312) %0)
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 48
  %18 = load i64, ptr %17, align 8, !tbaa !34
  %.not13 = icmp ult i64 %15, %18
  br i1 %.not13, label %58, label %19

19:                                               ; preds = %11
  %20 = tail call noundef i32 @_ZN7cascadb9InnerNode17find_msgbuf_maxszEv(ptr noundef nonnull align 8 dereferenceable(312) %0)
  br label %21

21:                                               ; preds = %19, %9
  %.011 = phi i32 [ %10, %9 ], [ %20, %19 ]
  %22 = icmp sgt i32 %.011, -1
  br i1 %22, label %24, label %23

23:                                               ; preds = %21
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 324, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv) #4
  unreachable

24:                                               ; preds = %21
  %25 = tail call noundef ptr @_ZN7cascadb9InnerNode6msgbufEi(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %.011)
  %26 = tail call noundef i64 @_ZN7cascadb9InnerNode5childEi(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %.011)
  %27 = icmp eq i64 %26, 0
  br i1 %27, label %28, label %36

28:                                               ; preds = %24
  %29 = load i8, ptr %4, align 4, !tbaa !35, !range !36, !noundef !37
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %32, label %31

31:                                               ; preds = %28
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 331, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv) #4
  unreachable

32:                                               ; preds = %28
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = tail call noundef ptr @_ZN7cascadb4Tree13new_leaf_nodeEv(ptr noundef nonnull align 8 dereferenceable(184) %33)
  %35 = tail call noundef i64 @_ZN7cascadb4Node3nidEv(ptr noundef nonnull align 8 dereferenceable(200) %34)
  tail call void @_ZN7cascadb9InnerNode9set_childEim(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %.011, i64 noundef %35)
  br label %39

36:                                               ; preds = %24
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = tail call noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184) %37, i64 noundef %26, i1 noundef zeroext false)
  br label %39

39:                                               ; preds = %36, %32
  %.0 = phi ptr [ %34, %32 ], [ %38, %36 ]
  %.not14 = icmp eq ptr %.0, null
  br i1 %.not14, label %40, label %41

40:                                               ; preds = %39
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 337, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7cascadb9InnerNode13maybe_cascadeEv) #4
  unreachable

41:                                               ; preds = %39
  %42 = load ptr, ptr %.0, align 8, !tbaa !32
  %43 = getelementptr inbounds i8, ptr %42, i64 48
  %44 = load ptr, ptr %43, align 8
  %45 = tail call noundef zeroext i1 %44(ptr noundef nonnull align 8 dereferenceable(212) %.0, ptr noundef %25, ptr noundef nonnull %0)
  tail call void @_ZN7cascadb4Node7dec_refEv(ptr noundef nonnull align 8 dereferenceable(200) %.0)
  tail call void @_ZN7cascadb4Node9read_lockEv(ptr noundef nonnull align 8 dereferenceable(200) %0)
  %46 = load i64, ptr %2, align 8, !tbaa !20
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 80
  %49 = load i64, ptr %48, align 8, !tbaa !28
  %.not15 = icmp ult i64 %46, %49
  br i1 %.not15, label %50, label %tailrecurse.backedge

50:                                               ; preds = %41
  %51 = load ptr, ptr %0, align 8, !tbaa !32
  %52 = getelementptr inbounds i8, ptr %51, i64 16
  %53 = load ptr, ptr %52, align 8
  %54 = tail call noundef i64 %53(ptr noundef nonnull align 8 dereferenceable(312) %0)
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 48
  %57 = load i64, ptr %56, align 8, !tbaa !34
  %.not16 = icmp ult i64 %54, %57
  br i1 %.not16, label %58, label %tailrecurse.backedge

tailrecurse.backedge:                             ; preds = %50, %41
  %.be = phi ptr [ %55, %50 ], [ %47, %41 ]
  br label %tailrecurse

58:                                               ; preds = %50, %11
  tail call void @_ZN7cascadb4Node6unlockEv(ptr noundef nonnull align 8 dereferenceable(200) %0)
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7cascadb9InnerNode6msgbufEi(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb9InnerNode9set_childEim(ptr noundef nonnull align 8 dereferenceable(312), i32 noundef, i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7cascadb9InnerNode18find_msgbuf_maxcntEv(ptr noundef nonnull align 8 dereferenceable(312)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7cascadb9InnerNode17find_msgbuf_maxszEv(ptr noundef nonnull align 8 dereferenceable(312)) local_unnamed_addr #1 align 2

declare noundef ptr @_ZN7cascadb4Tree13new_leaf_nodeEv(ptr noundef nonnull align 8 dereferenceable(184)) local_unnamed_addr #3

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

declare noundef ptr @_ZN7cascadb4Tree9load_nodeEmb(ptr noundef nonnull align 8 dereferenceable(184), i64 noundef, i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb4Node7dec_refEv(ptr noundef nonnull align 8 dereferenceable(200)) local_unnamed_addr #1 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 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 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 = { "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 }

!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, !10, i64 200}
!6 = !{!"_ZTSN7cascadb8DataNodeE", !7, i64 0, !10, i64 200, !19, i64 208}
!7 = !{!"_ZTSN7cascadb4NodeE", !8, i64 8, !13, i64 40, !14, i64 48, !15, i64 96, !15, i64 97, !15, i64 98, !16, i64 104, !16, i64 120, !17, i64 136, !17, i64 140, !18, i64 144}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !9, i64 0, !13, i64 8, !11, i64 16}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"long", !11, i64 0}
!14 = !{!"_ZTSN7cascadb5MutexE", !15, i64 0, !11, i64 8}
!15 = !{!"bool", !11, i64 0}
!16 = !{!"_ZTS7timeval", !13, i64 0, !13, i64 8}
!17 = !{!"int", !11, i64 0}
!18 = !{!"_ZTSN7cascadb6RWLockE", !11, i64 0}
!19 = !{!"_ZTSN7cascadb10NodeStatusE", !11, i64 0}
!20 = !{!21, !13, i64 296}
!21 = !{!"_ZTSN7cascadb9InnerNodeE", !6, i64 0, !15, i64 212, !13, i64 216, !10, i64 224, !22, i64 232, !17, i64 248, !17, i64 252, !17, i64 256, !23, i64 260, !24, i64 264, !13, i64 288, !13, i64 296, !13, i64 304}
!22 = !{!"_ZTSN7cascadb5SliceE", !10, i64 0, !17, i64 8}
!23 = !{!"short", !11, i64 0}
!24 = !{!"_ZTSSt6vectorIN7cascadb5PivotESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIN7cascadb5PivotESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN7cascadb5PivotESaIS1_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!28 = !{!29, !13, i64 80}
!29 = !{!"_ZTSN7cascadb4TreeE", !8, i64 0, !30, i64 32, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176}
!30 = !{!"_ZTSN7cascadb7OptionsE", !10, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !17, i64 72, !17, i64 76, !17, i64 80, !17, i64 84, !17, i64 88, !17, i64 92, !31, i64 96, !15, i64 100}
!31 = !{!"_ZTSN7cascadb8CompressE", !11, i64 0}
!32 = !{!33, !33, i64 0}
!33 = !{!"vtable pointer", !12, i64 0}
!34 = !{!29, !13, i64 48}
!35 = !{!21, !15, i64 212}
!36 = !{i8 0, i8 2}
!37 = !{}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass