; LLVM IR from cjmcv/hpc :: std/alg_quick_sort.ll (Z17ParallelQuickSortiPiii)

; 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.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9PartitionPiii(ptr noundef, i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11QuickSortV1Piii(ptr noundef, i32 noundef, i32 noundef) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 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) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17ParallelQuickSortiPiii(i32 noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::queue", align 8
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::pair", align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair", align 4
  %23 = alloca %"class.std::thread", align 8
  %24 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %9) #9
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %25 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %26 unwind label %62

26:                                               ; preds = %4
  store i64 %25, ptr %10, align 4
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %27 unwind label %62

27:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %28

28:                                               ; preds = %95, %27
  %29 = invoke noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %30 unwind label %66

30:                                               ; preds = %28
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = icmp ult i64 %29, %32
  br i1 %33, label %34, label %38

34:                                               ; preds = %30
  %35 = invoke noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %36 unwind label %66

36:                                               ; preds = %34
  %37 = icmp ugt i64 %35, 0
  br label %38

38:                                               ; preds = %36, %30
  %39 = phi i1 [ false, %30 ], [ %37, %36 ]
  br i1 %39, label %40, label %98

40:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %41 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %42 unwind label %70

42:                                               ; preds = %40
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %41, i64 8, i1 false)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %43 unwind label %70

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %44 = load ptr, ptr %6, align 8, !tbaa !9
  %45 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !13
  %49 = call noundef i32 @_Z9PartitionPiii(ptr noundef %44, i32 noundef %46, i32 noundef %48)
  store i32 %49, ptr %14, align 4, !tbaa !5
  %50 = load i32, ptr %14, align 4, !tbaa !5
  %51 = sub nsw i32 %50, 1
  %52 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  %53 = load i32, ptr %52, align 4, !tbaa !11
  %54 = icmp sgt i32 %51, %53
  br i1 %54, label %55, label %78

55:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %56 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %57 = load i32, ptr %14, align 4, !tbaa !5
  %58 = sub nsw i32 %57, 1
  store i32 %58, ptr %16, align 4, !tbaa !5
  %59 = invoke i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %56, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %60 unwind label %74

60:                                               ; preds = %55
  store i64 %59, ptr %15, align 4
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %61 unwind label %74

61:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  br label %78

62:                                               ; preds = %26, %4
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %11, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %206

66:                                               ; preds = %34, %28
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %11, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %12, align 4
  br label %206

70:                                               ; preds = %42, %40
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %11, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %12, align 4
  br label %97

74:                                               ; preds = %60, %55
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %11, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  br label %96

78:                                               ; preds = %61, %43
  %79 = load i32, ptr %14, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  %81 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !13
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %84, label %95

84:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %85 = load i32, ptr %14, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %18, align 4, !tbaa !5
  %87 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 1
  %88 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %87)
          to label %89 unwind label %91

89:                                               ; preds = %84
  store i64 %88, ptr %17, align 4
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr noundef nonnull align 4 dereferenceable(8) %17)
          to label %90 unwind label %91

90:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %95

91:                                               ; preds = %89, %84
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %11, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %96

95:                                               ; preds = %90, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  br label %28, !llvm.loop !14

96:                                               ; preds = %91, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %97

97:                                               ; preds = %96, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  br label %206

98:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %99 = invoke noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %100 unwind label %108

100:                                              ; preds = %98
  %101 = load i32, ptr %5, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = icmp ult i64 %99, %102
  br i1 %103, label %104, label %112

104:                                              ; preds = %100
  %105 = invoke noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %106 unwind label %108

106:                                              ; preds = %104
  %107 = trunc i64 %105 to i32
  store i32 %107, ptr %19, align 4, !tbaa !5
  br label %114

108:                                              ; preds = %104, %98
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %11, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %12, align 4
  br label %205

112:                                              ; preds = %100
  %113 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %113, ptr %19, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %112, %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %115 = load i32, ptr %19, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %116, i64 8)
  %118 = extractvalue { i64, i1 } %117, 1
  %119 = extractvalue { i64, i1 } %117, 0
  %120 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %119, i64 8)
  %121 = extractvalue { i64, i1 } %120, 1
  %122 = or i1 %118, %121
  %123 = extractvalue { i64, i1 } %120, 0
  %124 = select i1 %122, i64 -1, i64 %123
  %125 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %124) #10
          to label %126 unwind label %141

126:                                              ; preds = %114
  store i64 %116, ptr %125, align 8
  %127 = getelementptr inbounds i8, ptr %125, i64 8
  %128 = icmp eq i64 %116, 0
  br i1 %128, label %135, label %129

