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

; 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] }>
%"class.tbb::task_scheduler_init" = type { ptr }
%"class.Harness::SpinBarrier" = type <{ i32, %"struct.tbb::atomic.0", %"struct.tbb::atomic.0", i8, [3 x i8] }>
%"struct.tbb::atomic.0" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic.1" }
%"struct.tbb::internal::atomic_impl_with_arithmetic.1" = type { %"struct.tbb::internal::atomic_impl.2" }
%"struct.tbb::internal::atomic_impl.2" = type { %"struct.tbb::internal::aligned_storage.3" }
%"struct.tbb::internal::aligned_storage.3" = type { i32 }
%"class.tbb::affinity_partitioner" = type { %"class.tbb::internal::affinity_partitioner_base_v3" }
%"class.tbb::internal::affinity_partitioner_base_v3" = type { ptr, i64 }
%"class.tbb::blocked_range" = type { i32, i32, i64 }
%struct.Functor = type { ptr }
%"class.tbb::simple_partitioner" = type { i8 }

@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@_ZL7Verbose = external hidden global i8, align 1
@.str.17 = external hidden unnamed_addr constant [93 x i8], align 1
@__FUNCTION__._Z11TestWakeupsv = external hidden unnamed_addr constant [12 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [35 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 @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i64 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

declare noundef i32 @_ZN3tbb19task_scheduler_init19default_num_threadsEv() #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13), i32 noundef, i1 noundef zeroext) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11TestWakeupsv() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.tbb::task_scheduler_init", align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.Harness::SpinBarrier", align 4
  %5 = alloca %"class.tbb::affinity_partitioner", align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.tbb::blocked_range", align 8
  %8 = alloca %struct.Functor, align 8
  %9 = alloca i64, align 8
  %10 = alloca %"class.tbb::blocked_range", align 8
  %11 = alloca %struct.Functor, align 8
  %12 = alloca %"class.tbb::simple_partitioner", align 1
  %13 = alloca i64, align 8
  %14 = alloca %"class.tbb::blocked_range", align 8
  %15 = alloca %struct.Functor, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  call void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef -2, i64 noundef 0)
  %16 = invoke noundef i32 @_ZN3tbb19task_scheduler_init19default_num_threadsEv()
          to label %17 unwind label %21

17:                                               ; preds = %0
  %18 = icmp sle i32 %16, 4
  br i1 %18, label %19, label %25

19:                                               ; preds = %17
  invoke void @_ZN3tbb19task_scheduler_init10initializeEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 8)
          to label %20 unwind label %21

20:                                               ; preds = %19
  br label %30

21:                                               ; preds = %27, %25, %19, %0
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %2, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %3, align 4
  br label %141

25:                                               ; preds = %17
  %26 = invoke noundef i32 @_ZN3tbb19task_scheduler_init19default_num_threadsEv()
          to label %27 unwind label %21

27:                                               ; preds = %25
  %28 = add nsw i32 %26, 1
  invoke void @_ZN3tbb19task_scheduler_init10initializeEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %28)
          to label %29 unwind label %21

29:                                               ; preds = %27
  br label %30

30:                                               ; preds = %29, %20
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #4
  invoke void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13) %4, i32 noundef 4, i1 noundef zeroext false)
          to label %31 unwind label %45

31:                                               ; preds = %30
  %32 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !5, !range !9, !noundef !10
  %33 = trunc i8 %32 to i1
  br i1 %33, label %35, label %34

34:                                               ; preds = %31
  br label %39

35:                                               ; preds = %31
  %36 = invoke noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef @.str.17, i64 noundef 343, ptr noundef @__FUNCTION__._Z11TestWakeupsv)
          to label %37 unwind label %45

37:                                               ; preds = %35
  invoke void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %36, ptr noundef @.str.30)
          to label %38 unwind label %45

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38, %34
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  invoke void @_ZN3tbb20affinity_partitionerC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5)
          to label %40 unwind label %49

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !11
  br label %41

41:                                               ; preds = %57, %40
  %42 = load i64, ptr %6, align 8, !tbaa !11
  %43 = icmp ult i64 %42, 100000
  br i1 %43, label %53, label %44

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

45:                                               ; preds = %37, %35, %30
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %2, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %3, align 4
  br label %140

49:                                               ; preds = %39
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %2, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %3, align 4
  br label %139

53:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  invoke void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0, i32 noundef 4, i64 noundef 1)
          to label %54 unwind label %60

54:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  invoke void @_ZN7FunctorC2ERN7Harness11SpinBarrierE(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(13) %4)
          to label %55 unwind label %64

55:                                               ; preds = %54
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE7FunctorEEvRKT_RKT0_RNS_20affinity_partitionerE(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(16) %5)
          to label %56 unwind label %64

56:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  br label %57

57:                                               ; preds = %56
  %58 = load i64, ptr %6, align 8, !tbaa !11
  %59 = add i64 %58, 1
  store i64 %59, ptr %6, align 8, !tbaa !11
  br label %41, !llvm.loop !13

60:                                               ; preds = %53
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %2, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %3, align 4
  br label %68

64:                                               ; preds = %55, %54
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %2, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %68

68:                                               ; preds = %64, %60
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %138

69:                                               ; preds = %44
  %70 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !5, !range !9, !noundef !10
  %71 = trunc i8 %70 to i1
  br i1 %71, label %73, label %72

72:                                               ; preds = %69
  br label %77

73:                                               ; preds = %69
  %74 = invoke noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef @.str.17, i64 noundef 347, ptr noundef @__FUNCTION__._Z11TestWakeupsv)
          to label %75 unwind label %82

75:                                               ; preds = %73
  invoke void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %74, ptr noundef @.str.31)
          to label %76 unwind label %82

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76, %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %78

78:                                               ; preds = %91, %77
  %79 = load i64, ptr %9, align 8, !tbaa !11
  %80 = icmp ult i64 %79, 100000
  br i1 %80, label %86, label %81

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

82:                                               ; preds = %114, %112, %75, %73
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %2, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %3, align 4
  br label %138

86:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  invoke void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef 0, i32 noundef 4, i64 noundef 1)
          to label %87 unwind label %94

87:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  invoke void @_ZN7FunctorC2ERN7Harness11SpinBarrierE(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(13) %4)
          to label %88 unwind label %98

88:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  invoke void @_ZN3tbb18simple_partitionerC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %89 unwind label %102

89:                                               ; preds = %88
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE7FunctorEEvRKT_RKT0_RKNS_18simple_partitionerE(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %90 unwind label %102

90:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  br label %91

91:                                               ; preds = %90
  %92 = load i64, ptr %9, align 8, !tbaa !11
  %93 = add i64 %92, 1
  store i64 %93, ptr %9, align 8, !tbaa !11
  br label %78, !llvm.loop !15

94:                                               ; preds = %86
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %2, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %3, align 4
  br label %107

98:                                               ; preds = %87
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %2, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %3, align 4
  br label %106

102:                                              ; preds = %89, %88
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %2, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  br label %106

106:                                              ; preds = %102, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %107

107:                                              ; preds = %106, %94
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %138

108:                                              ; preds = %81
  %109 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !5, !range !9, !noundef !10
  %110 = trunc i8 %109 to i1
  br i1 %110, label %112, label %111

111:                                              ; preds = %108
  br label %116

112:                                              ; preds = %108
  %113 = invoke noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef @.str.17, i64 noundef 350, ptr noundef @__FUNCTION__._Z11TestWakeupsv)
          to label %114 unwind label %82

114:                                              ; preds = %112
  invoke void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %113, ptr noundef @.str.32)
          to label %115 unwind label %82

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115, %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !11
  br label %117

117:                                              ; preds = %125, %116
  %118 = load i64, ptr %13, align 8, !tbaa !11
  %119 = icmp ult i64 %118, 100000
  br i1 %119, label %121, label %120

120:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %137

121:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #4
  invoke void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %14, i32 noundef 0, i32 noundef 4, i64 noundef 1)
          to label %122 unwind label %128

122:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  invoke void @_ZN7FunctorC2ERN7Harness11SpinBarrierE(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(13) %4)
          to label %123 unwind label %132

123:                                              ; preds = %122
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE7FunctorEEvRKT_RKT0_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %124 unwind label %132

124:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #4
  br label %125

125:                                              ; preds = %124
  %126 = load i64, ptr %13, align 8, !tbaa !11
  %127 = add i64 %126, 1
  store i64 %127, ptr %13, align 8, !tbaa !11
  br label %117, !llvm.loop !16

128:                                              ; preds = %121
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %2, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %3, align 4
  br label %136

132:                                              ; preds = %123, %122
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %2, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %136

136:                                              ; preds = %132, %128
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %138

137:                                              ; preds = %120
  call void @_ZN3tbb8internal28affinity_partitioner_base_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #4
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void

138:                                              ; preds = %136, %107, %82, %68
  call void @_ZN3tbb8internal28affinity_partitioner_base_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #4
  br label %139

139:                                              ; preds = %138, %49
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  br label %140

140:                                              ; preds = %139, %45
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #4
  br label %141

141:                                              ; preds = %140, %21
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %2, align 8
  %144 = load i32, ptr %3, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146
}

declare void @_ZN3tbb19task_scheduler_init10initializeEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb8internal28affinity_partitioner_base_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(16)) 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !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] }>
%"class.tbb::task_scheduler_init" = type { ptr }
%"class.Harness::SpinBarrier" = type <{ i32, %"struct.tbb::atomic.0", %"struct.tbb::atomic.0", i8, [3 x i8] }>
%"struct.tbb::atomic.0" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic.1" }
%"struct.tbb::internal::atomic_impl_with_arithmetic.1" = type { %"struct.tbb::internal::atomic_impl.2" }
%"struct.tbb::internal::atomic_impl.2" = type { %"struct.tbb::internal::aligned_storage.3" }
%"struct.tbb::internal::aligned_storage.3" = type { i32 }
%"class.tbb::affinity_partitioner" = type { %"class.tbb::internal::affinity_partitioner_base_v3" }
%"class.tbb::internal::affinity_partitioner_base_v3" = type { ptr, i64 }
%"class.tbb::blocked_range" = type { i32, i32, i64 }
%struct.Functor = type { ptr }
%"class.tbb::simple_partitioner" = type { i8 }

@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@_ZL7Verbose = external hidden local_unnamed_addr global i8, align 1
@.str.17 = external hidden unnamed_addr constant [93 x i8], align 1
@__FUNCTION__._Z11TestWakeupsv = external hidden unnamed_addr constant [12 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [35 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 @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef, i64 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

declare noundef i32 @_ZN3tbb19task_scheduler_init19default_num_threadsEv() local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13), i32 noundef, i1 noundef zeroext) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11TestWakeupsv() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.tbb::task_scheduler_init", align 8
  %2 = alloca %"class.Harness::SpinBarrier", align 4
  %3 = alloca %"class.tbb::affinity_partitioner", align 8
  %4 = alloca %"class.tbb::blocked_range", align 8
  %5 = alloca %struct.Functor, align 8
  %6 = alloca %"class.tbb::blocked_range", align 8
  %7 = alloca %struct.Functor, align 8
  %8 = alloca %"class.tbb::simple_partitioner", align 1
  %9 = alloca %"class.tbb::blocked_range", align 8
  %10 = alloca %struct.Functor, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  call void @_ZN3tbb19task_scheduler_initC2Eim(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef -2, i64 noundef 0)
  %11 = invoke noundef i32 @_ZN3tbb19task_scheduler_init19default_num_threadsEv()
          to label %12 unwind label %14

12:                                               ; preds = %0
  %13 = icmp slt i32 %11, 5
  br i1 %13, label %.invoke, label %16

14:                                               ; preds = %.invoke, %16, %0
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %62

16:                                               ; preds = %12
  %17 = invoke noundef i32 @_ZN3tbb19task_scheduler_init19default_num_threadsEv()
          to label %18 unwind label %14

18:                                               ; preds = %16
  %19 = add nsw i32 %17, 1
  br label %.invoke

.invoke:                                          ; preds = %12, %18
  %20 = phi i32 [ %19, %18 ], [ 8, %12 ]
  invoke void @_ZN3tbb19task_scheduler_init10initializeEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %20)
          to label %21 unwind label %14

21:                                               ; preds = %.invoke
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  invoke void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13) %2, i32 noundef 4, i1 noundef zeroext false)
          to label %22 unwind label %31

22:                                               ; preds = %21
  %23 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !5, !range !9, !noundef !10
  %24 = trunc nuw i8 %23 to i1
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  %26 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef nonnull @.str.17, i64 noundef 343, ptr noundef nonnull @__FUNCTION__._Z11TestWakeupsv)
  invoke void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %26, ptr noundef nonnull @.str.30)
          to label %27 unwind label %31

27:                                               ; preds = %25, %22
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  invoke void @_ZN3tbb20affinity_partitionerC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %.preheader unwind label %33

28:                                               ; preds = %35
  %29 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !5, !range !9, !noundef !10
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %39, label %.preheader24

.preheader24:                                     ; preds = %39, %28
  br label %46

31:                                               ; preds = %25, %21
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %61

33:                                               ; preds = %27
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %60

.preheader:                                       ; preds = %27, %35
  %.0818 = phi i64 [ %36, %35 ], [ 0, %27 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %4, i32 noundef 0, i32 noundef 4, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @_ZN7FunctorC2ERN7Harness11SpinBarrierE(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(13) %2)
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE7FunctorEEvRKT_RKT0_RNS_20affinity_partitionerE(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %35 unwind label %37

35:                                               ; preds = %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  %36 = add nuw nsw i64 %.0818, 1
  %exitcond.not = icmp eq i64 %36, 100000
  br i1 %exitcond.not, label %28, label %.preheader, !llvm.loop !11

37:                                               ; preds = %.preheader
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br label %59

39:                                               ; preds = %28
  %40 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef nonnull @.str.17, i64 noundef 347, ptr noundef nonnull @__FUNCTION__._Z11TestWakeupsv)
  invoke void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %40, ptr noundef nonnull @.str.31)
          to label %.preheader24 unwind label %44

41:                                               ; preds = %47
  %42 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !5, !range !9, !noundef !10
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %51, label %.preheader23

.preheader23:                                     ; preds = %51, %41
  br label %54

44:                                               ; preds = %51, %39
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %59

46:                                               ; preds = %.preheader24, %47
  %.0719 = phi i64 [ %48, %47 ], [ 0, %.preheader24 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  call void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef 0, i32 noundef 4, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @_ZN7FunctorC2ERN7Harness11SpinBarrierE(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(13) %2)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #4
  call void @_ZN3tbb18simple_partitionerC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8)
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE7FunctorEEvRKT_RKT0_RKNS_18simple_partitionerE(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %47 unwind label %49

47:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  %48 = add nuw nsw i64 %.0719, 1
  %exitcond21.not = icmp eq i64 %48, 100000
  br i1 %exitcond21.not, label %41, label %46, !llvm.loop !13

49:                                               ; preds = %46
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  br label %59

51:                                               ; preds = %41
  %52 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef nonnull @.str.17, i64 noundef 350, ptr noundef nonnull @__FUNCTION__._Z11TestWakeupsv)
  invoke void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %52, ptr noundef nonnull @.str.32)
          to label %.preheader23 unwind label %44

53:                                               ; preds = %55
  call void @_ZN3tbb8internal28affinity_partitioner_base_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void

54:                                               ; preds = %.preheader23, %55
  %.020 = phi i64 [ %56, %55 ], [ 0, %.preheader23 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  call void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %9, i32 noundef 0, i32 noundef 4, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  call void @_ZN7FunctorC2ERN7Harness11SpinBarrierE(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(13) %2)
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE7FunctorEEvRKT_RKT0_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %55 unwind label %57

55:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  %56 = add nuw nsw i64 %.020, 1
  %exitcond22.not = icmp eq i64 %56, 100000
  br i1 %exitcond22.not, label %53, label %54, !llvm.loop !14

57:                                               ; preds = %54
  %58 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  br label %59

59:                                               ; preds = %57, %49, %44, %37
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %50, %49 ], [ %58, %57 ], [ %45, %44 ]
  call void @_ZN3tbb8internal28affinity_partitioner_base_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  br label %60

60:                                               ; preds = %59, %33
  %.pn.pn = phi { ptr, i32 } [ %.pn, %59 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  br label %61

61:                                               ; preds = %60, %31
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %60 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  br label %62

62:                                               ; preds = %61, %14
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %61 ], [ %15, %14 ]
  call void @_ZN3tbb19task_scheduler_initD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  resume { ptr, i32 } %.pn.pn.pn.pn
}

declare void @_ZN3tbb19task_scheduler_init10initializeEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb8internal28affinity_partitioner_base_v3D2Ev(ptr noundef nonnull align 8 dereferenceable(16)) 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass