; 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::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 }
%"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 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper20extend_segment_tableERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %7 = alloca %"struct.tbb::internal::concurrent_vector_base_v3::segment_not_used", align 1
  %8 = alloca %"class.tbb::internal::atomic_backoff", align 4
  %9 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %10 = alloca %"struct.tbb::internal::concurrent_vector_base_v3::segment_not_used", align 1
  %11 = alloca ptr, align 8
  %12 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_t", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %13 = load i64, ptr %4, align 8, !tbaa !9
  %14 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef 3)
  %15 = icmp ugt i64 %13, %14
  br i1 %15, label %16, label %18

16:                                               ; preds = %2
  %17 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef 3)
  store i64 %17, ptr %4, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %16, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %65, %18
  %20 = load i64, ptr %5, align 8, !tbaa !9
  %21 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef %20)
  %22 = load i64, ptr %4, align 8, !tbaa !9
  %23 = icmp ult i64 %21, %22
  br i1 %23, label %24, label %32

24:                                               ; preds = %19
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %25, i32 0, i32 3
  %27 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %26)
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %28, i32 0, i32 4
  %30 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %29, i64 0, i64 0
  %31 = icmp eq ptr %27, %30
  br label %32

32:                                               ; preds = %24, %19
  %33 = phi i1 [ false, %19 ], [ %31, %24 ]
  br i1 %33, label %35, label %34

34:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %68

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %36, i32 0, i32 4
  %38 = load i64, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %37, i64 0, i64 %38
  %40 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %39)
  %41 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %6, i32 0, i32 0
  store ptr %40, ptr %41, align 8
  %42 = 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 %6) #5
  br i1 %42, label %43, label %64

43:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4) %8, i1 noundef zeroext true)
  br label %44

44:                                               ; preds = %62, %43
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %45, i32 0, i32 3
  %47 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %46)
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %48, i32 0, i32 4
  %50 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %49, i64 0, i64 0
  %51 = icmp eq ptr %47, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  br i1 %51, label %52, label %60

52:                                               ; preds = %44
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %53, i32 0, i32 4
  %55 = load i64, ptr %5, align 8, !tbaa !9
  %56 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %54, i64 0, i64 %55
  %57 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %56)
  %58 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %9, i32 0, i32 0
  store ptr %57, ptr %58, align 8
  %59 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %9)
  br label %60

60:                                               ; preds = %52, %44
  %61 = phi i1 [ false, %44 ], [ %59, %52 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br i1 %61, label %62, label %63

62:                                               ; preds = %60
  call void @_ZN3tbb8internal14atomic_backoff5pauseEv(ptr noundef nonnull align 4 dereferenceable(4) %8)
  br label %44, !llvm.loop !11

63:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %64

64:                                               ; preds = %63, %35
  br label %65

65:                                               ; preds = %64
  %66 = load i64, ptr %5, align 8, !tbaa !9
  %67 = add i64 %66, 1
  store i64 %67, ptr %5, align 8, !tbaa !9
  br label %19, !llvm.loop !13

68:                                               ; preds = %34
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %69, i32 0, i32 3
  %71 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %70)
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %72, i32 0, i32 4
  %74 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %73, i64 0, i64 0
  %75 = icmp ne ptr %71, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %68
  br label %104

77:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %78 = call noundef ptr @_ZN3tbb8internal12NFS_AllocateEmmPv(i64 noundef 64, i64 noundef 8, ptr noundef null)
  store ptr %78, ptr %11, align 8, !tbaa !5
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @_ZN3tbb8internal25concurrent_vector_base_v39segment_tC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %80 = call noundef ptr @_ZSt20uninitialized_fill_nIPN3tbb8internal25concurrent_vector_base_v39segment_tEmS3_ET_S5_T0_RKT1_(ptr noundef %79, i64 noundef 64, ptr noundef nonnull align 8 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %81, i32 0, i32 4
  %83 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %82, i64 0, i64 0
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %84, i32 0, i32 4
  %86 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %85, i64 0, i64 0
  %87 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %86, i64 3
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = call noundef ptr @_ZSt4copyIPN3tbb8internal25concurrent_vector_base_v39segment_tES4_ET0_T_S6_S5_(ptr noundef %83, ptr noundef %87, ptr noundef %88)
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %90, i32 0, i32 3
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %93, i32 0, i32 4
  %95 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %94, i64 0, i64 0
  %96 = call noundef ptr @_ZN3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEE16compare_and_swapES4_S4_(ptr noundef nonnull align 8 dereferenceable(8) %91, ptr noundef %92, ptr noundef %95)
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %97, i32 0, i32 4
  %99 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %98, i64 0, i64 0
  %100 = icmp ne ptr %96, %99
  br i1 %100, label %101, label %103

101:                                              ; preds = %77
  %102 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3tbb8internal8NFS_FreeEPv(ptr noundef %102)
  br label %103

103:                                              ; preds = %101, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %104

104:                                              ; preds = %103, %76
  ret void
}

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

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

; 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)) #0 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)) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4), i1 noundef zeroext) unnamed_addr #0 align 2

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

declare noundef ptr @_ZN3tbb8internal12NFS_AllocateEmmPv(i64 noundef, i64 noundef, ptr noundef) #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPN3tbb8internal25concurrent_vector_base_v39segment_tES4_ET0_T_S6_S5_(ptr noundef, ptr noundef, ptr noundef) #4

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

declare void @_ZN3tbb8internal8NFS_FreeEPv(ptr noundef) #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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 #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 = !{!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}


; 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 uwtable
define dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper20extend_segment_tableERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %4 = alloca %"class.tbb::internal::atomic_backoff", align 4
  %5 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %6 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_t", align 8
  %7 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef 3)
  %8 = icmp ult i64 %7, %1
  br i1 %8, label %9, label %11

9:                                                ; preds = %2
  %10 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef 3)
  br label %11

11:                                               ; preds = %9, %2
  %.0 = phi i64 [ %10, %9 ], [ %1, %2 ]
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef 0)
  %14 = icmp ult i64 %13, %.0
  br i1 %14, label %.lr.ph30, label %.critedge

.lr.ph30:                                         ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  br label %16

16:                                               ; preds = %.lr.ph30, %33
  %.02429 = phi i64 [ 0, %.lr.ph30 ], [ %34, %33 ]
  %17 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %18 = icmp eq ptr %17, %15
  br i1 %18, label %21, label %.critedge

.critedge:                                        ; preds = %16, %33, %11
  %19 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  %.not = icmp eq ptr %19, %20
  br i1 %.not, label %37, label %44

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %22 = getelementptr inbounds [3 x %"class.tbb::internal::concurrent_vector_base_v3::segment_t"], ptr %15, i64 0, i64 %.02429
  %23 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %22)
  store ptr %23, ptr %3, align 8
  %24 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br i1 %24, label %25, label %33

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4) %4, i1 noundef zeroext true)
  %26 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %27 = icmp eq ptr %26, %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  br i1 %27, label %.lr.ph, label %.critedge2

.lr.ph:                                           ; preds = %25, %30
  %28 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE3EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %22)
  store ptr %28, ptr %5, align 8
  %29 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br i1 %29, label %30, label %.loopexit

30:                                               ; preds = %.lr.ph
  call void @_ZN3tbb8internal14atomic_backoff5pauseEv(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %31 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %32 = icmp eq ptr %31, %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  br i1 %32, label %.lr.ph, label %.critedge2, !llvm.loop !5

.critedge2:                                       ; preds = %30, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %.critedge2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %33

33:                                               ; preds = %21, %.loopexit
  %34 = add i64 %.02429, 1
  %35 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef %34)
  %36 = icmp ult i64 %35, %.0
  br i1 %36, label %16, label %.critedge, !llvm.loop !7

37:                                               ; preds = %.critedge
  %38 = call noundef ptr @_ZN3tbb8internal12NFS_AllocateEmmPv(i64 noundef 64, i64 noundef 8, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @_ZN3tbb8internal25concurrent_vector_base_v39segment_tC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %39 = call noundef ptr @_ZSt20uninitialized_fill_nIPN3tbb8internal25concurrent_vector_base_v39segment_tEmS3_ET_S5_T0_RKT1_(ptr noundef %38, i64 noundef 64, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %40 = getelementptr inbounds i8, ptr %0, i64 56
  %41 = call noundef ptr @_ZSt4copyIPN3tbb8internal25concurrent_vector_base_v39segment_tES4_ET0_T_S6_S5_(ptr noundef nonnull %20, ptr noundef nonnull %40, ptr noundef %38)
  %42 = call noundef ptr @_ZN3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEE16compare_and_swapES4_S4_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef %38, ptr noundef nonnull %20)
  %.not28 = icmp eq ptr %42, %20
  br i1 %.not28, label %44, label %43

43:                                               ; preds = %37
  call void @_ZN3tbb8internal8NFS_FreeEPv(ptr noundef %38)
  br label %44

44:                                               ; preds = %37, %43, %.critedge
  ret void
}

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

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

; 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 #0 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 #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb8internal14atomic_backoffC2Eb(ptr noundef nonnull align 4 dereferenceable(4), i1 noundef zeroext) unnamed_addr #0 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPN3tbb8internal25concurrent_vector_base_v39segment_tES4_ET0_T_S6_S5_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

declare void @_ZN3tbb8internal8NFS_FreeEPv(ptr noundef) local_unnamed_addr #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 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 #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"}
!7 = distinct !{!7, !6}


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