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

; 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_v3::segment_value_t" = type { ptr }
%"struct.tbb::internal::concurrent_vector_base_v3::segment_allocated" = type { i8 }
%"class.tbb::internal::concurrent_vector_base_v3" = type { ptr, %"struct.tbb::atomic", %"struct.tbb::atomic", %"struct.tbb::atomic.0", [3 x %"class.tbb::internal::concurrent_vector_base_v3::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 }
%"class.tbb::internal::concurrent_vector_base_v3::segment_t" = type { %"struct.tbb::atomic.4" }
%"struct.tbb::atomic.4" = type { %"struct.tbb::internal::atomic_impl.5" }
%"struct.tbb::internal::atomic_impl.5" = type { %"struct.tbb::internal::aligned_storage.6" }
%"struct.tbb::internal::aligned_storage.6" = 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 nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef) #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmb(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, i64 noundef, i1 noundef zeroext) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper33assign_first_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) #3 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper25extend_table_if_necessaryERS1_mm(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, i64 noundef) #3 align 2

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

24:                                               ; preds = %4
  %25 = load i64, ptr %9, align 8, !tbaa !9
  %26 = sub i64 %25, 1
  %27 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v316segment_index_ofEm(i64 noundef %26)
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper33assign_first_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %18, i64 noundef %27)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %28

28:                                               ; preds = %97, %24
  %29 = load i64, ptr %11, align 8, !tbaa !9
  %30 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef %29)
  store i64 %30, ptr %10, align 8, !tbaa !9
  %31 = load i64, ptr %9, align 8, !tbaa !9
  %32 = icmp ult i64 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %28
  store i32 2, ptr %12, align 4
  br label %100

34:                                               ; preds = %28
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %35, i32 0, i32 3
  %37 = call noundef ptr @_ZNK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEE4loadILNS_16memory_semanticsE1EEES4_v(ptr noundef nonnull align 8 dereferenceable(8) %36)
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %38, i32 0, i32 4
  %40 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %39, i64 0, i64 0
  %41 = icmp eq ptr %37, %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  br i1 %41, label %42, label %45

42:                                               ; preds = %34
  %43 = load i64, ptr %11, align 8, !tbaa !9
  %44 = icmp uge i64 %43, 3
  br i1 %44, label %54, label %45

45:                                               ; preds = %42, %34
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %46, i32 0, i32 3
  %48 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %47)
  %49 = load i64, ptr %11, align 8, !tbaa !9
  %50 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %48, i64 %49
  %51 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %50)
  %52 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %13, i32 0, i32 0
  store ptr %51, ptr %52, align 8
  %53 = call noundef zeroext i1 @_ZN3tbb8internalneINS0_25concurrent_vector_base_v317segment_allocatedEEEbRKNS2_15segment_value_tET_(ptr noundef nonnull align 8 dereferenceable(8) %13)
  br label %54

54:                                               ; preds = %45, %42
  %55 = phi i1 [ true, %42 ], [ %53, %45 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br i1 %55, label %56, label %60

56:                                               ; preds = %54
  %57 = load i64, ptr %10, align 8, !tbaa !9
  %58 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %18, i32 0, i32 2
  %59 = call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %58, i64 noundef %57)
  store i32 2, ptr %12, align 4
  br label %100

60:                                               ; preds = %54
  %61 = load i64, ptr %11, align 8, !tbaa !9
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper25extend_table_if_necessaryERS1_mm(ptr noundef nonnull align 8 dereferenceable(56) %18, i64 noundef %61, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %62 = load i64, ptr %11, align 8, !tbaa !9
  %63 = load i64, ptr %7, align 8, !tbaa !9
  %64 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmb(ptr noundef nonnull align 8 dereferenceable(56) %18, i64 noundef %62, i64 noundef %63, i1 noundef zeroext false)
  store i64 %64, ptr %15, align 8, !tbaa !9
  %65 = load i64, ptr %15, align 8, !tbaa !9
  %66 = load i64, ptr %9, align 8, !tbaa !9
  %67 = load i64, ptr %10, align 8, !tbaa !9
  %68 = sub i64 %66, %67
  %69 = icmp ugt i64 %65, %68
  br i1 %69, label %70, label %74

70:                                               ; preds = %60
  %71 = load i64, ptr %9, align 8, !tbaa !9
  %72 = load i64, ptr %10, align 8, !tbaa !9
  %73 = sub i64 %71, %72
  store i64 %73, ptr %15, align 8, !tbaa !9
  br label %74

74:                                               ; preds = %70, %60
  %75 = load i64, ptr %10, align 8, !tbaa !9
  %76 = load i64, ptr %15, align 8, !tbaa !9
  %77 = add i64 %75, %76
  %78 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %18, i32 0, i32 2
  %79 = call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %78, i64 noundef %77)
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %81 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %18, i32 0, i32 3
  %82 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %81)
  %83 = load i64, ptr %11, align 8, !tbaa !9
  %84 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %82, i64 %83
  %85 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %86 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %16, i32 0, i32 0
  store ptr %85, ptr %86, align 8
  %87 = call noundef ptr @_ZNK3tbb8internal25concurrent_vector_base_v315segment_value_t7pointerIvEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %88, i32 0, i32 3
  %90 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %89)
  %91 = load i64, ptr %11, align 8, !tbaa !9
  %92 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %90, i64 %91
  %93 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %92)
  %94 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %17, i32 0, i32 0
  store ptr %93, ptr %94, align 8
  %95 = call noundef ptr @_ZNK3tbb8internal25concurrent_vector_base_v315segment_value_t7pointerIvEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %17)
  %96 = load i64, ptr %15, align 8, !tbaa !9
  call void %80(ptr noundef %87, ptr noundef %95, i64 noundef %96)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %97