129:                                              ; preds = %126
  %130 = getelementptr inbounds %"class.std::thread", ptr %127, i64 %116
  br label %131

131:                                              ; preds = %131, %129
  %132 = phi ptr [ %127, %129 ], [ %133, %131 ]
  call void @_ZNSt6threadC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %132) #9
  %133 = getelementptr inbounds %"class.std::thread", ptr %132, i64 1
  %134 = icmp eq ptr %133, %130
  br i1 %134, label %135, label %131

135:                                              ; preds = %131, %126
  store ptr %127, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %157, %135
  %137 = load i32, ptr %21, align 4, !tbaa !5
  %138 = load i32, ptr %19, align 4, !tbaa !5
  %139 = icmp slt i32 %137, %138
  br i1 %139, label %145, label %140

140:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  br label %169

141:                                              ; preds = %114
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %11, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %12, align 4
  br label %204

145:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #9
  %146 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %147 unwind label %160

147:                                              ; preds = %145
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %146, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %148 = getelementptr inbounds %"struct.std::pair", ptr %22, i32 0, i32 0
  %149 = getelementptr inbounds %"struct.std::pair", ptr %22, i32 0, i32 1
  invoke void @_ZNSt6threadC2IRFvPiiiEJRS1_RiS5_EvEEOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull @_Z11QuickSortV1Piii, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %148, ptr noundef nonnull align 4 dereferenceable(4) %149)
          to label %150 unwind label %164

150:                                              ; preds = %147
  %151 = load ptr, ptr %20, align 8, !tbaa !9
  %152 = load i32, ptr %21, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds %"class.std::thread", ptr %151, i64 %153
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6threadaSEOS_(ptr noundef nonnull align 8 dereferenceable(8) %154, ptr noundef nonnull align 8 dereferenceable(8) %23) #9
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %156 unwind label %160

156:                                              ; preds = %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %21, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %21, align 4, !tbaa !5
  br label %136, !llvm.loop !16

160:                                              ; preds = %150, %145
  %161 = landingpad { ptr, i32 }
          cleanup
  %162 = extractvalue { ptr, i32 } %161, 0
  store ptr %162, ptr %11, align 8
  %163 = extractvalue { ptr, i32 } %161, 1
  store i32 %163, ptr %12, align 4
  br label %168

164:                                              ; preds = %147
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %11, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  br label %168

168:                                              ; preds = %164, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  br label %204

169:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %170

170:                                              ; preds = %181, %169
  %171 = load i32, ptr %24, align 4, !tbaa !5
  %172 = load i32, ptr %19, align 4, !tbaa !5
  %173 = icmp slt i32 %171, %172
  br i1 %173, label %175, label %174

174:                                              ; preds = %170
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  br label %188

175:                                              ; preds = %170
  %176 = load ptr, ptr %20, align 8, !tbaa !9
  %177 = load i32, ptr %24, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds %"class.std::thread", ptr %176, i64 %178
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %179)
          to label %180 unwind label %184

180:                                              ; preds = %175
  br label %181

181:                                              ; preds = %180
  %182 = load i32, ptr %24, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %24, align 4, !tbaa !5
  br label %170, !llvm.loop !17

184:                                              ; preds = %175
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %11, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  br label %204

188:                                              ; preds = %174
  %189 = load ptr, ptr %20, align 8, !tbaa !9
  %190 = icmp eq ptr %189, null
  br i1 %190, label %203, label %191

191:                                              ; preds = %188
  %192 = getelementptr inbounds i8, ptr %189, i64 -8
  %193 = load i64, ptr %192, align 8
  %194 = getelementptr inbounds %"class.std::thread", ptr %189, i64 %193
  %195 = icmp eq ptr %189, %194
  br i1 %195, label %200, label %196

196:                                              ; preds = %196, %191
  %197 = phi ptr [ %194, %191 ], [ %198, %196 ]
  %198 = getelementptr inbounds %"class.std::thread", ptr %197, i64 -1
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %198) #9
  %199 = icmp eq ptr %198, %189
  br i1 %199, label %200, label %196

200:                                              ; preds = %196, %191
  %201 = mul i64 8, %193
  %202 = add i64 %201, 8
  call void @_ZdaPvm(ptr noundef %192, i64 noundef %202) #11
  br label %203

203:                                              ; preds = %200, %188
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %9) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr %9) #9
  ret void

204:                                              ; preds = %184, %168, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  br label %205

205:                                              ; preds = %204, %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %206

206:                                              ; preds = %205, %97, %66, %62
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %9) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr %9) #9
  br label %207

207:                                              ; preds = %206
  %208 = load ptr, ptr %11, align 8
  %209 = load i32, ptr %12, align 4
  %210 = insertvalue { ptr, i32 } poison, ptr %208, 0
  %211 = insertvalue { ptr, i32 } %210, i32 %209, 1
  resume { ptr, i32 } %211
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64) #5

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #6

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

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

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

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

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) #7

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) #8

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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nobuiltin allocsize(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 #7 = { "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 #8 = { nobuiltin 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


; 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.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9PartitionPiii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

; 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 uwtable
declare dso_local void @_Z11QuickSortV1Piii(ptr noundef, i32 noundef, i32 noundef) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17ParallelQuickSortiPiii(i32 noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::queue", align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca %"class.std::thread", align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  store i32 %3, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %8) #8
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %17 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %18 unwind label %39

18:                                               ; preds = %4
  store i64 %17, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %8, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %19 unwind label %39

19:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %20 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %21 = sext i32 %0 to i64
  %22 = icmp ult i64 %20, %21
  br i1 %22, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %19
  %23 = getelementptr inbounds i8, ptr %10, i64 4
  br label %24

24:                                               ; preds = %.lr.ph, %53
  %25 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %.not = icmp eq i64 %25, 0
  br i1 %.not, label %.critedge, label %26

26:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %27 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %28 = load i64, ptr %27, align 4
  store i64 %28, ptr %10, align 8
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %29 = load i32, ptr %10, align 8, !tbaa !11
  %30 = load i32, ptr %23, align 4, !tbaa !13
  %31 = call noundef i32 @_Z9PartitionPiii(ptr noundef %1, i32 noundef %29, i32 noundef %30)
  %32 = add nsw i32 %31, -1
  %33 = load i32, ptr %10, align 8, !tbaa !11
  %34 = icmp sgt i32 %32, %33
  br i1 %34, label %35, label %43

35:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #8
  store i32 %32, ptr %12, align 4, !tbaa !9
  %36 = invoke i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %37 unwind label %41

37:                                               ; preds = %35
  store i64 %36, ptr %11, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %8, ptr noundef nonnull align 4 dereferenceable(8) %11)
          to label %38 unwind label %41

38:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  br label %43

39:                                               ; preds = %18, %4
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br label %102

41:                                               ; preds = %37, %35
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  br label %56

43:                                               ; preds = %38, %26
  %44 = add nsw i32 %31, 1
  %45 = load i32, ptr %23, align 4, !tbaa !13
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %47, label %53

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #8
  store i32 %44, ptr %14, align 4, !tbaa !9
  %48 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %23)
          to label %49 unwind label %51

49:                                               ; preds = %47
  store i64 %48, ptr %13, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %8, ptr noundef nonnull align 4 dereferenceable(8) %13)
          to label %50 unwind label %51

50:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  br label %53

51:                                               ; preds = %49, %47
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  br label %56

53:                                               ; preds = %50, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  %54 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %55 = icmp ult i64 %54, %21
  br i1 %55, label %24, label %.critedge, !llvm.loop !14

56:                                               ; preds = %51, %41
  %.pn32 = phi { ptr, i32 } [ %52, %51 ], [ %42, %41 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  br label %102

.critedge:                                        ; preds = %24, %53, %19
  %57 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %58 = icmp ult i64 %57, %21
  br i1 %58, label %59, label %62

59:                                               ; preds = %.critedge
  %60 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %61 = trunc i64 %60 to i32
  %sext = shl i64 %60, 32
  %.pre = ashr exact i64 %sext, 32
  br label %62

62:                                               ; preds = %.critedge, %59
  %.pre-phi = phi i64 [ %21, %.critedge ], [ %.pre, %59 ]
  %.022 = phi i32 [ %0, %.critedge ], [ %61, %59 ]
  %63 = icmp slt i32 %.022, 0
  %64 = shl nsw i64 %.pre-phi, 3
  %65 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %64, i64 8)
  %66 = extractvalue { i64, i1 } %65, 1
  %67 = or i1 %63, %66
  %68 = extractvalue { i64, i1 } %65, 0
  %69 = select i1 %67, i64 -1, i64 %68
  %70 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %69) #9
          to label %71 unwind label %81

