; LLVM IR from KoishiDB/Koishi-DB :: src/disk (builder)

; 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::Slice" = type { ptr, i64 }
%"class.koishidb::WritableFile" = type { %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i64, [65536 x i8] }
%"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::InternalKey" = type { %"class.std::__cxx11::basic_string" }
%"struct.koishidb::Option" = type { ptr }
%"class.koishidb::TableBuilder" = type { ptr }
%"struct.koishidb::FileMeta" = type { i64, i64, %"class.koishidb::InternalKey", %"class.koishidb::InternalKey" }

@.str = external hidden unnamed_addr constant [72 x i8], align 1
@__FUNCTION__._ZN8koishidb10BuildTableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_8FileMetaEPNS_8IteratorE = external hidden unnamed_addr constant [11 x i8], align 1
@stdout = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8koishidb10BuildTableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_8FileMetaEPNS_8IteratorE(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2, ptr noundef %3) #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %"class.koishidb::Slice", align 8
  %13 = alloca %"class.koishidb::Slice", align 8
  %14 = alloca i32, align 4
  %15 = alloca %"class.koishidb::WritableFile", align 8
  %16 = alloca %"class.std::__cxx11::basic_string", align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca %"class.koishidb::Slice", align 8
  %20 = alloca %"class.koishidb::InternalKey", align 8
  %21 = alloca %"struct.koishidb::Option", align 8
  %22 = alloca %"class.koishidb::TableBuilder", align 8
  %23 = alloca %"class.koishidb::Slice", align 8
  %24 = alloca %"class.koishidb::Slice", align 8
  %25 = alloca %"class.koishidb::InternalKey", align 8
  %26 = alloca %"class.koishidb::Status", align 8
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds ptr, ptr %28, i64 5
  %30 = load ptr, ptr %29, align 8
  call void %30(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 2
  %34 = load ptr, ptr %33, align 8
  %35 = call noundef zeroext i1 %34(ptr noundef nonnull align 8 dereferenceable(8) %31)
  br i1 %35, label %37, label %36

36:                                               ; preds = %4
  call void @_ZN8koishidb6Status2OKEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0)
  br label %208

37:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %38) #8
  %40 = call i32 (ptr, i32, ...) @open(ptr noundef %39, i32 noundef 65, i32 noundef 511)
  store i32 %40, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store ptr getelementptr (i8, ptr @.str, i64 1), ptr %10, align 8, !tbaa !5
  store ptr getelementptr (i8, ptr @.str, i64 1), ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_Z15OutputLogHeaderPKciS0_i(ptr noundef %41, i32 noundef 23, ptr noundef @__FUNCTION__._ZN8koishidb10BuildTableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_8FileMetaEPNS_8IteratorE, i32 noundef 300)
  %42 = load ptr, ptr @stdout, align 8, !tbaa !5
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %43) #8
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef @.str.1, ptr noundef %44) #8
  %46 = load ptr, ptr @stdout, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.2) #8
  %48 = load ptr, ptr @stdout, align 8, !tbaa !5
  %49 = call i32 @fflush(ptr noundef %48)
  %50 = load i32, ptr %9, align 4, !tbaa !11
  %51 = icmp eq i32 %50, -1
  br i1 %51, label %52, label %53

52:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #8
  call void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef @.str.3)
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #8
  call void @_ZN8koishidb5SliceC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %13)
  call void @_ZN8koishidb6Status7IOErrorERKNS_5SliceES3_(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %13)
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  store i32 1, ptr %14, align 4
  br label %207

53:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 65616, ptr %15) #8
  %54 = load i32, ptr %9, align 4, !tbaa !11
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %55)
  invoke void @_ZN8koishidb12WritableFileC2EiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(65616) %15, i32 noundef %54, ptr noundef %16)
          to label %56 unwind label %79

56:                                               ; preds = %53
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #8
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds ptr, ptr %58, i64 2
  %60 = load ptr, ptr %59, align 8
  %61 = invoke noundef zeroext i1 %60(ptr noundef nonnull align 8 dereferenceable(8) %57)
          to label %62 unwind label %83

62:                                               ; preds = %56
  br i1 %61, label %63, label %101

63:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = getelementptr inbounds ptr, ptr %65, i64 7
  %67 = load ptr, ptr %66, align 8
  %68 = invoke { ptr, i64 } %67(ptr noundef nonnull align 8 dereferenceable(8) %64)
          to label %69 unwind label %87

69:                                               ; preds = %63
  %70 = getelementptr inbounds { ptr, i64 }, ptr %19, i32 0, i32 0
  %71 = extractvalue { ptr, i64 } %68, 0
  store ptr %71, ptr %70, align 8
  %72 = getelementptr inbounds { ptr, i64 }, ptr %19, i32 0, i32 1
  %73 = extractvalue { ptr, i64 } %68, 1
  store i64 %73, ptr %72, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #8
  invoke void @_ZN8koishidb18TransToInternalKeyERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::InternalKey") align 8 %20, ptr noundef nonnull align 8 dereferenceable(16) %19)
          to label %74 unwind label %91

74:                                               ; preds = %69
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.koishidb::FileMeta", ptr %75, i32 0, i32 2
  %77 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8koishidb11InternalKeyaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %76, ptr noundef nonnull align 8 dereferenceable(32) %20)
          to label %78 unwind label %95

78:                                               ; preds = %74
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  br label %101

79:                                               ; preds = %53
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %17, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %18, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #8
  br label %206

83:                                               ; preds = %56
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %17, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %18, align 4
  br label %205

87:                                               ; preds = %63
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %17, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %18, align 4
  br label %100

91:                                               ; preds = %69
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %17, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %18, align 4
  br label %99

95:                                               ; preds = %74
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %17, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %18, align 4
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #8
  br label %99

99:                                               ; preds = %95, %91
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #8
  br label %100

100:                                              ; preds = %99, %87
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  br label %205

101:                                              ; preds = %78, %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %102 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 8) #9
          to label %103 unwind label %145

103:                                              ; preds = %101
  call void @llvm.memset.p0.i64(ptr align 8 %102, i8 0, i64 8, i1 false)
  call void @_ZN8koishidb21InternalKeyComparatorC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %102) #8
  invoke void @_ZN8koishidb6OptionC1EPKNS_10ComparatorE(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef %102)
          to label %104 unwind label %145

104:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  invoke void @_ZN8koishidb12TableBuilderC1EPKNS_6OptionEPNS_12WritableFileE(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef %21, ptr noundef %15)
          to label %105 unwind label %149

105:                                              ; preds = %104
  br label %106

106:                                              ; preds = %144, %105
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = load ptr, ptr %107, align 8, !tbaa !9
  %109 = getelementptr inbounds ptr, ptr %108, i64 2
  %110 = load ptr, ptr %109, align 8
  %111 = invoke noundef zeroext i1 %110(ptr noundef nonnull align 8 dereferenceable(8) %107)
          to label %112 unwind label %153

112:                                              ; preds = %106
  br i1 %111, label %113, label %176

113:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #8
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = load ptr, ptr %114, align 8, !tbaa !9
  %116 = getelementptr inbounds ptr, ptr %115, i64 7
  %117 = load ptr, ptr %116, align 8
  %118 = invoke { ptr, i64 } %117(ptr noundef nonnull align 8 dereferenceable(8) %114)
          to label %119 unwind label %157

119:                                              ; preds = %113
  %120 = getelementptr inbounds { ptr, i64 }, ptr %23, i32 0, i32 0
  %121 = extractvalue { ptr, i64 } %118, 0
  store ptr %121, ptr %120, align 8
  %122 = getelementptr inbounds { ptr, i64 }, ptr %23, i32 0, i32 1
  %123 = extractvalue { ptr, i64 } %118, 1
  store i64 %123, ptr %122, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #8
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = load ptr, ptr %124, align 8, !tbaa !9
  %126 = getelementptr inbounds ptr, ptr %125, i64 8
  %127 = load ptr, ptr %126, align 8
  %128 = invoke { ptr, i64 } %127(ptr noundef nonnull align 8 dereferenceable(8) %124)
          to label %129 unwind label %161

129:                                              ; preds = %119
  %130 = getelementptr inbounds { ptr, i64 }, ptr %24, i32 0, i32 0
  %131 = extractvalue { ptr, i64 } %128, 0
  store ptr %131, ptr %130, align 8
  %132 = getelementptr inbounds { ptr, i64 }, ptr %24, i32 0, i32 1
  %133 = extractvalue { ptr, i64 } %128, 1
  store i64 %133, ptr %132, align 8
  invoke void @_ZN8koishidb12TableBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %24)
          to label %134 unwind label %161

134:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 32, ptr %25) #8
  invoke void @_ZN8koishidb18TransToInternalKeyERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::InternalKey") align 8 %25, ptr noundef nonnull align 8 dereferenceable(16) %23)
          to label %135 unwind label %165

135:                                              ; preds = %134
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = getelementptr inbounds %"struct.koishidb::FileMeta", ptr %136, i32 0, i32 3
  %138 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8koishidb11InternalKeyaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %137, ptr noundef nonnull align 8 dereferenceable(32) %25)
          to label %139 unwind label %169

139:                                              ; preds = %135
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %25) #8
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = load ptr, ptr %140, align 8, !tbaa !9
  %142 = getelementptr inbounds ptr, ptr %141, i64 4
  %143 = load ptr, ptr %142, align 8
  invoke void %143(ptr noundef nonnull align 8 dereferenceable(8) %140)
          to label %144 unwind label %161

144:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  br label %106, !llvm.loop !13

145:                                              ; preds = %103, %101
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %17, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %18, align 4
  br label %204

149:                                              ; preds = %104
  %150 = landingpad { ptr, i32 }
          cleanup
  %151 = extractvalue { ptr, i32 } %150, 0
  store ptr %151, ptr %17, align 8
  %152 = extractvalue { ptr, i32 } %150, 1
  store i32 %152, ptr %18, align 4
  br label %203

153:                                              ; preds = %106
  %154 = landingpad { ptr, i32 }
          cleanup
  %155 = extractvalue { ptr, i32 } %154, 0
  store ptr %155, ptr %17, align 8
  %156 = extractvalue { ptr, i32 } %154, 1
  store i32 %156, ptr %18, align 4
  br label %202

157:                                              ; preds = %113
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %17, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %18, align 4
  br label %175

161:                                              ; preds = %139, %129, %119
  %162 = landingpad { ptr, i32 }
          cleanup
  %163 = extractvalue { ptr, i32 } %162, 0
  store ptr %163, ptr %17, align 8
  %164 = extractvalue { ptr, i32 } %162, 1
  store i32 %164, ptr %18, align 4
  br label %174

165:                                              ; preds = %134
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %17, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %18, align 4
  br label %173

169:                                              ; preds = %135
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %17, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %18, align 4
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #8
  br label %173

173:                                              ; preds = %169, %165
  call void @llvm.lifetime.end.p0(i64 32, ptr %25) #8
  br label %174

174:                                              ; preds = %173, %161
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #8
  br label %175

175:                                              ; preds = %174, %157
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  br label %202

176:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  invoke void @_ZN8koishidb12TableBuilder6FinishEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %26, ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %177 unwind label %184

177:                                              ; preds = %176
  %178 = invoke noundef zeroext i1 @_ZNK8koishidb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %26)
          to label %179 unwind label %188

179:                                              ; preds = %177
  br i1 %178, label %192, label %180

180:                                              ; preds = %179
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = invoke noundef zeroext i1 @_ZN8koishidb6RemoveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %181)
          to label %183 unwind label %188

183:                                              ; preds = %180
  call void @_ZN8koishidb6StatusC2EOS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %26) #8
  store i32 1, ptr %14, align 4
  br label %200

184:                                              ; preds = %176
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %17, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %18, align 4
  br label %201

188:                                              ; preds = %198, %194, %192, %180, %177
  %189 = landingpad { ptr, i32 }
          cleanup
  %190 = extractvalue { ptr, i32 } %189, 0
  store ptr %190, ptr %17, align 8
  %191 = extractvalue { ptr, i32 } %189, 1
  store i32 %191, ptr %18, align 4
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %26) #8
  br label %201

192:                                              ; preds = %179
  %193 = invoke noundef i64 @_ZNK8koishidb12TableBuilder8FileSizeEv(ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %194 unwind label %188

194:                                              ; preds = %192
  %195 = load ptr, ptr %7, align 8, !tbaa !5
  %196 = getelementptr inbounds %"struct.koishidb::FileMeta", ptr %195, i32 0, i32 0
  store i64 %193, ptr %196, align 8, !tbaa !15
  %197 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZN8koishidb13PrintFileMetaERNS_8FileMetaE(ptr noundef nonnull align 8 dereferenceable(80) %197)
          to label %198 unwind label %188

198:                                              ; preds = %194
  invoke void @_ZN8koishidb6Status2OKEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0)
          to label %199 unwind label %188

199:                                              ; preds = %198
  store i32 1, ptr %14, align 4
  br label %200

200:                                              ; preds = %199, %183
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @_ZN8koishidb12TableBuilderD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @_ZN8koishidb6OptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %15) #8
  call void @llvm.lifetime.end.p0(i64 65616, ptr %15) #8
  br label %207

201:                                              ; preds = %188, %184
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  br label %202

202:                                              ; preds = %201, %175, %153
  call void @_ZN8koishidb12TableBuilderD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  br label %203

203:                                              ; preds = %202, %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @_ZN8koishidb6OptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  br label %204

204:                                              ; preds = %203, %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %205

205:                                              ; preds = %204, %100, %83
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %15) #8
  br label %206

206:                                              ; preds = %205, %79
  call void @llvm.lifetime.end.p0(i64 65616, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %209

207:                                              ; preds = %200, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %208

208:                                              ; preds = %207, %36
  ret void

209:                                              ; preds = %206
  %210 = load ptr, ptr %17, align 8
  %211 = load i32, ptr %18, align 4
  %212 = insertvalue { ptr, i32 } poison, ptr %210, 0
  %213 = insertvalue { ptr, i32 } %212, i32 %211, 1
  resume { ptr, i32 } %213
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8koishidb6Status2OKEv(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8) #1 align 2

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

declare i32 @open(ptr noundef, i32 noundef, ...) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z15OutputLogHeaderPKciS0_i(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #4

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #5

declare i32 @fflush(ptr noundef) #3

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

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

declare void @_ZN8koishidb5SliceC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8koishidb12WritableFileC2EiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(65616), i32 noundef, ptr noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZN8koishidb18TransToInternalKeyERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::InternalKey") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #3

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

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

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

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

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

declare void @_ZN8koishidb6OptionC1EPKNS_10ComparatorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #3

declare void @_ZN8koishidb12TableBuilderC1EPKNS_6OptionEPNS_12WritableFileE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef) unnamed_addr #3

declare void @_ZN8koishidb12TableBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3

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

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

declare noundef zeroext i1 @_ZN8koishidb6RemoveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #3

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

declare noundef i64 @_ZNK8koishidb12TableBuilder8FileSizeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3

declare void @_ZN8koishidb13PrintFileMetaERNS_8FileMetaE(ptr noundef nonnull align 8 dereferenceable(80)) #3

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

; Function Attrs: nounwind
declare void @_ZN8koishidb12TableBuilderD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5

; Function Attrs: nounwind
declare void @_ZN8koishidb6OptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }

!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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !17, i64 0}
!16 = !{!"_ZTSN8koishidb8FileMetaE", !17, i64 0, !17, i64 8, !18, i64 16, !18, i64 48}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSN8koishidb11InternalKeyE", !19, i64 0}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !17, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, 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::Slice" = type { ptr, i64 }
%"class.koishidb::WritableFile" = type { %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i64, [65536 x i8] }
%"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::InternalKey" = type { %"class.std::__cxx11::basic_string" }
%"struct.koishidb::Option" = type { ptr }
%"class.koishidb::TableBuilder" = type { ptr }

@.str = external hidden unnamed_addr constant [72 x i8], align 1
@__FUNCTION__._ZN8koishidb10BuildTableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_8FileMetaEPNS_8IteratorE = external hidden unnamed_addr constant [11 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8koishidb10BuildTableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_8FileMetaEPNS_8IteratorE(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.koishidb::Slice", align 8
  %6 = alloca %"class.koishidb::Slice", align 8
  %7 = alloca %"class.koishidb::WritableFile", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.koishidb::Slice", align 8
  %10 = alloca %"class.koishidb::InternalKey", align 8
  %11 = alloca %"struct.koishidb::Option", align 8
  %12 = alloca %"class.koishidb::TableBuilder", align 8
  %13 = alloca %"class.koishidb::Slice", align 8
  %14 = alloca %"class.koishidb::Slice", align 8
  %15 = alloca %"class.koishidb::InternalKey", align 8
  %16 = alloca %"class.koishidb::Status", align 8
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 40
  %19 = load ptr, ptr %18, align 8
  tail call void %19(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %22 = load ptr, ptr %21, align 8
  %23 = tail call noundef zeroext i1 %22(ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %23, label %25, label %24

24:                                               ; preds = %4
  tail call void @_ZN8koishidb6Status2OKEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0)
  br label %143

25:                                               ; preds = %4
  %26 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #9
  %27 = tail call i32 (ptr, i32, ...) @open(ptr noundef %26, i32 noundef 65, i32 noundef 511)
  tail call void @_Z15OutputLogHeaderPKciS0_i(ptr noundef nonnull getelementptr inbounds (i8, ptr @.str, i64 1), i32 noundef 23, ptr noundef nonnull @__FUNCTION__._ZN8koishidb10BuildTableERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_8FileMetaEPNS_8IteratorE, i32 noundef 300)
  %28 = load ptr, ptr @stdout, align 8, !tbaa !8
  %29 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #9
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.1, ptr noundef %29) #9
  %31 = load ptr, ptr @stdout, align 8, !tbaa !8
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.2) #9
  %33 = load ptr, ptr @stdout, align 8, !tbaa !8
  %34 = tail call i32 @fflush(ptr noundef %33)
  %35 = icmp eq i32 %27, -1
  br i1 %35, label %36, label %37

36:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #9
  call void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull @.str.3)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #9
  call void @_ZN8koishidb5SliceC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @_ZN8koishidb6Status7IOErrorERKNS_5SliceES3_(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #9
  br label %143

37:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 65616, ptr nonnull %7) #9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %1)
  invoke void @_ZN8koishidb12WritableFileC2EiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(65616) %7, i32 noundef %27, ptr noundef nonnull %8)
          to label %38 unwind label %57

38:                                               ; preds = %37
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 16
  %41 = load ptr, ptr %40, align 8
  %42 = invoke noundef zeroext i1 %41(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %43 unwind label %59

43:                                               ; preds = %38
  br i1 %42, label %44, label %69

44:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #9
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 56
  %47 = load ptr, ptr %46, align 8
  %48 = invoke { ptr, i64 } %47(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %49 unwind label %61

49:                                               ; preds = %44
  %50 = extractvalue { ptr, i64 } %48, 0
  store ptr %50, ptr %9, align 8
  %51 = getelementptr inbounds i8, ptr %9, i64 8
  %52 = extractvalue { ptr, i64 } %48, 1
  store i64 %52, ptr %51, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #9
  invoke void @_ZN8koishidb18TransToInternalKeyERKNS_5SliceE(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::InternalKey") align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %53 unwind label %63

53:                                               ; preds = %49
  %54 = getelementptr inbounds i8, ptr %2, i64 16
  %55 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8koishidb11InternalKeyaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %54, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %56 unwind label %65

56:                                               ; preds = %53
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  br label %69

57:                                               ; preds = %37
  %58 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #9
  br label %142

59:                                               ; preds = %38
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %141

61:                                               ; preds = %44
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %68

63:                                               ; preds = %49
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %67

65:                                               ; preds = %53
  %66 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #9
  br label %67

67:                                               ; preds = %65, %63
  %.pn = phi { ptr, i32 } [ %66, %65 ], [ %64, %63 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #9
  br label %68

68:                                               ; preds = %67, %61
  %.pn.pn = phi { ptr, i32 } [ %.pn, %67 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  br label %141

69:                                               ; preds = %56, %43
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #9
  %70 = invoke noalias noundef nonnull dereferenceable(8) ptr @_Znwm(i64 noundef 8) #10
          to label %71 unwind label %105

71:                                               ; preds = %69
  store i64 0, ptr %70, align 8
  call void @_ZN8koishidb21InternalKeyComparatorC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %70) #9
  invoke void @_ZN8koishidb6OptionC1EPKNS_10ComparatorE(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull %70)
          to label %72 unwind label %105

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #9
  invoke void @_ZN8koishidb12TableBuilderC1EPKNS_6OptionEPNS_12WritableFileE(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull %11, ptr noundef nonnull %7)
          to label %.preheader unwind label %107

.preheader:                                       ; preds = %72
  %73 = getelementptr inbounds i8, ptr %13, i64 8
  %74 = getelementptr inbounds i8, ptr %14, i64 8
  %75 = getelementptr inbounds i8, ptr %2, i64 48
  br label %76

76:                                               ; preds = %.preheader, %104
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %77, i64 16
  %79 = load ptr, ptr %78, align 8
  %80 = invoke noundef zeroext i1 %79(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %81 unwind label %109

81:                                               ; preds = %76
  br i1 %80, label %82, label %122

82:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #9
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds i8, ptr %83, i64 56
  %85 = load ptr, ptr %84, align 8
  %86 = invoke { ptr, i64 } %85(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %87 unwind label %111

87:                                               ; preds = %82
  %88 = extractvalue { ptr, i64 } %86, 0
  store ptr %88, ptr %13, align 8
  %89 = extractvalue { ptr, i64 } %86, 1
  store i64 %89, ptr %73, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #9
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i64 64
  %92 = load ptr, ptr %91, align 8
  %93 = invoke { ptr, i64 } %92(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %94 unwind label %113

94:                                               ; preds = %87
  %95 = extractvalue { ptr, i64 } %93, 0
  store ptr %95, ptr %14, align 8
  %96 = extractvalue { ptr, i64 } %93, 1
  store i64 %96, ptr %74, align 8
  invoke void @_ZN8koishidb12TableBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %97 unwind label %113

97:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %15) #9
  invoke void @_ZN8koishidb18TransToInternalKeyERKNS_5SliceE(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::InternalKey") align 8 %15, ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %98 unwind label %115

98:                                               ; preds = %97
  %99 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8koishidb11InternalKeyaSERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %75, ptr noundef nonnull align 8 dereferenceable(32) %15)
          to label %100 unwind label %117

100:                                              ; preds = %98
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %15) #9
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds i8, ptr %101, i64 32
  %103 = load ptr, ptr %102, align 8
  invoke void %103(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %104 unwind label %113

104:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #9
  br label %76, !llvm.loop !11

105:                                              ; preds = %71, %69
  %106 = landingpad { ptr, i32 }
          cleanup
  br label %140

107:                                              ; preds = %72
  %108 = landingpad { ptr, i32 }
          cleanup
  br label %139

109:                                              ; preds = %76
  %110 = landingpad { ptr, i32 }
          cleanup
  br label %138

111:                                              ; preds = %82
  %112 = landingpad { ptr, i32 }
          cleanup
  br label %121

113:                                              ; preds = %100, %94, %87
  %114 = landingpad { ptr, i32 }
          cleanup
  br label %120

115:                                              ; preds = %97
  %116 = landingpad { ptr, i32 }
          cleanup
  br label %119

117:                                              ; preds = %98
  %118 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8koishidb11InternalKeyD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #9
  br label %119

119:                                              ; preds = %117, %115
  %.pn36 = phi { ptr, i32 } [ %118, %117 ], [ %116, %115 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %15) #9
  br label %120

120:                                              ; preds = %119, %113
  %.pn38 = phi { ptr, i32 } [ %114, %113 ], [ %.pn36, %119 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #9
  br label %121

121:                                              ; preds = %120, %111
  %.pn38.pn = phi { ptr, i32 } [ %.pn38, %120 ], [ %112, %111 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #9
  br label %138

122:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #9
  invoke void @_ZN8koishidb12TableBuilder6FinishEv(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::Status") align 8 %16, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %123 unwind label %128

123:                                              ; preds = %122
  %124 = call noundef zeroext i1 @_ZNK8koishidb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
  br i1 %124, label %132, label %125

125:                                              ; preds = %123
  %126 = invoke noundef zeroext i1 @_ZN8koishidb6RemoveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %127 unwind label %130

127:                                              ; preds = %125
  call void @_ZN8koishidb6StatusC2EOS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %16) #9
  br label %136

128:                                              ; preds = %122
  %129 = landingpad { ptr, i32 }
          cleanup
  br label %137

130:                                              ; preds = %134, %132, %125
  %131 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #9
  br label %137

132:                                              ; preds = %123
  %133 = invoke noundef i64 @_ZNK8koishidb12TableBuilder8FileSizeEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %134 unwind label %130

134:                                              ; preds = %132
  store i64 %133, ptr %2, align 8, !tbaa !13
  invoke void @_ZN8koishidb13PrintFileMetaERNS_8FileMetaE(ptr noundef nonnull align 8 dereferenceable(80) %2)
          to label %135 unwind label %130

135:                                              ; preds = %134
  call void @_ZN8koishidb6Status2OKEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %0)
  br label %136

136:                                              ; preds = %135, %127
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #9
  call void @_ZN8koishidb12TableBuilderD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #9
  call void @_ZN8koishidb6OptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %7) #9
  call void @llvm.lifetime.end.p0(i64 65616, ptr nonnull %7) #9
  br label %143

137:                                              ; preds = %130, %128
  %.pn34 = phi { ptr, i32 } [ %131, %130 ], [ %129, %128 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #9
  br label %138

138:                                              ; preds = %137, %121, %109
  %.pn38.pn.pn = phi { ptr, i32 } [ %.pn38.pn, %121 ], [ %.pn34, %137 ], [ %110, %109 ]
  call void @_ZN8koishidb12TableBuilderD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #9
  br label %139

139:                                              ; preds = %138, %107
  %.pn38.pn.pn.pn = phi { ptr, i32 } [ %.pn38.pn.pn, %138 ], [ %108, %107 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #9
  call void @_ZN8koishidb6OptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  br label %140

140:                                              ; preds = %139, %105
  %.pn38.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn38.pn.pn.pn, %139 ], [ %106, %105 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  br label %141

141:                                              ; preds = %140, %68, %59
  %.pn38.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn38.pn.pn.pn.pn, %140 ], [ %.pn.pn, %68 ], [ %60, %59 ]
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %7) #9
  br label %142

142:                                              ; preds = %141, %57
  %.pn38.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn38.pn.pn.pn.pn.pn, %141 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 65616, ptr nonnull %7) #9
  resume { ptr, i32 } %.pn38.pn.pn.pn.pn.pn.pn

143:                                              ; preds = %36, %136, %24
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8koishidb6Status2OKEv(ptr dead_on_unwind noalias writable sret(%"class.koishidb::Status") align 8) local_unnamed_addr #1 align 2

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

; Function Attrs: nofree
declare noundef i32 @open(ptr nocapture noundef readonly, i32 noundef, ...) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z15OutputLogHeaderPKciS0_i(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #5

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

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

declare void @_ZN8koishidb5SliceC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8koishidb12WritableFileC2EiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(65616), i32 noundef, ptr noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZN8koishidb18TransToInternalKeyERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::InternalKey") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6

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

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

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

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

declare void @_ZN8koishidb6OptionC1EPKNS_10ComparatorE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #6

declare void @_ZN8koishidb12TableBuilderC1EPKNS_6OptionEPNS_12WritableFileE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef) unnamed_addr #6

declare void @_ZN8koishidb12TableBuilder3AddERKNS_5SliceES3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6

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

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

declare noundef zeroext i1 @_ZN8koishidb6RemoveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #6

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

declare noundef i64 @_ZNK8koishidb12TableBuilder8FileSizeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

declare void @_ZN8koishidb13PrintFileMetaERNS_8FileMetaE(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #6

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

; Function Attrs: nounwind
declare void @_ZN8koishidb12TableBuilderD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #8

; Function Attrs: nounwind
declare void @_ZN8koishidb6OptionD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #8

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

attributes #0 = { 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree "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 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 = { nofree 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 #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTSN8koishidb8FileMetaE", !15, i64 0, !15, i64 8, !16, i64 16, !16, i64 48}
!15 = !{!"long", !10, i64 0}
!16 = !{!"_ZTSN8koishidb11InternalKeyE", !17, i64 0}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !15, i64 8, !10, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}


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