; LLVM IR from intel/qpl :: sources/middle-layer/dispatcher (hw_device)

; 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.qpl::ml::util::bitmask128" = type { i64, i64 }
%"class.qpl::ml::dispatcher::hw_device" = type { %"struct.std::array", i32, i64, i64, i64, i32, i32, i64, %"class.qpl::ml::dispatcher::queue_selector" }
%"struct.std::array" = type { [100 x %"class.qpl::ml::dispatcher::hw_queue"] }
%"class.qpl::ml::dispatcher::hw_queue" = type { ptr, i8, i32, i64, ptr, %"struct.std::atomic", i8, %"struct.std::array.0", i8, i32, i64 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i64 }
%"struct.std::array.0" = type { [8 x i32] }
%"class.qpl::ml::dispatcher::queue_selector" = type { %"class.std::unordered_map", %"class.std::map" }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, qpl::ml::util::bitmask128>, std::_Select1st<std::pair<const unsigned long, qpl::ml::util::bitmask128>>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, qpl::ml::util::bitmask128>, std::_Select1st<std::pair<const unsigned long, qpl::ml::util::bitmask128>>, std::less<unsigned long>>::_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 }

@_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx = external hidden thread_local global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tE(ptr noundef nonnull align 8 dereferenceable(9752) %0, ptr noundef %1, ptr noundef %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.qpl::ml::util::bitmask128", align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = invoke noundef zeroext i8 @_ZL31hw_iaa_descriptor_get_operationP13hw_descriptor(ptr noundef %17)
          to label %19 unwind label %88

19:                                               ; preds = %3
  %20 = zext i8 %18 to i32
  store i32 %20, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = invoke noundef i32 @_ZL37hw_iaa_descriptor_get_max_buffer_sizeP13hw_descriptor(ptr noundef %21)
          to label %23 unwind label %88

23:                                               ; preds = %19
  store i32 %22, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %24 = getelementptr inbounds %"class.qpl::ml::dispatcher::hw_device", ptr %16, i32 0, i32 1
  %25 = load i32, ptr %24, align 8, !tbaa !11
  call void @_ZN3qpl2ml4util10bitmask128C2Ej(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef %25) #6
  %26 = getelementptr inbounds %"class.qpl::ml::dispatcher::hw_device", ptr %16, i32 0, i32 8
  %27 = load i32, ptr %8, align 4, !tbaa !9
  call void @_ZNK3qpl2ml10dispatcher14queue_selector19reduce_by_operationEjRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104) %26, i32 noundef %27, ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !29
  %28 = call noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128eqERKm(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br i1 %28, label %29, label %30

29:                                               ; preds = %23
  store i32 7, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %86

30:                                               ; preds = %23
  %31 = getelementptr inbounds %"class.qpl::ml::dispatcher::hw_device", ptr %16, i32 0, i32 8
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  call void @_ZNK3qpl2ml10dispatcher14queue_selector23reduce_by_transfer_sizeEmRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104) %31, i64 noundef %33, ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store i64 0, ptr %13, align 8, !tbaa !29
  %34 = call noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128eqERKm(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br i1 %34, label %35, label %36

35:                                               ; preds = %30
  store i32 8, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %86

36:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store i64 0, ptr %14, align 8, !tbaa !29
  br label %37

37:                                               ; preds = %80, %36
  %38 = load i64, ptr %14, align 8, !tbaa !29
  %39 = getelementptr inbounds %"class.qpl::ml::dispatcher::hw_device", ptr %16, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !11
  %41 = zext i32 %40 to i64
  %42 = icmp ult i64 %38, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %37
  store i32 2, ptr %12, align 4
  br label %83

44:                                               ; preds = %37
  %45 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx)
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = call noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128ixEj(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef %46) #6
  br i1 %47, label %48, label %72

48:                                               ; preds = %44
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.qpl::ml::dispatcher::hw_device", ptr %16, i32 0, i32 0
  %51 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx)
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = zext i32 %52 to i64
  %54 = call noundef nonnull align 8 dereferenceable(96) ptr @_ZNKSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EEixEm(ptr noundef nonnull align 8 dereferenceable(9600) %50, i64 noundef %53) #6
  %55 = call noundef zeroext i1 @_ZNK3qpl2ml10dispatcher8hw_queue18get_block_on_faultEv(ptr noundef nonnull align 8 dereferenceable(96) %54) #6
  invoke void @_ZL36hw_iaa_descriptor_set_block_on_faultP13hw_descriptorb(ptr noundef %49, i1 noundef zeroext %55)
          to label %56 unwind label %88

56:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %57 = getelementptr inbounds %"class.qpl::ml::dispatcher::hw_device", ptr %16, i32 0, i32 0
  %58 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx)
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = call noundef nonnull align 8 dereferenceable(96) ptr @_ZNKSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EEixEm(ptr noundef nonnull align 8 dereferenceable(9600) %57, i64 noundef %60) #6
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = call noundef i32 @_ZNK3qpl2ml10dispatcher8hw_queue18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tE(ptr noundef nonnull align 8 dereferenceable(96) %61, ptr noundef %62, ptr noundef %63) #6
  store i32 %64, ptr %15, align 4, !tbaa !30
  %65 = load i32, ptr %15, align 4, !tbaa !30
  %66 = icmp eq i32 0, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %56
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %69

68:                                               ; preds = %56
  store i32 0, ptr %12, align 4
  br label %69

69:                                               ; preds = %68, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %70 = load i32, ptr %12, align 4
  switch i32 %70, label %83 [
    i32 0, label %71
  ]

71:                                               ; preds = %69
  br label %72

72:                                               ; preds = %71, %44
  %73 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx)
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = add i32 %74, 1
  %76 = getelementptr inbounds %"class.qpl::ml::dispatcher::hw_device", ptr %16, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !11
  %78 = urem i32 %75, %77
  %79 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx)
  store i32 %78, ptr %79, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %72
  %81 = load i64, ptr %14, align 8, !tbaa !29
  %82 = add i64 %81, 1
  store i64 %82, ptr %14, align 8, !tbaa !29
  br label %37, !llvm.loop !32

83:                                               ; preds = %69, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %84 = load i32, ptr %12, align 4
  switch i32 %84, label %86 [
    i32 2, label %85
  ]

85:                                               ; preds = %83
  store i32 6, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %86

86:                                               ; preds = %85, %83, %35, %29
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %87 = load i32, ptr %4, align 4
  ret i32 %87

88:                                               ; preds = %48, %19, %3
  %89 = landingpad { ptr, i32 }
          catch ptr null
  %90 = extractvalue { ptr, i32 } %89, 0
  call void @__clang_call_terminate(ptr %90) #7
  unreachable
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i8 @_ZL31hw_iaa_descriptor_get_operationP13hw_descriptor(ptr noundef) #2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL37hw_iaa_descriptor_get_max_buffer_sizeP13hw_descriptor(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3qpl2ml4util10bitmask128C2Ej(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3qpl2ml10dispatcher14queue_selector19reduce_by_operationEjRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef, ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128eqERKm(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3qpl2ml10dispatcher14queue_selector23reduce_by_transfer_sizeEmRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104), i64 noundef, ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128ixEj(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL36hw_iaa_descriptor_set_block_on_faultP13hw_descriptorb(ptr noundef, i1 noundef zeroext) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(96) ptr @_ZNKSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EEixEm(ptr noundef nonnull align 8 dereferenceable(9600), i64 noundef) #0 align 2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qpl2ml10dispatcher8hw_queue18get_block_on_faultEv(ptr noundef nonnull align 8 dereferenceable(96)) #5

; Function Attrs: nounwind
declare noundef i32 @_ZNK3qpl2ml10dispatcher8hw_queue18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, ptr noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #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 = !{!"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, !10, i64 9600}
!12 = !{!"_ZTSN3qpl2ml10dispatcher9hw_deviceE", !13, i64 0, !10, i64 9600, !14, i64 9608, !14, i64 9616, !14, i64 9624, !10, i64 9632, !10, i64 9636, !14, i64 9640, !15, i64 9648}
!13 = !{!"_ZTSSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EE", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN3qpl2ml10dispatcher14queue_selectorE", !16, i64 0, !21, i64 56}
!16 = !{!"_ZTSSt13unordered_mapIjN3qpl2ml4util10bitmask128ESt4hashIjESt8equal_toIjESaISt4pairIKjS3_EEE", !17, i64 0}
!17 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN3qpl2ml4util10bitmask128EESaIS6_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS8_18_Mod_range_hashingENS8_20_Default_ranged_hashENS8_20_Prime_rehash_policyENS8_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !14, i64 8, !18, i64 16, !14, i64 24, !19, i64 32, !6, i64 48}
!18 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!19 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !20, i64 0, !14, i64 8}
!20 = !{!"float", !7, i64 0}
!21 = !{!"_ZTSSt3mapImN3qpl2ml4util10bitmask128ESt4lessImESaISt4pairIKmS3_EEE", !22, i64 0}
!22 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmN3qpl2ml4util10bitmask128EESt10_Select1stIS6_ESt4lessImESaIS6_EE", !23, i64 0}
!23 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmN3qpl2ml4util10bitmask128EESt10_Select1stIS6_ESt4lessImESaIS6_EE13_Rb_tree_implISA_Lb1EEE", !24, i64 0, !26, i64 8}
!24 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !25, i64 0}
!25 = !{!"_ZTSSt4lessImE"}
!26 = !{!"_ZTSSt15_Rb_tree_header", !27, i64 0, !14, i64 32}
!27 = !{!"_ZTSSt18_Rb_tree_node_base", !28, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!28 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!29 = !{!14, !14, i64 0}
!30 = !{!31, !31, i64 0}
!31 = !{!"_ZTS10qpl_status", !7, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"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.qpl::ml::util::bitmask128" = type { i64, i64 }

@_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx = external hidden thread_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tE(ptr noundef nonnull align 8 dereferenceable(9752) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.qpl::ml::util::bitmask128", align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = tail call noundef zeroext i8 @_ZL31hw_iaa_descriptor_get_operationP13hw_descriptor(ptr noundef %1)
  %8 = zext i8 %7 to i32
  %9 = tail call noundef i32 @_ZL37hw_iaa_descriptor_get_max_buffer_sizeP13hw_descriptor(ptr noundef %1)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %10 = getelementptr inbounds i8, ptr %0, i64 9600
  %11 = load i32, ptr %10, align 8, !tbaa !5
  call void @_ZN3qpl2ml4util10bitmask128C2Ej(ptr noundef nonnull align 8 dereferenceable(16) %4, i32 noundef %11) #5
  %12 = getelementptr inbounds i8, ptr %0, i64 9648
  call void @_ZNK3qpl2ml10dispatcher14queue_selector19reduce_by_operationEjRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104) %12, i32 noundef %8, ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store i64 0, ptr %5, align 8, !tbaa !27
  %13 = call noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128eqERKm(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br i1 %13, label %.loopexit, label %14

14:                                               ; preds = %3
  %15 = zext i32 %9 to i64
  call void @_ZNK3qpl2ml10dispatcher14queue_selector23reduce_by_transfer_sizeEmRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104) %12, i64 noundef %15, ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store i64 0, ptr %6, align 8, !tbaa !27
  %16 = call noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128eqERKm(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br i1 %16, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %14
  %17 = load i32, ptr %10, align 8, !tbaa !5
  %.not1718.not = icmp eq i32 %17, 0
  br i1 %.not1718.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %18 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZNK3qpl2ml10dispatcher9hw_device18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tEE6wq_idx)
  %.pre = load i32, ptr %18, align 4, !tbaa !28
  br label %19

19:                                               ; preds = %.lr.ph, %31
  %20 = phi i32 [ %.pre, %.lr.ph ], [ %35, %31 ]
  %.01419 = phi i64 [ 0, %.lr.ph ], [ %36, %31 ]
  %21 = call noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128ixEj(ptr noundef nonnull align 8 dereferenceable(16) %4, i32 noundef %20) #5
  br i1 %21, label %22, label %31

22:                                               ; preds = %19
  %23 = load i32, ptr %18, align 4, !tbaa !28
  %24 = zext i32 %23 to i64
  %25 = call noundef nonnull align 8 dereferenceable(96) ptr @_ZNKSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EEixEm(ptr noundef nonnull align 8 dereferenceable(9600) %0, i64 noundef %24) #5
  %26 = call noundef zeroext i1 @_ZNK3qpl2ml10dispatcher8hw_queue18get_block_on_faultEv(ptr noundef nonnull align 8 dereferenceable(96) %25) #5
  call void @_ZL36hw_iaa_descriptor_set_block_on_faultP13hw_descriptorb(ptr noundef %1, i1 noundef zeroext %26)
  %27 = load i32, ptr %18, align 4, !tbaa !28
  %28 = zext i32 %27 to i64
  %29 = call noundef nonnull align 8 dereferenceable(96) ptr @_ZNKSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EEixEm(ptr noundef nonnull align 8 dereferenceable(9600) %0, i64 noundef %28) #5
  %30 = call noundef i32 @_ZNK3qpl2ml10dispatcher8hw_queue18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tE(ptr noundef nonnull align 8 dereferenceable(96) %29, ptr noundef %1, ptr noundef %2) #5
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %.loopexit, label %31

31:                                               ; preds = %22, %19
  %32 = load i32, ptr %18, align 4, !tbaa !28
  %33 = add i32 %32, 1
  %34 = load i32, ptr %10, align 8, !tbaa !5
  %35 = urem i32 %33, %34
  store i32 %35, ptr %18, align 4, !tbaa !28
  %36 = add nuw nsw i64 %.01419, 1
  %37 = zext i32 %34 to i64
  %.not17 = icmp ult i64 %36, %37
  br i1 %.not17, label %19, label %.loopexit, !llvm.loop !29

.loopexit:                                        ; preds = %31, %22, %.preheader, %14, %3
  %.4 = phi i32 [ 7, %3 ], [ 8, %14 ], [ 6, %.preheader ], [ 6, %31 ], [ 0, %22 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  ret i32 %.4
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i8 @_ZL31hw_iaa_descriptor_get_operationP13hw_descriptor(ptr noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL37hw_iaa_descriptor_get_max_buffer_sizeP13hw_descriptor(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3qpl2ml4util10bitmask128C2Ej(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3qpl2ml10dispatcher14queue_selector19reduce_by_operationEjRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128eqERKm(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK3qpl2ml10dispatcher14queue_selector23reduce_by_transfer_sizeEmRNS0_4util10bitmask128E(ptr noundef nonnull align 8 dereferenceable(104), i64 noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3qpl2ml4util10bitmask128ixEj(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL36hw_iaa_descriptor_set_block_on_faultP13hw_descriptorb(ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(96) ptr @_ZNKSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EEixEm(ptr noundef nonnull align 8 dereferenceable(9600), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qpl2ml10dispatcher8hw_queue18get_block_on_faultEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #4

; Function Attrs: nounwind
declare noundef i32 @_ZNK3qpl2ml10dispatcher8hw_queue18enqueue_descriptorEPvPNS0_4util22execution_record_ext_tE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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, !10, i64 9600}
!6 = !{!"_ZTSN3qpl2ml10dispatcher9hw_deviceE", !7, i64 0, !10, i64 9600, !11, i64 9608, !11, i64 9616, !11, i64 9624, !10, i64 9632, !10, i64 9636, !11, i64 9640, !12, i64 9648}
!7 = !{!"_ZTSSt5arrayIN3qpl2ml10dispatcher8hw_queueELm100EE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_ZTSN3qpl2ml10dispatcher14queue_selectorE", !13, i64 0, !19, i64 56}
!13 = !{!"_ZTSSt13unordered_mapIjN3qpl2ml4util10bitmask128ESt4hashIjESt8equal_toIjESaISt4pairIKjS3_EEE", !14, i64 0}
!14 = !{!"_ZTSSt10_HashtableIjSt4pairIKjN3qpl2ml4util10bitmask128EESaIS6_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS8_18_Mod_range_hashingENS8_20_Default_ranged_hashENS8_20_Prime_rehash_policyENS8_17_Hashtable_traitsILb0ELb0ELb1EEEE", !15, i64 0, !11, i64 8, !16, i64 16, !11, i64 24, !17, i64 32, !15, i64 48}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !15, i64 0}
!17 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !18, i64 0, !11, i64 8}
!18 = !{!"float", !8, i64 0}
!19 = !{!"_ZTSSt3mapImN3qpl2ml4util10bitmask128ESt4lessImESaISt4pairIKmS3_EEE", !20, i64 0}
!20 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmN3qpl2ml4util10bitmask128EESt10_Select1stIS6_ESt4lessImESaIS6_EE", !21, i64 0}
!21 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmN3qpl2ml4util10bitmask128EESt10_Select1stIS6_ESt4lessImESaIS6_EE13_Rb_tree_implISA_Lb1EEE", !22, i64 0, !24, i64 8}
!22 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !23, i64 0}
!23 = !{!"_ZTSSt4lessImE"}
!24 = !{!"_ZTSSt15_Rb_tree_header", !25, i64 0, !11, i64 32}
!25 = !{!"_ZTSSt18_Rb_tree_node_base", !26, i64 0, !15, i64 8, !15, i64 16, !15, i64 24}
!26 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!27 = !{!11, !11, i64 0}
!28 = !{!10, !10, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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