; 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 }
%"struct.tbb::internal::concurrent_vector_base_v3::helper::segment_not_used_predicate" = type { ptr }
%struct.segment_scope_guard = type <{ ptr, i8, [7 x 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef) #0 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 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)) #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmb(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1, i64 noundef %2, i1 noundef zeroext %3) #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %13 = alloca %"struct.tbb::internal::concurrent_vector_base_v3::segment_not_used", align 1
  %14 = alloca %"struct.tbb::internal::concurrent_vector_base_v3::helper::segment_not_used_predicate", align 8
  %15 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %16 = alloca %struct.segment_scope_guard, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca %struct.segment_scope_guard, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !9
  %20 = zext i1 %3 to i8
  store i8 %20, ptr %8, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %21, i32 0, i32 3
  %23 = call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %22)
  store ptr %23, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef %24)
  store i64 %25, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %26 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %26, ptr %11, align 8, !tbaa !9
  %27 = load i64, ptr %6, align 8, !tbaa !9
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %35, label %29

29:                                               ; preds = %4
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper33assign_first_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %30, i64 noundef 0)
  store i64 2, ptr %10, align 8, !tbaa !9
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %31, i32 0, i32 1
  %33 = call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %32)
  %34 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef %33)
  store i64 %34, ptr %11, align 8, !tbaa !9
  br label %38

35:                                               ; preds = %4
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %36, i32 0, i32 1
  call void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicImEEmEEvRVKT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %37, i64 noundef 0)
  br label %38

38:                                               ; preds = %35, %29
  %39 = load i64, ptr %6, align 8, !tbaa !9
  %40 = icmp ne i64 %39, 0
  br i1 %40, label %41, label %84

41:                                               ; preds = %38
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3", ptr %43, i32 0, i32 1
  %45 = call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %44)
  %46 = icmp ult i64 %42, %45
  br i1 %46, label %47, label %84

47:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %48, i64 0
  %50 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE1EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %49)
  %51 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %12, i32 0, i32 0
  store ptr %50, ptr %51, align 8
  %52 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %12)
  br i1 %52, label %53, label %62

53:                                               ; preds = %47
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %54, i64 0
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper26segment_not_used_predicateC2ERNS1_9segment_tE(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %55)
  %56 = getelementptr inbounds %"struct.tbb::internal::concurrent_vector_base_v3::helper::segment_not_used_predicate", ptr %14, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8
  call void @_ZN3tbb8internal15spin_wait_whileINS0_25concurrent_vector_base_v36helper26segment_not_used_predicateEEEvT_(ptr %57)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %58, i64 0
  %60 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE1EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %59)
  %61 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", ptr %15, i32 0, i32 0
  store ptr %60, ptr %61, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %15, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %62

62:                                               ; preds = %53, %47
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #6
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = load i64, ptr %6, align 8, !tbaa !9
  %65 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %63, i64 %64
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardC2ERNS1_9segment_tEb(ptr noundef nonnull align 8 dereferenceable(9) %16, ptr noundef nonnull align 8 dereferenceable(8) %65, i1 noundef zeroext false)
  invoke void @_ZN3tbb8internal25enforce_segment_allocatedERKNS0_25concurrent_vector_base_v315segment_value_tENS0_12exception_idE(ptr noundef nonnull align 8 dereferenceable(8) %12, i32 noundef 2)
          to label %66 unwind label %80

66:                                               ; preds = %62
  invoke void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guard7dismissEv(ptr noundef nonnull align 8 dereferenceable(9) %16)
          to label %67 unwind label %80

67:                                               ; preds = %66
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load i64, ptr %6, align 8, !tbaa !9
  %70 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %68, i64 %69
  %71 = invoke noundef ptr @_ZNK3tbb8internal25concurrent_vector_base_v315segment_value_t7pointerIcEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %72 unwind label %80

72:                                               ; preds = %67
  %73 = load i64, ptr %6, align 8, !tbaa !9
  %74 = invoke noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef %73)
          to label %75 unwind label %80

75:                                               ; preds = %72
  %76 = load i64, ptr %7, align 8, !tbaa !9
  %77 = mul i64 %74, %76
  %78 = getelementptr inbounds i8, ptr %71, i64 %77
  invoke void @_ZN3tbb8internal25concurrent_vector_base_v36helper15publish_segmentIPvEEvRNS1_9segment_tET_(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef %78)
          to label %79 unwind label %80

79:                                               ; preds = %75
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %103

80:                                               ; preds = %75, %72, %67, %66, %62
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %17, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %18, align 4
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %105

84:                                               ; preds = %41, %38
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = load i64, ptr %6, align 8, !tbaa !9
  %87 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %85, i64 %86
  %88 = load i8, ptr %8, align 1, !tbaa !11, !range !14, !noundef !15
  %89 = trunc i8 %88 to i1
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardC2ERNS1_9segment_tEb(ptr noundef nonnull align 8 dereferenceable(9) %19, ptr noundef nonnull align 8 dereferenceable(8) %87, i1 noundef zeroext %89)
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = load i64, ptr %6, align 8, !tbaa !9
  %92 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %90, i64 %91
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = load i64, ptr %11, align 8, !tbaa !9
  %95 = invoke noundef ptr @_ZN3tbb8internal25concurrent_vector_base_v36helper16allocate_segmentERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %93, i64 noundef %94)
          to label %96 unwind label %99

96:                                               ; preds = %84
  invoke void @_ZN3tbb8internal25concurrent_vector_base_v36helper15publish_segmentIPvEEvRNS1_9segment_tET_(ptr noundef nonnull align 8 dereferenceable(8) %92, ptr noundef %95)
          to label %97 unwind label %99

97:                                               ; preds = %96
  invoke void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guard7dismissEv(ptr noundef nonnull align 8 dereferenceable(9) %19)
          to label %98 unwind label %99

98:                                               ; preds = %97
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  br label %103

99:                                               ; preds = %97, %96, %84
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %17, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %18, align 4
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  br label %105

103:                                              ; preds = %98, %79
  %104 = load i64, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  ret i64 %104

105:                                              ; preds = %99, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %106

106:                                              ; preds = %105
  %107 = load ptr, ptr %17, align 8
  %108 = load i32, ptr %18, align 4
  %109 = insertvalue { ptr, i32 } poison, ptr %107, 0
  %110 = insertvalue { ptr, i32 } %109, i32 %108, 1
  resume { ptr, i32 } %110
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb8internal15spin_wait_whileINS0_25concurrent_vector_base_v36helper26segment_not_used_predicateEEEvT_(ptr) #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardC2ERNS1_9segment_tEb(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(8), i1 noundef zeroext) unnamed_addr #0 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) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guard7dismissEv(ptr noundef nonnull align 8 dereferenceable(9)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper15publish_segmentIPvEEvRNS1_9segment_tET_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #0 align 2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint 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 #6 = { 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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i64 0, i64 8, !5}
!14 = !{i8 0, i8 2}
!15 = !{}


; 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 }
%"struct.tbb::internal::concurrent_vector_base_v3::helper::segment_not_used_predicate" = type { ptr }
%struct.segment_scope_guard = type <{ ptr, i8, [7 x i8] }>
%"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 nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef) local_unnamed_addr #0 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 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 #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmb(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %1, i64 noundef %2, i1 noundef zeroext %3) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.tbb::internal::concurrent_vector_base_v3::segment_value_t", align 8
  %6 = alloca %"struct.tbb::internal::concurrent_vector_base_v3::helper::segment_not_used_predicate", align 8
  %7 = alloca %struct.segment_scope_guard, align 8
  %8 = alloca %struct.segment_scope_guard, align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = tail call noundef ptr @_ZNVK3tbb8internal11atomic_implIPNS0_25concurrent_vector_base_v39segment_tEEcvS4_Ev(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %11 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef %1)
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %.thread, label %15

.thread:                                          ; preds = %4
  tail call void @_ZN3tbb8internal25concurrent_vector_base_v36helper33assign_first_segment_if_necessaryERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef 0)
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
  %14 = tail call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_sizeEm(i64 noundef %13)
  br label %34

15:                                               ; preds = %4
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicImEEmEEvRVKT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %16, i64 noundef 0)
  %17 = tail call noundef i64 @_ZNVK3tbb8internal11atomic_implImEcvmEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
  %18 = icmp ugt i64 %17, %1
  br i1 %18, label %19, label %34

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %20 = tail call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE1EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
  store ptr %20, ptr %5, align 8
  %21 = call noundef zeroext i1 @_ZN3tbb8internaleqERKNS0_25concurrent_vector_base_v315segment_value_tENS1_16segment_not_usedE(ptr noundef nonnull align 8 dereferenceable(8) %5)
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper26segment_not_used_predicateC2ERNS1_9segment_tE(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %23 = load ptr, ptr %6, align 8
  call void @_ZN3tbb8internal15spin_wait_whileINS0_25concurrent_vector_base_v36helper26segment_not_used_predicateEEEvT_(ptr %23)
  %24 = call ptr @_ZNK3tbb8internal25concurrent_vector_base_v39segment_t4loadILNS_16memory_semanticsE1EEENS1_15segment_value_tEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
  store ptr %24, ptr %5, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %22, %19
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  %26 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %10, i64 %1
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardC2ERNS1_9segment_tEb(ptr noundef nonnull align 8 dereferenceable(9) %7, ptr noundef nonnull align 8 dereferenceable(8) %26, i1 noundef zeroext false)
  invoke void @_ZN3tbb8internal25enforce_segment_allocatedERKNS0_25concurrent_vector_base_v315segment_value_tENS0_12exception_idE(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 2)
          to label %27 unwind label %32

27:                                               ; preds = %25
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guard7dismissEv(ptr noundef nonnull align 8 dereferenceable(9) %7)
  %28 = call noundef ptr @_ZNK3tbb8internal25concurrent_vector_base_v315segment_value_t7pointerIcEEPT_v(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %29 = call noundef i64 @_ZN3tbb8internal25concurrent_vector_base_v312segment_baseEm(i64 noundef %1)
  %30 = mul i64 %29, %2
  %31 = getelementptr inbounds i8, ptr %28, i64 %30
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper15publish_segmentIPvEEvRNS1_9segment_tET_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef %31)
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %40

32:                                               ; preds = %25
  %33 = landingpad { ptr, i32 }
          cleanup
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %41

34:                                               ; preds = %.thread, %15
  %.02937 = phi i64 [ 2, %.thread ], [ %11, %15 ]
  %.03035 = phi i64 [ %14, %.thread ], [ %11, %15 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %35 = getelementptr inbounds %"class.tbb::internal::concurrent_vector_base_v3::segment_t", ptr %10, i64 %1
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardC2ERNS1_9segment_tEb(ptr noundef nonnull align 8 dereferenceable(9) %8, ptr noundef nonnull align 8 dereferenceable(8) %35, i1 noundef zeroext %3)
  %36 = invoke noundef ptr @_ZN3tbb8internal25concurrent_vector_base_v36helper16allocate_segmentERS1_m(ptr noundef nonnull align 8 dereferenceable(56) %0, i64 noundef %.03035)
          to label %37 unwind label %38

37:                                               ; preds = %34
  call void @_ZN3tbb8internal25concurrent_vector_base_v36helper15publish_segmentIPvEEvRNS1_9segment_tET_(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef %36)
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guard7dismissEv(ptr noundef nonnull align 8 dereferenceable(9) %8)
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  br label %40

38:                                               ; preds = %34
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  br label %41

40:                                               ; preds = %37, %27
  %.02936 = phi i64 [ %.02937, %37 ], [ %11, %27 ]
  ret i64 %.02936

41:                                               ; preds = %38, %32
  %.pn = phi { ptr, i32 } [ %33, %32 ], [ %39, %38 ]
  resume { ptr, i32 } %.pn
}

; 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 void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicImEEmEEvRVKT_T0_(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #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 #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb8internal15spin_wait_whileINS0_25concurrent_vector_base_v36helper26segment_not_used_predicateEEEvT_(ptr) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardC2ERNS1_9segment_tEb(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(8), i1 noundef zeroext) unnamed_addr #0 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 #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guard7dismissEv(ptr noundef nonnull align 8 dereferenceable(9)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb8internal25concurrent_vector_base_v36helper15publish_segmentIPvEEvRNS1_9segment_tET_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZZN3tbb8internal25concurrent_vector_base_v36helper14enable_segmentERS1_mmbEN19segment_scope_guardD2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #0 align 2

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 #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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass