; LLVM IR from NVIDIA/DALI :: dali/pipeline/util (thread_pool)

; 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.dali::DeviceGuard" = type { ptr }
%"class.std::unique_lock" = type <{ ptr, i8, [7 x i8] }>
%class.anon.32 = type { ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.10" = type { i8 }
%"class.dali::ThreadPool" = type { %"class.std::vector", %"class.std::priority_queue", i8, i8, i8, i32, %"class.std::mutex", %"class.std::condition_variable", %"class.std::condition_variable", %"class.std::vector.5" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::thread, std::allocator<std::thread>>::_Vector_impl" }
%"struct.std::_Vector_base<std::thread, std::allocator<std::thread>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::thread, std::allocator<std::thread>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::thread, std::allocator<std::thread>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<long, std::function<void (int)>>, std::allocator<std::pair<long, std::function<void (int)>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long, std::function<void (int)>>, std::allocator<std::pair<long, std::function<void (int)>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long, std::function<void (int)>>, std::allocator<std::pair<long, std::function<void (int)>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long, std::function<void (int)>>, std::allocator<std::pair<long, std::function<void (int)>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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 }
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = 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 }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::queue<std::__cxx11::basic_string<char>>, std::allocator<std::queue<std::__cxx11::basic_string<char>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::queue<std::__cxx11::basic_string<char>>, std::allocator<std::queue<std::__cxx11::basic_string<char>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::queue<std::__cxx11::basic_string<char>>, std::allocator<std::queue<std::__cxx11::basic_string<char>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::queue<std::__cxx11::basic_string<char>>, std::allocator<std::queue<std::__cxx11::basic_string<char>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i64, %"class.std::function" }

@_ZTISt9exception = external constant ptr
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4dali10ThreadPool10ThreadMainEiibRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(224) %0, i32 noundef %1, i32 noundef %2, i1 noundef zeroext %3, ptr noundef nonnull align 8 dereferenceable(32) %4) #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca %"class.dali::DeviceGuard", align 8
  %12 = alloca %"class.std::unique_lock", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %class.anon.32, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::function", align 8
  %18 = alloca %"class.std::__cxx11::basic_string", align 8
  %19 = alloca %"class.std::allocator.10", align 1
  %20 = alloca ptr, align 8
  %21 = alloca %"class.std::__cxx11::basic_string", align 8
  %22 = alloca %"class.std::allocator.10", align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  %23 = zext i1 %3 to i8
  store i8 %23, ptr %9, align 1, !tbaa !11
  store ptr %4, ptr %10, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %25) #7
  call void @_ZN4dali13SetThreadNameEPKc(ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %27 = load i32, ptr %8, align 4, !tbaa !9
  call void @_ZN4dali11DeviceGuardC1Ei(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef %27)
  br label %28

28:                                               ; preds = %165, %5
  %29 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 2
  %30 = load i8, ptr %29, align 8, !tbaa !13, !range !33, !noundef !34
  %31 = trunc i8 %30 to i1
  br i1 %31, label %32, label %170

32:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %33 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 6
  invoke void @_ZNSt11unique_lockISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %12, ptr noundef nonnull align 8 dereferenceable(40) %33)
          to label %34 unwind label %44

34:                                               ; preds = %32
  %35 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 7
  %36 = getelementptr inbounds %class.anon.32, ptr %15, i32 0, i32 0
  store ptr %24, ptr %36, align 8, !tbaa !35
  %37 = getelementptr inbounds %class.anon.32, ptr %15, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8
  invoke void @"_ZNSt18condition_variable4waitIZN4dali10ThreadPool10ThreadMainEiibRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3$_0EEvRSt11unique_lockISt5mutexET_"(ptr noundef nonnull align 8 dereferenceable(48) %35, ptr noundef nonnull align 8 dereferenceable(9) %12, ptr %38)
          to label %39 unwind label %48

39:                                               ; preds = %34
  %40 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 2
  %41 = load i8, ptr %40, align 8, !tbaa !13, !range !33, !noundef !34
  %42 = trunc i8 %41 to i1
  br i1 %42, label %52, label %43

43:                                               ; preds = %39
  store i32 3, ptr %16, align 4
  br label %163

44:                                               ; preds = %32
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %13, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %14, align 4
  br label %169

48:                                               ; preds = %34
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %13, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %14, align 4
  br label %168

52:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #7
  %53 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 1
  %54 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %53)
          to label %55 unwind label %66

