; LLVM IR from flashlight/flashlight :: flashlight/fl/dataset/BlobDataset.ll (ZNK2fl11BlobDataset10getEntriesEl)

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

%"struct.fl::BlobDatasetEntry" = type { i32, %"class.fl::Shape", i64 }
%"class.fl::Shape" = type { %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.34" = type { %"struct.std::_Vector_base.35" }
%"struct.std::_Vector_base.35" = type { %"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl" }
%"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl" = type { %"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl_data" }
%"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.fl::BlobDataset" = type { %"class.fl::Dataset", i32, [4 x i8], %"class.fl::BlobDatasetEntryBuffer", %"class.std::vector", %"class.std::vector", i64, %"class.std::unordered_map", %"class.std::mutex" }
%"class.fl::Dataset" = type { ptr }
%"class.fl::BlobDatasetEntryBuffer" = type <{ %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"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 }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2fl22BlobDatasetEntryBuffer3getEl(ptr dead_on_unwind noalias writable sret(%"struct.fl::BlobDatasetEntry") align 8, ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) #0 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK2fl11BlobDataset10getEntriesEl(ptr dead_on_unwind noalias writable sret(%"class.std::vector.34") align 8 %0, ptr noundef nonnull align 8 dereferenceable(200) %1, i64 noundef %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i1, align 1
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.fl::BlobDatasetEntry", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %12 = load ptr, ptr %5, align 8
  store i1 false, ptr %7, align 1
  call void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %13

13:                                               ; preds = %37, %3
  %14 = load i64, ptr %8, align 8, !tbaa !9
  %15 = getelementptr inbounds %"class.fl::BlobDataset", ptr %12, i32 0, i32 4
  %16 = load i64, ptr %6, align 8, !tbaa !9
  %17 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIlSaIlEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %16)
          to label %18 unwind label %22

18:                                               ; preds = %13
  %19 = load i64, ptr %17, align 8, !tbaa !9
  %20 = icmp slt i64 %14, %19
  br i1 %20, label %26, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %50

22:                                               ; preds = %13
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %9, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %10, align 4
  br label %49

26:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #4
  %27 = getelementptr inbounds %"class.fl::BlobDataset", ptr %12, i32 0, i32 3
  %28 = getelementptr inbounds %"class.fl::BlobDataset", ptr %12, i32 0, i32 5
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIlSaIlEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %29)
          to label %31 unwind label %40

31:                                               ; preds = %26
  %32 = load i64, ptr %30, align 8, !tbaa !9
  %33 = load i64, ptr %8, align 8, !tbaa !9
  %34 = add nsw i64 %32, %33
  invoke void @_ZNK2fl22BlobDatasetEntryBuffer3getEl(ptr dead_on_unwind writable sret(%"struct.fl::BlobDatasetEntry") align 8 %11, ptr noundef nonnull align 8 dereferenceable(28) %27, i64 noundef %34)
          to label %35 unwind label %40

35:                                               ; preds = %31
  invoke void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(40) %11)
          to label %36 unwind label %44

36:                                               ; preds = %35
  call void @_ZN2fl16BlobDatasetEntryD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #4
  br label %37

37:                                               ; preds = %36
  %38 = load i64, ptr %8, align 8, !tbaa !9
  %39 = add nsw i64 %38, 1
  store i64 %39, ptr %8, align 8, !tbaa !9
  br label %13, !llvm.loop !11

40:                                               ; preds = %31, %26
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %9, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %10, align 4
  br label %48

44:                                               ; preds = %35
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %9, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %10, align 4
  call void @_ZN2fl16BlobDatasetEntryD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #4
  br label %48

48:                                               ; preds = %44, %40
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #4
  br label %49

49:                                               ; preds = %48, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %54

50:                                               ; preds = %21
  store i1 true, ptr %7, align 1
  %51 = load i1, ptr %7, align 1
  br i1 %51, label %53, label %52

52:                                               ; preds = %50
  call void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %53

53:                                               ; preds = %52, %50
  ret void

54:                                               ; preds = %49
  %55 = load ptr, ptr %9, align 8
  %56 = load i32, ptr %10, align 4
  %57 = insertvalue { ptr, i32 } poison, ptr %55, 0
  %58 = insertvalue { ptr, i32 } %57, i32 %56, 1
  resume { ptr, i32 } %58
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(40)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%"struct.fl::BlobDatasetEntry" = type { i32, %"class.fl::Shape", i64 }
%"class.fl::Shape" = type { %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.34" = type { %"struct.std::_Vector_base.35" }
%"struct.std::_Vector_base.35" = type { %"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl" }
%"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl" = type { %"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl_data" }
%"struct.std::_Vector_base<fl::BlobDatasetEntry, std::allocator<fl::BlobDatasetEntry>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2fl22BlobDatasetEntryBuffer3getEl(ptr dead_on_unwind noalias writable sret(%"struct.fl::BlobDatasetEntry") align 8, ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) local_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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK2fl11BlobDataset10getEntriesEl(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector.34") align 8 %0, ptr noundef nonnull align 8 dereferenceable(200) %1, i64 noundef %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.fl::BlobDatasetEntry", align 8
  tail call void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %5 = getelementptr inbounds i8, ptr %1, i64 48
  %6 = getelementptr inbounds i8, ptr %1, i64 72
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  br label %8

8:                                                ; preds = %21, %3
  %.010 = phi i64 [ 0, %3 ], [ %22, %21 ]
  %9 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIlSaIlEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %2)
          to label %10 unwind label %13

10:                                               ; preds = %8
  %11 = load i64, ptr %9, align 8, !tbaa !5
  %12 = icmp slt i64 %.010, %11
  br i1 %12, label %15, label %29

13:                                               ; preds = %8
  %14 = landingpad { ptr, i32 }
          cleanup
  br label %28

15:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #4
  %16 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIlSaIlEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %2)
          to label %17 unwind label %23

17:                                               ; preds = %15
  %18 = load i64, ptr %16, align 8, !tbaa !5
  %19 = add nsw i64 %18, %.010
  invoke void @_ZNK2fl22BlobDatasetEntryBuffer3getEl(ptr dead_on_unwind nonnull writable sret(%"struct.fl::BlobDatasetEntry") align 8 %4, ptr noundef nonnull align 8 dereferenceable(28) %7, i64 noundef %19)
          to label %20 unwind label %23

20:                                               ; preds = %17
  invoke void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(40) %4)
          to label %21 unwind label %25

21:                                               ; preds = %20
  call void @_ZN2fl16BlobDatasetEntryD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  %22 = add nuw nsw i64 %.010, 1
  br label %8, !llvm.loop !9

23:                                               ; preds = %17, %15
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

25:                                               ; preds = %20
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN2fl16BlobDatasetEntryD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #4
  br label %27

27:                                               ; preds = %25, %23
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  br label %28

28:                                               ; preds = %27, %13
  %.pn.pn = phi { ptr, i32 } [ %.pn, %27 ], [ %14, %13 ]
  call void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  resume { ptr, i32 } %.pn.pn

29:                                               ; preds = %10
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN2fl16BlobDatasetEntryESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass