; LLVM IR from nsccgz-storage/nvlsm :: table_nvm/table_nvm.ll (ZNK7leveldb7Segment11NewIteratorERKNS_11ReadOptionsE)

; 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.leveldb::Segment" = type { ptr }
%"struct.leveldb::Segment::SegRep" = type { %"struct.leveldb::Options", i64, i64, ptr, i64, i64, ptr, %"class.std::vector.15" }
%"struct.leveldb::Options" = type { ptr, i8, i8, i8, ptr, ptr, i64, i32, ptr, i64, i32, i64, i32, i8, ptr, i64 }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<leveldb::KeyMetaData *, std::allocator<leveldb::KeyMetaData *>>::_Vector_impl" }
%"struct.std::_Vector_base<leveldb::KeyMetaData *, std::allocator<leveldb::KeyMetaData *>>::_Vector_impl" = type { %"struct.std::_Vector_base<leveldb::KeyMetaData *, std::allocator<leveldb::KeyMetaData *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<leveldb::KeyMetaData *, std::allocator<leveldb::KeyMetaData *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZNK7leveldb7Segment11NewIteratorERKNS_11ReadOptionsE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 128) #3
  %9 = getelementptr inbounds %"class.leveldb::Segment", ptr %7, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %"struct.leveldb::Segment::SegRep", ptr %10, i32 0, i32 0
  %12 = getelementptr inbounds %"struct.leveldb::Options", ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = getelementptr inbounds %"class.leveldb::Segment", ptr %7, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds %"struct.leveldb::Segment::SegRep", ptr %15, i32 0, i32 7
  %17 = getelementptr inbounds %"class.leveldb::Segment", ptr %7, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %"struct.leveldb::Segment::SegRep", ptr %18, i32 0, i32 6
  %20 = load ptr, ptr %19, align 8, !tbaa !22
  %21 = getelementptr inbounds %"class.leveldb::Segment", ptr %7, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = getelementptr inbounds %"struct.leveldb::Segment::SegRep", ptr %22, i32 0, i32 1
  %24 = load i64, ptr %23, align 8, !tbaa !23
  invoke void @_ZN7leveldb11SegIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EEPNS_16RandomAccessFileEm(ptr noundef nonnull align 8 dereferenceable(128) %8, ptr noundef %13, ptr noundef %16, ptr noundef %20, i64 noundef %24)
          to label %25 unwind label %26

25:                                               ; preds = %2
  ret ptr %8

26:                                               ; preds = %2
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %5, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %6, align 4
  call void @_ZdlPvm(ptr noundef %8, i64 noundef 128) #4
  br label %30

30:                                               ; preds = %26
  %31 = load ptr, ptr %5, align 8
  %32 = load i32, ptr %6, align 4
  %33 = insertvalue { ptr, i32 } poison, ptr %31, 0
  %34 = insertvalue { ptr, i32 } %33, i32 %32, 1
  resume { ptr, i32 } %34
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb11SegIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EEPNS_16RandomAccessFileEm(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef, ptr noundef, ptr noundef, i64 noundef) unnamed_addr #0 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 = { 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 #2 = { 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 #3 = { builtin allocsize(0) }
attributes #4 = { 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 = !{!10, !6, i64 0}
!10 = !{!"_ZTSN7leveldb7SegmentE", !6, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN7leveldb7Segment6SegRepE", !13, i64 0, !15, i64 104, !15, i64 112, !6, i64 120, !15, i64 128, !15, i64 136, !6, i64 144, !18, i64 152}
!13 = !{!"_ZTSN7leveldb7OptionsE", !6, i64 0, !14, i64 8, !14, i64 9, !14, i64 10, !6, i64 16, !6, i64 24, !15, i64 32, !16, i64 40, !6, i64 48, !15, i64 56, !16, i64 64, !15, i64 72, !17, i64 80, !14, i64 84, !6, i64 88, !15, i64 96}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN7leveldb15CompressionTypeE", !7, i64 0}
!18 = !{!"_ZTSSt6vectorIPN7leveldb11KeyMetaDataESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIPN7leveldb11KeyMetaDataESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIPN7leveldb11KeyMetaDataESaIS2_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIPN7leveldb11KeyMetaDataESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!12, !6, i64 144}
!23 = !{!12, !15, i64 104}


; 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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_ZNK7leveldb7Segment11NewIteratorERKNS_11ReadOptionsE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(16) %1) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = tail call noalias noundef nonnull dereferenceable(128) ptr @_Znwm(i64 noundef 128) #3
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !10
  %6 = getelementptr inbounds i8, ptr %4, i64 152
  %7 = getelementptr inbounds i8, ptr %4, i64 144
  %8 = load ptr, ptr %7, align 8, !tbaa !21
  %9 = getelementptr inbounds i8, ptr %4, i64 104
  %10 = load i64, ptr %9, align 8, !tbaa !22
  invoke void @_ZN7leveldb11SegIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EEPNS_16RandomAccessFileEm(ptr noundef nonnull align 8 dereferenceable(128) %3, ptr noundef %5, ptr noundef nonnull %6, ptr noundef %8, i64 noundef %10)
          to label %11 unwind label %12

11:                                               ; preds = %2
  ret ptr %3

12:                                               ; preds = %2
  %13 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %3, i64 noundef 128) #4
  resume { ptr, i32 } %13
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb11SegIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EEPNS_16RandomAccessFileEm(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef, ptr noundef, ptr noundef, i64 noundef) unnamed_addr #0 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 = { 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 #2 = { 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 #3 = { builtin allocsize(0) }
attributes #4 = { 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, !7, i64 0}
!6 = !{!"_ZTSN7leveldb7SegmentE", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 0}
!11 = !{!"_ZTSN7leveldb7Segment6SegRepE", !12, i64 0, !14, i64 104, !14, i64 112, !7, i64 120, !14, i64 128, !14, i64 136, !7, i64 144, !17, i64 152}
!12 = !{!"_ZTSN7leveldb7OptionsE", !7, i64 0, !13, i64 8, !13, i64 9, !13, i64 10, !7, i64 16, !7, i64 24, !14, i64 32, !15, i64 40, !7, i64 48, !14, i64 56, !15, i64 64, !14, i64 72, !16, i64 80, !13, i64 84, !7, i64 88, !14, i64 96}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"long", !8, i64 0}
!15 = !{!"int", !8, i64 0}
!16 = !{!"_ZTSN7leveldb15CompressionTypeE", !8, i64 0}
!17 = !{!"_ZTSSt6vectorIPN7leveldb11KeyMetaDataESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIPN7leveldb11KeyMetaDataESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIPN7leveldb11KeyMetaDataESaIS2_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIPN7leveldb11KeyMetaDataESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!21 = !{!11, !7, i64 144}
!22 = !{!11, !14, i64 104}


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