55:                                               ; preds = %52
  %56 = getelementptr inbounds %"struct.std::pair", ptr %54, i32 0, i32 1
  invoke void @_ZNSt8functionIFviEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull align 8 dereferenceable(32) %56)
          to label %57 unwind label %66

57:                                               ; preds = %55
  %58 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 1
  invoke void @_ZNSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %58)
          to label %59 unwind label %70

59:                                               ; preds = %57
  %60 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 5
  %61 = load i32, ptr %60, align 4, !tbaa !37
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %60, align 4, !tbaa !37
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %12)
          to label %63 unwind label %70

63:                                               ; preds = %59
  %64 = load i32, ptr %7, align 4, !tbaa !9
  invoke void @_ZNKSt8functionIFviEEclEi(ptr noundef nonnull align 8 dereferenceable(32) %17, i32 noundef %64)
          to label %65 unwind label %74

65:                                               ; preds = %63
  br label %99

66:                                               ; preds = %55, %52
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %13, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %14, align 4
  br label %167

70:                                               ; preds = %125, %111, %100, %99, %59, %57
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %13, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %14, align 4
  br label %166

74:                                               ; preds = %63
  %75 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %13, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %14, align 4
  br label %78

78:                                               ; preds = %74
  %79 = load i32, ptr %14, align 4
  %80 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #7
  %81 = icmp eq i32 %79, %80
  br i1 %81, label %82, label %115

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %83 = load ptr, ptr %13, align 8
  %84 = call ptr @__cxa_begin_catch(ptr %83) #7
  store ptr %84, ptr %20, align 8
  invoke void @_ZNSt11unique_lockISt5mutexE4lockEv(ptr noundef nonnull align 8 dereferenceable(9) %12)
          to label %85 unwind label %142

85:                                               ; preds = %82
  %86 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 9
  %87 = load i32, ptr %7, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %88) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #7
  %90 = load ptr, ptr %20, align 8, !tbaa !5
  %91 = load ptr, ptr %90, align 8, !tbaa !38
  %92 = getelementptr inbounds ptr, ptr %91, i64 2
  %93 = load ptr, ptr %92, align 8
  %94 = call noundef ptr %93(ptr noundef nonnull align 8 dereferenceable(8) %90) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef %94, ptr noundef nonnull align 1 dereferenceable(1) %22)
          to label %95 unwind label %146

95:                                               ; preds = %85
  invoke void @_ZNSt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS5_SaIS5_EEE4pushEOS5_(ptr noundef nonnull align 8 dereferenceable(80) %89, ptr noundef nonnull align 8 dereferenceable(32) %21)
          to label %96 unwind label %150

96:                                               ; preds = %95
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #7
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %12)
          to label %97 unwind label %142

97:                                               ; preds = %96
  invoke void @__cxa_end_catch()
          to label %98 unwind label %155

98:                                               ; preds = %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %99

99:                                               ; preds = %126, %98, %65
  invoke void @_ZNSt11unique_lockISt5mutexE4lockEv(ptr noundef nonnull align 8 dereferenceable(9) %12)
          to label %100 unwind label %70

100:                                              ; preds = %99
  %101 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 5
  %102 = load i32, ptr %101, align 4, !tbaa !37
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %101, align 4, !tbaa !37
  %104 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 1
  %105 = invoke noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %104)
          to label %106 unwind label %70

106:                                              ; preds = %100
  br i1 %105, label %107, label %162

107:                                              ; preds = %106
  %108 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 5
  %109 = load i32, ptr %108, align 4, !tbaa !37
  %110 = icmp eq i32 %109, 0
  br i1 %110, label %111, label %162

111:                                              ; preds = %107
  %112 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 3
  store i8 1, ptr %112, align 1, !tbaa !40
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %12)
          to label %113 unwind label %70

113:                                              ; preds = %111
  %114 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 8
  call void @_ZNSt18condition_variable10notify_oneEv(ptr noundef nonnull align 8 dereferenceable(48) %114) #7
  br label %162

115:                                              ; preds = %78
  %116 = load ptr, ptr %13, align 8
  %117 = call ptr @__cxa_begin_catch(ptr %116) #7
  invoke void @_ZNSt11unique_lockISt5mutexE4lockEv(ptr noundef nonnull align 8 dereferenceable(9) %12)
          to label %118 unwind label %127

