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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.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 { i64 }
%"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 }

@FooCount = external dso_local global %"struct.tbb::atomic", align 8
@.str = external hidden unnamed_addr constant [100 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 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 noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; 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 i64 @_ZN3tbb17concurrent_vectorI3FooE7grow_byEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 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 nounwind uwtable
declare dso_local void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12TestCapacityv() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.tbb::concurrent_vector", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  store i64 0, ptr %1, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %120, %0
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %12 = icmp ule i64 %11, 10000
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  store i32 2, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  br label %122

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %107, %14
  %16 = load i64, ptr %3, align 8, !tbaa !5
  %17 = icmp ule i64 %16, 10000
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 5, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %110

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %20 = call noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8) @FooCount)
  store i64 %20, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #3
  call void @_ZN3tbb17concurrent_vectorI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %21 = load i64, ptr %1, align 8, !tbaa !5
  invoke void @_ZN3tbb17concurrent_vectorI3FooE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %21)
          to label %22 unwind label %55

22:                                               ; preds = %19
  %23 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE8capacityEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %24 unwind label %55

24:                                               ; preds = %22
  %25 = load i64, ptr %1, align 8, !tbaa !5
  %26 = icmp uge i64 %23, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  br label %30

28:                                               ; preds = %24
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 128, ptr noundef @.str.7, ptr noundef null)
          to label %29 unwind label %55

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29, %27
  %31 = load i64, ptr %3, align 8, !tbaa !5
  invoke void @_ZN3tbb17concurrent_vectorI3FooE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %31)
          to label %32 unwind label %55

32:                                               ; preds = %30
  %33 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE8capacityEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %34 unwind label %55

34:                                               ; preds = %32
  %35 = load i64, ptr %1, align 8, !tbaa !5
  %36 = icmp uge i64 %33, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %34
  br label %40

38:                                               ; preds = %34
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 130, ptr noundef @.str.7, ptr noundef null)
          to label %39 unwind label %55

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39, %37
  %41 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE8capacityEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %42 unwind label %55

42:                                               ; preds = %40
  %43 = load i64, ptr %3, align 8, !tbaa !5
  %44 = icmp uge i64 %41, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %42
  br label %48

46:                                               ; preds = %42
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 131, ptr noundef @.str.8, ptr noundef null)
          to label %47 unwind label %55

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47, %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %79, %48
  %50 = load i64, ptr %8, align 8, !tbaa !5
  %51 = load i64, ptr %3, align 8, !tbaa !5
  %52 = mul i64 2, %51
  %53 = icmp ult i64 %50, %52
  br i1 %53, label %59, label %54

54:                                               ; preds = %49
  store i32 8, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %91

55:                                               ; preds = %46, %40, %38, %32, %30, %28, %22, %19
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %6, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %7, align 4
  br label %109

59:                                               ; preds = %49
  %60 = invoke noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8) @FooCount)
          to label %61 unwind label %82

61:                                               ; preds = %59
  %62 = load i64, ptr %4, align 8, !tbaa !5
  %63 = load i64, ptr %8, align 8, !tbaa !5
  %64 = add i64 %62, %63
  %65 = icmp eq i64 %60, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %61
  br label %69

67:                                               ; preds = %61
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 133, ptr noundef @.str.9, ptr noundef null)
          to label %68 unwind label %82

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68, %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %70 = invoke noundef i64 @_ZN3tbb17concurrent_vectorI3FooE7grow_byEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef 1)
          to label %71 unwind label %86

71:                                               ; preds = %69
  store i64 %70, ptr %9, align 8, !tbaa !5
  %72 = load i64, ptr %9, align 8, !tbaa !5
  %73 = load i64, ptr %8, align 8, !tbaa !5
  %74 = icmp eq i64 %72, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %71
  br label %78

76:                                               ; preds = %71
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 135, ptr noundef @.str.10, ptr noundef null)
          to label %77 unwind label %86

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %79

79:                                               ; preds = %78
  %80 = load i64, ptr %8, align 8, !tbaa !5
  %81 = add i64 %80, 1
  store i64 %81, ptr %8, align 8, !tbaa !5
  br label %49, !llvm.loop !9

82:                                               ; preds = %67, %59
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %6, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %7, align 4
  br label %90

86:                                               ; preds = %76, %69
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %6, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %90

90:                                               ; preds = %86, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %109

91:                                               ; preds = %54
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #3
  %92 = call noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8) @FooCount)
  %93 = load i64, ptr %4, align 8, !tbaa !5
  %94 = icmp eq i64 %92, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %91
  br label %97

96:                                               ; preds = %91
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 138, ptr noundef @.str.11, ptr noundef null)
  br label %97

97:                                               ; preds = %96, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %98

98:                                               ; preds = %97
  %99 = load i64, ptr %3, align 8, !tbaa !5
  %100 = icmp ult i64 %99, 5
  br i1 %100, label %101, label %104

101:                                              ; preds = %98
  %102 = load i64, ptr %3, align 8, !tbaa !5
  %103 = add i64 %102, 1
  br label %107

104:                                              ; preds = %98
  %105 = load i64, ptr %3, align 8, !tbaa !5
  %106 = mul i64 3, %105
  br label %107

107:                                              ; preds = %104, %101
  %108 = phi i64 [ %103, %101 ], [ %106, %104 ]
  store i64 %108, ptr %3, align 8, !tbaa !5
  br label %15, !llvm.loop !11

109:                                              ; preds = %90, %55
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  br label %123

110:                                              ; preds = %18
  br label %111

111:                                              ; preds = %110
  %112 = load i64, ptr %1, align 8, !tbaa !5
  %113 = icmp ult i64 %112, 5
  br i1 %113, label %114, label %117

114:                                              ; preds = %111
  %115 = load i64, ptr %1, align 8, !tbaa !5
  %116 = add i64 %115, 1
  br label %120

117:                                              ; preds = %111
  %118 = load i64, ptr %1, align 8, !tbaa !5
  %119 = mul i64 3, %118
  br label %120

120:                                              ; preds = %117, %114
  %121 = phi i64 [ %116, %114 ], [ %119, %117 ]
  store i64 %121, ptr %1, align 8, !tbaa !5
  br label %10, !llvm.loop !12

122:                                              ; preds = %13
  ret void

123:                                              ; preds = %109
  %124 = load ptr, ptr %6, align 8
  %125 = load i32, ptr %7, align 4
  %126 = insertvalue { ptr, i32 } poison, ptr %124, 0
  %127 = insertvalue { ptr, i32 } %126, i32 %125, 1
  resume { ptr, i32 } %127
}

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

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

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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.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 { i64 }
%"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 }

@FooCount = external dso_local global %"struct.tbb::atomic", align 8
@.str = external hidden unnamed_addr constant [100 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 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 noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; 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 i64 @_ZN3tbb17concurrent_vectorI3FooE7grow_byEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) 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: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12TestCapacityv() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.tbb::concurrent_vector", align 8
  br label %.preheader

.preheader:                                       ; preds = %0, %3
  %.033 = phi i64 [ 0, %0 ], [ %7, %3 ]
  br label %9

2:                                                ; preds = %3
  ret void

3:                                                ; preds = %47
  %4 = icmp ult i64 %.033, 5
  %5 = add nuw nsw i64 %.033, 1
  %6 = mul nuw nsw i64 %.033, 3
  %7 = select i1 %4, i64 %5, i64 %6
  %8 = icmp ult i64 %7, 10001
  br i1 %8, label %.preheader, label %2, !llvm.loop !5

9:                                                ; preds = %.preheader, %47
  %.02632 = phi i64 [ 0, %.preheader ], [ %51, %47 ]
  %10 = call noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8) @FooCount)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #3
  call void @_ZN3tbb17concurrent_vectorI3FooEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1)
  invoke void @_ZN3tbb17concurrent_vectorI3FooE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %.033)
          to label %11 unwind label %28

11:                                               ; preds = %9
  %12 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE8capacityEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %13 unwind label %28

13:                                               ; preds = %11
  %.not = icmp ult i64 %12, %.033
  br i1 %.not, label %14, label %15

14:                                               ; preds = %13
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 128, ptr noundef nonnull @.str.7, ptr noundef null)
          to label %15 unwind label %28

15:                                               ; preds = %14, %13
  invoke void @_ZN3tbb17concurrent_vectorI3FooE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %.02632)
          to label %16 unwind label %28

16:                                               ; preds = %15
  %17 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE8capacityEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %18 unwind label %28

18:                                               ; preds = %16
  %.not27 = icmp ult i64 %17, %.033
  br i1 %.not27, label %19, label %20

19:                                               ; preds = %18
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 130, ptr noundef nonnull @.str.7, ptr noundef null)
          to label %20 unwind label %28

20:                                               ; preds = %19, %18
  %21 = invoke noundef i64 @_ZNK3tbb17concurrent_vectorI3FooE8capacityEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %22 unwind label %28

22:                                               ; preds = %20
  %.not28 = icmp ult i64 %21, %.02632
  br i1 %.not28, label %23, label %24

23:                                               ; preds = %22
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 131, ptr noundef nonnull @.str.8, ptr noundef null)
          to label %.lr.ph.preheader unwind label %28

24:                                               ; preds = %22
  %.not34 = icmp eq i64 %.02632, 0
  br i1 %.not34, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %23, %24
  %25 = shl nuw nsw i64 %.02632, 1
  br label %.lr.ph

._crit_edge:                                      ; preds = %40, %24
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #3
  %26 = call noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8) @FooCount)
  %27 = icmp eq i64 %26, %10
  br i1 %27, label %47, label %46

28:                                               ; preds = %23, %20, %19, %16, %15, %14, %11, %9
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %53

.lr.ph:                                           ; preds = %.lr.ph.preheader, %40
  %.02231 = phi i64 [ %41, %40 ], [ 0, %.lr.ph.preheader ]
  %30 = invoke noundef i64 @_ZNVK3tbb8internal11atomic_implIlEcvlEv(ptr noundef nonnull align 8 dereferenceable(8) @FooCount)
          to label %31 unwind label %42

31:                                               ; preds = %.lr.ph
  %32 = add i64 %.02231, %10
  %33 = icmp eq i64 %30, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %31
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 133, ptr noundef nonnull @.str.9, ptr noundef null)
          to label %35 unwind label %42

35:                                               ; preds = %34, %31
  %36 = invoke noundef i64 @_ZN3tbb17concurrent_vectorI3FooE7grow_byEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef 1)
          to label %37 unwind label %44

37:                                               ; preds = %35
  %38 = icmp eq i64 %36, %.02231
  br i1 %38, label %40, label %39

39:                                               ; preds = %37
  invoke void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 135, ptr noundef nonnull @.str.10, ptr noundef null)
          to label %40 unwind label %44

40:                                               ; preds = %39, %37
  %41 = add nuw nsw i64 %.02231, 1
  %exitcond.not = icmp eq i64 %41, %25
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !7

42:                                               ; preds = %34, %.lr.ph
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %53

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

46:                                               ; preds = %._crit_edge
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 138, ptr noundef nonnull @.str.11, ptr noundef null)
  br label %47

47:                                               ; preds = %._crit_edge, %46
  %48 = icmp ult i64 %.02632, 5
  %49 = add nuw nsw i64 %.02632, 1
  %50 = mul nuw nsw i64 %.02632, 3
  %51 = select i1 %48, i64 %49, i64 %50
  %52 = icmp ult i64 %51, 10001
  br i1 %52, label %9, label %3, !llvm.loop !8

53:                                               ; preds = %42, %44, %28
  %.pn.pn = phi { ptr, i32 } [ %29, %28 ], [ %45, %44 ], [ %43, %42 ]
  call void @_ZN3tbb17concurrent_vectorI3FooED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #3
  resume { ptr, i32 } %.pn.pn
}

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

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

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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6}


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