; LLVM IR from KoishiDB/Koishi-DB :: src/db_impl.ll (ZN8koishidb6DBimpl12DumpManifestEv)

; 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::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.std::allocator.3" = type { i8 }
%"class.koishidb::Status" = type { ptr }
%"class.koishidb::Slice" = type { ptr, i64 }
%"class.koishidb::DBimpl" = type { %"class.koishidb::DB", %"class.std::deque", %"class.std::shared_mutex", %"class.std::mutex", ptr, ptr, %"class.std::condition_variable", i8, i64, %"struct.std::atomic", %"class.std::vector", i64, ptr }
%"class.koishidb::DB" = type { ptr }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<koishidb::DBimpl::Writer *, std::allocator<koishidb::DBimpl::Writer *>>::_Deque_impl" }
%"struct.std::_Deque_base<koishidb::DBimpl::Writer *, std::allocator<koishidb::DBimpl::Writer *>>::_Deque_impl" = type { %"struct.std::_Deque_base<koishidb::DBimpl::Writer *, std::allocator<koishidb::DBimpl::Writer *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<koishidb::DBimpl::Writer *, std::allocator<koishidb::DBimpl::Writer *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::shared_mutex" = type { %"class.std::__shared_mutex_pthread" }
%"class.std::__shared_mutex_pthread" = type { %union.pthread_rwlock_t }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<koishidb::FileMeta *, std::allocator<koishidb::FileMeta *>>::_Vector_impl" }
%"struct.std::_Vector_base<koishidb::FileMeta *, std::allocator<koishidb::FileMeta *>>::_Vector_impl" = type { %"struct.std::_Vector_base<koishidb::FileMeta *, std::allocator<koishidb::FileMeta *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<koishidb::FileMeta *, std::allocator<koishidb::FileMeta *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8koishidb6DBimpl12DumpManifestEv(ptr noundef nonnull align 8 dereferenceable(312) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.koishidb::WritableFile", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator.3", align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.koishidb::Status", align 8
  %11 = alloca %"class.koishidb::Slice", align 8
  %12 = alloca %"class.koishidb::Status", align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %15 = call i32 (ptr, i32, ...) @open(ptr noundef @.str.3, i32 noundef 65, i32 noundef 511)
  store i32 %15, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 65616, ptr %4) #4
  %16 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %17 unwind label %37

17:                                               ; preds = %1
  invoke void @_ZN8koishidb12WritableFileC2EiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(65616) %4, i32 noundef %16, ptr noundef %5)
          to label %18 unwind label %41

18:                                               ; preds = %17
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #4
  %19 = getelementptr inbounds %"class.koishidb::DBimpl", ptr %14, i32 0, i32 10
  %20 = call noundef i64 @_ZNKSt6vectorIPN8koishidb8FileMetaESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #4
  %21 = trunc i64 %20 to i32
  invoke void @_ZN8koishidb11PutVarint32EjPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(i32 noundef %21, ptr noundef %9)
          to label %22 unwind label %46

22:                                               ; preds = %18
  %23 = getelementptr inbounds %"class.koishidb::DBimpl", ptr %14, i32 0, i32 8
  %24 = load i64, ptr %23, align 8, !tbaa !11
  invoke void @_ZN8koishidb11PutVarint64EPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef %9, i64 noundef %24)
          to label %25 unwind label %46

25:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  %26 = call noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #4
  invoke void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef %26)
          to label %27 unwind label %50

27:                                               ; preds = %25
  invoke void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %10, ptr noundef nonnull align 8 dereferenceable(65616) %4, ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %28 unwind label %50

28:                                               ; preds = %27
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  invoke void @_ZN8koishidb12WritableFile5FlushEv(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %12, ptr noundef nonnull align 8 dereferenceable(65616) %4)
          to label %29 unwind label %46

29:                                               ; preds = %28
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %67, %29
  %31 = load i32, ptr %13, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %"class.koishidb::DBimpl", ptr %14, i32 0, i32 10
  %34 = call noundef i64 @_ZNKSt6vectorIPN8koishidb8FileMetaESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %33) #4
  %35 = icmp ult i64 %32, %34
  br i1 %35, label %54, label %36

36:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %74

37:                                               ; preds = %1
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %7, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %8, align 4
  br label %45

41:                                               ; preds = %17
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %7, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %8, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  br label %45

45:                                               ; preds = %41, %37
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  br label %76

46:                                               ; preds = %28, %22, %18
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %7, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %8, align 4
  br label %75

50:                                               ; preds = %27, %25
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %7, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  br label %75

54:                                               ; preds = %30
  %55 = getelementptr inbounds %"class.koishidb::DBimpl", ptr %14, i32 0, i32 10
  %56 = load i32, ptr %13, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN8koishidb8FileMetaESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %55, i64 noundef %57) #4
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  invoke void @_ZN8koishidb13PrintFileMetaERNS_8FileMetaE(ptr noundef nonnull align 8 dereferenceable(80) %59)
          to label %60 unwind label %70

60:                                               ; preds = %54
  %61 = getelementptr inbounds %"class.koishidb::DBimpl", ptr %14, i32 0, i32 10
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN8koishidb8FileMetaESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %63) #4
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  invoke void @_ZN8koishidb14EncodeFileMetaEPNS_8FileMetaERNS_12WritableFileE(ptr noundef %65, ptr noundef nonnull align 8 dereferenceable(65616) %4)
          to label %66 unwind label %70

66:                                               ; preds = %60
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %13, align 4, !tbaa !9
  br label %30, !llvm.loop !33

70:                                               ; preds = %60, %54
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %7, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %75

74:                                               ; preds = %36
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %4) #4
  call void @llvm.lifetime.end.p0(i64 65616, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void

75:                                               ; preds = %70, %50, %46
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %4) #4
  br label %76

76:                                               ; preds = %75, %45
  call void @llvm.lifetime.end.p0(i64 65616, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %77

77:                                               ; preds = %76
  %78 = load ptr, ptr %7, align 8
  %79 = load i32, ptr %8, align 4
  %80 = insertvalue { ptr, i32 } poison, ptr %78, 0
  %81 = insertvalue { ptr, i32 } %80, i32 %79, 1
  resume { ptr, i32 } %81
}

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 #2 align 2

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

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

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

declare void @_ZN8koishidb11PutVarint32EjPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(i32 noundef, ptr noundef) #3

declare void @_ZN8koishidb11PutVarint64EPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef, i64 noundef) #3

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

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

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

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

