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

; 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::internal::concurrent_vector_base" = type { %"struct.tbb::atomic", %"struct.tbb::atomic.0", [2 x %"struct.tbb::internal::concurrent_vector_base::segment_t"] }
%"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 }
%"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 { ptr }
%"struct.tbb::internal::concurrent_vector_base::segment_t" = type { ptr }

; 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_implImEcvmEv(ptr noundef nonnull align 8 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 noundef ptr @_ZN3tbb8internal12NFS_AllocateEmmPv(i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_baseEm(i64 noundef) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_sizeEm(i64 noundef) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3tbb8internal22concurrent_vector_base15internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #1 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %23, i32 0, i32 0
  %25 = call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
  store i64 %25, ptr %13, align 8, !tbaa !9
  br label %26

26:                                               ; preds = %45, %6
  %27 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 0
  %28 = call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %29 = load i64, ptr %13, align 8, !tbaa !9
  %30 = icmp ugt i64 %28, %29
  br i1 %30, label %31, label %67

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %32 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 0
  %33 = call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %32)
  %34 = sub i64 %33, 1
  %35 = call noundef i64 @_ZN3tbb8internal22concurrent_vector_base16segment_index_ofEm(i64 noundef %34)
  store i64 %35, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %36 = load i64, ptr %14, align 8, !tbaa !9
  %37 = call noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_baseEm(i64 noundef %36)
  store i64 %37, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %38 = load i64, ptr %15, align 8, !tbaa !9
  %39 = load i64, ptr %13, align 8, !tbaa !9
  %40 = icmp uge i64 %38, %39
  br i1 %40, label %41, label %43

41:                                               ; preds = %31
  %42 = load i64, ptr %15, align 8, !tbaa !9
  br label %45

43:                                               ; preds = %31
  %44 = load i64, ptr %13, align 8, !tbaa !9
  br label %45

45:                                               ; preds = %43, %41
  %46 = phi i64 [ %42, %41 ], [ %44, %43 ]
  store i64 %46, ptr %16, align 8, !tbaa !9
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 1
  %49 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %48)
  %50 = load i64, ptr %14, align 8, !tbaa !9
  %51 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %49, i64 %50
  %52 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %51, i32 0, i32 0
  %53 = load volatile ptr, ptr %52, align 8, !tbaa !11
  %54 = load i64, ptr %9, align 8, !tbaa !9
  %55 = load i64, ptr %16, align 8, !tbaa !9
  %56 = load i64, ptr %15, align 8, !tbaa !9
  %57 = sub i64 %55, %56
  %58 = mul i64 %54, %57
  %59 = getelementptr inbounds i8, ptr %53, i64 %58
  %60 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 0
  %61 = call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %60)
  %62 = load i64, ptr %16, align 8, !tbaa !9
  %63 = sub i64 %61, %62
  call void %47(ptr noundef %59, i64 noundef %63)
  %64 = load i64, ptr %16, align 8, !tbaa !9
  %65 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 0
  %66 = call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %65, i64 noundef %64)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %26, !llvm.loop !13

67:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %68 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 0
  %69 = call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %68)
  store i64 %69, ptr %17, align 8, !tbaa !9
  %70 = load i64, ptr %13, align 8, !tbaa !9
  %71 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 0
  %72 = call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %71, i64 noundef %70)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  store i64 0, ptr %19, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %168, %67
  %74 = load i64, ptr %19, align 8, !tbaa !9
  %75 = call noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_baseEm(i64 noundef %74)
  store i64 %75, ptr %18, align 8, !tbaa !9
  %76 = load i64, ptr %13, align 8, !tbaa !9
  %77 = icmp ult i64 %75, %76
  br i1 %77, label %79, label %78

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

79:                                               ; preds = %73
  %80 = load i64, ptr %19, align 8, !tbaa !9
  call void @_ZN3tbb8internal22concurrent_vector_base6helper27extend_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(32) %22, i64 noundef %80)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %81 = load i64, ptr %19, align 8, !tbaa !9
  %82 = call noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_sizeEm(i64 noundef %81)
  store i64 %82, ptr %20, align 8, !tbaa !9
  %83 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 1
  %84 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %83)
  %85 = load i64, ptr %19, align 8, !tbaa !9
  %86 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %84, i64 %85
  %87 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %86, i32 0, i32 0
  %88 = load volatile ptr, ptr %87, align 8, !tbaa !11
  %89 = icmp ne ptr %88, null
  br i1 %89, label %99, label %90

90:                                               ; preds = %79
  %91 = load i64, ptr %20, align 8, !tbaa !9
  %92 = load i64, ptr %9, align 8, !tbaa !9
  %93 = call noundef ptr @_ZN3tbb8internal12NFS_AllocateEmmPv(i64 noundef %91, i64 noundef %92, ptr noundef null)
  %94 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 1
  %95 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %94)
  %96 = load i64, ptr %19, align 8, !tbaa !9
  %97 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %95, i64 %96
  %98 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %97, i32 0, i32 0
  store volatile ptr %93, ptr %98, align 8, !tbaa !11
  br label %99

99:                                               ; preds = %90, %79
  %100 = load i64, ptr %20, align 8, !tbaa !9
  %101 = load i64, ptr %13, align 8, !tbaa !9
  %102 = load i64, ptr %18, align 8, !tbaa !9
  %103 = sub i64 %101, %102
  %104 = icmp ugt i64 %100, %103
  br i1 %104, label %105, label %109

105:                                              ; preds = %99
  %106 = load i64, ptr %13, align 8, !tbaa !9
  %107 = load i64, ptr %18, align 8, !tbaa !9
  %108 = sub i64 %106, %107
  store i64 %108, ptr %20, align 8, !tbaa !9
  br label %109

109:                                              ; preds = %105, %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  store i64 0, ptr %21, align 8, !tbaa !9
  %110 = load i64, ptr %17, align 8, !tbaa !9
  %111 = load i64, ptr %18, align 8, !tbaa !9
  %112 = icmp ugt i64 %110, %111
  br i1 %112, label %113, label %144

113:                                              ; preds = %109
  %114 = load i64, ptr %17, align 8, !tbaa !9
  %115 = load i64, ptr %18, align 8, !tbaa !9
  %116 = sub i64 %114, %115
  store i64 %116, ptr %21, align 8, !tbaa !9
  %117 = load i64, ptr %21, align 8, !tbaa !9
  %118 = load i64, ptr %20, align 8, !tbaa !9
  %119 = icmp ugt i64 %117, %118
  br i1 %119, label %120, label %122

120:                                              ; preds = %113
  %121 = load i64, ptr %20, align 8, !tbaa !9
  store i64 %121, ptr %21, align 8, !tbaa !9
  br label %122

122:                                              ; preds = %120, %113
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 1
  %125 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %124)
  %126 = load i64, ptr %19, align 8, !tbaa !9
  %127 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %125, i64 %126
  %128 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %127, i32 0, i32 0
  %129 = load volatile ptr, ptr %128, align 8, !tbaa !11
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %130, i32 0, i32 1
  %132 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %131)
  %133 = load i64, ptr %19, align 8, !tbaa !9
  %134 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %132, i64 %133
  %135 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %134, i32 0, i32 0
  %136 = load volatile ptr, ptr %135, align 8, !tbaa !11
  %137 = load i64, ptr %21, align 8, !tbaa !9
  call void %123(ptr noundef %129, ptr noundef %136, i64 noundef %137)
  %138 = load i64, ptr %21, align 8, !tbaa !9
  %139 = load i64, ptr %20, align 8, !tbaa !9
  %140 = sub i64 %139, %138
  store i64 %140, ptr %20, align 8, !tbaa !9
  %141 = load i64, ptr %9, align 8, !tbaa !9
  %142 = load i64, ptr %21, align 8, !tbaa !9
  %143 = mul i64 %142, %141
  store i64 %143, ptr %21, align 8, !tbaa !9
  br label %144

144:                                              ; preds = %122, %109
  %145 = load i64, ptr %20, align 8, !tbaa !9
  %146 = icmp ugt i64 %145, 0
  br i1 %146, label %147, label %167

147:                                              ; preds = %144
  %148 = load ptr, ptr %12, align 8, !tbaa !5
  %149 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %22, i32 0, i32 1
  %150 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %149)
  %151 = load i64, ptr %19, align 8, !tbaa !9
  %152 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %150, i64 %151
  %153 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %152, i32 0, i32 0
  %154 = load volatile ptr, ptr %153, align 8, !tbaa !11
  %155 = load i64, ptr %21, align 8, !tbaa !9
  %156 = getelementptr inbounds i8, ptr %154, i64 %155
  %157 = load ptr, ptr %8, align 8, !tbaa !5
  %158 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base", ptr %157, i32 0, i32 1
  %159 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %158)
  %160 = load i64, ptr %19, align 8, !tbaa !9
  %161 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %159, i64 %160
  %162 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %161, i32 0, i32 0
  %163 = load volatile ptr, ptr %162, align 8, !tbaa !11
  %164 = load i64, ptr %21, align 8, !tbaa !9
  %165 = getelementptr inbounds i8, ptr %163, i64 %164
  %166 = load i64, ptr %20, align 8, !tbaa !9
  call void %148(ptr noundef %156, ptr noundef %165, i64 noundef %166)
  br label %167

167:                                              ; preds = %147, %144
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  br label %168

168:                                              ; preds = %167
  %169 = load i64, ptr %19, align 8, !tbaa !9
  %170 = add i64 %169, 1
  store i64 %170, ptr %19, align 8, !tbaa !9
  br label %73, !llvm.loop !15

171:                                              ; preds = %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN3tbb8internal22concurrent_vector_base16segment_index_ofEm(i64 noundef) #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 = { "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 = { nounwind }

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

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

%"struct.tbb::internal::concurrent_vector_base::segment_t" = type { ptr }

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

