; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/old/test_concurrent_vector_v2.ll (Z20TestConcurrentGrowByi)

; 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.tbb::concurrent_vector" = type { %"class.tbb::internal::concurrent_vector_base" }
%"class.tbb::internal::concurrent_vector_base" = type { %"struct.tbb::atomic.0", %"struct.tbb::atomic.4", [2 x %"struct.tbb::internal::concurrent_vector_base::segment_t"] }
%"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 { i64 }
%"struct.tbb::atomic.4" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic.5" }
%"struct.tbb::internal::atomic_impl_with_arithmetic.5" = type { %"struct.tbb::internal::atomic_impl.6" }
%"struct.tbb::internal::atomic_impl.6" = type { %"struct.tbb::internal::aligned_storage.7" }
%"struct.tbb::internal::aligned_storage.7" = type { ptr }
%"struct.tbb::internal::concurrent_vector_base::segment_t" = type { ptr }
%"class.tbb::blocked_range.13" = type { i32, i32, i64 }
%class.GrowBy = type { ptr }

@.str = external hidden unnamed_addr constant [100 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [55 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 uwtable
declare dso_local void @_ZN3tbb17concurrent_vectorI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

declare i32 @printf(ptr noundef, ...) #2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z20TestConcurrentGrowByi(i32 noundef %0) #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.tbb::concurrent_vector", align 8
  %5 = alloca %"class.tbb::blocked_range.13", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %class.GrowBy, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 100000, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #7
  call void @_ZN3tbb17concurrent_vectorI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4)
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  %14 = load i32, ptr %3, align 4, !tbaa !5
  invoke void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef 0, i32 noundef %14, i64 noundef 1000)
          to label %15 unwind label %39

15:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  invoke void @_ZN6GrowByC2ERN3tbb17concurrent_vectorI3FooEE(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %16 unwind label %43

16:                                               ; preds = %15
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE6GrowByEEvRKT_RKT0_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %17 unwind label %43

17:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  %18 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %19 unwind label %48

19:                                               ; preds = %17
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp eq i64 %18, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %19
  br label %26

24:                                               ; preds = %19
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 407, ptr noundef @.str.32, ptr noundef null)
          to label %25 unwind label %48

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25, %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %28) #8
          to label %30 unwind label %52

30:                                               ; preds = %26
  store ptr %29, ptr %10, align 8, !tbaa !9
  %31 = load ptr, ptr %10, align 8, !tbaa !9
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %31, i8 0, i64 %33, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %105, %30
  %35 = load i32, ptr %11, align 4, !tbaa !5
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %56, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %108

39:                                               ; preds = %1
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %6, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %7, align 4
  br label %47

43:                                               ; preds = %16, %15
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %6, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %47

47:                                               ; preds = %43, %39
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  br label %165

48:                                               ; preds = %24, %17
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %6, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %7, align 4
  br label %165

52:                                               ; preds = %160, %26
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %6, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %7, align 4
  br label %164

56:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %57 = load i32, ptr %11, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %58)
          to label %60 unwind label %100

60:                                               ; preds = %56
  %61 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %59)
          to label %62 unwind label %100

62:                                               ; preds = %60
  %63 = load i32, ptr %61, align 4, !tbaa !5
  store i32 %63, ptr %12, align 4, !tbaa !5
  %64 = load ptr, ptr %10, align 8, !tbaa !9
  %65 = load i32, ptr %12, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i8, ptr %64, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !11, !range !13, !noundef !14
  %69 = trunc i8 %68 to i1
  br i1 %69, label %71, label %70

70:                                               ; preds = %62
  br label %73

71:                                               ; preds = %62
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 415, ptr noundef @.str.33, ptr noundef null)
          to label %72 unwind label %100

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72, %70
  %74 = load ptr, ptr %10, align 8, !tbaa !9
  %75 = load i32, ptr %12, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %74, i64 %76
  store i8 1, ptr %77, align 1, !tbaa !11
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %80, label %104

80:                                               ; preds = %73
  %81 = load i32, ptr %11, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %82)
          to label %84 unwind label %100

84:                                               ; preds = %80
  %85 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %83)
          to label %86 unwind label %100

86:                                               ; preds = %84
  %87 = load i32, ptr %85, align 4, !tbaa !5
  %88 = load i32, ptr %11, align 4, !tbaa !5
  %89 = sub nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %90)
          to label %92 unwind label %100

92:                                               ; preds = %86
  %93 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %91)
          to label %94 unwind label %100

94:                                               ; preds = %92
  %95 = load i32, ptr %93, align 4, !tbaa !5
  %96 = icmp slt i32 %87, %95
  %97 = zext i1 %96 to i32
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = add nsw i32 %98, %97
  store i32 %99, ptr %9, align 4, !tbaa !5
  br label %104

100:                                              ; preds = %92, %86, %84, %80, %71, %60, %56
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %6, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %164

104:                                              ; preds = %94, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %11, align 4, !tbaa !5
  br label %34, !llvm.loop !15

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

109:                                              ; preds = %141, %108
  %110 = load i32, ptr %13, align 4, !tbaa !5
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %148

114:                                              ; preds = %109
  %115 = load ptr, ptr %10, align 8, !tbaa !9
  %116 = load i32, ptr %13, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i8, ptr %115, i64 %117
  %119 = load i8, ptr %118, align 1, !tbaa !11, !range !13, !noundef !14
  %120 = trunc i8 %119 to i1
  br i1 %120, label %121, label %122

121:                                              ; preds = %114
  br label %124

122:                                              ; preds = %114
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 421, ptr noundef @.str.34, ptr noundef null)
          to label %123 unwind label %144

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123, %121
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = icmp sgt i32 %125, 1
  br i1 %126, label %137, label %127

127:                                              ; preds = %124
  %128 = load i32, ptr %13, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %129)
          to label %131 unwind label %144

131:                                              ; preds = %127
  %132 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %130)
          to label %133 unwind label %144

133:                                              ; preds = %131
  %134 = load i32, ptr %132, align 4, !tbaa !5
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = icmp eq i32 %134, %135
  br i1 %136, label %137, label %138

137:                                              ; preds = %133, %124
  br label %140

138:                                              ; preds = %133
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 422, ptr noundef @.str.35, ptr noundef @.str.36)
          to label %139 unwind label %144

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139, %137
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %13, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %13, align 4, !tbaa !5
  br label %109, !llvm.loop !17

144:                                              ; preds = %138, %131, %127, %122
  %145 = landingpad { ptr, i32 }
          cleanup
  %146 = extractvalue { ptr, i32 } %145, 0
  store ptr %146, ptr %6, align 8
  %147 = extractvalue { ptr, i32 } %145, 1
  store i32 %147, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %164

148:                                              ; preds = %113
  %149 = load ptr, ptr %10, align 8, !tbaa !9
  %150 = icmp eq ptr %149, null
  br i1 %150, label %152, label %151

151:                                              ; preds = %148
  call void @_ZdaPv(ptr noundef %149) #9
  br label %152

152:                                              ; preds = %151, %148
  %153 = load i32, ptr %2, align 4, !tbaa !5
  %154 = icmp sgt i32 %153, 1
  br i1 %154, label %155, label %163

155:                                              ; preds = %152
  %156 = load i32, ptr %9, align 4, !tbaa !5
  %157 = load i32, ptr %3, align 4, !tbaa !5
  %158 = sdiv i32 %157, 10
  %159 = icmp slt i32 %156, %158
  br i1 %159, label %160, label %163

160:                                              ; preds = %155
  %161 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.37)
          to label %162 unwind label %52

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162, %155, %152
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  ret void

164:                                              ; preds = %144, %100, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %165

165:                                              ; preds = %164, %48, %47
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %166

166:                                              ; preds = %165
  %167 = load ptr, ptr %6, align 8
  %168 = load i32, ptr %7, align 4
  %169 = insertvalue { ptr, i32 } poison, ptr %167, 0
  %170 = insertvalue { ptr, i32 } %169, i32 %168, 1
  resume { ptr, i32 } %170
}

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

; 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 #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6GrowByC2ERN3tbb17concurrent_vectorI3FooEE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #6

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

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

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


; 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.tbb::concurrent_vector" = type { %"class.tbb::internal::concurrent_vector_base" }
%"class.tbb::internal::concurrent_vector_base" = type { %"struct.tbb::atomic.0", %"struct.tbb::atomic.4", [2 x %"struct.tbb::internal::concurrent_vector_base::segment_t"] }
%"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 { i64 }
%"struct.tbb::atomic.4" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic.5" }
%"struct.tbb::internal::atomic_impl_with_arithmetic.5" = type { %"struct.tbb::internal::atomic_impl.6" }
%"struct.tbb::internal::atomic_impl.6" = type { %"struct.tbb::internal::aligned_storage.7" }
%"struct.tbb::internal::aligned_storage.7" = type { ptr }
%"struct.tbb::internal::concurrent_vector_base::segment_t" = type { ptr }
%"class.tbb::blocked_range.13" = type { i32, i32, i64 }
%class.GrowBy = type { ptr }

@.str = external hidden unnamed_addr constant [100 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [55 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 uwtable
declare dso_local void @_ZN3tbb17concurrent_vectorI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z20TestConcurrentGrowByi(i32 noundef %0) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.tbb::concurrent_vector", align 8
  %3 = alloca %"class.tbb::blocked_range.13", align 8
  %4 = alloca %class.GrowBy, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  call void @_ZN3tbb17concurrent_vectorI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @_ZN3tbb13blocked_rangeIiEC2Eiim(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef 0, i32 noundef 100000, i64 noundef 1000)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @_ZN6GrowByC2ERN3tbb17concurrent_vectorI3FooEE(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(32) %2)
  invoke void @_ZN3tbb12parallel_forINS_13blocked_rangeIiEE6GrowByEEvRKT_RKT0_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %5 unwind label %29

5:                                                ; preds = %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  %6 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %7 unwind label %31

7:                                                ; preds = %5
  %8 = icmp eq i64 %6, 100000
  br i1 %8, label %10, label %9

9:                                                ; preds = %7
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 407, ptr noundef nonnull @.str.32, ptr noundef null)
          to label %10 unwind label %31

10:                                               ; preds = %9, %7
  %11 = invoke noalias noundef nonnull dereferenceable(100000) ptr @_Znam(i64 noundef 100000) #8
          to label %.peel.begin unwind label %33

.peel.begin:                                      ; preds = %10
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(100000) %11, i8 0, i64 100000, i1 false)
  %12 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef 0)
          to label %13 unwind label %.loopexit.split-lp

13:                                               ; preds = %.peel.begin
  %14 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %12)
          to label %15 unwind label %.loopexit.split-lp

15:                                               ; preds = %13
  %16 = load i32, ptr %14, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i8, ptr %11, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !9, !range !11, !noundef !12
  %20 = trunc nuw i8 %19 to i1
  br i1 %20, label %21, label %.peel.next

21:                                               ; preds = %15
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 415, ptr noundef nonnull @.str.33, ptr noundef null)
          to label %.peel.next unwind label %.loopexit.split-lp

.peel.next:                                       ; preds = %21, %15
  store i8 1, ptr %18, align 1, !tbaa !9
  br label %35

.preheader:                                       ; preds = %56
  %22 = icmp sgt i32 %0, 1
  br i1 %22, label %.preheader.split.us, label %.preheader.split

.preheader.split.us:                              ; preds = %.preheader, %27
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %27 ], [ 0, %.preheader ]
  %23 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv52
  %24 = load i8, ptr %23, align 1, !tbaa !9, !range !11, !noundef !12
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %27, label %26

26:                                               ; preds = %.preheader.split.us
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 421, ptr noundef nonnull @.str.34, ptr noundef null)
          to label %27 unwind label %.split.us

27:                                               ; preds = %26, %.preheader.split.us
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %exitcond55.not = icmp eq i64 %indvars.iv.next53, 100000
  br i1 %exitcond55.not, label %.split43.us, label %.preheader.split.us, !llvm.loop !13

.split.us:                                        ; preds = %26
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %80

29:                                               ; preds = %1
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  br label %80

31:                                               ; preds = %9, %5
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %80

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

35:                                               ; preds = %.peel.next, %56
  %indvars.iv = phi i64 [ 1, %.peel.next ], [ %indvars.iv.next, %56 ]
  %.03439 = phi i32 [ 0, %.peel.next ], [ %60, %56 ]
  %36 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %indvars.iv)
          to label %37 unwind label %.loopexit

37:                                               ; preds = %35
  %38 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %36)
          to label %39 unwind label %.loopexit

39:                                               ; preds = %37
  %40 = load i32, ptr %38, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i8, ptr %11, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !9, !range !11, !noundef !12
  %44 = trunc nuw i8 %43 to i1
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 415, ptr noundef nonnull @.str.33, ptr noundef null)
          to label %46 unwind label %.loopexit

46:                                               ; preds = %39, %45
  store i8 1, ptr %42, align 1, !tbaa !9
  %47 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %indvars.iv)
          to label %48 unwind label %.loopexit

48:                                               ; preds = %46
  %49 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %47)
          to label %50 unwind label %.loopexit

50:                                               ; preds = %48
  %51 = load i32, ptr %49, align 4, !tbaa !5
  %52 = add nsw i64 %indvars.iv, -1
  %53 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %52)
          to label %54 unwind label %.loopexit

54:                                               ; preds = %50
  %55 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %53)
          to label %56 unwind label %.loopexit

.loopexit:                                        ; preds = %35, %37, %45, %46, %48, %50, %54
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %80

.loopexit.split-lp:                               ; preds = %.peel.begin, %13, %21
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %80

56:                                               ; preds = %54
  %57 = load i32, ptr %55, align 4, !tbaa !5
  %58 = icmp slt i32 %51, %57
  %59 = zext i1 %58 to i32
  %60 = add nuw nsw i32 %.03439, %59
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100000
  br i1 %exitcond.not, label %.preheader, label %35, !llvm.loop !15

.preheader.split:                                 ; preds = %.preheader, %74
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %74 ], [ 0, %.preheader ]
  %61 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv48
  %62 = load i8, ptr %61, align 1, !tbaa !9, !range !11, !noundef !12
  %63 = trunc nuw i8 %62 to i1
  br i1 %63, label %65, label %64

64:                                               ; preds = %.preheader.split
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 421, ptr noundef nonnull @.str.34, ptr noundef null)
          to label %65 unwind label %.split

65:                                               ; preds = %64, %.preheader.split
  %66 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN3tbb17concurrent_vectorI3FooEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %indvars.iv48)
          to label %67 unwind label %.split

67:                                               ; preds = %65
  %68 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN3Foo3barEv(ptr noundef nonnull align 4 dereferenceable(8) %66)
          to label %69 unwind label %.split

69:                                               ; preds = %67
  %70 = load i32, ptr %68, align 4, !tbaa !5
  %71 = zext i32 %70 to i64
  %72 = icmp eq i64 %indvars.iv48, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 422, ptr noundef nonnull @.str.35, ptr noundef nonnull @.str.36)
          to label %74 unwind label %.split

74:                                               ; preds = %69, %73
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %exitcond51.not = icmp eq i64 %indvars.iv.next49, 100000
  br i1 %exitcond51.not, label %.split43.us, label %.preheader.split, !llvm.loop !13

.split:                                           ; preds = %73, %67, %65, %64
  %75 = landingpad { ptr, i32 }
          cleanup
  br label %80

.split43.us:                                      ; preds = %74, %27
  call void @_ZdaPv(ptr noundef nonnull %11) #9
  %76 = icmp ult i32 %60, 10000
  %or.cond = select i1 %22, i1 %76, i1 false
  br i1 %or.cond, label %77, label %79

77:                                               ; preds = %.split43.us
  %78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.37)
  br label %79

79:                                               ; preds = %77, %.split43.us
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  ret void

80:                                               ; preds = %.loopexit, %.loopexit.split-lp, %.split, %.split.us, %33, %31, %29
  %.pn.pn = phi { ptr, i32 } [ %32, %31 ], [ %30, %29 ], [ %34, %33 ], [ %75, %.split ], [ %28, %.split.us ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn.pn
}

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

; 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 #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6GrowByC2ERN3tbb17concurrent_vectorI3FooEE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #6

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

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

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


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