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

; 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::BlockHandle" = type { i64, i64 }
%"class.koishidb::Slice" = type { ptr, i64 }
%"class.koishidb::Status" = type { ptr }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload.base", [7 x i8] }
%"struct.std::_Optional_payload.base" = type { %"struct.std::_Optional_payload_base.base" }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<std::unique_ptr<koishidb::Slice>>::_Storage", i8 }>
%"union.std::_Optional_payload_base<std::unique_ptr<koishidb::Slice>>::_Storage" = type { %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.2" }
%"struct.std::_Head_base.2" = type { ptr }
%"class.koishidb::SSTableIterator" = type { %"class.koishidb::Iterator", ptr, ptr, ptr, ptr, %"class.std::__cxx11::basic_string" }
%"class.koishidb::Iterator" = type { ptr }
%"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] }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN8koishidb15SSTableIterator11BlockReaderEPNS_16RandomAccessFileERKNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.koishidb::BlockHandle", align 8
  %9 = alloca %"class.koishidb::Slice", align 8
  %10 = alloca %"class.koishidb::Status", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::optional", align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #9
  call void @_ZN8koishidb11BlockHandleC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #9
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %17, i64 16, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  call void @_ZN8koishidb11BlockHandle10DecodeFromEPNS_5SliceE(ptr dead_on_unwind writable sret(%"class.koishidb::Status") align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef %9)
  %18 = invoke noundef zeroext i1 @_ZNK8koishidb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %19 unwind label %21

19:                                               ; preds = %3
  br i1 %18, label %25, label %20

20:                                               ; preds = %19
  store ptr null, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %62

21:                                               ; preds = %3
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %11, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %12, align 4
  br label %64

25:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #9
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN8koishidb9ReadBlockEPNS_16RandomAccessFileERKNS_11BlockHandleE(ptr dead_on_unwind writable sret(%"class.std::optional") align 8 %14, ptr noundef %26, ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %27 unwind label %30

27:                                               ; preds = %25
  %28 = call noundef zeroext i1 @_ZNKSt8optionalISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EEE9has_valueEv(ptr noundef nonnull align 8 dereferenceable(16) %14) #9
  br i1 %28, label %34, label %29

29:                                               ; preds = %27
  store ptr null, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %60

30:                                               ; preds = %25
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %11, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %12, align 4
  br label %61

34:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %35 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #10
          to label %36 unwind label %47

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNRSt8optionalISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EEE5valueEv(ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %38 unwind label %51

38:                                               ; preds = %36
  %39 = call noundef ptr @_ZNKSt10unique_ptrIN8koishidb5SliceESt14default_deleteIS1_EE3getEv(ptr noundef nonnull align 8 dereferenceable(8) %37) #9
  invoke void @_ZN8koishidb5BlockC2EPKNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef %39)
          to label %40 unwind label %51

40:                                               ; preds = %38
  store ptr %35, ptr %15, align 8, !tbaa !5
  %41 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 88) #10
          to label %42 unwind label %47

42:                                               ; preds = %40
  %43 = load ptr, ptr %15, align 8, !tbaa !5
  %44 = getelementptr inbounds %"class.koishidb::SSTableIterator", ptr %16, i32 0, i32 3
  %45 = load ptr, ptr %44, align 8, !tbaa !12
  invoke void @_ZN8koishidb13BlockIteratorC1EPNS_5BlockEPKNS_6OptionE(ptr noundef nonnull align 8 dereferenceable(88) %41, ptr noundef %43, ptr noundef %45)
          to label %46 unwind label %55

46:                                               ; preds = %42
  store ptr %41, ptr %4, align 8
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  br label %60

47:                                               ; preds = %40, %34
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %11, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %12, align 4
  br label %59

51:                                               ; preds = %38, %36
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %11, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %35, i64 noundef 16) #11
  br label %59

55:                                               ; preds = %42
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %11, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %41, i64 noundef 88) #11
  br label %59

59:                                               ; preds = %55, %51, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @_ZNSt14_Optional_baseISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EELb0ELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #9
  br label %61

60:                                               ; preds = %46, %29
  call void @_ZNSt14_Optional_baseISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EELb0ELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #9
  br label %62

61:                                               ; preds = %59, %30
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #9
  br label %64

62:                                               ; preds = %60, %20
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #9
  %63 = load ptr, ptr %4, align 8
  ret ptr %63

64:                                               ; preds = %61, %21
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #9
  br label %65

65:                                               ; preds = %64
  %66 = load ptr, ptr %11, align 8
  %67 = load i32, ptr %12, align 4
  %68 = insertvalue { ptr, i32 } poison, ptr %66, 0
  %69 = insertvalue { ptr, i32 } %68, i32 %67, 1
  resume { ptr, i32 } %69
}

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

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

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

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

declare void @_ZN8koishidb9ReadBlockEPNS_16RandomAccessFileERKNS_11BlockHandleE(ptr dead_on_unwind writable sret(%"class.std::optional") align 8, ptr noundef, ptr noundef nonnull align 8 dereferenceable(16)) #6

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNRSt8optionalISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EEE5valueEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #8

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i64 0, i64 8, !5, i64 8, i64 8, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !6, i64 24}
!13 = !{!"_ZTSN8koishidb15SSTableIteratorE", !14, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !15, i64 40}
!14 = !{!"_ZTSN8koishidb8IteratorE"}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !11, i64 8, !7, i64 16}
!16 = !{!"_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::BlockHandle" = type { i64, i64 }
%"class.koishidb::Slice" = type { ptr, i64 }
%"class.koishidb::Status" = type { ptr }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload.base", [7 x i8] }
%"struct.std::_Optional_payload.base" = type { %"struct.std::_Optional_payload_base.base" }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<std::unique_ptr<koishidb::Slice>>::_Storage", i8 }>
%"union.std::_Optional_payload_base<std::unique_ptr<koishidb::Slice>>::_Storage" = type { %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.2" }
%"struct.std::_Head_base.2" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN8koishidb15SSTableIterator11BlockReaderEPNS_16RandomAccessFileERKNS_5SliceE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(72) %0, ptr noundef %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.koishidb::BlockHandle", align 8
  %5 = alloca %"class.koishidb::Slice", align 8
  %6 = alloca %"class.koishidb::Status", align 8
  %7 = alloca %"class.std::optional", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #9
  call void @_ZN8koishidb11BlockHandleC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %2, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  call void @_ZN8koishidb11BlockHandle10DecodeFromEPNS_5SliceE(ptr dead_on_unwind nonnull writable sret(%"class.koishidb::Status") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull %5)
  %8 = call noundef zeroext i1 @_ZNK8koishidb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %8, label %9, label %34

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #9
  invoke void @_ZN8koishidb9ReadBlockEPNS_16RandomAccessFileERKNS_11BlockHandleE(ptr dead_on_unwind nonnull writable sret(%"class.std::optional") align 8 %7, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %10 unwind label %12

10:                                               ; preds = %9
  %11 = call noundef zeroext i1 @_ZNKSt8optionalISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EEE9has_valueEv(ptr noundef nonnull align 8 dereferenceable(16) %7) #9
  br i1 %11, label %14, label %32

12:                                               ; preds = %9
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %33

14:                                               ; preds = %10
  %15 = invoke noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #10
          to label %16 unwind label %25

16:                                               ; preds = %14
  %17 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNRSt8optionalISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EEE5valueEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %18 unwind label %27

18:                                               ; preds = %16
  %19 = call noundef ptr @_ZNKSt10unique_ptrIN8koishidb5SliceESt14default_deleteIS1_EE3getEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  invoke void @_ZN8koishidb5BlockC2EPKNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef %19)
          to label %20 unwind label %27

20:                                               ; preds = %18
  %21 = invoke noalias noundef nonnull dereferenceable(88) ptr @_Znwm(i64 noundef 88) #10
          to label %22 unwind label %25

22:                                               ; preds = %20
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  invoke void @_ZN8koishidb13BlockIteratorC1EPNS_5BlockEPKNS_6OptionE(ptr noundef nonnull align 8 dereferenceable(88) %21, ptr noundef nonnull %15, ptr noundef %24)
          to label %32 unwind label %29

25:                                               ; preds = %20, %14
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %31

27:                                               ; preds = %18, %16
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %15, i64 noundef 16) #11
  br label %31

29:                                               ; preds = %22
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %21, i64 noundef 88) #11
  br label %31

31:                                               ; preds = %29, %27, %25
  %.pn = phi { ptr, i32 } [ %30, %29 ], [ %26, %25 ], [ %28, %27 ]
  call void @_ZNSt14_Optional_baseISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EELb0ELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #9
  br label %33

32:                                               ; preds = %22, %10
  %.0 = phi ptr [ null, %10 ], [ %21, %22 ]
  call void @_ZNSt14_Optional_baseISt10unique_ptrIN8koishidb5SliceESt14default_deleteIS2_EELb0ELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #9
  br label %34

33:                                               ; preds = %31, %12
  %.pn.pn = phi { ptr, i32 } [ %.pn, %31 ], [ %13, %12 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #9
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #9
  resume { ptr, i32 } %.pn.pn

34:                                               ; preds = %3, %32
  %.1 = phi ptr [ %.0, %32 ], [ null, %3 ]
  call void @_ZN8koishidb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #9
  ret ptr %.1
}

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #8

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{i64 0, i64 8, !6, i64 8, i64 8, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !7, i64 24}
!13 = !{!"_ZTSN8koishidb15SSTableIteratorE", !14, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !15, i64 40}
!14 = !{!"_ZTSN8koishidb8IteratorE"}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !11, i64 8, !8, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass