; LLVM IR from KoishiDB/Koishi-DB :: src/disk/table_builder.ll (ZN8koishidb12TableBuilder6FinishEv)

; 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.koishidb::Status" = type { ptr }
%"class.koishidb::BlockHandle" = type { i64, i64 }
%"class.koishidb::Slice" = type { ptr, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.koishidb::Footer" = type { %"class.koishidb::BlockHandle", %"class.koishidb::BlockHandle" }
%"class.koishidb::TableBuilder" = type { ptr }
%"struct.koishidb::TableBuilder::Rep" = type { ptr, ptr, %"class.koishidb::BlockBuilder", %"class.koishidb::BlockBuilder", %"class.koishidb::FilterBlockBuilder", i64, i64, i8, %"class.koishidb::BlockHandle", i8, %"class.std::__cxx11::basic_string", %"class.koishidb::Status" }
%"class.koishidb::BlockBuilder" = type <{ %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", ptr, i8, [7 x i8] }>
%"class.koishidb::FilterBlockBuilder" = type { %"class.koishidb::BloomFilter", %"class.std::__cxx11::basic_string", %"class.std::vector", %"class.std::vector.3", %"class.std::vector", %"class.std::__cxx11::basic_string" }
%"class.koishidb::BloomFilter" = type { i32, i32 }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<koishidb::Slice, std::allocator<koishidb::Slice>>::_Vector_impl" }
%"struct.std::_Vector_base<koishidb::Slice, std::allocator<koishidb::Slice>>::_Vector_impl" = type { %"struct.std::_Vector_base<koishidb::Slice, std::allocator<koishidb::Slice>>::_Vector_impl_data" }
%"struct.std::_Vector_base<koishidb::Slice, std::allocator<koishidb::Slice>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@__PRETTY_FUNCTION__._ZN8koishidb12TableBuilder6FinishEv = external hidden unnamed_addr constant [40 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

; 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 void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

declare void @_ZN8koishidb12BlockBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(73), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

declare void @_ZN8koishidb5SliceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

declare noundef i64 @_ZNK8koishidb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #2

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

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

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

declare void @_ZN8koishidb12WritableFile5FlushEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(65616)) #2

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

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

declare void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(65616), ptr noundef nonnull align 8 dereferenceable(16)) #2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8koishidb12TableBuilder6FinishEv(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.koishidb::BlockHandle", align 8
  %8 = alloca %"class.koishidb::BlockHandle", align 8
  %9 = alloca %"class.koishidb::Slice", align 8
  %10 = alloca %"class.koishidb::Status", align 8
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.koishidb::Slice", align 8
  %15 = alloca %"class.koishidb::Slice", align 8
  %16 = alloca %"class.koishidb::Footer", align 8
  %17 = alloca %"class.koishidb::BlockHandle", align 8
  %18 = alloca %"class.koishidb::BlockHandle", align 8
  %19 = alloca %"class.std::__cxx11::basic_string", align 8
  %20 = alloca %"class.koishidb::Status", align 8
  %21 = alloca %"class.koishidb::Slice", align 8
  %22 = alloca %"class.koishidb::Status", align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %24 = getelementptr inbounds %"class.koishidb::TableBuilder", ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  store ptr %25, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %26, i32 0, i32 7
  %28 = load i8, ptr %27, align 8, !tbaa !11, !range !31, !noundef !32
  %29 = trunc i8 %28 to i1
  %30 = xor i1 %29, true
  br i1 %30, label %31, label %32

31:                                               ; preds = %2
  br label %34

32:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 109, ptr noundef @__PRETTY_FUNCTION__._ZN8koishidb12TableBuilder6FinishEv) #9
  unreachable

33:                                               ; No predecessors!
  br label %34

34:                                               ; preds = %33, %31
  call void @_ZN8koishidb12TableBuilder5FlushEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %35, i32 0, i32 7
  store i8 1, ptr %36, align 8, !tbaa !11
  %37 = call noundef zeroext i1 @_ZNK8koishidb12TableBuilder2okEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %23)
  store i32 1, ptr %6, align 4
  br label %151

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #8
  call void @_ZN8koishidb11BlockHandleC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #8
  call void @_ZN8koishidb11BlockHandleC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %40, i32 0, i32 4
  %42 = call { ptr, i64 } @_ZN8koishidb18FilterBlockBuilder6FinishEv(ptr noundef nonnull align 8 dereferenceable(144) %41)
  %43 = getelementptr inbounds { ptr, i64 }, ptr %9, i32 0, i32 0
  %44 = extractvalue { ptr, i64 } %42, 0
  store ptr %44, ptr %43, align 8
  %45 = getelementptr inbounds { ptr, i64 }, ptr %9, i32 0, i32 1
  %46 = extractvalue { ptr, i64 } %42, 1
  store i64 %46, ptr %45, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !33
  call void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %10, ptr noundef nonnull align 8 dereferenceable(65616) %49, ptr noundef nonnull align 8 dereferenceable(16) %9)
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %50, i32 0, i32 11
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8koishidb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %53, i32 0, i32 11
  %55 = call noundef zeroext i1 @_ZNK8koishidb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %54)
  br i1 %55, label %59, label %56

56:                                               ; preds = %39
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %57, i32 0, i32 11
  call void @_ZN8koishidb6StatusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %58)
  store i32 1, ptr %6, align 4
  br label %149

59:                                               ; preds = %39
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %60, i32 0, i32 5
  %62 = load i64, ptr %61, align 8, !tbaa !34
  call void @_ZN8koishidb11BlockHandle10set_offsetEm(ptr noundef nonnull align 8 dereferenceable(16) %8, i64 noundef %62)
  %63 = call noundef i64 @_ZNK8koishidb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %9)
  call void @_ZN8koishidb11BlockHandle8set_sizeEm(ptr noundef nonnull align 8 dereferenceable(16) %8, i64 noundef %63)
  %64 = call noundef i64 @_ZNK8koishidb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %9)
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %65, i32 0, i32 5
  %67 = load i64, ptr %66, align 8, !tbaa !34
  %68 = add i64 %67, %64
  store i64 %68, ptr %66, align 8, !tbaa !34
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %69, i32 0, i32 9
  %71 = load i8, ptr %70, align 8, !tbaa !35, !range !31, !noundef !32
  %72 = trunc i8 %71 to i1
  br i1 %72, label %73, label %100

73:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %74, i32 0, i32 8
  invoke void @_ZNK8koishidb11BlockHandle8EncodeToEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %75, ptr noundef %11)
          to label %76 unwind label %86

76:                                               ; preds = %73
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %77, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #8
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %79, i32 0, i32 10
  invoke void @_ZN8koishidb5SliceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(32) %80)
          to label %81 unwind label %90

81:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #8
  invoke void @_ZN8koishidb5SliceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %82 unwind label %94

82:                                               ; preds = %81
  invoke void @_ZN8koishidb12BlockBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(73) %78, ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %83 unwind label %94

83:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %84, i32 0, i32 9
  store i8 0, ptr %85, align 8, !tbaa !35
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #8
  br label %100

86:                                               ; preds = %73
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %12, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %13, align 4
  br label %99

90:                                               ; preds = %76
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %12, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %13, align 4
  br label %98

94:                                               ; preds = %82, %81
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %12, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #8
  br label %98

98:                                               ; preds = %94, %90
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  br label %99

99:                                               ; preds = %98, %86
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #8
  br label %150

