; LLVM IR from turi-code/SFrame :: oss_src/parallel/thread_pool.ll (ZN8graphlab11thread_pool13wait_for_taskEv)

; 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.std::pair.22" = type { %"struct.std::pair.18", i8, [7 x i8] }
%"struct.std::pair.18" = type <{ %"class.boost::function", i32, [4 x i8] }>
%"class.boost::function" = type { %"class.boost::function0" }
%"class.boost::function0" = type { %"class.boost::function_base" }
%"class.boost::function_base" = type { ptr, %"union.boost::detail::function::function_buffer" }
%"union.boost::detail::function::function_buffer" = type { %"union.boost::detail::function::function_buffer_members" }
%"union.boost::detail::function::function_buffer_members" = type { %"struct.boost::detail::function::function_buffer_members::bound_memfunc_ptr_t" }
%"struct.boost::detail::function::function_buffer_members::bound_memfunc_ptr_t" = type { { i64, i64 }, ptr }
%"class.std::lock_guard" = type { ptr }
%"class.graphlab::thread_pool" = type <{ %"class.graphlab::thread_group", %"class.graphlab::blocking_queue", i64, %"class.graphlab::mutex", %"class.graphlab::conditional", i64, i64, i8, i8, [6 x i8] }>
%"class.graphlab::thread_group" = type { i64, i64, %"class.graphlab::mutex", %"class.graphlab::conditional", %"class.std::queue.0" }
%"class.std::queue.0" = type { %"class.std::deque.1" }
%"class.std::deque.1" = type { %"class.std::_Deque_base.2" }
%"class.std::_Deque_base.2" = type { %"struct.std::_Deque_base<std::pair<unsigned long, const char *>, std::allocator<std::pair<unsigned long, const char *>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<unsigned long, const char *>, std::allocator<std::pair<unsigned long, const char *>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<unsigned long, const char *>, std::allocator<std::pair<unsigned long, const char *>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<unsigned long, const char *>, std::allocator<std::pair<unsigned long, const char *>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.6", %"struct.std::_Deque_iterator.6" }
%"struct.std::_Deque_iterator.6" = type { ptr, ptr, ptr, ptr }
%"class.graphlab::blocking_queue" = type <{ i8, [7 x i8], %"class.std::deque.7", %"class.graphlab::mutex", %"class.graphlab::conditional", %"class.graphlab::conditional", i16, i16, [4 x i8] }>
%"class.std::deque.7" = type { %"class.std::_Deque_base.8" }
%"class.std::_Deque_base.8" = type { %"struct.std::_Deque_base<std::pair<boost::function<void ()>, int>, std::allocator<std::pair<boost::function<void ()>, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<boost::function<void ()>, int>, std::allocator<std::pair<boost::function<void ()>, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<boost::function<void ()>, int>, std::allocator<std::pair<boost::function<void ()>, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<boost::function<void ()>, int>, std::allocator<std::pair<boost::function<void ()>, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.12", %"struct.std::_Deque_iterator.12" }
%"struct.std::_Deque_iterator.12" = type { ptr, ptr, ptr, ptr }
%"class.graphlab::mutex" = 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 }
%"class.graphlab::conditional" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8graphlab11thread_pool13wait_for_taskEv(ptr noundef nonnull align 8 dereferenceable(530) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.std::pair.22", align 8
  %4 = alloca %"struct.std::pair.22", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::lock_guard", align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  %12 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8graphlab6thread12get_tls_dataEv()
  call void @_ZN8graphlab6thread8tls_data18set_in_thread_flagEb(ptr noundef nonnull align 8 dereferenceable(24) %12, i1 noundef zeroext true)
  br label %13

13:                                               ; preds = %84, %1
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #6
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbEC2IS4_bTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES8_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(41) %3)
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #6
  %14 = getelementptr inbounds %"class.graphlab::thread_pool", ptr %11, i32 0, i32 1
  invoke void @_ZN8graphlab14blocking_queueISt4pairIN5boost8functionIFvvEEEiEE7dequeueEv(ptr dead_on_unwind writable sret(%"struct.std::pair.22") align 8 %4, ptr noundef nonnull align 8 dereferenceable(228) %14)
          to label %15 unwind label %33

15:                                               ; preds = %13
  %16 = invoke noundef nonnull align 8 dereferenceable(41) ptr @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbEaSEOS5_(ptr noundef nonnull align 8 dereferenceable(41) %3, ptr noundef nonnull align 8 dereferenceable(41) %4)
          to label %17 unwind label %37

17:                                               ; preds = %15
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #6
  %18 = getelementptr inbounds %"struct.std::pair.22", ptr %3, i32 0, i32 1
  %19 = load i8, ptr %18, align 8, !tbaa !9, !range !17, !noundef !18
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %80

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %22 = getelementptr inbounds %"struct.std::pair.22", ptr %3, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.std::pair.18", ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !19
  store i32 %24, ptr %7, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %25 = invoke noundef i64 @_ZN8graphlab6thread9thread_idEv()
          to label %26 unwind label %42

26:                                               ; preds = %21
  store i64 %25, ptr %8, align 8, !tbaa !21
  %27 = load i32, ptr %7, align 4, !tbaa !20
  %28 = icmp ne i32 %27, -1
  br i1 %28, label %29, label %46

29:                                               ; preds = %26
  %30 = load i32, ptr %7, align 4, !tbaa !20
  %31 = sext i32 %30 to i64
  invoke void @_ZN8graphlab6thread13set_thread_idEm(i64 noundef %31)
          to label %32 unwind label %42

32:                                               ; preds = %29
  br label %46

33:                                               ; preds = %13
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %5, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %6, align 4
  br label %41

37:                                               ; preds = %15
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %5, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %6, align 4
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %4) #6
  br label %41

41:                                               ; preds = %37, %33
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #6
  br label %85

42:                                               ; preds = %49, %46, %29, %21
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %5, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %6, align 4
  br label %79

46:                                               ; preds = %32, %26
  %47 = getelementptr inbounds %"struct.std::pair.22", ptr %3, i32 0, i32 0
  %48 = getelementptr inbounds %"struct.std::pair.18", ptr %47, i32 0, i32 0
  invoke void @_ZNK5boost9function0IvEclEv(ptr noundef nonnull align 8 dereferenceable(32) %48)
          to label %49 unwind label %42

49:                                               ; preds = %46
  %50 = load i64, ptr %8, align 8, !tbaa !21
  invoke void @_ZN8graphlab6thread13set_thread_idEm(i64 noundef %50)
          to label %51 unwind label %42

51:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %52 = getelementptr inbounds %"class.graphlab::thread_pool", ptr %11, i32 0, i32 3
  invoke void @_ZNSt10lock_guardIN8graphlab5mutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(40) %52)
          to label %53 unwind label %69

53:                                               ; preds = %51
  %54 = getelementptr inbounds %"class.graphlab::thread_pool", ptr %11, i32 0, i32 6
  %55 = load i64, ptr %54, align 8, !tbaa !23
  %56 = add i64 %55, 1
  store i64 %56, ptr %54, align 8, !tbaa !23
  %57 = getelementptr inbounds %"class.graphlab::thread_pool", ptr %11, i32 0, i32 7
  %58 = load i8, ptr %57, align 8, !tbaa !41, !range !17, !noundef !18
  %59 = trunc i8 %58 to i1
  br i1 %59, label %60, label %77

60:                                               ; preds = %53
  %61 = getelementptr inbounds %"class.graphlab::thread_pool", ptr %11, i32 0, i32 6
  %62 = load i64, ptr %61, align 8, !tbaa !23
  %63 = getelementptr inbounds %"class.graphlab::thread_pool", ptr %11, i32 0, i32 5
  %64 = load i64, ptr %63, align 8, !tbaa !42
  %65 = icmp eq i64 %62, %64
  br i1 %65, label %66, label %77

66:                                               ; preds = %60
  %67 = getelementptr inbounds %"class.graphlab::thread_pool", ptr %11, i32 0, i32 4
  invoke void @_ZNK8graphlab11conditional6signalEv(ptr noundef nonnull align 8 dereferenceable(48) %67)
          to label %68 unwind label %73

68:                                               ; preds = %66
  br label %77

69:                                               ; preds = %51
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %5, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %6, align 4
  br label %78

73:                                               ; preds = %66
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %5, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %6, align 4
  call void @_ZNSt10lock_guardIN8graphlab5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  br label %78

77:                                               ; preds = %68, %60, %53
  call void @_ZNSt10lock_guardIN8graphlab5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %81

78:                                               ; preds = %73, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %79

79:                                               ; preds = %78, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %85

80:                                               ; preds = %17
  store i32 3, ptr %10, align 4
  br label %82

81:                                               ; preds = %77
  store i32 0, ptr %10, align 4
  br label %82

82:                                               ; preds = %81, %80
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %3) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #6
  %83 = load i32, ptr %10, align 4
  switch i32 %83, label %92 [
    i32 0, label %84
    i32 3, label %86
  ]

84:                                               ; preds = %82
  br label %13, !llvm.loop !43

85:                                               ; preds = %79, %41
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %3) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #6
  br label %87

86:                                               ; preds = %82
  ret void

87:                                               ; preds = %85
  %88 = load ptr, ptr %5, align 8
  %89 = load i32, ptr %6, align 4
  %90 = insertvalue { ptr, i32 } poison, ptr %88, 0
  %91 = insertvalue { ptr, i32 } %90, i32 %89, 1
  resume { ptr, i32 } %91

92:                                               ; preds = %82
  unreachable
}

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8graphlab6thread12get_tls_dataEv() #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8graphlab6thread8tls_data18set_in_thread_flagEb(ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext) #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8graphlab14blocking_queueISt4pairIN5boost8functionIFvvEEEiEE7dequeueEv(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.22") align 8, ptr noundef nonnull align 8 dereferenceable(228)) #5 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN8graphlab6thread9thread_idEv() #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8graphlab6thread13set_thread_idEm(i64 noundef) #5 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab11conditional6signalEv(ptr noundef nonnull align 8 dereferenceable(48)) #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 = { 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 = { "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 = { 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 #6 = { 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, !16, i64 40}
!10 = !{!"_ZTSSt4pairIS_IN5boost8functionIFvvEEEiEbE", !11, i64 0, !16, i64 40}
!11 = !{!"_ZTSSt4pairIN5boost8functionIFvvEEEiE", !12, i64 0, !15, i64 32}
!12 = !{!"_ZTSN5boost8functionIFvvEEE", !13, i64 0}
!13 = !{!"_ZTSN5boost9function0IvEE", !14, i64 0}
!14 = !{!"_ZTSN5boost13function_baseE", !6, i64 0, !7, i64 8}
!15 = !{!"int", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!10, !15, i64 32}
!20 = !{!15, !15, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!24, !22, i64 520}
!24 = !{!"_ZTSN8graphlab11thread_poolE", !25, i64 0, !34, i64 184, !22, i64 416, !26, i64 424, !27, i64 464, !22, i64 512, !22, i64 520, !16, i64 528, !16, i64 529}
!25 = !{!"_ZTSN8graphlab12thread_groupE", !22, i64 0, !22, i64 8, !26, i64 16, !27, i64 56, !28, i64 104}
!26 = !{!"_ZTSN8graphlab5mutexE", !7, i64 0}
!27 = !{!"_ZTSN8graphlab11conditionalE", !7, i64 0}
!28 = !{!"_ZTSSt5queueISt4pairImPKcESt5dequeIS3_SaIS3_EEE", !29, i64 0}
!29 = !{!"_ZTSSt5dequeISt4pairImPKcESaIS3_EE", !30, i64 0}
!30 = !{!"_ZTSSt11_Deque_baseISt4pairImPKcESaIS3_EE", !31, i64 0}
!31 = !{!"_ZTSNSt11_Deque_baseISt4pairImPKcESaIS3_EE11_Deque_implE", !32, i64 0}
!32 = !{!"_ZTSNSt11_Deque_baseISt4pairImPKcESaIS3_EE16_Deque_impl_dataE", !6, i64 0, !22, i64 8, !33, i64 16, !33, i64 48}
!33 = !{!"_ZTSSt15_Deque_iteratorISt4pairImPKcERS3_PS3_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!34 = !{!"_ZTSN8graphlab14blocking_queueISt4pairIN5boost8functionIFvvEEEiEEE", !16, i64 0, !35, i64 8, !26, i64 88, !27, i64 128, !27, i64 176, !40, i64 224, !40, i64 226}
!35 = !{!"_ZTSSt5dequeISt4pairIN5boost8functionIFvvEEEiESaIS5_EE", !36, i64 0}
!36 = !{!"_ZTSSt11_Deque_baseISt4pairIN5boost8functionIFvvEEEiESaIS5_EE", !37, i64 0}
!37 = !{!"_ZTSNSt11_Deque_baseISt4pairIN5boost8functionIFvvEEEiESaIS5_EE11_Deque_implE", !38, i64 0}
!38 = !{!"_ZTSNSt11_Deque_baseISt4pairIN5boost8functionIFvvEEEiESaIS5_EE16_Deque_impl_dataE", !6, i64 0, !22, i64 8, !39, i64 16, !39, i64 48}
!39 = !{!"_ZTSSt15_Deque_iteratorISt4pairIN5boost8functionIFvvEEEiERS5_PS5_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!40 = !{!"short", !7, i64 0}
!41 = !{!24, !16, i64 528}
!42 = !{!24, !22, i64 512}
!43 = distinct !{!43, !44}
!44 = !{!"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.std::pair.22" = type { %"struct.std::pair.18", i8, [7 x i8] }
%"struct.std::pair.18" = type <{ %"class.boost::function", i32, [4 x i8] }>
%"class.boost::function" = type { %"class.boost::function0" }
%"class.boost::function0" = type { %"class.boost::function_base" }
%"class.boost::function_base" = type { ptr, %"union.boost::detail::function::function_buffer" }
%"union.boost::detail::function::function_buffer" = type { %"union.boost::detail::function::function_buffer_members" }
%"union.boost::detail::function::function_buffer_members" = type { %"struct.boost::detail::function::function_buffer_members::bound_memfunc_ptr_t" }
%"struct.boost::detail::function::function_buffer_members::bound_memfunc_ptr_t" = type { { i64, i64 }, ptr }
%"class.std::lock_guard" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
declare dso_local void @_ZNSt10lock_guardIN8graphlab5mutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

; 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 nounwind uwtable
declare dso_local void @_ZNSt10lock_guardIN8graphlab5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8graphlab11thread_pool13wait_for_taskEv(ptr noundef nonnull align 8 dereferenceable(530) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"struct.std::pair.22", align 8
  %3 = alloca %"struct.std::pair.22", align 8
  %4 = alloca %"class.std::lock_guard", align 8
  %5 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8graphlab6thread12get_tls_dataEv()
  tail call void @_ZN8graphlab6thread8tls_data18set_in_thread_flagEb(ptr noundef nonnull align 8 dereferenceable(24) %5, i1 noundef zeroext true)
  %6 = getelementptr inbounds i8, ptr %0, i64 184
  %7 = getelementptr inbounds i8, ptr %2, i64 40
  %8 = getelementptr inbounds i8, ptr %2, i64 32
  %9 = getelementptr inbounds i8, ptr %0, i64 424
  %10 = getelementptr inbounds i8, ptr %0, i64 520
  %11 = getelementptr inbounds i8, ptr %0, i64 528
  %12 = getelementptr inbounds i8, ptr %0, i64 512
  %13 = getelementptr inbounds i8, ptr %0, i64 464
  br label %14

14:                                               ; preds = %49, %1
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #6
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbEC2IS4_bTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES8_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(41) %2)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #6
  invoke void @_ZN8graphlab14blocking_queueISt4pairIN5boost8functionIFvvEEEiEE7dequeueEv(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.22") align 8 %3, ptr noundef nonnull align 8 dereferenceable(228) %6)
          to label %15 unwind label %26

15:                                               ; preds = %14
  %16 = invoke noundef nonnull align 8 dereferenceable(41) ptr @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbEaSEOS5_(ptr noundef nonnull align 8 dereferenceable(41) %2, ptr noundef nonnull align 8 dereferenceable(41) %3)
          to label %17 unwind label %28

17:                                               ; preds = %15
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %3) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #6
  %18 = load i8, ptr %7, align 8, !tbaa !5, !range !16, !noundef !17
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %20, label %51

20:                                               ; preds = %17
  %21 = load i32, ptr %8, align 8, !tbaa !18
  %22 = invoke noundef i64 @_ZN8graphlab6thread9thread_idEv()
          to label %23 unwind label %31

23:                                               ; preds = %20
  %.not = icmp eq i32 %21, -1
  br i1 %.not, label %33, label %24

24:                                               ; preds = %23
  %25 = sext i32 %21 to i64
  invoke void @_ZN8graphlab6thread13set_thread_idEm(i64 noundef %25)
          to label %33 unwind label %31

26:                                               ; preds = %14
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %30

28:                                               ; preds = %15
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %3) #6
  br label %30

30:                                               ; preds = %28, %26
  %.pn = phi { ptr, i32 } [ %29, %28 ], [ %27, %26 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #6
  br label %50

31:                                               ; preds = %34, %33, %24, %20
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %50

33:                                               ; preds = %24, %23
  invoke void @_ZNK5boost9function0IvEclEv(ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %34 unwind label %31

34:                                               ; preds = %33
  invoke void @_ZN8graphlab6thread13set_thread_idEm(i64 noundef %22)
          to label %35 unwind label %31

35:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  invoke void @_ZNSt10lock_guardIN8graphlab5mutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(40) %9)
          to label %36 unwind label %44

36:                                               ; preds = %35
  %37 = load i64, ptr %10, align 8, !tbaa !19
  %38 = add i64 %37, 1
  store i64 %38, ptr %10, align 8, !tbaa !19
  %39 = load i8, ptr %11, align 8, !tbaa !38, !range !16, !noundef !17
  %40 = trunc nuw i8 %39 to i1
  %41 = load i64, ptr %12, align 8
  %42 = icmp eq i64 %38, %41
  %or.cond = select i1 %40, i1 %42, i1 false
  br i1 %or.cond, label %43, label %49

43:                                               ; preds = %36
  invoke void @_ZNK8graphlab11conditional6signalEv(ptr noundef nonnull align 8 dereferenceable(48) %13)
          to label %49 unwind label %46

44:                                               ; preds = %35
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %48

46:                                               ; preds = %43
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt10lock_guardIN8graphlab5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  br label %48

48:                                               ; preds = %46, %44
  %.pn13 = phi { ptr, i32 } [ %47, %46 ], [ %45, %44 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %50

49:                                               ; preds = %36, %43
  call void @_ZNSt10lock_guardIN8graphlab5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %2) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #6
  br label %14

50:                                               ; preds = %31, %48, %30
  %.pn13.pn.pn = phi { ptr, i32 } [ %.pn, %30 ], [ %.pn13, %48 ], [ %32, %31 ]
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %2) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn13.pn.pn

51:                                               ; preds = %17
  call void @_ZNSt4pairIS_IN5boost8functionIFvvEEEiEbED2Ev(ptr noundef nonnull align 8 dereferenceable(41) %2) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #6
  ret void
}

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8graphlab6thread12get_tls_dataEv() local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8graphlab6thread8tls_data18set_in_thread_flagEb(ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8graphlab14blocking_queueISt4pairIN5boost8functionIFvvEEEiEE7dequeueEv(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.22") align 8, ptr noundef nonnull align 8 dereferenceable(228)) local_unnamed_addr #5 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN8graphlab6thread9thread_idEv() local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8graphlab6thread13set_thread_idEm(i64 noundef) local_unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab11conditional6signalEv(ptr noundef nonnull align 8 dereferenceable(48)) local_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 = { 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 = { "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 = { 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 #6 = { 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, !15, i64 40}
!6 = !{!"_ZTSSt4pairIS_IN5boost8functionIFvvEEEiEbE", !7, i64 0, !15, i64 40}
!7 = !{!"_ZTSSt4pairIN5boost8functionIFvvEEEiE", !8, i64 0, !14, i64 32}
!8 = !{!"_ZTSN5boost8functionIFvvEEE", !9, i64 0}
!9 = !{!"_ZTSN5boost9function0IvEE", !10, i64 0}
!10 = !{!"_ZTSN5boost13function_baseE", !11, i64 0, !12, i64 8}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"int", !12, i64 0}
!15 = !{!"bool", !12, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!6, !14, i64 32}
!19 = !{!20, !22, i64 520}
!20 = !{!"_ZTSN8graphlab11thread_poolE", !21, i64 0, !31, i64 184, !22, i64 416, !23, i64 424, !24, i64 464, !22, i64 512, !22, i64 520, !15, i64 528, !15, i64 529}
!21 = !{!"_ZTSN8graphlab12thread_groupE", !22, i64 0, !22, i64 8, !23, i64 16, !24, i64 56, !25, i64 104}
!22 = !{!"long", !12, i64 0}
!23 = !{!"_ZTSN8graphlab5mutexE", !12, i64 0}
!24 = !{!"_ZTSN8graphlab11conditionalE", !12, i64 0}
!25 = !{!"_ZTSSt5queueISt4pairImPKcESt5dequeIS3_SaIS3_EEE", !26, i64 0}
!26 = !{!"_ZTSSt5dequeISt4pairImPKcESaIS3_EE", !27, i64 0}
!27 = !{!"_ZTSSt11_Deque_baseISt4pairImPKcESaIS3_EE", !28, i64 0}
!28 = !{!"_ZTSNSt11_Deque_baseISt4pairImPKcESaIS3_EE11_Deque_implE", !29, i64 0}
!29 = !{!"_ZTSNSt11_Deque_baseISt4pairImPKcESaIS3_EE16_Deque_impl_dataE", !11, i64 0, !22, i64 8, !30, i64 16, !30, i64 48}
!30 = !{!"_ZTSSt15_Deque_iteratorISt4pairImPKcERS3_PS3_E", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!31 = !{!"_ZTSN8graphlab14blocking_queueISt4pairIN5boost8functionIFvvEEEiEEE", !15, i64 0, !32, i64 8, !23, i64 88, !24, i64 128, !24, i64 176, !37, i64 224, !37, i64 226}
!32 = !{!"_ZTSSt5dequeISt4pairIN5boost8functionIFvvEEEiESaIS5_EE", !33, i64 0}
!33 = !{!"_ZTSSt11_Deque_baseISt4pairIN5boost8functionIFvvEEEiESaIS5_EE", !34, i64 0}
!34 = !{!"_ZTSNSt11_Deque_baseISt4pairIN5boost8functionIFvvEEEiESaIS5_EE11_Deque_implE", !35, i64 0}
!35 = !{!"_ZTSNSt11_Deque_baseISt4pairIN5boost8functionIFvvEEEiESaIS5_EE16_Deque_impl_dataE", !11, i64 0, !22, i64 8, !36, i64 16, !36, i64 48}
!36 = !{!"_ZTSSt15_Deque_iteratorISt4pairIN5boost8functionIFvvEEEiERS5_PS5_E", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!37 = !{!"short", !12, i64 0}
!38 = !{!20, !15, i64 528}


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