71:                                               ; preds = %62
  store i64 %.pre-phi, ptr %70, align 8
  %.ptr = getelementptr inbounds i8, ptr %70, i64 8
  %72 = icmp eq i32 %.022, 0
  br i1 %72, label %._crit_edge, label %73

73:                                               ; preds = %71
  %74 = getelementptr inbounds %"class.std::thread", ptr %.ptr, i64 %.pre-phi
  br label %75

75:                                               ; preds = %75, %73
  %76 = phi ptr [ %.ptr, %73 ], [ %77, %75 ]
  call void @_ZNSt6threadC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %76) #8
  %77 = getelementptr inbounds i8, ptr %76, i64 8
  %78 = icmp eq ptr %77, %74
  br i1 %78, label %.loopexit36, label %75

.loopexit36:                                      ; preds = %75
  %79 = icmp sgt i32 %.022, 0
  br i1 %79, label %.lr.ph42, label %._crit_edgethread-pre-split

.lr.ph42:                                         ; preds = %.loopexit36
  %80 = getelementptr inbounds i8, ptr %15, i64 4
  %wide.trip.count = zext nneg i32 %.022 to i64
  br label %83

.preheader35:                                     ; preds = %86
  br i1 %79, label %.lr.ph44.preheader, label %._crit_edgethread-pre-split

.lr.ph44.preheader:                               ; preds = %.preheader35
  %wide.trip.count49 = zext nneg i32 %.022 to i64
  br label %.lr.ph44

81:                                               ; preds = %62
  %82 = landingpad { ptr, i32 }
          cleanup
  br label %102

83:                                               ; preds = %.lr.ph42, %86
  %indvars.iv = phi i64 [ 0, %.lr.ph42 ], [ %indvars.iv.next, %86 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #8
  %84 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %85 = load i64, ptr %84, align 4
  store i64 %85, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #8
  invoke void @_ZNSt6threadC2IRFvPiiiEJRS1_RiS5_EvEEOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull @_Z11QuickSortV1Piii, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %80)
          to label %86 unwind label %89

86:                                               ; preds = %83
  %87 = getelementptr inbounds %"class.std::thread", ptr %.ptr, i64 %indvars.iv
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6threadaSEOS_(ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #8
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader35, label %83, !llvm.loop !16

89:                                               ; preds = %83
  %90 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #8
  br label %102

.lr.ph44:                                         ; preds = %.lr.ph44.preheader, %92
  %indvars.iv46 = phi i64 [ 0, %.lr.ph44.preheader ], [ %indvars.iv.next47, %92 ]
  %91 = getelementptr inbounds %"class.std::thread", ptr %.ptr, i64 %indvars.iv46
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %91)
          to label %92 unwind label %93

92:                                               ; preds = %.lr.ph44
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
  br i1 %exitcond50.not, label %._crit_edgethread-pre-split, label %.lr.ph44, !llvm.loop !17

93:                                               ; preds = %.lr.ph44
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %102

._crit_edgethread-pre-split:                      ; preds = %92, %.preheader35, %.loopexit36
  %.pr = load i64, ptr %70, align 8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edgethread-pre-split, %71
  %95 = phi i64 [ %.pr, %._crit_edgethread-pre-split ], [ %.pre-phi, %71 ]
  %.idx = shl i64 %95, 3
  %96 = icmp eq i64 %95, 0
  br i1 %96, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge
  %97 = getelementptr i8, ptr %70, i64 %.idx
  %.ptr30 = getelementptr i8, ptr %97, i64 8
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %98 = phi ptr [ %99, %.preheader ], [ %.ptr30, %.preheader.preheader ]
  %99 = getelementptr inbounds i8, ptr %98, i64 -8
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %99) #8
  %100 = icmp eq ptr %99, %.ptr
  br i1 %100, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %.preheader, %._crit_edge
  %101 = add i64 %.idx, 8
  call void @_ZdaPvm(ptr noundef nonnull %70, i64 noundef %101) #10
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %8) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %8) #8
  ret void

102:                                              ; preds = %81, %89, %93, %56, %39
  %.pn32.pn = phi { ptr, i32 } [ %.pn32, %56 ], [ %40, %39 ], [ %90, %89 ], [ %94, %93 ], [ %82, %81 ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %8) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %8) #8
  resume { ptr, i32 } %.pn32.pn
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64) #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #5

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

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

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

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

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) local_unnamed_addr #7

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 = { 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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nobuiltin allocsize(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 = { "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 #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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 0}
!12 = !{!"_ZTSSt4pairIiiE", !10, i64 0, !10, i64 4}
!13 = !{!12, !10, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


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