100:                                              ; preds = %83, %59
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %101, i32 0, i32 3
  call void @_ZN8koishidb12TableBuilder10WriteBlockEPNS_12BlockBuilderEPNS_11BlockHandleE(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef %102, ptr noundef %7)
  %103 = call noundef zeroext i1 @_ZNK8koishidb12TableBuilder2okEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  call void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %23)
  store i32 1, ptr %6, align 4
  br label %149

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #8
  call void @_ZN8koishidb6FooterC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !36
  %106 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 0
  %107 = load i64, ptr %106, align 8
  %108 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 1
  %109 = load i64, ptr %108, align 8
  call void @_ZN8koishidb6Footer9set_indexENS_11BlockHandleE(ptr noundef nonnull align 8 dereferenceable(32) %16, i64 %107, i64 %109)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %8, i64 16, i1 false), !tbaa.struct !36
  %110 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 0
  %111 = load i64, ptr %110, align 8
  %112 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 1
  %113 = load i64, ptr %112, align 8
  call void @_ZN8koishidb6Footer10set_filterENS_11BlockHandleE(ptr noundef nonnull align 8 dereferenceable(32) %16, i64 %111, i64 %113)
  call void @llvm.lifetime.start.p0(i64 32, ptr %19) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  invoke void @_ZN8koishidb6Footer8EncodeToEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef %19)
          to label %114 unwind label %128

114:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %115, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #8
  %118 = call noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  invoke void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef %118)
          to label %119 unwind label %132

119:                                              ; preds = %114
  invoke void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %20, ptr noundef nonnull align 8 dereferenceable(65616) %117, ptr noundef nonnull align 8 dereferenceable(16) %21)
          to label %120 unwind label %132

120:                                              ; preds = %119
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %121, i32 0, i32 11
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8koishidb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8) %122, ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  %124 = invoke noundef zeroext i1 @_ZNK8koishidb12TableBuilder2okEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %125 unwind label %128

125:                                              ; preds = %120
  br i1 %124, label %136, label %126

126:                                              ; preds = %125
  invoke void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %127 unwind label %128

127:                                              ; preds = %126
  store i32 1, ptr %6, align 4
  br label %147

128:                                              ; preds = %145, %136, %126, %120, %105
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %12, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %13, align 4
  br label %148

132:                                              ; preds = %119, %114
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %12, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %148

136:                                              ; preds = %125
  %137 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %138, i32 0, i32 5
  %140 = load i64, ptr %139, align 8, !tbaa !34
  %141 = add i64 %140, %137
  store i64 %141, ptr %139, align 8, !tbaa !34
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %"struct.koishidb::TableBuilder::Rep", ptr %142, i32 0, i32 1
  %144 = load ptr, ptr %143, align 8, !tbaa !33
  invoke void @_ZN8koishidb12WritableFile5FlushEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %22, ptr noundef nonnull align 8 dereferenceable(65616) %144)
          to label %145 unwind label %128

145:                                              ; preds = %136
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  invoke void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %146 unwind label %128

146:                                              ; preds = %145
  store i32 1, ptr %6, align 4
  br label %147

147:                                              ; preds = %146, %127
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #8
  br label %149

148:                                              ; preds = %132, %128
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #8
  br label %150

149:                                              ; preds = %147, %104, %56
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #8
  br label %151

150:                                              ; preds = %148, %99
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %152

151:                                              ; preds = %149, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  ret void

152:                                              ; preds = %150
  %153 = load ptr, ptr %12, align 8
  %154 = load i32, ptr %13, align 4
  %155 = insertvalue { ptr, i32 } poison, ptr %153, 0
  %156 = insertvalue { ptr, i32 } %155, i32 %154, 1
  resume { ptr, i32 } %156
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(8)) #5 align 2

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

declare { ptr, i64 } @_ZN8koishidb18FilterBlockBuilder6FinishEv(ptr noundef nonnull align 8 dereferenceable(144)) #2

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 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 = { "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 = { 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 #5 = { 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 #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
attributes #9 = { 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, !6, i64 0}
!10 = !{!"_ZTSN8koishidb12TableBuilderE", !6, i64 0}
!11 = !{!12, !17, i64 336}
!12 = !{!"_ZTSN8koishidb12TableBuilder3RepE", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 96, !18, i64 176, !16, i64 320, !16, i64 328, !17, i64 336, !29, i64 344, !17, i64 360, !14, i64 368, !30, i64 400}
!13 = !{!"_ZTSN8koishidb12BlockBuilderE", !14, i64 0, !14, i64 32, !6, i64 64, !17, i64 72}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSN8koishidb18FilterBlockBuilderE", !19, i64 0, !14, i64 8, !21, i64 40, !25, i64 64, !21, i64 88, !14, i64 112}
!19 = !{!"_ZTSN8koishidb11BloomFilterE", !20, i64 0, !20, i64 4}
!20 = !{!"int", !7, i64 0}
!21 = !{!"_ZTSSt6vectorIjSaIjEE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSSt6vectorIN8koishidb5SliceESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIN8koishidb5SliceESaIS1_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN8koishidb5SliceESaIS1_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIN8koishidb5SliceESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"_ZTSN8koishidb11BlockHandleE", !16, i64 0, !16, i64 8}
!30 = !{!"_ZTSN8koishidb6StatusE", !6, i64 0}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!12, !6, i64 8}
!34 = !{!12, !16, i64 320}
!35 = !{!12, !17, i64 360}
!36 = !{i64 0, i64 8, !37, i64 8, i64 8, !37}
!37 = !{!16, !16, 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"

%"class.koishidb::Status" = type { ptr }
%"class.koishidb::BlockHandle" = type { i64, i64 }
%"class.koishidb::Slice" = type { ptr, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.koishidb::Footer" = type { %"class.koishidb::BlockHandle", %"class.koishidb::BlockHandle" }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@__PRETTY_FUNCTION__._ZN8koishidb12TableBuilder6FinishEv = external hidden unnamed_addr constant [40 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

; Function Attrs: mustprogress 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 void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

declare void @_ZN8koishidb12BlockBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(73), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

declare void @_ZN8koishidb5SliceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

declare noundef i64 @_ZNK8koishidb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

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

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

declare void @_ZN8koishidb12WritableFile5FlushEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(65616)) local_unnamed_addr #2

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

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

declare void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(65616), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8koishidb12TableBuilder6FinishEv(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.koishidb::BlockHandle", align 8
  %4 = alloca %"class.koishidb::BlockHandle", align 8
  %5 = alloca %"class.koishidb::Slice", align 8
  %6 = alloca %"class.koishidb::Status", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.koishidb::Slice", align 8
  %9 = alloca %"class.koishidb::Slice", align 8
  %10 = alloca %"class.koishidb::Footer", align 8
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca %"class.koishidb::Status", align 8
  %13 = alloca %"class.koishidb::Slice", align 8
  %14 = alloca %"class.koishidb::Status", align 8
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 336
  %17 = load i8, ptr %16, align 8, !tbaa !10, !range !30, !noundef !31
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %19, label %20

19:                                               ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 109, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN8koishidb12TableBuilder6FinishEv) #7
  unreachable

20:                                               ; preds = %2
  tail call void @_ZN8koishidb12TableBuilder5FlushEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  store i8 1, ptr %16, align 8, !tbaa !10
  %21 = tail call noundef zeroext i1 @_ZNK8koishidb12TableBuilder2okEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  br i1 %21, label %23, label %22

22:                                               ; preds = %20
  tail call void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1)
  br label %88

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #8
  call void @_ZN8koishidb11BlockHandleC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #8
  call void @_ZN8koishidb11BlockHandleC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  %24 = getelementptr inbounds i8, ptr %15, i64 176
  %25 = call { ptr, i64 } @_ZN8koishidb18FilterBlockBuilder6FinishEv(ptr noundef nonnull align 8 dereferenceable(144) %24)
  %26 = extractvalue { ptr, i64 } %25, 0
  store ptr %26, ptr %5, align 8
  %27 = getelementptr inbounds i8, ptr %5, i64 8
  %28 = extractvalue { ptr, i64 } %25, 1
  store i64 %28, ptr %27, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %29 = getelementptr inbounds i8, ptr %15, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !32
  call void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::Status") align 8 %6, ptr noundef nonnull align 8 dereferenceable(65616) %30, ptr noundef nonnull align 8 dereferenceable(16) %5)
  %31 = getelementptr inbounds i8, ptr %15, i64 400
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8koishidb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %33 = call noundef zeroext i1 @_ZNK8koishidb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %31)
  br i1 %33, label %35, label %34

34:                                               ; preds = %23
  call void @_ZN8koishidb6StatusC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %31)
  br label %86

35:                                               ; preds = %23
  %36 = getelementptr inbounds i8, ptr %15, i64 320
  %37 = load i64, ptr %36, align 8, !tbaa !33
  call void @_ZN8koishidb11BlockHandle10set_offsetEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %37)
  %38 = call noundef i64 @_ZNK8koishidb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @_ZN8koishidb11BlockHandle8set_sizeEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %38)
  %39 = call noundef i64 @_ZNK8koishidb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %40 = load i64, ptr %36, align 8, !tbaa !33
  %41 = add i64 %40, %39
  store i64 %41, ptr %36, align 8, !tbaa !33
  %42 = getelementptr inbounds i8, ptr %15, i64 360
  %43 = load i8, ptr %42, align 8, !tbaa !34, !range !30, !noundef !31
  %44 = trunc nuw i8 %43 to i1
  br i1 %44, label %45, label %61

45:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  %46 = getelementptr inbounds i8, ptr %15, i64 344
  invoke void @_ZNK8koishidb11BlockHandle8EncodeToEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %46, ptr noundef nonnull %7)
          to label %47 unwind label %53

47:                                               ; preds = %45
  %48 = getelementptr inbounds i8, ptr %15, i64 96
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #8
  %49 = getelementptr inbounds i8, ptr %15, i64 368
  invoke void @_ZN8koishidb5SliceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(32) %49)
          to label %50 unwind label %55

50:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #8
  invoke void @_ZN8koishidb5SliceC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %51 unwind label %57

51:                                               ; preds = %50
  invoke void @_ZN8koishidb12BlockBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(73) %48, ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %52 unwind label %57

52:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #8
  store i8 0, ptr %42, align 8, !tbaa !34
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #8
  br label %61

53:                                               ; preds = %45
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %60

55:                                               ; preds = %47
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %59

57:                                               ; preds = %51, %50
  %58 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #8
  br label %59

59:                                               ; preds = %57, %55
  %.pn = phi { ptr, i32 } [ %58, %57 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #8
  br label %60

60:                                               ; preds = %59, %53
  %.pn.pn = phi { ptr, i32 } [ %.pn, %59 ], [ %54, %53 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #8
  br label %87

61:                                               ; preds = %52, %35
  %62 = getelementptr inbounds i8, ptr %15, i64 96
  call void @_ZN8koishidb12TableBuilder10WriteBlockEPNS_12BlockBuilderEPNS_11BlockHandleE(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %62, ptr noundef nonnull %3)
  %63 = call noundef zeroext i1 @_ZNK8koishidb12TableBuilder2okEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  call void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1)
  br label %86

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #8
  call void @_ZN8koishidb6FooterC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10)
  %.sroa.01.0.copyload = load i64, ptr %3, align 8, !tbaa !35
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %.sroa.22.0.copyload = load i64, ptr %.sroa.22.0..sroa_idx, align 8, !tbaa !35
  call void @_ZN8koishidb6Footer9set_indexENS_11BlockHandleE(ptr noundef nonnull align 8 dereferenceable(32) %10, i64 %.sroa.01.0.copyload, i64 %.sroa.22.0.copyload)
  %.sroa.0.0.copyload = load i64, ptr %4, align 8, !tbaa !35
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 8
  %.sroa.2.0.copyload = load i64, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !35
  call void @_ZN8koishidb6Footer10set_filterENS_11BlockHandleE(ptr noundef nonnull align 8 dereferenceable(32) %10, i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  invoke void @_ZN8koishidb6Footer8EncodeToEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull %11)
          to label %66 unwind label %74

66:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #8
  %67 = load ptr, ptr %29, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #8
  %68 = call noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  invoke void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef %68)
          to label %69 unwind label %76

69:                                               ; preds = %66
  invoke void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::Status") align 8 %12, ptr noundef nonnull align 8 dereferenceable(65616) %67, ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %70 unwind label %76

70:                                               ; preds = %69
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8koishidb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  %72 = invoke noundef zeroext i1 @_ZNK8koishidb12TableBuilder2okEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %73 unwind label %74

73:                                               ; preds = %70
  br i1 %72, label %78, label %.invoke

74:                                               ; preds = %.invoke, %78, %70, %65
  %75 = landingpad { ptr, i32 }
          cleanup
  br label %85

76:                                               ; preds = %69, %66
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  br label %85

78:                                               ; preds = %73
  %79 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  %80 = load i64, ptr %36, align 8, !tbaa !33
  %81 = add i64 %80, %79
  store i64 %81, ptr %36, align 8, !tbaa !33
  %82 = load ptr, ptr %29, align 8, !tbaa !32
  invoke void @_ZN8koishidb12WritableFile5FlushEv(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::Status") align 8 %14, ptr noundef nonnull align 8 dereferenceable(65616) %82)
          to label %83 unwind label %74

83:                                               ; preds = %78
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  br label %.invoke

.invoke:                                          ; preds = %73, %83
  invoke void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %84 unwind label %74

84:                                               ; preds = %.invoke
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #8
  br label %86

85:                                               ; preds = %76, %74
  %.pn29 = phi { ptr, i32 } [ %75, %74 ], [ %77, %76 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #8
  br label %87

86:                                               ; preds = %84, %64, %34
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #8
  br label %88

87:                                               ; preds = %85, %60
  %.pn29.pn = phi { ptr, i32 } [ %.pn29, %85 ], [ %.pn.pn, %60 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #8
  resume { ptr, i32 } %.pn29.pn

88:                                               ; preds = %86, %22
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8koishidb12TableBuilder6statusEv(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5 align 2

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

declare { ptr, i64 } @_ZN8koishidb18FilterBlockBuilder6FinishEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #2

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

attributes #0 = { mustprogress 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 = { "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 = { 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 #5 = { 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 #6 = { 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 #7 = { noreturn nounwind }
attributes #8 = { 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, !7, i64 0}
!6 = !{!"_ZTSN8koishidb12TableBuilderE", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !16, i64 336}
!11 = !{!"_ZTSN8koishidb12TableBuilder3RepE", !7, i64 0, !7, i64 8, !12, i64 16, !12, i64 96, !17, i64 176, !15, i64 320, !15, i64 328, !16, i64 336, !28, i64 344, !16, i64 360, !13, i64 368, !29, i64 400}
!12 = !{!"_ZTSN8koishidb12BlockBuilderE", !13, i64 0, !13, i64 32, !7, i64 64, !16, i64 72}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !8, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!15 = !{!"long", !8, i64 0}
!16 = !{!"bool", !8, i64 0}
!17 = !{!"_ZTSN8koishidb18FilterBlockBuilderE", !18, i64 0, !13, i64 8, !20, i64 40, !24, i64 64, !20, i64 88, !13, i64 112}
!18 = !{!"_ZTSN8koishidb11BloomFilterE", !19, i64 0, !19, i64 4}
!19 = !{!"int", !8, i64 0}
!20 = !{!"_ZTSSt6vectorIjSaIjEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!24 = !{!"_ZTSSt6vectorIN8koishidb5SliceESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIN8koishidb5SliceESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN8koishidb5SliceESaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN8koishidb5SliceESaIS1_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!28 = !{!"_ZTSN8koishidb11BlockHandleE", !15, i64 0, !15, i64 8}
!29 = !{!"_ZTSN8koishidb6StatusE", !7, i64 0}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!11, !7, i64 8}
!33 = !{!11, !15, i64 320}
!34 = !{!11, !16, i64 360}
!35 = !{!15, !15, i64 0}


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