; LLVM IR from facebook/redex :: libredex/BalancedPartitioning.ll (ZNK20BalancedPartitioning3runEv)

; 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.sparta::WorkQueue" = type { %"struct.redex_workqueue_impl::WithStateWorkQueueHelper", %"class.std::vector.9", i64, i64, %"struct.sparta::workqueue_impl::StateCounters", i8, ptr }
%"struct.redex_workqueue_impl::WithStateWorkQueueHelper" = type { %class.anon }
%class.anon = type { ptr }
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.sparta::workqueue_impl::StateCounters" = type { %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", i32, %"class.std::unique_ptr" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"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.15" }
%"struct.std::_Head_base.15" = type { ptr }
%struct.WorkItem = type <{ %"class.__gnu_cxx::__normal_iterator", %"class.__gnu_cxx::__normal_iterator", i32, i32, i32, [4 x i8] }>
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%class.BalancedPartitioning = type { ptr, [16384 x double], i32, i32 }
%class.Document = type { i32, i64, %"class.std::vector.4", %"class.std::vector.4" }
%"class.std::vector.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK20BalancedPartitioning3runEv(ptr noundef nonnull align 8 dereferenceable(131088) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.sparta::WorkQueue", align 8
  %5 = alloca %class.anon, align 8
  %6 = alloca %struct.WorkItem, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %28, %1
  %11 = load i32, ptr %3, align 4, !tbaa !9
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds %class.BalancedPartitioning, ptr %9, i32 0, i32 0
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = call noundef i64 @_ZNKSt6vectorIP8DocumentSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  %16 = icmp ult i64 %12, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %31

18:                                               ; preds = %10
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds %class.BalancedPartitioning, ptr %9, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8DocumentSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %24) #5
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = getelementptr inbounds %class.Document, ptr %26, i32 0, i32 1
  store i64 %20, ptr %27, align 8, !tbaa !13
  br label %28

28:                                               ; preds = %18
  %29 = load i32, ptr %3, align 4, !tbaa !9
  %30 = add i32 %29, 1
  store i32 %30, ptr %3, align 4, !tbaa !9
  br label %10, !llvm.loop !20

31:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 88, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %32 = getelementptr inbounds %class.anon, ptr %5, i32 0, i32 0
  store ptr %9, ptr %32, align 8, !tbaa !22
  %33 = call noundef i64 @_ZN14redex_parallel19default_num_threadsEv()
  %34 = trunc i64 %33 to i32
  call void @"_Z17workqueue_foreachIZNK20BalancedPartitioning3runEvE8WorkItemZNKS0_3runEvE3$_0TnNSt9enable_ifIXeqsr5ArityIT0_EE5valueLi2EEiE4typeELi0EEN6sparta9WorkQueueIT_N20redex_workqueue_impl24WithStateWorkQueueHelperIS9_S4_EEEERKS4_jb"(ptr dead_on_unwind writable sret(%"class.sparta::WorkQueue") align 8 %4, ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef %34, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %35 = getelementptr inbounds %struct.WorkItem, ptr %6, i32 0, i32 0
  %36 = getelementptr inbounds %class.BalancedPartitioning, ptr %9, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !11
  %38 = invoke ptr @_ZSt5beginISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) %37)
          to label %39 unwind label %52

39:                                               ; preds = %31
  %40 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %35, i32 0, i32 0
  store ptr %38, ptr %40, align 8
  %41 = getelementptr inbounds %struct.WorkItem, ptr %6, i32 0, i32 1
  %42 = getelementptr inbounds %class.BalancedPartitioning, ptr %9, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = invoke ptr @_ZSt3endISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) %43)
          to label %45 unwind label %52

45:                                               ; preds = %39
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %41, i32 0, i32 0
  store ptr %44, ptr %46, align 8
  %47 = getelementptr inbounds %struct.WorkItem, ptr %6, i32 0, i32 2
  store i32 0, ptr %47, align 8, !tbaa !24
  %48 = getelementptr inbounds %struct.WorkItem, ptr %6, i32 0, i32 3
  store i32 1, ptr %48, align 4, !tbaa !27
  %49 = getelementptr inbounds %struct.WorkItem, ptr %6, i32 0, i32 4
  store i32 0, ptr %49, align 8, !tbaa !28
  invoke void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE8add_itemES2_"(ptr noundef nonnull align 8 dereferenceable(88) %4, ptr noundef byval(%struct.WorkItem) align 8 %6)
          to label %50 unwind label %52

50:                                               ; preds = %45
  invoke void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE7run_allEv"(ptr noundef nonnull align 8 dereferenceable(88) %4)
          to label %51 unwind label %52

51:                                               ; preds = %50
  call void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEED2Ev"(ptr noundef nonnull align 8 dereferenceable(88) %4) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr %4) #5
  ret void

52:                                               ; preds = %50, %45, %39, %31
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %7, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %8, align 4
  call void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEED2Ev"(ptr noundef nonnull align 8 dereferenceable(88) %4) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr %4) #5
  br label %56

56:                                               ; preds = %52
  %57 = load ptr, ptr %7, align 8
  %58 = load i32, ptr %8, align 4
  %59 = insertvalue { ptr, i32 } poison, ptr %57, 0
  %60 = insertvalue { ptr, i32 } %59, i32 %58, 1
  resume { ptr, i32 } %60
}

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z17workqueue_foreachIZNK20BalancedPartitioning3runEvE8WorkItemZNKS0_3runEvE3$_0TnNSt9enable_ifIXeqsr5ArityIT0_EE5valueLi2EEiE4typeELi0EEN6sparta9WorkQueueIT_N20redex_workqueue_impl24WithStateWorkQueueHelperIS9_S4_EEEERKS4_jb"(ptr dead_on_unwind noalias writable sret(%"class.sparta::WorkQueue") align 8, ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i1 noundef zeroext) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN14redex_parallel19default_num_threadsEv() #3

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE8add_itemES2_"(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef byval(%struct.WorkItem) align 8) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt5beginISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt3endISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24)) #4

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE7run_allEv"(ptr noundef nonnull align 8 dereferenceable(88)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEED2Ev"(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #4 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 = { 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 = { 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 #4 = { 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 #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, !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, !6, i64 0}
!12 = !{!"_ZTS20BalancedPartitioning", !6, i64 0, !7, i64 8, !10, i64 131080, !10, i64 131084}
!13 = !{!14, !15, i64 8}
!14 = !{!"_ZTS8Document", !10, i64 0, !15, i64 8, !16, i64 16, !16, i64 40}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSSt6vectorIjSaIjEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !6, i64 0}
!23 = !{!"_ZTSZNK20BalancedPartitioning3runEvE3$_0", !6, i64 0}
!24 = !{!25, !10, i64 16}
!25 = !{!"_ZTSZNK20BalancedPartitioning3runEvE8WorkItem", !26, i64 0, !26, i64 8, !10, i64 16, !10, i64 20, !10, i64 24}
!26 = !{!"_ZTSN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEE", !6, i64 0}
!27 = !{!25, !10, i64 20}
!28 = !{!25, !10, i64 24}


; 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.sparta::WorkQueue" = type { %"struct.redex_workqueue_impl::WithStateWorkQueueHelper", %"class.std::vector.9", i64, i64, %"struct.sparta::workqueue_impl::StateCounters", i8, ptr }
%"struct.redex_workqueue_impl::WithStateWorkQueueHelper" = type { %class.anon }
%class.anon = type { ptr }
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<sparta::WorkerState<WorkItem>>, std::allocator<std::unique_ptr<sparta::WorkerState<WorkItem>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.sparta::workqueue_impl::StateCounters" = type { %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic", i32, %"class.std::unique_ptr" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"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.15" }
%"struct.std::_Head_base.15" = type { ptr }
%struct.WorkItem = type <{ %"class.__gnu_cxx::__normal_iterator", %"class.__gnu_cxx::__normal_iterator", i32, i32, i32, [4 x i8] }>
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK20BalancedPartitioning3runEv(ptr noundef nonnull align 8 dereferenceable(131088) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.sparta::WorkQueue", align 8
  %3 = alloca %class.anon, align 8
  %4 = alloca %struct.WorkItem, align 8
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = tail call noundef i64 @_ZNKSt6vectorIP8DocumentSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %1
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store ptr %0, ptr %3, align 8, !tbaa !11
  %7 = tail call noundef i64 @_ZN14redex_parallel19default_num_threadsEv()
  %8 = trunc i64 %7 to i32
  call void @"_Z17workqueue_foreachIZNK20BalancedPartitioning3runEvE8WorkItemZNKS0_3runEvE3$_0TnNSt9enable_ifIXeqsr5ArityIT0_EE5valueLi2EEiE4typeELi0EEN6sparta9WorkQueueIT_N20redex_workqueue_impl24WithStateWorkQueueHelperIS9_S4_EEEERKS4_jb"(ptr dead_on_unwind nonnull writable sret(%"class.sparta::WorkQueue") align 8 %2, ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %8, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %9 = load ptr, ptr %0, align 8, !tbaa !5
  %10 = call ptr @_ZSt5beginISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) %9)
  store ptr %10, ptr %4, align 8
  %11 = getelementptr inbounds i8, ptr %4, i64 8
  %12 = load ptr, ptr %0, align 8, !tbaa !5
  %13 = call ptr @_ZSt3endISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) %12)
  store ptr %13, ptr %11, align 8
  %14 = getelementptr inbounds i8, ptr %4, i64 16
  store i32 0, ptr %14, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %4, i64 20
  store i32 1, ptr %15, align 4, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %4, i64 24
  store i32 0, ptr %16, align 8, !tbaa !17
  invoke void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE8add_itemES2_"(ptr noundef nonnull align 8 dereferenceable(88) %2, ptr noundef nonnull byval(%struct.WorkItem) align 8 %4)
          to label %27 unwind label %29

