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

; 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::tbb_thread_v3::id" = type { i64 }
%"class.tbb::interface5::reader_writer_lock::scoped_lock" = type <{ ptr, ptr, %"struct.tbb::atomic.8", [4 x i8] }>
%"struct.tbb::atomic.8" = type { %"struct.tbb::internal::atomic_impl.9" }
%"struct.tbb::internal::atomic_impl.9" = type { %"struct.tbb::internal::aligned_storage.10" }
%"struct.tbb::internal::aligned_storage.10" = type { i32 }
%"class.tbb::interface5::reader_writer_lock" = type { %"struct.tbb::atomic", %"struct.tbb::atomic.0", %"struct.tbb::atomic.0", %"class.tbb::internal::tbb_thread_v3::id", %"struct.tbb::atomic.4" }
%"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 { ptr }
%"struct.tbb::atomic.0" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic.1" }
%"struct.tbb::internal::atomic_impl_with_arithmetic.1" = type { %"struct.tbb::internal::atomic_impl.2" }
%"struct.tbb::internal::atomic_impl.2" = type { %"struct.tbb::internal::aligned_storage.3" }
%"struct.tbb::internal::aligned_storage.3" = type { ptr }
%"struct.tbb::atomic.4" = type { %"struct.tbb::internal::atomic_impl_with_arithmetic.5" }
%"struct.tbb::internal::atomic_impl_with_arithmetic.5" = type { %"struct.tbb::internal::atomic_impl.6" }
%"struct.tbb::internal::atomic_impl.6" = type { %"struct.tbb::internal::aligned_storage.7" }
%"struct.tbb::internal::aligned_storage.7" = type { i64 }

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb10interface518reader_writer_lock11scoped_lockdlEPv(ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3tbb10interface518reader_writer_lock11start_writeEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.tbb::internal::tbb_thread_v3::id", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %10 = call i64 @_ZN3tbb15this_tbb_thread6get_idEv()
  %11 = getelementptr inbounds %"class.tbb::internal::tbb_thread_v3::id", ptr %6, i32 0, i32 0
  store i64 %10, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %12, i32 0, i32 2
  %14 = call noundef i32 @_ZNVK3tbb8internal11atomic_implINS_10interface518reader_writer_lock8status_tEEcvS4_Ev(ptr noundef nonnull align 4 dereferenceable(4) %13)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %27

16:                                               ; preds = %2
  %17 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock", ptr %9, i32 0, i32 2
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE16compare_and_swapES5_S5_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef %18, ptr noundef null)
  store ptr %19, ptr %7, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %26

21:                                               ; preds = %16
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %22) #5
  call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockdlEPv(ptr noundef %22) #5
  br label %25

25:                                               ; preds = %24, %21
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %78

26:                                               ; preds = %16
  br label %31

27:                                               ; preds = %2
  %28 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock", ptr %9, i32 0, i32 2
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE15fetch_and_storeES5_(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef %29)
  store ptr %30, ptr %7, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %27, %26
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %38

34:                                               ; preds = %31
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %36, i32 0, i32 1
  store ptr %35, ptr %37, align 8, !tbaa !9
  br label %74

38:                                               ; preds = %31
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN3tbb10interface518reader_writer_lock15set_next_writerEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef %39)
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %40, i32 0, i32 2
  %42 = call noundef i32 @_ZNVK3tbb8internal11atomic_implINS_10interface518reader_writer_lock8status_tEEcvS4_Ev(ptr noundef nonnull align 4 dereferenceable(4) %41)
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %73

44:                                               ; preds = %38
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %53

49:                                               ; preds = %44
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  call void @_ZN3tbb10interface518reader_writer_lock15set_next_writerEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef %52)
  br label %68

53:                                               ; preds = %44
  %54 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock", ptr %9, i32 0, i32 1
  %55 = call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE15fetch_and_storeES5_(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef null)
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock", ptr %9, i32 0, i32 2
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE16compare_and_swapES5_S5_(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef null, ptr noundef %58)
  %60 = icmp ne ptr %56, %59
  br i1 %60, label %61, label %67

61:                                               ; preds = %53
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %62, i32 0, i32 1
  call void @_ZN3tbb8internal18spin_wait_while_eqIPNS_10interface518reader_writer_lock11scoped_lockES5_EEvRVKT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef null)
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  call void @_ZN3tbb10interface518reader_writer_lock15set_next_writerEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef %66)
  br label %67

67:                                               ; preds = %61, %53
  br label %68

68:                                               ; preds = %67, %49
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = icmp eq ptr %69, null
  br i1 %70, label %72, label %71

71:                                               ; preds = %68
  call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %69) #5
  call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockdlEPv(ptr noundef %69) #5
  br label %72

72:                                               ; preds = %71, %68
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %78

73:                                               ; preds = %38
  br label %74

74:                                               ; preds = %73, %34
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock::scoped_lock", ptr %75, i32 0, i32 2
  call void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicINS_10interface518reader_writer_lock8status_tEEES5_EEvRVKT_T0_(ptr noundef nonnull align 4 dereferenceable(4) %76, i32 noundef 1)
  %77 = getelementptr inbounds %"class.tbb::interface5::reader_writer_lock", ptr %9, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %77, ptr align 8 %6, i64 8, i1 false), !tbaa.struct !15
  store i1 true, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %78

78:                                               ; preds = %74, %72, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %79 = load i1, ptr %3, align 1
  ret i1 %79
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN3tbb15this_tbb_thread6get_idEv() #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNVK3tbb8internal11atomic_implINS_10interface518reader_writer_lock8status_tEEcvS4_Ev(ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb10interface518reader_writer_lock15set_next_writerEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicINS_10interface518reader_writer_lock8status_tEEES5_EEvRVKT_T0_(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 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, !6, i64 8}
!10 = !{!"_ZTSN3tbb10interface518reader_writer_lock11scoped_lockE", !6, i64 0, !6, i64 8, !11, i64 16}
!11 = !{!"_ZTSN3tbb6atomicINS_10interface518reader_writer_lock8status_tEEE", !12, i64 0}
!12 = !{!"_ZTSN3tbb8internal11atomic_implINS_10interface518reader_writer_lock8status_tEEE", !13, i64 0}
!13 = !{!"_ZTSN3tbb8internal15aligned_storageINS_10interface518reader_writer_lock8status_tELm4EEE", !14, i64 0}
!14 = !{!"_ZTSN3tbb10interface518reader_writer_lock8status_tE", !7, i64 0}
!15 = !{i64 0, i64 8, !16}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}


; 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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3tbb10interface518reader_writer_lock11scoped_lockdlEPv(ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3tbb10interface518reader_writer_lock11start_writeEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = tail call i64 @_ZN3tbb15this_tbb_thread6get_idEv()
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  %5 = tail call noundef i32 @_ZNVK3tbb8internal11atomic_implINS_10interface518reader_writer_lock8status_tEEcvS4_Ev(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %6 = icmp eq i32 %5, 0
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  br i1 %6, label %8, label %13

8:                                                ; preds = %2
  %9 = tail call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE16compare_and_swapES5_S5_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef %1, ptr noundef null)
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %.thread, label %10

10:                                               ; preds = %8
  %11 = icmp eq ptr %1, null
  br i1 %11, label %33, label %12

12:                                               ; preds = %10
  tail call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %1) #3
  tail call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockdlEPv(ptr noundef nonnull %1) #3
  br label %33

13:                                               ; preds = %2
  %14 = tail call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE15fetch_and_storeES5_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef %1)
  %.not23 = icmp eq ptr %14, null
  br i1 %.not23, label %.thread, label %15

15:                                               ; preds = %13
  %16 = getelementptr inbounds i8, ptr %14, i64 8
  store ptr %1, ptr %16, align 8, !tbaa !5
  br label %31

.thread:                                          ; preds = %8, %13
  tail call void @_ZN3tbb10interface518reader_writer_lock15set_next_writerEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %1)
  %17 = tail call noundef i32 @_ZNVK3tbb8internal11atomic_implINS_10interface518reader_writer_lock8status_tEEcvS4_Ev(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %31

19:                                               ; preds = %.thread
  %20 = getelementptr inbounds i8, ptr %1, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %.not24 = icmp eq ptr %21, null
  br i1 %.not24, label %23, label %22

22:                                               ; preds = %19
  tail call void @_ZN3tbb10interface518reader_writer_lock15set_next_writerEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull %21)
  br label %30

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  %25 = tail call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE15fetch_and_storeES5_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef null)
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = tail call noundef ptr @_ZN3tbb8internal11atomic_implIPNS_10interface518reader_writer_lock11scoped_lockEE16compare_and_swapES5_S5_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef null, ptr noundef nonnull %1)
  %.not25 = icmp eq ptr %27, %1
  br i1 %.not25, label %30, label %28

28:                                               ; preds = %23
  tail call void @_ZN3tbb8internal18spin_wait_while_eqIPNS_10interface518reader_writer_lock11scoped_lockES5_EEvRVKT_T0_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef null)
  %29 = load ptr, ptr %20, align 8, !tbaa !5
  tail call void @_ZN3tbb10interface518reader_writer_lock15set_next_writerEPNS1_11scoped_lockE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %29)
  br label %30

30:                                               ; preds = %22, %28, %23
  tail call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %1) #3
  tail call void @_ZN3tbb10interface518reader_writer_lock11scoped_lockdlEPv(ptr noundef nonnull %1) #3
  br label %33

31:                                               ; preds = %.thread, %15
  tail call void @_ZN3tbb8internal18spin_wait_while_eqINS_6atomicINS_10interface518reader_writer_lock8status_tEEES5_EEvRVKT_T0_(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef 1)
  %32 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %3, ptr %32, align 8, !tbaa !14
  br label %33

33:                                               ; preds = %30, %10, %12, %31
  %.019 = phi i1 [ true, %31 ], [ false, %12 ], [ false, %10 ], [ false, %30 ]
  ret i1 %.019
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_ZN3tbb15this_tbb_thread6get_idEv() local_unnamed_addr #2

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

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

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

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

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

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

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

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 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 = { 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 #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, !7, i64 8}
!6 = !{!"_ZTSN3tbb10interface518reader_writer_lock11scoped_lockE", !7, i64 0, !7, i64 8, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN3tbb6atomicINS_10interface518reader_writer_lock8status_tEEE", !11, i64 0}
!11 = !{!"_ZTSN3tbb8internal11atomic_implINS_10interface518reader_writer_lock8status_tEEE", !12, i64 0}
!12 = !{!"_ZTSN3tbb8internal15aligned_storageINS_10interface518reader_writer_lock8status_tELm4EEE", !13, i64 0}
!13 = !{!"_ZTSN3tbb10interface518reader_writer_lock8status_tE", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !8, i64 0}


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