; LLVM IR from nsccgz-storage/nvlsm :: table_nvm/table_nvm.ll (ZNK7leveldb7Segment16NewIndexIteratorERKNS_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 }

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZNK7leveldb7Segment16NewIndexIteratorERKNS_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 64) #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
  invoke void @_ZN7leveldb20SegKeyoffsetIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(64) %8, ptr noundef %13, ptr noundef %16)
          to label %17 unwind label %18

17:                                               ; preds = %2
  ret ptr %8

18:                                               ; preds = %2
  %19 = landingpad { ptr, i32 }
          cleanup
  %20 = extractvalue { ptr, i32 } %19, 0
  store ptr %20, ptr %5, align 8
  %21 = extractvalue { ptr, i32 } %19, 1
  store i32 %21, ptr %6, align 4
  call void @_ZdlPvm(ptr noundef %8, i64 noundef 64) #4
  br label %22

22:                                               ; preds = %18
  %23 = load ptr, ptr %5, align 8
  %24 = load i32, ptr %6, align 4
  %25 = insertvalue { ptr, i32 } poison, ptr %23, 0
  %26 = insertvalue { ptr, i32 } %25, i32 %24, 1
  resume { ptr, i32 } %26
}

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN7leveldb20SegKeyoffsetIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef, ptr 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}


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

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_ZNK7leveldb7Segment16NewIndexIteratorERKNS_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(64) ptr @_Znwm(i64 noundef 64) #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
  invoke void @_ZN7leveldb20SegKeyoffsetIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(64) %3, ptr noundef %5, ptr noundef nonnull %6)
          to label %7 unwind label %8

7:                                                ; preds = %2
  ret ptr %3

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

declare i32 @__gxx_personality_v0(...)

; 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 @_ZN7leveldb20SegKeyoffsetIteratorC2EPKNS_10ComparatorEPKSt6vectorIPNS_11KeyMetaDataESaIS6_EE(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef, ptr 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}


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