; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/test/test_task_enqueue.ll (Z11TestEnqueuei)

; 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.Harness::internal::Tracer" = type <{ i32, [4 x i8], ptr, ptr, i64, [8 x i8] }>
%"struct.tbb::atomic" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic" }
%"struct.tbb::internal::atomic_impl_with_arithmetic" = type { %"struct.tbb::internal::atomic_impl" }
%"struct.tbb::internal::atomic_impl" = type { %"struct.tbb::internal::aligned_storage" }
%"struct.tbb::internal::aligned_storage" = type { i32 }
%"class.tbb::task_scheduler_init" = type { ptr }
%class.ProgressMonitor = type { i8 }
%"class.tbb::internal::tbb_thread_v3" = type { i64 }
%"class.tbb::internal::allocate_root_proxy" = type { i8 }

@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@_ZN12EnqueuedTask15nCompletedPairsE = external dso_local global %"struct.tbb::atomic", align 4
@_ZN12EnqueuedTask13nOrderedPairsE = external dso_local global %"struct.tbb::atomic", align 4
@_ZL7Verbose = external hidden global i8, align 1
@.str.17 = external hidden unnamed_addr constant [93 x i8], align 1
@__FUNCTION__._Z11TestEnqueuei = external hidden unnamed_addr constant [12 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [38 x i8], align 1
@_ZL10TaskTracks = external hidden global [10 x i32], align 16
@.str.19 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [76 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33), i32 noundef, ptr noundef, i64 noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, ...) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10TimedYieldd(double noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11TestEnqueuei(i32 noundef %0) #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.tbb::task_scheduler_init", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %class.ProgressMonitor, align 1
  %10 = alloca %"class.tbb::internal::tbb_thread_v3", align 8
  %11 = alloca %class.ProgressMonitor, align 1
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca %"class.tbb::internal::allocate_root_proxy", align 1
  %15 = alloca %"class.tbb::internal::allocate_root_proxy", align 1
  %16 = alloca ptr, align 8
  %17 = alloca %"class.tbb::internal::allocate_root_proxy", align 1
  %18 = alloca %"class.tbb::internal::allocate_root_proxy", align 1
  %19 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  %20 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !9, !range !11, !noundef !12
  %21 = trunc i8 %20 to i1
  br i1 %21, label %23, label %22

22:                                               ; preds = %1
  br label %26

23:                                               ; preds = %1
  %24 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef @.str.17, i64 noundef 128, ptr noundef @__FUNCTION__._Z11TestEnqueuei)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %24, ptr noundef @.str.18, i32 noundef %25)
  br label %26

26:                                               ; preds = %23, %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %167, %26
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 3
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %177

31:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %32 = load i32, ptr %2, align 4, !tbaa !5
  call void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef %32, i64 noundef 0)
  %33 = invoke noundef i32 @_ZN3tbb6atomicIiEaSEi(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask13nOrderedPairsE, i32 noundef 0)
          to label %34 unwind label %41

34:                                               ; preds = %31
  %35 = invoke noundef i32 @_ZN3tbb6atomicIiEaSEi(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask15nCompletedPairsE, i32 noundef %33)
          to label %36 unwind label %41

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

37:                                               ; preds = %53, %36
  %38 = load i32, ptr %8, align 4, !tbaa !5
  %39 = icmp slt i32 %38, 10
  br i1 %39, label %45, label %40

40:                                               ; preds = %37
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %60

41:                                               ; preds = %34, %31
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %6, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %7, align 4
  br label %176

45:                                               ; preds = %37
  %46 = load i32, ptr %8, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [10 x i32], ptr @_ZL10TaskTracks, i64 0, i64 %47
  store i32 -1, ptr %48, align 4, !tbaa !5
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr @_ZL10TaskTracks, i64 %50
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef %51)
          to label %52 unwind label %56

52:                                               ; preds = %45
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %8, align 4, !tbaa !5
  br label %37, !llvm.loop !13

56:                                               ; preds = %45
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %6, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %176

60:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  invoke void @_ZN3tbb8internal13tbb_thread_v3C2I15ProgressMonitorEET_(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %61 unwind label %69

61:                                               ; preds = %60
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = icmp eq i32 %62, 1
  br i1 %63, label %64, label %99

64:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %81, %64
  %66 = load i32, ptr %12, align 4, !tbaa !5
  %67 = icmp slt i32 %66, 10
  br i1 %67, label %73, label %68

68:                                               ; preds = %65
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %98

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

73:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  invoke void @_ZN3tbb4task13allocate_rootEv()
          to label %74 unwind label %84

74:                                               ; preds = %73
  %75 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %76 unwind label %84

76:                                               ; preds = %74
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %75, i32 noundef 2, i32 noundef 5)
          to label %77 unwind label %88

77:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  store ptr %75, ptr %13, align 8, !tbaa !15
  %78 = load ptr, ptr %13, align 8, !tbaa !15
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %78)
          to label %79 unwind label %93

79:                                               ; preds = %77
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %80 unwind label %93

80:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %12, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %12, align 4, !tbaa !5
  br label %65, !llvm.loop !17

84:                                               ; preds = %74, %73
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %6, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %7, align 4
  br label %92

88:                                               ; preds = %76
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %6, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %7, align 4
  call void @_ZdlPvRKN3tbb8internal19allocate_root_proxyE(ptr noundef %75, ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  br label %92

92:                                               ; preds = %88, %84
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  br label %97

93:                                               ; preds = %79, %77
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %6, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %7, align 4
  br label %97

97:                                               ; preds = %93, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %174

98:                                               ; preds = %68
  br label %99

99:                                               ; preds = %98, %61
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = icmp eq i32 %100, 2
  br i1 %101, label %102, label %149

102:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #6
  invoke void @_ZN3tbb4task13allocate_rootEv()
          to label %103 unwind label %113

103:                                              ; preds = %102
  %104 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) %17)
          to label %105 unwind label %113

105:                                              ; preds = %103
  invoke void @_ZN3tbb10empty_taskC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %104)
          to label %106 unwind label %117

106:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  store ptr %104, ptr %16, align 8, !tbaa !15
  %107 = load ptr, ptr %16, align 8, !tbaa !15
  invoke void @_ZN3tbb4task13set_ref_countEi(ptr noundef nonnull align 8 dereferenceable(8) %107, i32 noundef 100)
          to label %108 unwind label %122

108:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %134, %108
  %110 = load i32, ptr %19, align 4, !tbaa !5
  %111 = icmp slt i32 %110, 100
  br i1 %111, label %126, label %112

112:                                              ; preds = %109
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %146

113:                                              ; preds = %103, %102
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %6, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %7, align 4
  br label %121

117:                                              ; preds = %105
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %6, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %7, align 4
  call void @_ZdlPvRKN3tbb8internal19allocate_root_proxyE(ptr noundef %104, ptr noundef nonnull align 1 dereferenceable(1) %17) #6
  br label %121

121:                                              ; preds = %117, %113
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  br label %148

122:                                              ; preds = %146, %106
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %6, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %7, align 4
  br label %148

126:                                              ; preds = %109
  %127 = load ptr, ptr %16, align 8, !tbaa !15
  %128 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN3tbb4task14allocate_childEv(ptr noundef nonnull align 8 dereferenceable(8) %127)
          to label %129 unwind label %137

129:                                              ; preds = %126
  %130 = invoke noundef ptr @_ZnwmRKN3tbb8internal20allocate_child_proxyE(i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) %128)
          to label %131 unwind label %137

131:                                              ; preds = %129
  invoke void @_ZN3tbb10empty_taskC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %130)
          to label %132 unwind label %141

132:                                              ; preds = %131
  invoke void @_ZN3tbb4task7enqueueERS0_(ptr noundef nonnull align 8 dereferenceable(8) %130)
          to label %133 unwind label %137

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %19, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %19, align 4, !tbaa !5
  br label %109, !llvm.loop !18

137:                                              ; preds = %132, %129, %126
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %6, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %7, align 4
  br label %145

141:                                              ; preds = %131
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %6, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %7, align 4
  call void @_ZdlPvRKN3tbb8internal20allocate_child_proxyE(ptr noundef %130, ptr noundef nonnull align 1 dereferenceable(1) %128) #6
  br label %145

145:                                              ; preds = %141, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %148

146:                                              ; preds = %112
  invoke void @_ZN3tbb19task_scheduler_init9terminateEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %147 unwind label %122

147:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %149

148:                                              ; preds = %145, %122, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %174