118:                                              ; preds = %115
  %119 = getelementptr inbounds %"class.dali::ThreadPool", ptr %24, i32 0, i32 9
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %119, i64 noundef %121) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef @.str.9, ptr noundef nonnull align 1 dereferenceable(1) %19)
          to label %123 unwind label %131

123:                                              ; preds = %118
  invoke void @_ZNSt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS5_SaIS5_EEE4pushEOS5_(ptr noundef nonnull align 8 dereferenceable(80) %122, ptr noundef nonnull align 8 dereferenceable(32) %18)
          to label %124 unwind label %135

124:                                              ; preds = %123
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #7
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %12)
          to label %125 unwind label %127

125:                                              ; preds = %124
  invoke void @__cxa_end_catch()
          to label %126 unwind label %70

126:                                              ; preds = %125
  br label %99

127:                                              ; preds = %124, %115
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %13, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %14, align 4
  br label %140

131:                                              ; preds = %118
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %13, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %14, align 4
  br label %139

135:                                              ; preds = %123
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %13, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %14, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #7
  br label %139

139:                                              ; preds = %135, %131
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #7
  br label %140

140:                                              ; preds = %139, %127
  invoke void @__cxa_end_catch()
          to label %141 unwind label %176

141:                                              ; preds = %140
  br label %166

142:                                              ; preds = %96, %82
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %13, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %14, align 4
  br label %159

146:                                              ; preds = %85
  %147 = landingpad { ptr, i32 }
          cleanup
  %148 = extractvalue { ptr, i32 } %147, 0
  store ptr %148, ptr %13, align 8
  %149 = extractvalue { ptr, i32 } %147, 1
  store i32 %149, ptr %14, align 4
  br label %154

150:                                              ; preds = %95
  %151 = landingpad { ptr, i32 }
          cleanup
  %152 = extractvalue { ptr, i32 } %151, 0
  store ptr %152, ptr %13, align 8
  %153 = extractvalue { ptr, i32 } %151, 1
  store i32 %153, ptr %14, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #7
  br label %154

154:                                              ; preds = %150, %146
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #7
  br label %159

155:                                              ; preds = %97
  %156 = landingpad { ptr, i32 }
          cleanup
  %157 = extractvalue { ptr, i32 } %156, 0
  store ptr %157, ptr %13, align 8
  %158 = extractvalue { ptr, i32 } %156, 1
  store i32 %158, ptr %14, align 4
  br label %161

159:                                              ; preds = %154, %142
  invoke void @__cxa_end_catch()
          to label %160 unwind label %176

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160, %155
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %166

162:                                              ; preds = %113, %107, %106
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #7
  store i32 0, ptr %16, align 4
  br label %163

163:                                              ; preds = %162, %43
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  %164 = load i32, ptr %16, align 4
  switch i32 %164, label %179 [
    i32 0, label %165
    i32 3, label %170
  ]

165:                                              ; preds = %163
  br label %28, !llvm.loop !41

166:                                              ; preds = %161, %141, %70
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #7
  br label %167

167:                                              ; preds = %166, %66
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #7
  br label %168

168:                                              ; preds = %167, %48
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %12) #7
  br label %169

169:                                              ; preds = %168, %44
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @_ZN4dali11DeviceGuardD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %171

170:                                              ; preds = %163, %28
  call void @_ZN4dali11DeviceGuardD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  ret void

171:                                              ; preds = %169
  %172 = load ptr, ptr %13, align 8
  %173 = load i32, ptr %14, align 4
  %174 = insertvalue { ptr, i32 } poison, ptr %172, 0
  %175 = insertvalue { ptr, i32 } %174, i32 %173, 1
  resume { ptr, i32 } %175

176:                                              ; preds = %159, %140
  %177 = landingpad { ptr, i32 }
          catch ptr null
  %178 = extractvalue { ptr, i32 } %177, 0
  call void @__clang_call_terminate(ptr %178) #8
  unreachable

179:                                              ; preds = %163
  unreachable
}

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #3

declare ptr @__cxa_begin_catch(ptr)

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

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

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

; Function Attrs: nounwind
declare void @_ZNSt18condition_variable10notify_oneEv(ptr noundef nonnull align 8 dereferenceable(48)) #4

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

declare void @_ZN4dali13SetThreadNameEPKc(ptr noundef) #5

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