97:                                               ; preds = %74
  %98 = load i64, ptr %11, align 8, !tbaa !9
  %99 = add i64 %98, 1
  store i64 %99, ptr %11, align 8, !tbaa !9
  br label %28, !llvm.loop !11

100:                                              ; preds = %56, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %101

101:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %102

102:                                              ; preds = %101, %4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

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

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

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

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


; 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::internal::concurrent_vector_base_v3::segment_value_t" = type { ptr }
%"class.tbb::internal::concurrent_vector_base_v3::segment_t" = type { %"struct.tbb::atomic.4" }
%"struct.tbb::atomic.4" = type { %"struct.tbb::internal::atomic_impl.5" }
%"struct.tbb::internal::atomic_impl.5" = type { %"struct.tbb::internal::aligned_storage.6" }
%"struct.tbb::internal::aligned_storage.6" = type { ptr }

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmb(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, i64 noundef, i1 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper33assign_first_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) local_unnamed_addr #3 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper25extend_table_if_necessaryERS1_mm(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3tbb8internal25concurrent_vector_base_v313internal_copyERKS1_mPFvPvPKvmE(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, i64 noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #2 align 2 {
  %5 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %6 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %7 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %.loopexit, label %10

10:                                               ; preds = %4
  %11 = add i64 %9, -1
  %12 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v316segment_index_ofEm(i64 noundef %11)
  tail call void @_ZN3tbb8internal25concurrent_vector_base_v36helper33assign_first_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %12)
  %13 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef 0)
  %14 = icmp ult i64 %13, %9
  br i1 %14, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %10
  %15 = getelementptr inbounds i8, ptr %1, i64 24
  %16 = getelementptr inbounds i8, ptr %1, i64 32
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  br label %19

19:                                               ; preds = %.lr.ph, %30
  %20 = phi i64 [ %13, %.lr.ph ], [ %44, %30 ]
  %.02836 = phi i64 [ 0, %.lr.ph ], [ %43, %30 ]
  %21 = call noundef ptr @_ZNK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEE4loadILNS_16memory_semanticsE1EEES4_v(ptr noundef nonnull align 8 dereferenceable(8) %15)
  %22 = icmp eq ptr %21, %16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %23 = icmp ugt i64 %.02836, 2
  %or.cond = and i1 %23, %22
  br i1 %or.cond, label %.critedge, label %24

24:                                               ; preds = %19
  %25 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %15)
  %26 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %25, i64 %.02836
  %27 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %26)
  store ptr %27, ptr %5, align 8
  %28 = call noundef zeroext i1 @_ZN3tbb8internalneINS0_25concurrent_vector_base_v317segment_allocatedEEEbRKNS2_15segment_value_tET_(ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br i1 %28, label %.loopexit33, label %30

.critedge:                                        ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %.loopexit33

.loopexit33:                                      ; preds = %24, %.critedge
  %29 = call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %17, i64 noundef %20)
  br label %.loopexit

30:                                               ; preds = %24
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper25extend_table_if_necessaryERS1_mm(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %.02836, i64 noundef 0)
  %31 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmb(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %.02836, i64 noundef %2, i1 noundef zeroext false)
  %32 = sub i64 %9, %20
  %spec.select = call i64 @llvm.umin.i64(i64 %31, i64 %32)
  %33 = add i64 %spec.select, %20
  %34 = call noundef i64 @_ZN3tbb6atomicImEaSEm(ptr noundef nonnull align 8 dereferenceable(8) %17, i64 noundef %33)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %35 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %18)
  %36 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %35, i64 %.02836
  %37 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %36)
  store ptr %37, ptr %6, align 8
  %38 = call noundef ptr @_ZNK3tbb8internal25concurrent_vector_base_v315segment_value_t7pointerIvEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %39 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %15)
  %40 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %39, i64 %.02836
  %41 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %40)
  store ptr %41, ptr %7, align 8
  %42 = call noundef ptr @_ZNK3tbb8internal25concurrent_vector_base_v315segment_value_t7pointerIvEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void %3(ptr noundef %38, ptr noundef %42, i64 noundef %spec.select)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %43 = add i64 %.02836, 1
  %44 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef %43)
  %45 = icmp ult i64 %44, %9
  br i1 %45, label %19, label %.loopexit, !llvm.loop !5

.loopexit:                                        ; preds = %30, %10, %.loopexit33, %4
  ret void
}

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

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

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

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

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


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