149:                                              ; preds = %147, %99
  invoke void @_ZN3tbb8internal13tbb_thread_v34joinEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %150 unwind label %170

150:                                              ; preds = %149
  %151 = invoke noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask15nCompletedPairsE)
          to label %152 unwind label %170

152:                                              ; preds = %150
  %153 = icmp eq i32 %151, 1000
  br i1 %153, label %154, label %155

154:                                              ; preds = %152
  br label %157

155:                                              ; preds = %152
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 156, ptr noundef @.str.19, ptr noundef null)
          to label %156 unwind label %170

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156, %154
  %158 = invoke noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask13nOrderedPairsE)
          to label %159 unwind label %170

159:                                              ; preds = %157
  %160 = invoke noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask15nCompletedPairsE)
          to label %161 unwind label %170

161:                                              ; preds = %159
  %162 = icmp slt i32 %158, %160
  br i1 %162, label %163, label %164

163:                                              ; preds = %161
  br label %166

164:                                              ; preds = %161
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 158, ptr noundef @.str.20, ptr noundef @.str.21)
          to label %165 unwind label %170

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165, %163
  call void @_ZN3tbb8internal13tbb_thread_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %3, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %3, align 4, !tbaa !5
  br label %27, !llvm.loop !19

170:                                              ; preds = %164, %159, %157, %155, %150, %149
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %6, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %7, align 4
  br label %174

174:                                              ; preds = %170, %148, %97
  call void @_ZN3tbb8internal13tbb_thread_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  br label %175

175:                                              ; preds = %174, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  br label %176

176:                                              ; preds = %175, %56, %41
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %178

177:                                              ; preds = %30
  ret void

178:                                              ; preds = %176
  %179 = load ptr, ptr %6, align 8
  %180 = load i32, ptr %7, align 4
  %181 = insertvalue { ptr, i32 } poison, ptr %179, 0
  %182 = insertvalue { ptr, i32 } %181, i32 %180, 1
  resume { ptr, i32 } %182
}

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb4task13allocate_rootEv() #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZdlPvRKN3tbb8internal19allocate_root_proxyE(ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #4

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZnwmRKN3tbb8internal20allocate_child_proxyE(i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZdlPvRKN3tbb8internal20allocate_child_proxyE(ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #4

declare void @_ZN3tbb19task_scheduler_init9terminateEv(ptr noundef nonnull align 8 dereferenceable(8)) #5

declare void @_ZN3tbb8internal13tbb_thread_v34joinEv(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


; 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.Harness::internal::Tracer" = type <{ i32, [4 x i8], ptr, ptr, i64, [8 x i8] }>
%"struct.tbb::atomic" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic" }
%"struct.tbb::internal::atomic_impl_with_arithmetic" = type { %"struct.tbb::internal::atomic_impl" }
%"struct.tbb::internal::atomic_impl" = type { %"struct.tbb::internal::aligned_storage" }
%"struct.tbb::internal::aligned_storage" = type { i32 }
%"class.tbb::task_scheduler_init" = type { ptr }
%"class.tbb::internal::tbb_thread_v3" = type { i64 }
%"class.tbb::internal::allocate_root_proxy" = type { i8 }

@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@_ZN12EnqueuedTask15nCompletedPairsE = external dso_local global %"struct.tbb::atomic", align 4
@_ZN12EnqueuedTask13nOrderedPairsE = external dso_local global %"struct.tbb::atomic", align 4
@_ZL7Verbose = external hidden local_unnamed_addr global i8, align 1
@.str.17 = external hidden unnamed_addr constant [93 x i8], align 1
@__FUNCTION__._Z11TestEnqueuei = external hidden unnamed_addr constant [12 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [38 x i8], align 1
@_ZL10TaskTracks = external hidden global [10 x i32], align 16
@.str.19 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [76 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, ...) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10TimedYieldd(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11TestEnqueuei(i32 noundef %0) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.tbb::task_scheduler_init", align 8
  %3 = alloca %"class.tbb::internal::tbb_thread_v3", align 8
  %4 = alloca %"class.tbb::internal::allocate_root_proxy", align 1
  %5 = alloca %"class.tbb::internal::allocate_root_proxy", align 1
  %6 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !5, !range !9, !noundef !10
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %.preheader

8:                                                ; preds = %1
  %9 = tail call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef nonnull @.str.17, i64 noundef 128, ptr noundef nonnull @__FUNCTION__._Z11TestEnqueuei)
  tail call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %9, ptr noundef nonnull @.str.18, i32 noundef %0)
  br label %.preheader

.preheader:                                       ; preds = %1, %8
  br label %11

10:                                               ; preds = %105
  ret void

11:                                               ; preds = %.preheader, %105
  %.01854 = phi i32 [ %106, %105 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %0, i64 noundef 0)
  %12 = invoke noundef i32 @_ZN3tbb6atomicIiEaSEi(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask13nOrderedPairsE, i32 noundef 0)
          to label %13 unwind label %15

13:                                               ; preds = %11
  %14 = invoke noundef i32 @_ZN3tbb6atomicIiEaSEi(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask15nCompletedPairsE, i32 noundef %12)
          to label %.preheader42.preheader unwind label %15

.preheader42.preheader:                           ; preds = %13
  store i32 -1, ptr @_ZL10TaskTracks, align 16, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull @_ZL10TaskTracks)
          to label %.preheader42.1 unwind label %18

15:                                               ; preds = %13, %11
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %111

.preheader42.1:                                   ; preds = %.preheader42.preheader
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 4), align 4, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 4))
          to label %.preheader42.2 unwind label %18

.preheader42.2:                                   ; preds = %.preheader42.1
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 8), align 8, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 8))
          to label %.preheader42.3 unwind label %18

.preheader42.3:                                   ; preds = %.preheader42.2
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 12), align 4, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 12))
          to label %.preheader42.4 unwind label %18

.preheader42.4:                                   ; preds = %.preheader42.3
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 16), align 16, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 16))
          to label %.preheader42.5 unwind label %18

.preheader42.5:                                   ; preds = %.preheader42.4
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 20), align 4, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 20))
          to label %.preheader42.6 unwind label %18

.preheader42.6:                                   ; preds = %.preheader42.5
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 24), align 8, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 24))
          to label %.preheader42.7 unwind label %18

.preheader42.7:                                   ; preds = %.preheader42.6
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 28), align 4, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 28))
          to label %.preheader42.8 unwind label %18

.preheader42.8:                                   ; preds = %.preheader42.7
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 32), align 16, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 32))
          to label %.preheader42.9 unwind label %18

.preheader42.9:                                   ; preds = %.preheader42.8
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 36), align 4, !tbaa !11
  invoke void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZL10TaskTracks, i64 36))
          to label %17 unwind label %18

17:                                               ; preds = %.preheader42.9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  invoke void @_ZN3tbb8internal13tbb_thread_v3C2I15ProgressMonitorEET_(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %20 unwind label %22

18:                                               ; preds = %.preheader42.9, %.preheader42.8, %.preheader42.7, %.preheader42.6, %.preheader42.5, %.preheader42.4, %.preheader42.3, %.preheader42.2, %.preheader42.1, %.preheader42.preheader
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %111

20:                                               ; preds = %17
  switch i32 %.01854, label %.loopexit [
    i32 1, label %.preheader.preheader
    i32 2, label %70
  ]

.preheader.preheader:                             ; preds = %20
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %21 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %24 unwind label %63

22:                                               ; preds = %17
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %110

24:                                               ; preds = %.preheader.preheader
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %21, i32 noundef 2, i32 noundef 5)
          to label %25 unwind label %65

25:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %21)
          to label %26 unwind label %68

26:                                               ; preds = %25
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.1 unwind label %68

.preheader.1:                                     ; preds = %26
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %27 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %28 unwind label %63

28:                                               ; preds = %.preheader.1
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %27, i32 noundef 2, i32 noundef 5)
          to label %29 unwind label %65

29:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %27)
          to label %30 unwind label %68

30:                                               ; preds = %29
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.2 unwind label %68

.preheader.2:                                     ; preds = %30
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %31 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %32 unwind label %63

32:                                               ; preds = %.preheader.2
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %31, i32 noundef 2, i32 noundef 5)
          to label %33 unwind label %65

33:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %31)
          to label %34 unwind label %68

34:                                               ; preds = %33
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.3 unwind label %68

.preheader.3:                                     ; preds = %34
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %35 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %36 unwind label %63

36:                                               ; preds = %.preheader.3
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef 2, i32 noundef 5)
          to label %37 unwind label %65

37:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %35)
          to label %38 unwind label %68

38:                                               ; preds = %37
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.4 unwind label %68

.preheader.4:                                     ; preds = %38
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %39 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %40 unwind label %63

40:                                               ; preds = %.preheader.4
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %39, i32 noundef 2, i32 noundef 5)
          to label %41 unwind label %65

41:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %39)
          to label %42 unwind label %68

42:                                               ; preds = %41
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.5 unwind label %68

.preheader.5:                                     ; preds = %42
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %43 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %44 unwind label %63

44:                                               ; preds = %.preheader.5
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %43, i32 noundef 2, i32 noundef 5)
          to label %45 unwind label %65

45:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %43)
          to label %46 unwind label %68

46:                                               ; preds = %45
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.6 unwind label %68

.preheader.6:                                     ; preds = %46
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %47 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %48 unwind label %63

48:                                               ; preds = %.preheader.6
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %47, i32 noundef 2, i32 noundef 5)
          to label %49 unwind label %65

49:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %47)
          to label %50 unwind label %68

50:                                               ; preds = %49
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.7 unwind label %68

.preheader.7:                                     ; preds = %50
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %51 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %52 unwind label %63

52:                                               ; preds = %.preheader.7
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %51, i32 noundef 2, i32 noundef 5)
          to label %53 unwind label %65

53:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %51)
          to label %54 unwind label %68

54:                                               ; preds = %53
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.8 unwind label %68

.preheader.8:                                     ; preds = %54
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %55 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %56 unwind label %63

56:                                               ; preds = %.preheader.8
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %55, i32 noundef 2, i32 noundef 5)
          to label %57 unwind label %65

57:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %55)
          to label %58 unwind label %68

58:                                               ; preds = %57
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.preheader.9 unwind label %68

.preheader.9:                                     ; preds = %58
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %59 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 16, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %60 unwind label %63

60:                                               ; preds = %.preheader.9
  invoke void @_ZN13TaskGeneratorC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %59, i32 noundef 2, i32 noundef 5)
          to label %61 unwind label %65

61:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  invoke void @_ZN3tbb4task19spawn_root_and_waitERS0_(ptr noundef nonnull align 8 dereferenceable(8) %59)
          to label %62 unwind label %68

62:                                               ; preds = %61
  invoke void @_Z10TimedYieldd(double noundef 0x3EB0C6F7A0B5ED8D)
          to label %.loopexit unwind label %68

63:                                               ; preds = %.preheader.9, %.preheader.8, %.preheader.7, %.preheader.6, %.preheader.5, %.preheader.4, %.preheader.3, %.preheader.2, %.preheader.1, %.preheader.preheader
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %67

65:                                               ; preds = %60, %56, %52, %48, %44, %40, %36, %32, %28, %24
  %.lcssa59 = phi ptr [ %21, %24 ], [ %27, %28 ], [ %31, %32 ], [ %35, %36 ], [ %39, %40 ], [ %43, %44 ], [ %47, %48 ], [ %51, %52 ], [ %55, %56 ], [ %59, %60 ]
  %66 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvRKN3tbb8internal19allocate_root_proxyE(ptr noundef %.lcssa59, ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  br label %67

67:                                               ; preds = %65, %63
  %.pn34 = phi { ptr, i32 } [ %66, %65 ], [ %64, %63 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  br label %109

68:                                               ; preds = %62, %61, %58, %57, %54, %53, %50, %49, %46, %45, %42, %41, %38, %37, %34, %33, %30, %29, %26, %25
  %69 = landingpad { ptr, i32 }
          cleanup
  br label %109

70:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  call void @_ZN3tbb4task13allocate_rootEv()
  %71 = invoke noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %72 unwind label %75

72:                                               ; preds = %70
  invoke void @_ZN3tbb10empty_taskC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %71)
          to label %73 unwind label %77

73:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @_ZN3tbb4task13set_ref_countEi(ptr noundef nonnull align 8 dereferenceable(8) %71, i32 noundef 100)
  br label %82

74:                                               ; preds = %87
  invoke void @_ZN3tbb19task_scheduler_init9terminateEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %.loopexit unwind label %80

75:                                               ; preds = %70
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %79

77:                                               ; preds = %72
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvRKN3tbb8internal19allocate_root_proxyE(ptr noundef %71, ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  br label %79

79:                                               ; preds = %77, %75
  %.pn = phi { ptr, i32 } [ %78, %77 ], [ %76, %75 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  br label %109

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

82:                                               ; preds = %73, %87
  %.053 = phi i32 [ 0, %73 ], [ %88, %87 ]
  %83 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN3tbb4task14allocate_childEv(ptr noundef nonnull align 8 dereferenceable(8) %71)
  %84 = invoke noundef ptr @_ZnwmRKN3tbb8internal20allocate_child_proxyE(i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) %83)
          to label %85 unwind label %89

85:                                               ; preds = %82
  invoke void @_ZN3tbb10empty_taskC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %84)
          to label %86 unwind label %91

86:                                               ; preds = %85
  invoke void @_ZN3tbb4task7enqueueERS0_(ptr noundef nonnull align 8 dereferenceable(8) %84)
          to label %87 unwind label %89

87:                                               ; preds = %86
  %88 = add nuw nsw i32 %.053, 1
  %exitcond.not = icmp eq i32 %88, 100
  br i1 %exitcond.not, label %74, label %82, !llvm.loop !13

89:                                               ; preds = %86, %82
  %90 = landingpad { ptr, i32 }
          cleanup
  br label %109

91:                                               ; preds = %85
  %92 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvRKN3tbb8internal20allocate_child_proxyE(ptr noundef %84, ptr noundef nonnull align 1 dereferenceable(1) %83) #6
  br label %109

.loopexit:                                        ; preds = %62, %74, %20
  invoke void @_ZN3tbb8internal13tbb_thread_v34joinEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %93 unwind label %107

93:                                               ; preds = %.loopexit
  %94 = invoke noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask15nCompletedPairsE)
          to label %95 unwind label %107

95:                                               ; preds = %93
  %96 = icmp eq i32 %94, 1000
  br i1 %96, label %98, label %97

97:                                               ; preds = %95
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 156, ptr noundef nonnull @.str.19, ptr noundef null)
          to label %98 unwind label %107

98:                                               ; preds = %97, %95
  %99 = invoke noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask13nOrderedPairsE)
          to label %100 unwind label %107

100:                                              ; preds = %98
  %101 = invoke noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @_ZN12EnqueuedTask15nCompletedPairsE)
          to label %102 unwind label %107

102:                                              ; preds = %100
  %103 = icmp slt i32 %99, %101
  br i1 %103, label %105, label %104

104:                                              ; preds = %102
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 158, ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.21)
          to label %105 unwind label %107

105:                                              ; preds = %104, %102
  call void @_ZN3tbb8internal13tbb_thread_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %106 = add nuw nsw i32 %.01854, 1
  %exitcond68.not = icmp eq i32 %106, 3
  br i1 %exitcond68.not, label %10, label %11, !llvm.loop !15

107:                                              ; preds = %104, %100, %98, %97, %93, %.loopexit
  %108 = landingpad { ptr, i32 }
          cleanup
  br label %109

109:                                              ; preds = %79, %80, %91, %89, %67, %68, %107
  %.pn36.pn = phi { ptr, i32 } [ %108, %107 ], [ %69, %68 ], [ %.pn34, %67 ], [ %81, %80 ], [ %.pn, %79 ], [ %90, %89 ], [ %92, %91 ]
  call void @_ZN3tbb8internal13tbb_thread_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br label %110

110:                                              ; preds = %109, %22
  %.pn36.pn.pn = phi { ptr, i32 } [ %.pn36.pn, %109 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %111

111:                                              ; preds = %110, %18, %15
  %.pn40 = phi { ptr, i32 } [ %19, %18 ], [ %.pn36.pn.pn, %110 ], [ %16, %15 ]
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn40
}

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12EnqueuedTask12FireTwoTasksEPi(ptr noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb4task13allocate_rootEv() local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZnwmRKN3tbb8internal19allocate_root_proxyE(i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZdlPvRKN3tbb8internal19allocate_root_proxyE(ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZnwmRKN3tbb8internal20allocate_child_proxyE(i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZdlPvRKN3tbb8internal20allocate_child_proxyE(ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

declare void @_ZN3tbb19task_scheduler_init9terminateEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

declare void @_ZN3tbb8internal13tbb_thread_v34joinEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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