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

; 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] }>
%"class.cascadb::Pivot" = type <{ %"class.cascadb::Slice", %"class.cascadb::Slice", i64, ptr, i32, i32, i32, i16, [2 x i8] }>

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN7cascadb9InnerNode21estimated_buffer_sizeEv(ptr noundef nonnull align 8 dereferenceable(312) %0) unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store i64 0, ptr %3, align 8, !tbaa !9
  %7 = load i64, ptr %3, align 8, !tbaa !9
  %8 = add i64 %7, 27
  store i64 %8, ptr %3, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 3
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = call noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104) %10)
  %12 = trunc i64 %11 to i32
  %13 = call noundef i64 @_ZN7cascadb9InnerNode10bloom_sizeEi(ptr noundef nonnull align 8 dereferenceable(312) %6, i32 noundef %12)
  %14 = load i64, ptr %3, align 8, !tbaa !9
  %15 = add i64 %14, %13
  store i64 %15, ptr %3, align 8, !tbaa !9
  %16 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 10
  %17 = load i64, ptr %16, align 8, !tbaa !29
  %18 = load i64, ptr %3, align 8, !tbaa !9
  %19 = add i64 %18, %17
  store i64 %19, ptr %3, align 8, !tbaa !9
  %20 = getelementptr inbounds %"class.cascadb::DataNode", ptr %6, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !30
  %22 = getelementptr inbounds %"class.cascadb::Tree", ptr %21, i32 0, i32 5
  %23 = load ptr, ptr %22, align 8, !tbaa !31
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %76

25:                                               ; preds = %1
  %26 = getelementptr inbounds %"class.cascadb::DataNode", ptr %6, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !30
  %28 = getelementptr inbounds %"class.cascadb::Tree", ptr %27, i32 0, i32 5
  %29 = load ptr, ptr %28, align 8, !tbaa !31
  %30 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 3
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %31)
  %33 = load ptr, ptr %29, align 8, !tbaa !35
  %34 = getelementptr inbounds ptr, ptr %33, i64 2
  %35 = load ptr, ptr %34, align 8
  %36 = call noundef i64 %35(ptr noundef nonnull align 8 dereferenceable(8) %29, i64 noundef %32)
  %37 = load i64, ptr %3, align 8, !tbaa !9
  %38 = add i64 %37, %36
  store i64 %38, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %39

39:                                               ; preds = %72, %25
  %40 = load i64, ptr %4, align 8, !tbaa !9
  %41 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 9
  %42 = call noundef i64 @_ZNKSt6vectorIN7cascadb5PivotESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #3
  %43 = icmp ult i64 %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %75

45:                                               ; preds = %39
  %46 = getelementptr inbounds %"class.cascadb::DataNode", ptr %6, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !30
  %48 = getelementptr inbounds %"class.cascadb::Tree", ptr %47, i32 0, i32 5
  %49 = load ptr, ptr %48, align 8, !tbaa !31
  %50 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 9
  %51 = load i64, ptr %4, align 8, !tbaa !9
  %52 = call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %50, i64 noundef %51) #3
  %53 = getelementptr inbounds %"class.cascadb::Pivot", ptr %52, i32 0, i32 3
  %54 = load ptr, ptr %53, align 8, !tbaa !37
  %55 = call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %54)
  %56 = load ptr, ptr %49, align 8, !tbaa !35
  %57 = getelementptr inbounds ptr, ptr %56, i64 2
  %58 = load ptr, ptr %57, align 8
  %59 = call noundef i64 %58(ptr noundef nonnull align 8 dereferenceable(8) %49, i64 noundef %55)
  %60 = load i64, ptr %3, align 8, !tbaa !9
  %61 = add i64 %60, %59
  store i64 %61, ptr %3, align 8, !tbaa !9
  %62 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 9
  %63 = load i64, ptr %4, align 8, !tbaa !9
  %64 = call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %62, i64 noundef %63) #3
  %65 = getelementptr inbounds %"class.cascadb::Pivot", ptr %64, i32 0, i32 3
  %66 = load ptr, ptr %65, align 8, !tbaa !37
  %67 = call noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104) %66)
  %68 = trunc i64 %67 to i32
  %69 = call noundef i64 @_ZN7cascadb9InnerNode10bloom_sizeEi(ptr noundef nonnull align 8 dereferenceable(312) %6, i32 noundef %68)
  %70 = load i64, ptr %3, align 8, !tbaa !9
  %71 = add i64 %70, %69
  store i64 %71, ptr %3, align 8, !tbaa !9
  br label %72

72:                                               ; preds = %45
  %73 = load i64, ptr %4, align 8, !tbaa !9
  %74 = add i64 %73, 1
  store i64 %74, ptr %4, align 8, !tbaa !9
  br label %39, !llvm.loop !39

75:                                               ; preds = %44
  br label %111

76:                                               ; preds = %1
  %77 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 3
  %78 = load ptr, ptr %77, align 8, !tbaa !11
  %79 = call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %78)
  %80 = load i64, ptr %3, align 8, !tbaa !9
  %81 = add i64 %80, %79
  store i64 %81, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %82

82:                                               ; preds = %107, %76
  %83 = load i64, ptr %5, align 8, !tbaa !9
  %84 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 9
  %85 = call noundef i64 @_ZNKSt6vectorIN7cascadb5PivotESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %84) #3
  %86 = icmp ult i64 %83, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %110

88:                                               ; preds = %82
  %89 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 9
  %90 = load i64, ptr %5, align 8, !tbaa !9
  %91 = call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %89, i64 noundef %90) #3
  %92 = getelementptr inbounds %"class.cascadb::Pivot", ptr %91, i32 0, i32 3
  %93 = load ptr, ptr %92, align 8, !tbaa !37
  %94 = call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %93)
  %95 = load i64, ptr %3, align 8, !tbaa !9
  %96 = add i64 %95, %94
  store i64 %96, ptr %3, align 8, !tbaa !9
  %97 = getelementptr inbounds %"class.cascadb::InnerNode", ptr %6, i32 0, i32 9
  %98 = load i64, ptr %5, align 8, !tbaa !9
  %99 = call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %97, i64 noundef %98) #3
  %100 = getelementptr inbounds %"class.cascadb::Pivot", ptr %99, i32 0, i32 3
  %101 = load ptr, ptr %100, align 8, !tbaa !37
  %102 = call noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104) %101)
  %103 = trunc i64 %102 to i32
  %104 = call noundef i64 @_ZN7cascadb9InnerNode10bloom_sizeEi(ptr noundef nonnull align 8 dereferenceable(312) %6, i32 noundef %103)
  %105 = load i64, ptr %3, align 8, !tbaa !9
  %106 = add i64 %105, %104
  store i64 %106, ptr %3, align 8, !tbaa !9
  br label %107

107:                                              ; preds = %88
  %108 = load i64, ptr %5, align 8, !tbaa !9
  %109 = add i64 %108, 1
  store i64 %109, ptr %5, align 8, !tbaa !9
  br label %82, !llvm.loop !41

110:                                              ; preds = %87
  br label %111

111:                                              ; preds = %110, %75
  %112 = load i64, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret i64 %112
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 224}
!12 = !{!"_ZTSN7cascadb9InnerNodeE", !13, i64 0, !18, i64 212, !10, i64 216, !6, i64 224, !23, i64 232, !20, i64 248, !20, i64 252, !20, i64 256, !24, i64 260, !25, i64 264, !10, i64 288, !10, i64 296, !10, i64 304}
!13 = !{!"_ZTSN7cascadb8DataNodeE", !14, i64 0, !6, i64 200, !22, i64 208}
!14 = !{!"_ZTSN7cascadb4NodeE", !15, i64 8, !10, i64 40, !17, i64 48, !18, i64 96, !18, i64 97, !18, i64 98, !19, i64 104, !19, i64 120, !20, i64 136, !20, i64 140, !21, i64 144}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !10, i64 8, !7, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!17 = !{!"_ZTSN7cascadb5MutexE", !18, i64 0, !7, i64 8}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTS7timeval", !10, i64 0, !10, i64 8}
!20 = !{!"int", !7, i64 0}
!21 = !{!"_ZTSN7cascadb6RWLockE", !7, i64 0}
!22 = !{!"_ZTSN7cascadb10NodeStatusE", !7, i64 0}
!23 = !{!"_ZTSN7cascadb5SliceE", !6, i64 0, !20, 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 = !{!12, !10, i64 288}
!30 = !{!13, !6, i64 200}
!31 = !{!32, !6, i64 160}
!32 = !{!"_ZTSN7cascadb4TreeE", !15, i64 0, !33, i64 32, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!33 = !{!"_ZTSN7cascadb7OptionsE", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !20, i64 72, !20, i64 76, !20, i64 80, !20, i64 84, !20, i64 88, !20, i64 92, !34, i64 96, !18, i64 100}
!34 = !{!"_ZTSN7cascadb8CompressE", !7, i64 0}
!35 = !{!36, !36, i64 0}
!36 = !{!"vtable pointer", !8, i64 0}
!37 = !{!38, !6, i64 40}
!38 = !{!"_ZTSN7cascadb5PivotE", !23, i64 0, !23, i64 16, !10, i64 32, !6, i64 40, !20, i64 48, !20, i64 52, !20, i64 56, !24, i64 60}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}
!41 = distinct !{!41, !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"

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN7cascadb9InnerNode21estimated_buffer_sizeEv(ptr noundef nonnull align 8 dereferenceable(312) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 224
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = tail call noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104) %3)
  %5 = trunc i64 %4 to i32
  %6 = tail call noundef i64 @_ZN7cascadb9InnerNode10bloom_sizeEi(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %5)
  %7 = add i64 %6, 27
  %8 = getelementptr inbounds i8, ptr %0, i64 288
  %9 = load i64, ptr %8, align 8, !tbaa !27
  %10 = add i64 %7, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 200
  %12 = load ptr, ptr %11, align 8, !tbaa !28
  %13 = getelementptr inbounds i8, ptr %12, i64 160
  %14 = load ptr, ptr %13, align 8, !tbaa !29
  %.not = icmp eq ptr %14, null
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = tail call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %15)
  br i1 %.not, label %47, label %17

17:                                               ; preds = %1
  %18 = load ptr, ptr %14, align 8, !tbaa !33
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %20 = load ptr, ptr %19, align 8
  %21 = tail call noundef i64 %20(ptr noundef nonnull align 8 dereferenceable(8) %14, i64 noundef %16)
  %22 = add i64 %21, %10
  %23 = getelementptr inbounds i8, ptr %0, i64 264
  %24 = tail call noundef i64 @_ZNKSt6vectorIN7cascadb5PivotESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #2
  %.not28 = icmp eq i64 %24, 0
  br i1 %.not28, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %17, %.lr.ph
  %.01823 = phi i64 [ %44, %.lr.ph ], [ 0, %17 ]
  %.01922 = phi i64 [ %43, %.lr.ph ], [ %22, %17 ]
  %25 = load ptr, ptr %11, align 8, !tbaa !28
  %26 = getelementptr inbounds i8, ptr %25, i64 160
  %27 = load ptr, ptr %26, align 8, !tbaa !29
  %28 = tail call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %.01823) #2
  %29 = getelementptr inbounds i8, ptr %28, i64 40
  %30 = load ptr, ptr %29, align 8, !tbaa !35
  %31 = tail call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %30)
  %32 = load ptr, ptr %27, align 8, !tbaa !33
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %34 = load ptr, ptr %33, align 8
  %35 = tail call noundef i64 %34(ptr noundef nonnull align 8 dereferenceable(8) %27, i64 noundef %31)
  %36 = add i64 %35, %.01922
  %37 = tail call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %.01823) #2
  %38 = getelementptr inbounds i8, ptr %37, i64 40
  %39 = load ptr, ptr %38, align 8, !tbaa !35
  %40 = tail call noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104) %39)
  %41 = trunc i64 %40 to i32
  %42 = tail call noundef i64 @_ZN7cascadb9InnerNode10bloom_sizeEi(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %41)
  %43 = add i64 %36, %42
  %44 = add nuw i64 %.01823, 1
  %45 = tail call noundef i64 @_ZNKSt6vectorIN7cascadb5PivotESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #2
  %46 = icmp ult i64 %44, %45
  br i1 %46, label %.lr.ph, label %.loopexit, !llvm.loop !37

47:                                               ; preds = %1
  %48 = add i64 %16, %10
  %49 = getelementptr inbounds i8, ptr %0, i64 264
  %50 = tail call noundef i64 @_ZNKSt6vectorIN7cascadb5PivotESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %49) #2
  %.not29 = icmp eq i64 %50, 0
  br i1 %.not29, label %.loopexit, label %.lr.ph26

.lr.ph26:                                         ; preds = %47, %.lr.ph26
  %.025 = phi i64 [ %63, %.lr.ph26 ], [ 0, %47 ]
  %.124 = phi i64 [ %62, %.lr.ph26 ], [ %48, %47 ]
  %51 = tail call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef %.025) #2
  %52 = getelementptr inbounds i8, ptr %51, i64 40
  %53 = load ptr, ptr %52, align 8, !tbaa !35
  %54 = tail call noundef i64 @_ZNK7cascadb6MsgBuf4sizeEv(ptr noundef nonnull align 8 dereferenceable(104) %53)
  %55 = add i64 %54, %.124
  %56 = tail call noundef nonnull align 8 dereferenceable(62) ptr @_ZNSt6vectorIN7cascadb5PivotESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef %.025) #2
  %57 = getelementptr inbounds i8, ptr %56, i64 40
  %58 = load ptr, ptr %57, align 8, !tbaa !35
  %59 = tail call noundef i64 @_ZNK7cascadb6MsgBuf5countEv(ptr noundef nonnull align 8 dereferenceable(104) %58)
  %60 = trunc i64 %59 to i32
  %61 = tail call noundef i64 @_ZN7cascadb9InnerNode10bloom_sizeEi(ptr noundef nonnull align 8 dereferenceable(312) %0, i32 noundef %60)
  %62 = add i64 %55, %61
  %63 = add nuw i64 %.025, 1
  %64 = tail call noundef i64 @_ZNKSt6vectorIN7cascadb5PivotESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %49) #2
  %65 = icmp ult i64 %63, %64
  br i1 %65, label %.lr.ph26, label %.loopexit, !llvm.loop !39

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph26, %17, %47
  %.2 = phi i64 [ %48, %47 ], [ %22, %17 ], [ %62, %.lr.ph26 ], [ %43, %.lr.ph ]
  ret i64 %.2
}

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


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