; LLVM IR from xissburg/edyn :: src/edyn/parallel/job_dispatcher.ll (ZN4edyn14job_dispatcher5asyncERKNS_3jobE)

; 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::_Rb_tree_iterator" = type { ptr }
%"class.std::thread::id" = type { i64 }
%"class.edyn::job_dispatcher" = type { %"class.std::vector", %"class.std::map", %"struct.std::atomic" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::unique_ptr<std::thread>, std::allocator<std::unique_ptr<std::thread>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<std::thread>, std::allocator<std::unique_ptr<std::thread>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<std::thread>, std::allocator<std::unique_ptr<std::thread>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<std::thread>, std::allocator<std::unique_ptr<std::thread>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::thread::id, std::pair<const std::thread::id, std::unique_ptr<edyn::worker>>, std::_Select1st<std::pair<const std::thread::id, std::unique_ptr<edyn::worker>>>, std::less<std::thread::id>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::thread::id, std::pair<const std::thread::id, std::unique_ptr<edyn::worker>>, std::_Select1st<std::pair<const std::thread::id, std::unique_ptr<edyn::worker>>>, std::less<std::thread::id>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i64 }
%"struct.std::pair" = type { %"class.std::thread::id", %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.4" }
%"struct.std::_Head_base.4" = type { ptr }

@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__._ZN4edyn14job_dispatcher5asyncERKNS_3jobE = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEEixERSB_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4edyn14job_dispatcher5asyncERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr noundef nonnull align 8 dereferenceable(64) %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = alloca %"class.std::thread::id", align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8
  %17 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %18 = call noundef zeroext i1 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %17) #7
  %19 = xor i1 %18, true
  br i1 %19, label %20, label %21

20:                                               ; preds = %2
  br label %23

21:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 50, ptr noundef @__PRETTY_FUNCTION__._ZN4edyn14job_dispatcher5asyncERKNS_3jobE) #8
  unreachable

22:                                               ; No predecessors!
  br label %23

23:                                               ; preds = %22, %20
  %24 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %25 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %24) #7
  %26 = icmp eq i64 %25, 1
  br i1 %26, label %27, label %35

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %28 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %29 = call ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %28) #7
  %30 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %5, i32 0, i32 0
  store ptr %29, ptr %30, align 8
  %31 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS6_EEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %32 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %33 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %32) #7
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184) %33, ptr noundef nonnull align 8 dereferenceable(64) %34)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %103

35:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @_ZNSt6thread2idC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 -1, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %36 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 2
  %37 = call noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %36, i64 noundef 1, i32 noundef 0) #7
  %38 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %39 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %38) #7
  %40 = urem i64 %37, %39
  store i64 %40, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %41 = load i64, ptr %8, align 8, !tbaa !9
  %42 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %43 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %42) #7
  %44 = add i64 %41, %43
  store i64 %44, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %45 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %45, ptr %10, align 8, !tbaa !9
  br label %46

46:                                               ; preds = %84, %35
  %47 = load i64, ptr %10, align 8, !tbaa !9
  %48 = load i64, ptr %9, align 8, !tbaa !9
  %49 = icmp ult i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 2, ptr %11, align 4
  br label %87

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %52 = load i64, ptr %10, align 8, !tbaa !9
  %53 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %54 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %53) #7
  %55 = urem i64 %52, %54
  store i64 %55, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %56 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %57 = call ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %56) #7
  %58 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %13, i32 0, i32 0
  store ptr %57, ptr %58, align 8
  %59 = load i64, ptr %12, align 8, !tbaa !9
  call void @_ZSt7advanceISt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS7_EEEEmEvRT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %13, i64 noundef %59)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS6_EEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  store ptr %60, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.std::pair", ptr %61, i32 0, i32 1
  %63 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %62) #7
  %64 = call noundef i64 @_ZN4edyn6worker4sizeEv(ptr noundef nonnull align 8 dereferenceable(184) %63)
  store i64 %64, ptr %15, align 8, !tbaa !9
  %65 = load i64, ptr %15, align 8, !tbaa !9
  %66 = icmp eq i64 %65, 0
  br i1 %66, label %67, label %72

67:                                               ; preds = %51
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.std::pair", ptr %68, i32 0, i32 1
  %70 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %69) #7
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184) %70, ptr noundef nonnull align 8 dereferenceable(64) %71)
  store i32 1, ptr %11, align 4
  br label %81

72:                                               ; preds = %51
  %73 = load i64, ptr %15, align 8, !tbaa !9
  %74 = load i64, ptr %7, align 8, !tbaa !9
  %75 = icmp ult i64 %73, %74
  br i1 %75, label %76, label %80

76:                                               ; preds = %72
  %77 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %77, ptr %7, align 8, !tbaa !9
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = getelementptr inbounds %"struct.std::pair", ptr %78, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %79, i64 8, i1 false), !tbaa.struct !11
  br label %80

80:                                               ; preds = %76, %72
  store i32 0, ptr %11, align 4
  br label %81

81:                                               ; preds = %80, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %82 = load i32, ptr %11, align 4
  switch i32 %82, label %87 [
    i32 0, label %83
  ]

83:                                               ; preds = %81
  br label %84

84:                                               ; preds = %83
  %85 = load i64, ptr %10, align 8, !tbaa !9
  %86 = add i64 %85, 1
  store i64 %86, ptr %10, align 8, !tbaa !9
  br label %46, !llvm.loop !12

87:                                               ; preds = %81, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  %88 = load i32, ptr %11, align 4
  switch i32 %88, label %101 [
    i32 2, label %89
  ]

89:                                               ; preds = %87
  %90 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %91 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5countERSB_(ptr noundef nonnull align 8 dereferenceable(48) %90, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %92 = icmp ne i64 %91, 0
  br i1 %92, label %93, label %94

93:                                               ; preds = %89
  br label %96

94:                                               ; preds = %89
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 82, ptr noundef @__PRETTY_FUNCTION__._ZN4edyn14job_dispatcher5asyncERKNS_3jobE) #8
  unreachable

95:                                               ; No predecessors!
  br label %96

96:                                               ; preds = %95, %93
  %97 = getelementptr inbounds %"class.edyn::job_dispatcher", ptr %16, i32 0, i32 1
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEEixERSB_(ptr noundef nonnull align 8 dereferenceable(48) %97, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %99 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %98) #7
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184) %99, ptr noundef nonnull align 8 dereferenceable(64) %100)
  store i32 0, ptr %11, align 4
  br label %101

101:                                              ; preds = %96, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %102 = load i32, ptr %11, align 4
  switch i32 %102, label %104 [
    i32 0, label %103
    i32 1, label %103
  ]

103:                                              ; preds = %101, %101, %27
  ret void

104:                                              ; preds = %101
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184), ptr noundef nonnull align 8 dereferenceable(64)) #3 align 2

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7advanceISt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS7_EEEEmEvRT_T0_(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #5

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5countERSB_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

attributes #0 = { noreturn 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { alwaysinline 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!11 = !{i64 0, i64 8, !9}
!12 = distinct !{!12, !13}
!13 = !{!"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::_Rb_tree_iterator" = type { ptr }
%"class.std::thread::id" = type { i64 }

@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__._ZN4edyn14job_dispatcher5asyncERKNS_3jobE = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEEixERSB_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4edyn14job_dispatcher5asyncERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr noundef nonnull align 8 dereferenceable(64) %1) local_unnamed_addr #3 align 2 {
  %3 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %4 = alloca %"class.std::thread::id", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = tail call noundef zeroext i1 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  br i1 %7, label %8, label %9

8:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 50, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4edyn14job_dispatcher5asyncERKNS_3jobE) #7
  unreachable

9:                                                ; preds = %2
  %10 = tail call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  %11 = icmp eq i64 %10, 1
  br i1 %11, label %12, label %17

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %13 = tail call ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  store ptr %13, ptr %3, align 8
  %14 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS6_EEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184) %16, ptr noundef nonnull align 8 dereferenceable(64) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %45

17:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt6thread2idC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %18 = getelementptr inbounds i8, ptr %0, i64 72
  %19 = call noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %18, i64 noundef 1, i32 noundef 0) #6
  %20 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  %21 = urem i64 %19, %20
  %22 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  %23 = add i64 %22, %21
  %.not2428 = icmp ult i64 %21, %23
  br i1 %.not2428, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %17, %35
  %.030 = phi i64 [ %.2.ph, %35 ], [ -1, %17 ]
  %.02029 = phi i64 [ %36, %35 ], [ %21, %17 ]
  %24 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  %25 = urem i64 %.02029, %24
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %26 = call ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  store ptr %26, ptr %5, align 8
  call void @_ZSt7advanceISt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS7_EEEEmEvRT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %5, i64 noundef %25)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS6_EEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  %29 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  %30 = call noundef i64 @_ZN4edyn6worker4sizeEv(ptr noundef nonnull align 8 dereferenceable(184) %29)
  %.not = icmp eq i64 %30, 0
  br i1 %.not, label %37, label %31

31:                                               ; preds = %.lr.ph
  %32 = icmp ult i64 %30, %.030
  br i1 %32, label %33, label %35

33:                                               ; preds = %31
  %34 = load i64, ptr %27, align 8, !tbaa !5
  store i64 %34, ptr %4, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %31, %33
  %.2.ph = phi i64 [ %.030, %31 ], [ %30, %33 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %36 = add i64 %.02029, 1
  %exitcond.not = icmp eq i64 %36, %23
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !9

37:                                               ; preds = %.lr.ph
  %38 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  call void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184) %38, ptr noundef nonnull align 8 dereferenceable(64) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %44

.critedge:                                        ; preds = %35, %17
  %39 = call noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5countERSB_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %.not25 = icmp eq i64 %39, 0
  br i1 %.not25, label %40, label %41

40:                                               ; preds = %.critedge
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 82, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4edyn14job_dispatcher5asyncERKNS_3jobE) #7
  unreachable

41:                                               ; preds = %.critedge
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEEixERSB_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %43 = call noundef ptr @_ZNKSt10unique_ptrIN4edyn6workerESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %42) #6
  call void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184) %43, ptr noundef nonnull align 8 dereferenceable(64) %1)
  br label %44

44:                                               ; preds = %37, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %45

45:                                               ; preds = %44, %12
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4edyn6worker8push_jobERKNS_3jobE(ptr noundef nonnull align 8 dereferenceable(184), ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #3 align 2

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7advanceISt17_Rb_tree_iteratorISt4pairIKNSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS7_EEEEmEvRT_T0_(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapINSt6thread2idESt10unique_ptrIN4edyn6workerESt14default_deleteIS4_EESt4lessIS1_ESaISt4pairIKS1_S7_EEE5countERSB_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

attributes #0 = { noreturn 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { alwaysinline 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 }
attributes #7 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass