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

; 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::Slice" = type <{ ptr, i32, [4 x i8] }>
%"class.cascadb::DataNode" = type <{ %"class.cascadb::Node", ptr, i32, [4 x i8] }>
%"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::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] }>
%"class.cascadb::LeafNode" = type { %"class.cascadb::DataNode.base", i8, i64, i64, i64, %"class.std::vector.8", %"class.cascadb::RecordBuckets" }
%"class.cascadb::DataNode.base" = type <{ %"class.cascadb::Node", ptr, i32 }>
%"class.std::vector.8" = type { %"struct.std::_Vector_base.9" }
%"struct.std::_Vector_base.9" = type { %"struct.std::_Vector_base<cascadb::LeafNode::BucketInfo, std::allocator<cascadb::LeafNode::BucketInfo>>::_Vector_impl" }
%"struct.std::_Vector_base<cascadb::LeafNode::BucketInfo, std::allocator<cascadb::LeafNode::BucketInfo>>::_Vector_impl" = type { %"struct.std::_Vector_base<cascadb::LeafNode::BucketInfo, std::allocator<cascadb::LeafNode::BucketInfo>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cascadb::LeafNode::BucketInfo, std::allocator<cascadb::LeafNode::BucketInfo>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.cascadb::RecordBuckets" = type { i64, %"class.std::vector.13", i64, i64, i64 }
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<cascadb::RecordBuckets::RecordBucketInfo, std::allocator<cascadb::RecordBuckets::RecordBucketInfo>>::_Vector_impl" }
%"struct.std::_Vector_base<cascadb::RecordBuckets::RecordBucketInfo, std::allocator<cascadb::RecordBuckets::RecordBucketInfo>>::_Vector_impl" = type { %"struct.std::_Vector_base<cascadb::RecordBuckets::RecordBucketInfo, std::allocator<cascadb::RecordBuckets::RecordBucketInfo>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cascadb::RecordBuckets::RecordBucketInfo, std::allocator<cascadb::RecordBuckets::RecordBucketInfo>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.cascadb::LeafNode::BucketInfo" = type <{ %"class.cascadb::Slice", %"class.cascadb::Slice", i32, i32, i32, i16, [2 x i8] }>

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i32 } @_ZN7cascadb5Slice5allocEm(i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb11BlockReader4seekEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb8LeafNode16load_all_bucketsERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(320) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.cascadb::Slice", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.cascadb::Slice", align 8
  %9 = alloca { ptr, i32 }, align 8
  %10 = alloca i8, align 1
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca %"class.cascadb::Slice", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  call void @_ZN7cascadb5SliceC2Ev(ptr noundef nonnull align 8 dereferenceable(12) %5)
  %16 = getelementptr inbounds %"class.cascadb::DataNode", ptr %15, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %"class.cascadb::Tree", ptr %17, i32 0, i32 5
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %51

21:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !25
  br label %22

22:                                               ; preds = %45, %21
  %23 = load i64, ptr %7, align 8, !tbaa !25
  %24 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 5
  %25 = call noundef i64 @_ZNKSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #7
  %26 = icmp ult i64 %23, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %48

28:                                               ; preds = %22
  %29 = load i64, ptr %6, align 8, !tbaa !25
  %30 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 5
  %31 = load i64, ptr %7, align 8, !tbaa !25
  %32 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %31) #7
  %33 = getelementptr inbounds %"struct.cascadb::LeafNode::BucketInfo", ptr %32, i32 0, i32 4
  %34 = load i32, ptr %33, align 8, !tbaa !26
  %35 = zext i32 %34 to i64
  %36 = icmp ult i64 %29, %35
  br i1 %36, label %37, label %44

37:                                               ; preds = %28
  %38 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 5
  %39 = load i64, ptr %7, align 8, !tbaa !25
  %40 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %39) #7
  %41 = getelementptr inbounds %"struct.cascadb::LeafNode::BucketInfo", ptr %40, i32 0, i32 4
  %42 = load i32, ptr %41, align 8, !tbaa !26
  %43 = zext i32 %42 to i64
  store i64 %43, ptr %6, align 8, !tbaa !25
  br label %44

44:                                               ; preds = %37, %28
  br label %45

45:                                               ; preds = %44
  %46 = load i64, ptr %7, align 8, !tbaa !25
  %47 = add i64 %46, 1
  store i64 %47, ptr %7, align 8, !tbaa !25
  br label %22, !llvm.loop !30

48:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  %49 = load i64, ptr %6, align 8, !tbaa !25
  %50 = call { ptr, i32 } @_ZN7cascadb5Slice5allocEm(i64 noundef %49)
  store { ptr, i32 } %50, ptr %9, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %9, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %8, i64 12, i1 false), !tbaa.struct !32
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %51

51:                                               ; preds = %48, %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #7
  store i8 1, ptr %10, align 1, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !25
  br label %52

52:                                               ; preds = %98, %51
  %53 = load i64, ptr %11, align 8, !tbaa !25
  %54 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 5
  %55 = call noundef i64 @_ZNKSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %54) #7
  %56 = icmp ult i64 %53, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %52
  store i32 5, ptr %12, align 4
  br label %101

58:                                               ; preds = %52
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 5
  %61 = load i64, ptr %11, align 8, !tbaa !25
  %62 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef %61) #7
  %63 = getelementptr inbounds %"struct.cascadb::LeafNode::BucketInfo", ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 8, !tbaa !35
  %65 = zext i32 %64 to i64
  call void @_ZN7cascadb11BlockReader4seekEm(ptr noundef nonnull align 8 dereferenceable(16) %59, i64 noundef %65)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %66 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #8
  call void @llvm.memset.p0.i64(ptr align 16 %66, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIN7cascadb6RecordESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %66) #7
  store ptr %66, ptr %13, align 8, !tbaa !5
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %58
  store i8 0, ptr %10, align 1, !tbaa !34
  store i32 5, ptr %12, align 4
  br label %95

70:                                               ; preds = %58
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 5
  %73 = load i64, ptr %11, align 8, !tbaa !25
  %74 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %72, i64 noundef %73) #7
  %75 = getelementptr inbounds %"struct.cascadb::LeafNode::BucketInfo", ptr %74, i32 0, i32 3
  %76 = load i32, ptr %75, align 4, !tbaa !36
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 5
  %79 = load i64, ptr %11, align 8, !tbaa !25
  %80 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %78, i64 noundef %79) #7
  %81 = getelementptr inbounds %"struct.cascadb::LeafNode::BucketInfo", ptr %80, i32 0, i32 4
  %82 = load i32, ptr %81, align 8, !tbaa !26
  %83 = zext i32 %82 to i64
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %5, i64 16, i1 false), !tbaa.struct !32
  %85 = call noundef zeroext i1 @_ZN7cascadb8LeafNode11read_bucketERNS_11BlockReaderEmmPSt6vectorINS_6RecordESaIS4_EENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(320) %15, ptr noundef nonnull align 8 dereferenceable(16) %71, i64 noundef %77, i64 noundef %83, ptr noundef %84, ptr noundef byval(%"class.cascadb::Slice") align 8 %14)
  br i1 %85, label %91, label %86

86:                                               ; preds = %70
  store i8 0, ptr %10, align 1, !tbaa !34
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = icmp eq ptr %87, null
  br i1 %88, label %90, label %89

89:                                               ; preds = %86
  call void @_ZNSt6vectorIN7cascadb6RecordESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %87) #7
  call void @_ZdlPvm(ptr noundef %87, i64 noundef 24) #9
  br label %90

90:                                               ; preds = %89, %86
  store i32 5, ptr %12, align 4
  br label %95

91:                                               ; preds = %70
  %92 = getelementptr inbounds %"class.cascadb::LeafNode", ptr %15, i32 0, i32 6
  %93 = load i64, ptr %11, align 8, !tbaa !25
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN7cascadb13RecordBuckets10set_bucketEmPSt6vectorINS_6RecordESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(56) %92, i64 noundef %93, ptr noundef %94)
  store i32 0, ptr %12, align 4
  br label %95

95:                                               ; preds = %91, %90, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %96 = load i32, ptr %12, align 4
  switch i32 %96, label %101 [
    i32 0, label %97
  ]

97:                                               ; preds = %95
  br label %98

98:                                               ; preds = %97
  %99 = load i64, ptr %11, align 8, !tbaa !25
  %100 = add i64 %99, 1
  store i64 %100, ptr %11, align 8, !tbaa !25
  br label %52, !llvm.loop !37

101:                                              ; preds = %95, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %102

102:                                              ; preds = %101
  %103 = call noundef i64 @_ZNK7cascadb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(12) %5)
  %104 = icmp ne i64 %103, 0
  br i1 %104, label %105, label %106

105:                                              ; preds = %102
  call void @_ZN7cascadb5Slice7destroyEv(ptr noundef nonnull align 8 dereferenceable(12) %5)
  br label %106

106:                                              ; preds = %105, %102
  %107 = getelementptr inbounds %"class.cascadb::DataNode", ptr %15, i32 0, i32 2
  store i32 3, ptr %107, align 8, !tbaa !38
  %108 = load i8, ptr %10, align 1, !tbaa !34, !range !39, !noundef !40
  %109 = trunc i8 %108 to i1
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  ret i1 %109
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb8LeafNode11read_bucketERNS_11BlockReaderEmmPSt6vectorINS_6RecordESaIS4_EENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(320), ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef, ptr noundef, ptr noundef byval(%"class.cascadb::Slice") align 8) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb13RecordBuckets10set_bucketEmPSt6vectorINS_6RecordESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, ptr noundef) #2 align 2

attributes #0 = { nobuiltin 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 = { 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 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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, !6, i64 200}
!10 = !{!"_ZTSN7cascadb8DataNodeE", !11, i64 0, !6, i64 200, !20, i64 208}
!11 = !{!"_ZTSN7cascadb4NodeE", !12, i64 8, !14, i64 40, !15, i64 48, !16, i64 96, !16, i64 97, !16, i64 98, !17, i64 104, !17, i64 120, !18, i64 136, !18, i64 140, !19, i64 144}
!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 = !{!"_ZTSN7cascadb5MutexE", !16, i64 0, !7, i64 8}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS7timeval", !14, i64 0, !14, i64 8}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSN7cascadb6RWLockE", !7, i64 0}
!20 = !{!"_ZTSN7cascadb10NodeStatusE", !7, i64 0}
!21 = !{!22, !6, i64 160}
!22 = !{!"_ZTSN7cascadb4TreeE", !12, i64 0, !23, i64 32, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!23 = !{!"_ZTSN7cascadb7OptionsE", !6, i64 0, !6, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !18, i64 72, !18, i64 76, !18, i64 80, !18, i64 84, !18, i64 88, !18, i64 92, !24, i64 96, !16, i64 100}
!24 = !{!"_ZTSN7cascadb8CompressE", !7, i64 0}
!25 = !{!14, !14, i64 0}
!26 = !{!27, !18, i64 40}
!27 = !{!"_ZTSN7cascadb8LeafNode10BucketInfoE", !28, i64 0, !28, i64 16, !18, i64 32, !18, i64 36, !18, i64 40, !29, i64 44}
!28 = !{!"_ZTSN7cascadb5SliceE", !6, i64 0, !18, i64 8}
!29 = !{!"short", !7, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{i64 0, i64 8, !5, i64 8, i64 4, !33}
!33 = !{!18, !18, i64 0}
!34 = !{!16, !16, i64 0}
!35 = !{!27, !18, i64 32}
!36 = !{!27, !18, i64 36}
!37 = distinct !{!37, !31}
!38 = !{!10, !20, i64 208}
!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"

%"class.cascadb::Slice" = type <{ ptr, i32, [4 x i8] }>

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb5SliceC2Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i32 } @_ZN7cascadb5Slice5allocEm(i64 noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb8LeafNode16load_all_bucketsERNS_11BlockReaderE(ptr noundef nonnull align 8 dereferenceable(320) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"class.cascadb::Slice", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @_ZN7cascadb5SliceC2Ev(ptr noundef nonnull align 8 dereferenceable(12) %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 200
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 160
  %7 = load ptr, ptr %6, align 8, !tbaa !20
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %25, label %.preheader

.preheader:                                       ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 240
  %9 = call noundef i64 @_ZNKSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  %.not37 = icmp eq i64 %9, 0
  br i1 %.not37, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %21, %.preheader
  %.0.lcssa = phi i64 [ 0, %.preheader ], [ %.1, %21 ]
  %10 = call { ptr, i32 } @_ZN7cascadb5Slice5allocEm(i64 noundef %.0.lcssa)
  %.fca.0.extract = extractvalue { ptr, i32 } %10, 0
  %.fca.1.extract = extractvalue { ptr, i32 } %10, 1
  store ptr %.fca.0.extract, ptr %3, align 8, !tbaa !24
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %.fca.1.extract, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !25
  br label %25

.lr.ph:                                           ; preds = %.preheader, %21
  %.032 = phi i64 [ %.1, %21 ], [ 0, %.preheader ]
  %.02531 = phi i64 [ %22, %21 ], [ 0, %.preheader ]
  %11 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %.02531) #6
  %12 = getelementptr inbounds i8, ptr %11, i64 40
  %13 = load i32, ptr %12, align 8, !tbaa !26
  %14 = zext i32 %13 to i64
  %15 = icmp ult i64 %.032, %14
  br i1 %15, label %16, label %21

16:                                               ; preds = %.lr.ph
  %17 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %.02531) #6
  %18 = getelementptr inbounds i8, ptr %17, i64 40
  %19 = load i32, ptr %18, align 8, !tbaa !26
  %20 = zext i32 %19 to i64
  br label %21

21:                                               ; preds = %.lr.ph, %16
  %.1 = phi i64 [ %20, %16 ], [ %.032, %.lr.ph ]
  %22 = add nuw i64 %.02531, 1
  %23 = call noundef i64 @_ZNKSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  %24 = icmp ult i64 %22, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !30

25:                                               ; preds = %._crit_edge, %2
  %26 = getelementptr inbounds i8, ptr %0, i64 240
  %27 = call noundef i64 @_ZNKSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  %28 = icmp eq i64 %27, 0
  br i1 %28, label %.loopexit, label %.lr.ph35

.lr.ph35:                                         ; preds = %25
  %29 = getelementptr inbounds i8, ptr %0, i64 264
  br label %30

30:                                               ; preds = %.lr.ph35, %46
  %.02233 = phi i64 [ 0, %.lr.ph35 ], [ %47, %46 ]
  %31 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %.02233) #6
  %32 = getelementptr inbounds i8, ptr %31, i64 32
  %33 = load i32, ptr %32, align 8, !tbaa !32
  %34 = zext i32 %33 to i64
  call void @_ZN7cascadb11BlockReader4seekEm(ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef %34)
  %35 = call noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %35, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIN7cascadb6RecordESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %35) #6
  %36 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %.02233) #6
  %37 = getelementptr inbounds i8, ptr %36, i64 36
  %38 = load i32, ptr %37, align 4, !tbaa !33
  %39 = zext i32 %38 to i64
  %40 = call noundef nonnull align 8 dereferenceable(46) ptr @_ZNSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %.02233) #6
  %41 = getelementptr inbounds i8, ptr %40, i64 40
  %42 = load i32, ptr %41, align 8, !tbaa !26
  %43 = zext i32 %42 to i64
  %44 = call noundef zeroext i1 @_ZN7cascadb8LeafNode11read_bucketERNS_11BlockReaderEmmPSt6vectorINS_6RecordESaIS4_EENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(320) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef %39, i64 noundef %43, ptr noundef nonnull %35, ptr noundef nonnull byval(%"class.cascadb::Slice") align 8 %3)
  br i1 %44, label %46, label %45

45:                                               ; preds = %30
  call void @_ZNSt6vectorIN7cascadb6RecordESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %35) #6
  call void @_ZdlPvm(ptr noundef nonnull %35, i64 noundef 24) #8
  br label %.loopexit

46:                                               ; preds = %30
  call void @_ZN7cascadb13RecordBuckets10set_bucketEmPSt6vectorINS_6RecordESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(56) %29, i64 noundef %.02233, ptr noundef nonnull %35)
  %47 = add nuw i64 %.02233, 1
  %48 = call noundef i64 @_ZNKSt6vectorIN7cascadb8LeafNode10BucketInfoESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  %.not42 = icmp ult i64 %47, %48
  br i1 %.not42, label %30, label %.loopexit, !llvm.loop !34

.loopexit:                                        ; preds = %46, %25, %45
  %49 = phi i1 [ false, %45 ], [ true, %25 ], [ true, %46 ]
  %50 = call noundef i64 @_ZNK7cascadb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(12) %3)
  %.not26 = icmp eq i64 %50, 0
  br i1 %.not26, label %52, label %51

51:                                               ; preds = %.loopexit
  call void @_ZN7cascadb5Slice7destroyEv(ptr noundef nonnull align 8 dereferenceable(12) %3)
  br label %52

52:                                               ; preds = %51, %.loopexit
  %53 = getelementptr inbounds i8, ptr %0, i64 208
  store i32 3, ptr %53, align 8, !tbaa !35
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  ret i1 %49
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN7cascadb6RecordESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb8LeafNode11read_bucketERNS_11BlockReaderEmmPSt6vectorINS_6RecordESaIS4_EENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(320), ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef, ptr noundef, ptr noundef byval(%"class.cascadb::Slice") align 8) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN7cascadb6RecordESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb13RecordBuckets10set_bucketEmPSt6vectorINS_6RecordESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, ptr noundef) local_unnamed_addr #2 align 2

attributes #0 = { nobuiltin 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 = { 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 = { nobuiltin allocsize(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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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, !10, i64 160}
!21 = !{!"_ZTSN7cascadb4TreeE", !8, i64 0, !22, i64 32, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176}
!22 = !{!"_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, !23, i64 96, !15, i64 100}
!23 = !{!"_ZTSN7cascadb8CompressE", !11, i64 0}
!24 = !{!10, !10, i64 0}
!25 = !{!17, !17, i64 0}
!26 = !{!27, !17, i64 40}
!27 = !{!"_ZTSN7cascadb8LeafNode10BucketInfoE", !28, i64 0, !28, i64 16, !17, i64 32, !17, i64 36, !17, i64 40, !29, i64 44}
!28 = !{!"_ZTSN7cascadb5SliceE", !10, i64 0, !17, i64 8}
!29 = !{!"short", !11, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!27, !17, i64 32}
!33 = !{!27, !17, i64 36}
!34 = distinct !{!34, !31}
!35 = !{!6, !19, i64 208}


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