declare noundef ptr @_ZN3tbb8internal12NFS_AllocateEmmPv(i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_baseEm(i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_sizeEm(i64 noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3tbb8internal22concurrent_vector_base15internal_assignERKS1_mPFvPvmEPFvS4_PKvmESA_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5) local_unnamed_addr #0 align 2 {
  %7 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  %8 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %9 = icmp ugt i64 %8, %7
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  br label %11

11:                                               ; preds = %.lr.ph, %11
  %12 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %13 = add i64 %12, -1
  %14 = tail call noundef i64 @_ZN3tbb8internal22concurrent_vector_base16segment_index_ofEm(i64 noundef %13)
  %15 = tail call noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_baseEm(i64 noundef %14)
  %16 = tail call i64 @llvm.umax.i64(i64 %15, i64 %7)
  %17 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %10)
  %18 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %17, i64 %14
  %19 = load volatile ptr, ptr %18, align 8, !tbaa !5
  %20 = sub i64 %16, %15
  %21 = mul i64 %20, %2
  %22 = getelementptr inbounds i8, ptr %19, i64 %21
  %23 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %24 = sub i64 %23, %16
  tail call void %3(ptr noundef %22, i64 noundef %24)
  %25 = tail call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %0, i64 noundef %16)
  %26 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %27 = icmp ugt i64 %26, %7
  br i1 %27, label %11, label %._crit_edge, !llvm.loop !10

._crit_edge:                                      ; preds = %11, %6
  %28 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %29 = tail call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %0, i64 noundef %7)
  %30 = tail call noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_baseEm(i64 noundef 0)
  %31 = icmp ult i64 %30, %7
  br i1 %31, label %.lr.ph68, label %._crit_edge69

.lr.ph68:                                         ; preds = %._crit_edge
  %32 = getelementptr inbounds i8, ptr %0, i64 8
  %33 = getelementptr inbounds i8, ptr %1, i64 8
  br label %34

._crit_edge69:                                    ; preds = %67, %._crit_edge
  ret void

34:                                               ; preds = %.lr.ph68, %67
  %35 = phi i64 [ %30, %.lr.ph68 ], [ %69, %67 ]
  %.05566 = phi i64 [ 0, %.lr.ph68 ], [ %68, %67 ]
  tail call void @_ZN3tbb8internal22concurrent_vector_base6helper27extend_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.05566)
  %36 = tail call noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_sizeEm(i64 noundef %.05566)
  %37 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %32)
  %38 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %37, i64 %.05566
  %39 = load volatile ptr, ptr %38, align 8, !tbaa !5
  %.not = icmp eq ptr %39, null
  br i1 %.not, label %40, label %44

40:                                               ; preds = %34
  %41 = tail call noundef ptr @_ZN3tbb8internal12NFS_AllocateEmmPv(i64 noundef %36, i64 noundef %2, ptr noundef null)
  %42 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %32)
  %43 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %42, i64 %.05566
  store volatile ptr %41, ptr %43, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %40, %34
  %45 = sub i64 %7, %35
  %spec.select = tail call i64 @llvm.umin.i64(i64 %36, i64 %45)
  %46 = icmp ugt i64 %28, %35
  br i1 %46, label %47, label %57

47:                                               ; preds = %44
  %48 = sub i64 %28, %35
  %spec.select65 = tail call i64 @llvm.umin.i64(i64 %48, i64 %spec.select)
  %49 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %32)
  %50 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %49, i64 %.05566
  %51 = load volatile ptr, ptr %50, align 8, !tbaa !5
  %52 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %33)
  %53 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %52, i64 %.05566
  %54 = load volatile ptr, ptr %53, align 8, !tbaa !5
  tail call void %4(ptr noundef %51, ptr noundef %54, i64 noundef %spec.select65)
  %55 = sub i64 %spec.select, %spec.select65
  %56 = mul i64 %spec.select65, %2
  br label %57

57:                                               ; preds = %47, %44
  %.154 = phi i64 [ %55, %47 ], [ %spec.select, %44 ]
  %.1 = phi i64 [ %56, %47 ], [ 0, %44 ]
  %.not63 = icmp eq i64 %.154, 0
  br i1 %.not63, label %67, label %58

58:                                               ; preds = %57
  %59 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %32)
  %60 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %59, i64 %.05566
  %61 = load volatile ptr, ptr %60, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 %.1
  %63 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_22concurrent_vector_base9segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %33)
  %64 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base::segment_t", ptr %63, i64 %.05566
  %65 = load volatile ptr, ptr %64, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 %.1
  tail call void %5(ptr noundef %62, ptr noundef %66, i64 noundef %.154)
  br label %67

67:                                               ; preds = %58, %57
  %68 = add i64 %.05566, 1
  %69 = tail call noundef i64 @_ZN3tbb8internal22concurrent_vector_base12segment_baseEm(i64 noundef %68)
  %70 = icmp ult i64 %69, %7
  br i1 %70, label %34, label %._crit_edge69, !llvm.loop !12
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN3tbb8internal22concurrent_vector_base16segment_index_ofEm(i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #3

attributes #0 = { 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 #1 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !7, i64 0}
!6 = !{!"_ZTSN3tbb8internal22concurrent_vector_base9segment_tE", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass