; 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_not_used" = type { i8 }
%"class.tbb::internal::atomic_backoff" = type { i32 }
%"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 uwtable
declare dso_local noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8)) #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)) #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 uwtable
declare dso_local void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4), i1 noundef zeroext) unnamed_addr #1 align 2

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

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

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

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

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

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

26:                                               ; preds = %48, %5
  %27 = load i64, ptr %11, align 8, !tbaa !9
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = icmp ult i64 %27, %28
  br i1 %29, label %30, label %49

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %31 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, i32 0, i32 2
  %32 = load i64, ptr %7, align 8, !tbaa !9
  %33 = load i64, ptr %11, align 8, !tbaa !9
  %34 = call noundef i64 @_ZN3tbb8internal11atomic_implImE16compare_and_swapEmm(ptr noundef nonnull align 8 dereferenceable(8) %31, i64 noundef %32, i64 noundef %33)
  store i64 %34, ptr %12, align 8, !tbaa !9
  %35 = load i64, ptr %12, align 8, !tbaa !9
  %36 = load i64, ptr %11, align 8, !tbaa !9
  %37 = icmp eq i64 %35, %36
  br i1 %37, label %38, label %44

38:                                               ; preds = %30
  %39 = load i64, ptr %11, align 8, !tbaa !9
  %40 = load i64, ptr %7, align 8, !tbaa !9
  %41 = load i64, ptr %8, align 8, !tbaa !9
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3tbb8internal25concurrent_vector_base_v313internal_growEmmmPFvPvPKvmES4_(ptr noundef nonnull align 8 dereferenceable(56) %23, i64 noundef %39, i64 noundef %40, i64 noundef %41, ptr noundef %42, ptr noundef %43)
  store i32 3, ptr %13, align 4
  br label %46

44:                                               ; preds = %30
  %45 = load i64, ptr %12, align 8, !tbaa !9
  store i64 %45, ptr %11, align 8, !tbaa !9
  store i32 0, ptr %13, align 4
  br label %46

46:                                               ; preds = %44, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %47 = load i32, ptr %13, align 4
  switch i32 %47, label %102 [
    i32 0, label %48
    i32 3, label %49
  ]

48:                                               ; preds = %46
  br label %26, !llvm.loop !11

49:                                               ; preds = %46, %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %50 = load i64, ptr %7, align 8, !tbaa !9
  %51 = sub i64 %50, 1
  %52 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v316segment_index_ofEm(i64 noundef %51)
  store i64 %52, ptr %15, align 8, !tbaa !9
  %53 = load i64, ptr %15, align 8, !tbaa !9
  %54 = icmp uge i64 %53, 3
  br i1 %54, label %55, label %65

55:                                               ; preds = %49
  %56 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, i32 0, i32 3
  %57 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %56)
  %58 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, i32 0, i32 4
  %59 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %58, i64 0, i64 0
  %60 = icmp eq ptr %57, %59
  br i1 %60, label %61, label %65

61:                                               ; preds = %55
  %62 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, i32 0, i32 3
  %63 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, i32 0, i32 4
  %64 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %63, i64 0, i64 0
  call void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicIPNS0_25concurrent_vector_base_v39segment_tEEES5_EEvRVKT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %62, ptr noundef %64)
  br label %65

65:                                               ; preds = %61, %55, %49
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %97, %65
  %67 = load i64, ptr %14, align 8, !tbaa !9
  %68 = load i64, ptr %15, align 8, !tbaa !9
  %69 = icmp ule i64 %67, %68
  br i1 %69, label %70, label %100

70:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %71 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, i32 0, i32 3
  %72 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %71)
  %73 = load i64, ptr %14, align 8, !tbaa !9
  %74 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %72, i64 %73
  store ptr %74, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %75 = load ptr, ptr %16, align 8, !tbaa !5
  %76 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %75)
  %77 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %17, i32 0, i32 0
  store ptr %76, ptr %77, align 8
  %78 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  br i1 %78, label %79, label %90

79:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4) %19, i1 noundef zeroext true)
  br label %80

80:                                               ; preds = %88, %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %81 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, 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 %14, 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_semanticsE1EEENS1_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 %20, i32 0, i32 0
  store ptr %85, ptr %86, align 8
  %87 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  br i1 %87, label %88, label %89

88:                                               ; preds = %80
  call void @_ZN3tbb8internal14atomic_backoff5pauseEv(ptr noundef nonnull align 4 dereferenceable(4) %19)
  br label %80, !llvm.loop !13

89:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  br label %90

90:                                               ; preds = %89, %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %91 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %23, i32 0, i32 3
  %92 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %91)
  %93 = load i64, ptr %14, align 8, !tbaa !9
  %94 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %92, i64 %93
  %95 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %94)
  %96 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %22, i32 0, i32 0
  store ptr %95, ptr %96, align 8
  call void @_ZN3tbb8internal25enforce_segment_allocatedERKNS0_25concurrent_vector_base_v315segment_value_tENS0_12exception_idE(ptr noundef nonnull align 8 dereferenceable(8) %22, i32 noundef 2)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %97

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

100:                                              ; preds = %66
  %101 = load i64, ptr %11, align 8, !tbaa !9
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret i64 %101

102:                                              ; preds = %46
  unreachable
}

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

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

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

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 = !{!"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"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


; 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::atomic_backoff" = type { i32 }
%"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 uwtable
declare dso_local noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #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 #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 uwtable
declare dso_local void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4), i1 noundef zeroext) unnamed_addr #1 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v337internal_grow_to_at_least_with_resultEmmPFvPvPKvmES4_(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #1 align 2 {
  %6 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %7 = alloca %"class.tbb::internal::atomic_backoff", align 4
  %8 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %9 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
  br label %12

12:                                               ; preds = %14, %5
  %.0 = phi i64 [ %11, %5 ], [ %15, %14 ]
  %13 = icmp ult i64 %.0, %1
  br i1 %13, label %14, label %.loopexit

14:                                               ; preds = %12
  %15 = tail call noundef i64 @_ZN3tbb8internal11atomic_implImE16compare_and_swapEmm(ptr noundef nonnull align 8 dereferenceable(8) %10, i64 noundef %1, i64 noundef %.0)
  %16 = icmp eq i64 %15, %.0
  br i1 %16, label %.thread, label %12

.thread:                                          ; preds = %14
  tail call void @_ZN3tbb8internal25concurrent_vector_base_v313internal_growEmmmPFvPvPKvmES4_(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %.0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4)
  br label %.loopexit

.loopexit:                                        ; preds = %12, %.thread
  %17 = add i64 %1, -1
  %18 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v316segment_index_ofEm(i64 noundef %17)
  %19 = icmp ugt i64 %18, 2
  br i1 %19, label %20, label %26

20:                                               ; preds = %.loopexit
  %21 = getelementptr inbounds i8, ptr %0, i64 24
  %22 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  %24 = icmp eq ptr %22, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %20
  tail call void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicIPNS0_25concurrent_vector_base_v39segment_tEEES5_EEvRVKT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull %23)
  br label %26

26:                                               ; preds = %25, %20, %.loopexit
  %27 = getelementptr inbounds i8, ptr %0, i64 24
  br label %28

28:                                               ; preds = %26, %42
  %.02433 = phi i64 [ 0, %26 ], [ %46, %42 ]
  %29 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %30 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %29, i64 %.02433
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %31 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %30)
  store ptr %31, ptr %6, align 8
  %32 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  br i1 %32, label %33, label %42

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  call void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4) %7, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %34 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %35 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %34, i64 %.02433
  %36 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE1EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %35)
  store ptr %36, ptr %8, align 8
  %37 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  br i1 %37, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %33, %.lr.ph
  call void @_ZN3tbb8internal14atomic_backoff5pauseEv(ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %38 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %39 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %38, i64 %.02433
  %40 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE1EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %39)
  store ptr %40, ptr %8, align 8
  %41 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  br i1 %41, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  br label %42

42:                                               ; preds = %._crit_edge, %28
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  %43 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %44 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %43, i64 %.02433
  %45 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %44)
  store ptr %45, ptr %9, align 8
  call void @_ZN3tbb8internal25enforce_segment_allocatedERKNS0_25concurrent_vector_base_v315segment_value_tENS0_12exception_idE(ptr noundef nonnull align 8 dereferenceable(8) %9, i32 noundef 2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  %46 = add i64 %.02433, 1
  %.not = icmp ugt i64 %46, %18
  br i1 %.not, label %47, label %28, !llvm.loop !7

47:                                               ; preds = %42
  ret i64 %.0
}

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

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

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

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}


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