declare void @_ZN8koishidb14EncodeFileMetaEPNS_8FileMetaERNS_12WritableFileE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(65616)) #3

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !18, i64 256}
!12 = !{!"_ZTSN8koishidb6DBimplE", !13, i64 0, !14, i64 8, !20, i64 88, !22, i64 144, !6, i64 184, !6, i64 192, !24, i64 200, !26, i64 248, !18, i64 256, !27, i64 264, !29, i64 272, !18, i64 296, !6, i64 304}
!13 = !{!"_ZTSN8koishidb2DBE"}
!14 = !{!"_ZTSSt5dequeIPN8koishidb6DBimpl6WriterESaIS3_EE", !15, i64 0}
!15 = !{!"_ZTSSt11_Deque_baseIPN8koishidb6DBimpl6WriterESaIS3_EE", !16, i64 0}
!16 = !{!"_ZTSNSt11_Deque_baseIPN8koishidb6DBimpl6WriterESaIS3_EE11_Deque_implE", !17, i64 0}
!17 = !{!"_ZTSNSt11_Deque_baseIPN8koishidb6DBimpl6WriterESaIS3_EE16_Deque_impl_dataE", !6, i64 0, !18, i64 8, !19, i64 16, !19, i64 48}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTSSt15_Deque_iteratorIPN8koishidb6DBimpl6WriterERS3_PS3_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!"_ZTSSt12shared_mutex", !21, i64 0}
!21 = !{!"_ZTSSt22__shared_mutex_pthread", !7, i64 0}
!22 = !{!"_ZTSSt5mutex", !23, i64 0}
!23 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!24 = !{!"_ZTSSt18condition_variable", !25, i64 0}
!25 = !{!"_ZTSSt9__condvar", !7, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!"_ZTSSt6atomicIbE", !28, i64 0}
!28 = !{!"_ZTSSt13__atomic_baseIbE", !26, i64 0}
!29 = !{!"_ZTSSt6vectorIPN8koishidb8FileMetaESaIS2_EE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseIPN8koishidb8FileMetaESaIS2_EE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIPN8koishidb8FileMetaESaIS2_EE12_Vector_implE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIPN8koishidb8FileMetaESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}


; 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::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.std::allocator.3" = type { i8 }
%"class.koishidb::Status" = type { ptr }
%"class.koishidb::Slice" = type { ptr, i64 }

@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8koishidb6DBimpl12DumpManifestEv(ptr noundef nonnull align 8 dereferenceable(312) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.koishidb::WritableFile", align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::allocator.3", align 1
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.koishidb::Status", align 8
  %7 = alloca %"class.koishidb::Slice", align 8
  %8 = alloca %"class.koishidb::Status", align 8
  %9 = tail call i32 (ptr, i32, ...) @open(ptr noundef nonnull @.str.3, i32 noundef 65, i32 noundef 511)
  call void @llvm.lifetime.start.p0(i64 65616, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull @.str.3, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %10 unwind label %24

10:                                               ; preds = %1
  invoke void @_ZN8koishidb12WritableFileC2EiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(65616) %2, i32 noundef %9, ptr noundef nonnull %3)
          to label %11 unwind label %26

11:                                               ; preds = %10
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  %12 = getelementptr inbounds i8, ptr %0, i64 272
  %13 = call noundef i64 @_ZNKSt6vectorIPN8koishidb8FileMetaESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  %14 = trunc i64 %13 to i32
  invoke void @_ZN8koishidb11PutVarint32EjPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(i32 noundef %14, ptr noundef nonnull %5)
          to label %15 unwind label %29

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 256
  %17 = load i64, ptr %16, align 8, !tbaa !5
  invoke void @_ZN8koishidb11PutVarint64EPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef nonnull %5, i64 noundef %17)
          to label %18 unwind label %29

18:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  %19 = call noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  invoke void @_ZN8koishidb5SliceC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef %19)
          to label %20 unwind label %31

20:                                               ; preds = %18
  invoke void @_ZN8koishidb12WritableFile6AppendERKNS_5SliceE(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::Status") align 8 %6, ptr noundef nonnull align 8 dereferenceable(65616) %2, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %21 unwind label %31

21:                                               ; preds = %20
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  invoke void @_ZN8koishidb12WritableFile5FlushEv(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::Status") align 8 %8, ptr noundef nonnull align 8 dereferenceable(65616) %2)
          to label %22 unwind label %29

22:                                               ; preds = %21
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  %23 = call noundef i64 @_ZNKSt6vectorIPN8koishidb8FileMetaESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  %.not = icmp eq i64 %23, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %38, %22
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %2) #5
  call void @llvm.lifetime.end.p0(i64 65616, ptr nonnull %2) #5
  ret void

24:                                               ; preds = %1
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %28

26:                                               ; preds = %10
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  br label %28

28:                                               ; preds = %26, %24
  %.pn = phi { ptr, i32 } [ %27, %26 ], [ %25, %24 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  br label %44

29:                                               ; preds = %21, %15, %11
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %43

31:                                               ; preds = %20, %18
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  br label %43

.lr.ph:                                           ; preds = %22, %38
  %indvars.iv = phi i64 [ %indvars.iv.next, %38 ], [ 0, %22 ]
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN8koishidb8FileMetaESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %indvars.iv) #5
  %34 = load ptr, ptr %33, align 8, !tbaa !30
  invoke void @_ZN8koishidb13PrintFileMetaERNS_8FileMetaE(ptr noundef nonnull align 8 dereferenceable(80) %34)
          to label %35 unwind label %41

35:                                               ; preds = %.lr.ph
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN8koishidb8FileMetaESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %indvars.iv) #5
  %37 = load ptr, ptr %36, align 8, !tbaa !30
  invoke void @_ZN8koishidb14EncodeFileMetaEPNS_8FileMetaERNS_12WritableFileE(ptr noundef %37, ptr noundef nonnull align 8 dereferenceable(65616) %2)
          to label %38 unwind label %41