.lr.ph:                                           ; preds = %1, %.lr.ph
  %17 = phi i64 [ %23, %.lr.ph ], [ 0, %1 ]
  %.07 = phi i32 [ %22, %.lr.ph ], [ 0, %1 ]
  %18 = load ptr, ptr %0, align 8, !tbaa !5
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8DocumentSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %17) #5
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  store i64 %17, ptr %21, align 8, !tbaa !19
  %22 = add i32 %.07, 1
  %23 = zext i32 %22 to i64
  %24 = load ptr, ptr %0, align 8, !tbaa !5
  %25 = tail call noundef i64 @_ZNKSt6vectorIP8DocumentSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #5
  %26 = icmp ugt i64 %25, %23
  br i1 %26, label %.lr.ph, label %._crit_edge, !llvm.loop !26

27:                                               ; preds = %._crit_edge
  invoke void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE7run_allEv"(ptr noundef nonnull align 8 dereferenceable(88) %2)
          to label %28 unwind label %29

28:                                               ; preds = %27
  call void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEED2Ev"(ptr noundef nonnull align 8 dereferenceable(88) %2) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %2) #5
  ret void

29:                                               ; preds = %27, %._crit_edge
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEED2Ev"(ptr noundef nonnull align 8 dereferenceable(88) %2) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %2) #5
  resume { ptr, i32 } %30
}

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_Z17workqueue_foreachIZNK20BalancedPartitioning3runEvE8WorkItemZNKS0_3runEvE3$_0TnNSt9enable_ifIXeqsr5ArityIT0_EE5valueLi2EEiE4typeELi0EEN6sparta9WorkQueueIT_N20redex_workqueue_impl24WithStateWorkQueueHelperIS9_S4_EEEERKS4_jb"(ptr dead_on_unwind noalias writable sret(%"class.sparta::WorkQueue") align 8, ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN14redex_parallel19default_num_threadsEv() local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE8add_itemES2_"(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef byval(%struct.WorkItem) align 8) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt5beginISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt3endISt6vectorIP8DocumentSaIS2_EEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEE7run_allEv"(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @"_ZN6sparta9WorkQueueIZNK20BalancedPartitioning3runEvE8WorkItemN20redex_workqueue_impl24WithStateWorkQueueHelperIS2_ZNKS1_3runEvE3$_0EEED2Ev"(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #4 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 = { 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 = { 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 #4 = { 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 #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, !7, i64 0}
!6 = !{!"_ZTS20BalancedPartitioning", !7, i64 0, !8, i64 8, !10, i64 131080, !10, i64 131084}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"_ZTSZNK20BalancedPartitioning3runEvE3$_0", !7, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTSZNK20BalancedPartitioning3runEvE8WorkItem", !15, i64 0, !15, i64 8, !10, i64 16, !10, i64 20, !10, i64 24}
!15 = !{!"_ZTSN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEE", !7, i64 0}
!16 = !{!14, !10, i64 20}
!17 = !{!14, !10, i64 24}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !21, i64 8}
!20 = !{!"_ZTS8Document", !10, i64 0, !21, i64 8, !22, i64 16, !22, i64 40}
!21 = !{!"long", !8, i64 0}
!22 = !{!"_ZTSSt6vectorIjSaIjEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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