declare void @_ZN4dali11DeviceGuardC1Ei(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNSt18condition_variable4waitIZN4dali10ThreadPool10ThreadMainEiibRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3$_0EEvRSt11unique_lockISt5mutexET_"(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(9), ptr) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #1 align 2

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

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

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

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #6

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

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

declare void @__cxa_end_catch()

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #1 align 2

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

; Function Attrs: nounwind
declare void @_ZN4dali11DeviceGuardD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { noinline noreturn nounwind uwtable "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 "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 = { "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 memory(none) }
attributes #7 = { nounwind }
attributes #8 = { noreturn 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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !12, i64 56}
!14 = !{!"_ZTSN4dali10ThreadPoolE", !15, i64 0, !19, i64 24, !12, i64 56, !12, i64 57, !12, i64 58, !10, i64 60, !25, i64 64, !27, i64 104, !27, i64 152, !29, i64 200}
!15 = !{!"_ZTSSt6vectorISt6threadSaIS0_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseISt6threadSaIS0_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt6threadSaIS0_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseISt6threadSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE", !20, i64 0, !24, i64 24}
!20 = !{!"_ZTSSt6vectorISt4pairIlSt8functionIFviEEESaIS4_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseISt4pairIlSt8functionIFviEEESaIS4_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseISt4pairIlSt8functionIFviEEESaIS4_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt4pairIlSt8functionIFviEEESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTSN4dali10ThreadPool14SortByPriorityE"}
!25 = !{!"_ZTSSt5mutex", !26, i64 0}
!26 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!27 = !{!"_ZTSSt18condition_variable", !28, i64 0}
!28 = !{!"_ZTSSt9__condvar", !7, i64 0}
!29 = !{!"_ZTSSt6vectorISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE12_Vector_implE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!36, !6, i64 0}
!36 = !{!"_ZTSZN4dali10ThreadPool10ThreadMainEiibRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3$_0", !6, i64 0}
!37 = !{!14, !10, i64 60}
!38 = !{!39, !39, i64 0}
!39 = !{!"vtable pointer", !8, i64 0}
!40 = !{!14, !12, i64 57}
!41 = distinct !{!41, !42}
!42 = !{!"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"

%"class.dali::DeviceGuard" = type { ptr }
%"class.std::unique_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.10" = type { i8 }

@_ZTISt9exception = external constant ptr
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4dali10ThreadPool10ThreadMainEiibRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(224) %0, i32 noundef %1, i32 noundef %2, i1 noundef zeroext %3, ptr noundef nonnull align 8 dereferenceable(32) %4) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.dali::DeviceGuard", align 8
  %7 = alloca %"class.std::unique_lock", align 8
  %8 = alloca %"class.std::function", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::allocator.10", align 1
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca %"class.std::allocator.10", align 1
  %13 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  tail call void @_ZN4dali13SetThreadNameEPKc(ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  call void @_ZN4dali11DeviceGuardC1Ei(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef %2)
  %14 = getelementptr inbounds i8, ptr %0, i64 56
  %15 = load i8, ptr %14, align 8, !tbaa !5, !range !30, !noundef !31
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %5
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  %18 = getelementptr inbounds i8, ptr %0, i64 104
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = getelementptr inbounds i8, ptr %0, i64 60
  %21 = getelementptr inbounds i8, ptr %0, i64 200
  %22 = sext i32 %1 to i64
  %23 = getelementptr inbounds i8, ptr %0, i64 57
  %24 = getelementptr inbounds i8, ptr %0, i64 152
  br label %25

25:                                               ; preds = %.lr.ph, %96
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  invoke void @_ZNSt11unique_lockISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %7, ptr noundef nonnull align 8 dereferenceable(40) %17)
          to label %26 unwind label %30

26:                                               ; preds = %25
  invoke void @"_ZNSt18condition_variable4waitIZN4dali10ThreadPool10ThreadMainEiibRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3$_0EEvRSt11unique_lockISt5mutexET_"(ptr noundef nonnull align 8 dereferenceable(48) %18, ptr noundef nonnull align 8 dereferenceable(9) %7, ptr nonnull %0)
          to label %27 unwind label %32

27:                                               ; preds = %26
  %28 = load i8, ptr %14, align 8, !tbaa !5, !range !30, !noundef !31
  %29 = trunc nuw i8 %28 to i1
  br i1 %29, label %34, label %.thread

.thread:                                          ; preds = %27
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  br label %.loopexit

30:                                               ; preds = %25
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %102

32:                                               ; preds = %26
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %101

34:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #7
  %35 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %19)
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  invoke void @_ZNSt8functionIFviEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %36)
          to label %37 unwind label %42

37:                                               ; preds = %34
  invoke void @_ZNSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %19)
          to label %38 unwind label %44

38:                                               ; preds = %37
  %39 = load i32, ptr %20, align 4, !tbaa !32
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %20, align 4, !tbaa !32
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
          to label %41 unwind label %44

41:                                               ; preds = %38
  invoke void @_ZNKSt8functionIFviEEclEi(ptr noundef nonnull align 8 dereferenceable(32) %8, i32 noundef %1)
          to label %63 unwind label %46

42:                                               ; preds = %34
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %100

44:                                               ; preds = %77, %70, %63, %38, %37
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %99

46:                                               ; preds = %41
  %47 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  %48 = extractvalue { ptr, i32 } %47, 0
  %49 = extractvalue { ptr, i32 } %47, 1
  %50 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #7
  %51 = icmp eq i32 %49, %50
  %52 = call ptr @__cxa_begin_catch(ptr %48) #7
  br i1 %51, label %53, label %72

53:                                               ; preds = %46
  invoke void @_ZNSt11unique_lockISt5mutexE4lockEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
          to label %54 unwind label %86

54:                                               ; preds = %53
  %55 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %22) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #7
  %56 = load ptr, ptr %52, align 8, !tbaa !33
  %57 = getelementptr inbounds i8, ptr %56, i64 16
  %58 = load ptr, ptr %57, align 8
  %59 = call noundef ptr %58(ptr noundef nonnull align 8 dereferenceable(8) %52) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef %59, ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %60 unwind label %88

60:                                               ; preds = %54
  invoke void @_ZNSt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS5_SaIS5_EEE4pushEOS5_(ptr noundef nonnull align 8 dereferenceable(80) %55, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %61 unwind label %90

61:                                               ; preds = %60
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #7
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
          to label %62 unwind label %86

62:                                               ; preds = %61
  invoke void @__cxa_end_catch()
          to label %63 unwind label %93

63:                                               ; preds = %62, %77, %41
  invoke void @_ZNSt11unique_lockISt5mutexE4lockEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
          to label %64 unwind label %44

64:                                               ; preds = %63
  %65 = load i32, ptr %20, align 4, !tbaa !32
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr %20, align 4, !tbaa !32
  %67 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %19)
  %68 = load i32, ptr %20, align 4
  %69 = icmp eq i32 %68, 0
  %or.cond = select i1 %67, i1 %69, i1 false
  br i1 %or.cond, label %70, label %96

70:                                               ; preds = %64
  store i8 1, ptr %23, align 1, !tbaa !35
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
          to label %71 unwind label %44

71:                                               ; preds = %70
  call void @_ZNSt18condition_variable10notify_oneEv(ptr noundef nonnull align 8 dereferenceable(48) %24) #7
  br label %96

72:                                               ; preds = %46
  invoke void @_ZNSt11unique_lockISt5mutexE4lockEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
          to label %73 unwind label %78

73:                                               ; preds = %72
  %74 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %22) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull @.str.9, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %75 unwind label %80

75:                                               ; preds = %73
  invoke void @_ZNSt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS5_SaIS5_EEE4pushEOS5_(ptr noundef nonnull align 8 dereferenceable(80) %74, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %76 unwind label %82

76:                                               ; preds = %75
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  invoke void @_ZNSt11unique_lockISt5mutexE6unlockEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
          to label %77 unwind label %78

77:                                               ; preds = %76
  invoke void @__cxa_end_catch()
          to label %63 unwind label %44

78:                                               ; preds = %76, %72
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %85

80:                                               ; preds = %73
  %81 = landingpad { ptr, i32 }
          cleanup
  br label %84

82:                                               ; preds = %75
  %83 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  br label %84

84:                                               ; preds = %82, %80
  %.pn = phi { ptr, i32 } [ %83, %82 ], [ %81, %80 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  br label %85

85:                                               ; preds = %84, %78
  %.pn23 = phi { ptr, i32 } [ %79, %78 ], [ %.pn, %84 ]
  invoke void @__cxa_end_catch()
          to label %99 unwind label %103

86:                                               ; preds = %61, %53
  %87 = landingpad { ptr, i32 }
          cleanup
  br label %95

88:                                               ; preds = %54
  %89 = landingpad { ptr, i32 }
          cleanup
  br label %92

90:                                               ; preds = %60
  %91 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  br label %92

92:                                               ; preds = %90, %88
  %.pn25 = phi { ptr, i32 } [ %91, %90 ], [ %89, %88 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #7
  br label %95

93:                                               ; preds = %62
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %99

95:                                               ; preds = %92, %86
  %.pn27 = phi { ptr, i32 } [ %87, %86 ], [ %.pn25, %92 ]
  invoke void @__cxa_end_catch()
          to label %99 unwind label %103

96:                                               ; preds = %64, %71
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  %97 = load i8, ptr %14, align 8, !tbaa !5, !range !30, !noundef !31
  %98 = trunc nuw i8 %97 to i1
  br i1 %98, label %25, label %.loopexit

99:                                               ; preds = %93, %95, %85, %44
  %.pn31 = phi { ptr, i32 } [ %45, %44 ], [ %.pn23, %85 ], [ %94, %93 ], [ %.pn27, %95 ]
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  br label %100

100:                                              ; preds = %99, %42
  %.pn31.pn = phi { ptr, i32 } [ %.pn31, %99 ], [ %43, %42 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  br label %101

101:                                              ; preds = %100, %32
  %.pn31.pn.pn = phi { ptr, i32 } [ %.pn31.pn, %100 ], [ %33, %32 ]
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #7
  br label %102

102:                                              ; preds = %101, %30
  %.pn31.pn.pn.pn = phi { ptr, i32 } [ %.pn31.pn.pn, %101 ], [ %31, %30 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @_ZN4dali11DeviceGuardD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  resume { ptr, i32 } %.pn31.pn.pn.pn

.loopexit:                                        ; preds = %96, %5, %.thread
  call void @_ZN4dali11DeviceGuardD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  ret void

103:                                              ; preds = %95, %85
  %104 = landingpad { ptr, i32 }
          catch ptr null
  %105 = extractvalue { ptr, i32 } %104, 0
  call void @__clang_call_terminate(ptr %105) #8
  unreachable
}

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #3

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

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

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

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

; Function Attrs: nounwind
declare void @_ZNSt18condition_variable10notify_oneEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4

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

declare void @_ZN4dali13SetThreadNameEPKc(ptr noundef) local_unnamed_addr #5

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

declare void @_ZN4dali11DeviceGuardC1Ei(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNSt18condition_variable4waitIZN4dali10ThreadPool10ThreadMainEiibRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE3$_0EEvRSt11unique_lockISt5mutexET_"(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(9), ptr) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #6

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

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

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #1 align 2

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

; Function Attrs: nounwind
declare void @_ZN4dali11DeviceGuardD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { noinline noreturn nounwind uwtable "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 "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 = { "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 = { nofree nosync nounwind memory(none) }
attributes #7 = { nounwind }
attributes #8 = { noreturn 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, !20, i64 56}
!6 = !{!"_ZTSN4dali10ThreadPoolE", !7, i64 0, !14, i64 24, !20, i64 56, !20, i64 57, !20, i64 58, !21, i64 60, !22, i64 64, !24, i64 104, !24, i64 152, !26, i64 200}
!7 = !{!"_ZTSSt6vectorISt6threadSaIS0_EE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseISt6threadSaIS0_EE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseISt6threadSaIS0_EE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseISt6threadSaIS0_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSSt14priority_queueISt4pairIlSt8functionIFviEEESt6vectorIS4_SaIS4_EEN4dali10ThreadPool14SortByPriorityEE", !15, i64 0, !19, i64 24}
!15 = !{!"_ZTSSt6vectorISt4pairIlSt8functionIFviEEESaIS4_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseISt4pairIlSt8functionIFviEEESaIS4_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt4pairIlSt8functionIFviEEESaIS4_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseISt4pairIlSt8functionIFviEEESaIS4_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!19 = !{!"_ZTSN4dali10ThreadPool14SortByPriorityE"}
!20 = !{!"bool", !12, i64 0}
!21 = !{!"int", !12, i64 0}
!22 = !{!"_ZTSSt5mutex", !23, i64 0}
!23 = !{!"_ZTSSt12__mutex_base", !12, i64 0}
!24 = !{!"_ZTSSt18condition_variable", !25, i64 0}
!25 = !{!"_ZTSSt9__condvar", !12, i64 0}
!26 = !{!"_ZTSSt6vectorISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseISt5queueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt5dequeIS6_SaIS6_EEESaISA_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!6, !21, i64 60}
!33 = !{!34, !34, i64 0}
!34 = !{!"vtable pointer", !13, i64 0}
!35 = !{!6, !20, i64 57}


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