38:                                               ; preds = %35
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = call noundef i64 @_ZNKSt6vectorIPN8koishidb8FileMetaESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  %40 = icmp ugt i64 %39, %indvars.iv.next
  br i1 %40, label %.lr.ph, label %._crit_edge, !llvm.loop !31

41:                                               ; preds = %35, %.lr.ph
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %43

43:                                               ; preds = %41, %31, %29
  %.pn13 = phi { ptr, i32 } [ %42, %41 ], [ %30, %29 ], [ %32, %31 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @_ZN8koishidb12WritableFileD2Ev(ptr noundef nonnull align 8 dereferenceable(65616) %2) #5
  br label %44

44:                                               ; preds = %43, %28
  %.pn13.pn = phi { ptr, i32 } [ %.pn13, %43 ], [ %.pn, %28 ]
  call void @llvm.lifetime.end.p0(i64 65616, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn13.pn
}

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 #2 align 2

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

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

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

declare void @_ZN8koishidb11PutVarint32EjPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(i32 noundef, ptr noundef) local_unnamed_addr #4

declare void @_ZN8koishidb11PutVarint64EPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm(ptr noundef, i64 noundef) local_unnamed_addr #4

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 #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 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 #4

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

declare void @_ZN8koishidb14EncodeFileMetaEPNS_8FileMetaERNS_12WritableFileE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(65616)) local_unnamed_addr #4

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

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

!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, !15, i64 256}
!6 = !{!"_ZTSN8koishidb6DBimplE", !7, i64 0, !8, i64 8, !17, i64 88, !19, i64 144, !12, i64 184, !12, i64 192, !21, i64 200, !23, i64 248, !15, i64 256, !24, i64 264, !26, i64 272, !15, i64 296, !12, i64 304}
!7 = !{!"_ZTSN8koishidb2DBE"}
!8 = !{!"_ZTSSt5dequeIPN8koishidb6DBimpl6WriterESaIS3_EE", !9, i64 0}
!9 = !{!"_ZTSSt11_Deque_baseIPN8koishidb6DBimpl6WriterESaIS3_EE", !10, i64 0}
!10 = !{!"_ZTSNSt11_Deque_baseIPN8koishidb6DBimpl6WriterESaIS3_EE11_Deque_implE", !11, i64 0}
!11 = !{!"_ZTSNSt11_Deque_baseIPN8koishidb6DBimpl6WriterESaIS3_EE16_Deque_impl_dataE", !12, i64 0, !15, i64 8, !16, i64 16, !16, i64 48}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"_ZTSSt15_Deque_iteratorIPN8koishidb6DBimpl6WriterERS3_PS3_E", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!17 = !{!"_ZTSSt12shared_mutex", !18, i64 0}
!18 = !{!"_ZTSSt22__shared_mutex_pthread", !13, i64 0}
!19 = !{!"_ZTSSt5mutex", !20, i64 0}
!20 = !{!"_ZTSSt12__mutex_base", !13, i64 0}
!21 = !{!"_ZTSSt18condition_variable", !22, i64 0}
!22 = !{!"_ZTSSt9__condvar", !13, i64 0}
!23 = !{!"bool", !13, i64 0}
!24 = !{!"_ZTSSt6atomicIbE", !25, i64 0}
!25 = !{!"_ZTSSt13__atomic_baseIbE", !23, i64 0}
!26 = !{!"_ZTSSt6vectorIPN8koishidb8FileMetaESaIS2_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseIPN8koishidb8FileMetaESaIS2_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIPN8koishidb8FileMetaESaIS2_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIPN8koishidb8FileMetaESaIS2_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!30 = !{!12, !12, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass