; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/rml/test/test_rml_mixed.ll (Z7TBBWorkv)

; 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.RunTime = type { %"class.tbb::internal::rml::tbb_factory", ptr, ptr }
%"class.tbb::internal::rml::tbb_factory" = type { %"class.rml::factory", ptr, ptr }
%"class.rml::factory" = type { ptr, ptr, ptr }
%class.RunTime.4 = type { %"class.__kmp::rml::omp_factory", ptr, ptr }
%"class.__kmp::rml::omp_factory" = type { %"class.rml::factory", ptr, ptr }
%"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 { i32 }
%class.OMP_Team = type { %"struct.tbb::atomic.0" }
%"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 { i32 }

@TBB_MaxThread = external dso_local global i32, align 4
@TBB_RunTime = external dso_local global %class.RunTime, align 8
@OMP_RunTime = external dso_local global %class.RunTime.4, align 8
@AvailWork = external dso_local global %"struct.tbb::atomic", align 4
@CompletionCount = external dso_local global %"struct.tbb::atomic", align 4

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7OMPWorkv() #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7TBBWorkv() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %class.OMP_Team, align 4
  %4 = alloca i32, align 4
  %5 = alloca [15 x ptr], align 16
  %6 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @AvailWork)
  %7 = icmp sge i32 %6, 0
  br i1 %7, label %8, label %67

8:                                                ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  %9 = call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEmmEv(ptr noundef nonnull align 4 dereferenceable(4) @AvailWork)
  store i32 %9, ptr %1, align 4, !tbaa !5
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = icmp eq i32 %10, -1
  br i1 %11, label %12, label %21

12:                                               ; preds = %8
  %13 = load ptr, ptr getelementptr inbounds (%class.RunTime, ptr @TBB_RunTime, i32 0, i32 2), align 8, !tbaa !9
  %14 = load i32, ptr @TBB_MaxThread, align 4, !tbaa !5
  %15 = sub nsw i32 %14, 1
  %16 = sub nsw i32 0, %15
  %17 = load ptr, ptr %13, align 8, !tbaa !14
  %18 = getelementptr inbounds ptr, ptr %17, i64 5
  %19 = load ptr, ptr %18, align 8
  call void %19(ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef %16)
  %20 = call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) @CompletionCount)
  br label %66

21:                                               ; preds = %8
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = icmp sge i32 %22, 0
  br i1 %23, label %24, label %65

24:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %60, %24
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = icmp slt i32 %26, 4
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %63

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %30 = load ptr, ptr getelementptr inbounds (%class.RunTime.4, ptr @OMP_RunTime, i32 0, i32 2), align 8, !tbaa !16
  call void @_ZN8OMP_TeamC2ERN5__kmp3rml10omp_serverE(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 8 dereferenceable(8) %30)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %31 = load ptr, ptr getelementptr inbounds (%class.RunTime.4, ptr @OMP_RunTime, i32 0, i32 2), align 8, !tbaa !16
  %32 = load ptr, ptr %31, align 8, !tbaa !14
  %33 = getelementptr inbounds ptr, ptr %32, i64 6
  %34 = load ptr, ptr %33, align 8
  %35 = call noundef i32 %34(ptr noundef nonnull align 8 dereferenceable(8) %31, i32 noundef 15, i1 noundef zeroext false)
  store i32 %35, ptr %4, align 4, !tbaa !5
  %36 = getelementptr inbounds %class.OMP_Team, ptr %3, i32 0, i32 0
  %37 = call noundef i32 @_ZN3tbb6atomicIjEaSEj(ptr noundef nonnull align 4 dereferenceable(4) %36, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 120, ptr %5) #4
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %40, label %47

40:                                               ; preds = %29
  %41 = load ptr, ptr getelementptr inbounds (%class.RunTime.4, ptr @OMP_RunTime, i32 0, i32 2), align 8, !tbaa !16
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = getelementptr inbounds [15 x ptr], ptr %5, i64 0, i64 0
  %44 = load ptr, ptr %41, align 8, !tbaa !14
  %45 = getelementptr inbounds ptr, ptr %44, i64 8
  %46 = load ptr, ptr %45, align 8
  call void %46(ptr noundef nonnull align 8 dereferenceable(8) %41, i32 noundef %42, ptr noundef %3, ptr noundef %43)
  br label %47

47:                                               ; preds = %40, %29
  call void @_Z7OMPWorkv()
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %50, label %59

50:                                               ; preds = %47
  br label %51

51:                                               ; preds = %56, %50
  %52 = getelementptr inbounds %class.OMP_Team, ptr %3, i32 0, i32 0
  %53 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %52)
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = icmp ne i32 %53, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %51
  %57 = call i32 @sched_yield() #4
  br label %51, !llvm.loop !19

58:                                               ; preds = %51
  br label %59

59:                                               ; preds = %58, %47
  call void @llvm.lifetime.end.p0(i64 120, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %2, align 4, !tbaa !5
  br label %25, !llvm.loop !21

63:                                               ; preds = %28
  %64 = call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) @CompletionCount)
  br label %65

65:                                               ; preds = %63, %21
  br label %66

66:                                               ; preds = %65, %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %67

67:                                               ; preds = %66, %0
  ret void
}

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

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

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

; Function Attrs: nounwind
declare i32 @sched_yield() #3

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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 48}
!10 = !{!"_ZTS7RunTimeIN3tbb8internal3rml11tbb_factoryE10TBB_ClientE", !11, i64 0, !13, i64 40, !13, i64 48}
!11 = !{!"_ZTSN3tbb8internal3rml11tbb_factoryE", !12, i64 0, !13, i64 24, !13, i64 32}
!12 = !{!"_ZTSN3rml7factoryE", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !8, i64 0}
!16 = !{!17, !13, i64 48}
!17 = !{!"_ZTS7RunTimeIN5__kmp3rml11omp_factoryE10OMP_ClientE", !18, i64 0, !13, i64 40, !13, i64 48}
!18 = !{!"_ZTSN5__kmp3rml11omp_factoryE", !12, i64 0, !13, i64 24, !13, i64 32}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; 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.RunTime = type { %"class.tbb::internal::rml::tbb_factory", ptr, ptr }
%"class.tbb::internal::rml::tbb_factory" = type { %"class.rml::factory", ptr, ptr }
%"class.rml::factory" = type { ptr, ptr, ptr }
%class.RunTime.4 = type { %"class.__kmp::rml::omp_factory", ptr, ptr }
%"class.__kmp::rml::omp_factory" = type { %"class.rml::factory", ptr, ptr }
%"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 { i32 }
%class.OMP_Team = type { %"struct.tbb::atomic.0" }
%"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 { i32 }

@TBB_MaxThread = external dso_local local_unnamed_addr global i32, align 4
@TBB_RunTime = external dso_local local_unnamed_addr global %class.RunTime, align 8
@OMP_RunTime = external dso_local local_unnamed_addr global %class.RunTime.4, align 8
@AvailWork = external dso_local global %"struct.tbb::atomic", align 4
@CompletionCount = external dso_local global %"struct.tbb::atomic", align 4

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7OMPWorkv() local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7TBBWorkv() local_unnamed_addr #1 {
  %1 = alloca %class.OMP_Team, align 4
  %2 = alloca [15 x ptr], align 16
  %3 = tail call noundef i32 @_ZNVK3tbb8internal11atomic_implIiEcviEv(ptr noundef nonnull align 4 dereferenceable(4) @AvailWork)
  %4 = icmp sgt i32 %3, -1
  br i1 %4, label %5, label %83

5:                                                ; preds = %0
  %6 = tail call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEmmEv(ptr noundef nonnull align 4 dereferenceable(4) @AvailWork)
  %7 = icmp eq i32 %6, -1
  br i1 %7, label %8, label %16

8:                                                ; preds = %5
  %9 = load ptr, ptr getelementptr inbounds (i8, ptr @TBB_RunTime, i64 48), align 8, !tbaa !5
  %10 = load i32, ptr @TBB_MaxThread, align 4, !tbaa !12
  %11 = sub nsw i32 1, %10
  %12 = load ptr, ptr %9, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %12, i64 40
  %14 = load ptr, ptr %13, align 8
  tail call void %14(ptr noundef nonnull align 8 dereferenceable(8) %9, i32 noundef %11)
  %15 = tail call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) @CompletionCount)
  br label %83

16:                                               ; preds = %5
  %17 = icmp sgt i32 %6, -1
  br i1 %17, label %.preheader.preheader, label %83

.preheader.preheader:                             ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %18 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  call void @_ZN8OMP_TeamC2ERN5__kmp3rml10omp_serverE(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 8 dereferenceable(8) %18)
  %19 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %20, i64 48
  %22 = load ptr, ptr %21, align 8
  %23 = call noundef i32 %22(ptr noundef nonnull align 8 dereferenceable(8) %19, i32 noundef 15, i1 noundef zeroext false)
  %24 = call noundef i32 @_ZN3tbb6atomicIjEaSEj(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %2) #4
  %25 = icmp sgt i32 %23, 0
  br i1 %25, label %26, label %.critedge

26:                                               ; preds = %.preheader.preheader
  %27 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %28, i64 64
  %30 = load ptr, ptr %29, align 8
  call void %30(ptr noundef nonnull align 8 dereferenceable(8) %27, i32 noundef %23, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @_Z7OMPWorkv()
  %31 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not10 = icmp eq i32 %31, %23
  br i1 %.not10, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %26, %.lr.ph
  %32 = call i32 @sched_yield() #4
  %33 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not = icmp eq i32 %33, %23
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !19

.critedge:                                        ; preds = %.preheader.preheader
  call void @_Z7OMPWorkv()
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %26, %.critedge
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %34 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  call void @_ZN8OMP_TeamC2ERN5__kmp3rml10omp_serverE(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 8 dereferenceable(8) %34)
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = getelementptr inbounds i8, ptr %36, i64 48
  %38 = load ptr, ptr %37, align 8
  %39 = call noundef i32 %38(ptr noundef nonnull align 8 dereferenceable(8) %35, i32 noundef 15, i1 noundef zeroext false)
  %40 = call noundef i32 @_ZN3tbb6atomicIjEaSEj(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %2) #4
  %41 = icmp sgt i32 %39, 0
  br i1 %41, label %42, label %.critedge.1

.critedge.1:                                      ; preds = %.loopexit
  call void @_Z7OMPWorkv()
  br label %.loopexit.1

42:                                               ; preds = %.loopexit
  %43 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %44 = load ptr, ptr %43, align 8, !tbaa !14
  %45 = getelementptr inbounds i8, ptr %44, i64 64
  %46 = load ptr, ptr %45, align 8
  call void %46(ptr noundef nonnull align 8 dereferenceable(8) %43, i32 noundef %39, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @_Z7OMPWorkv()
  %47 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not10.1 = icmp eq i32 %47, %39
  br i1 %.not10.1, label %.loopexit.1, label %.lr.ph.1

.lr.ph.1:                                         ; preds = %42, %.lr.ph.1
  %48 = call i32 @sched_yield() #4
  %49 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not.1 = icmp eq i32 %49, %39
  br i1 %.not.1, label %.loopexit.1, label %.lr.ph.1, !llvm.loop !19

.loopexit.1:                                      ; preds = %.lr.ph.1, %42, %.critedge.1
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %50 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  call void @_ZN8OMP_TeamC2ERN5__kmp3rml10omp_serverE(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 8 dereferenceable(8) %50)
  %51 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %52 = load ptr, ptr %51, align 8, !tbaa !14
  %53 = getelementptr inbounds i8, ptr %52, i64 48
  %54 = load ptr, ptr %53, align 8
  %55 = call noundef i32 %54(ptr noundef nonnull align 8 dereferenceable(8) %51, i32 noundef 15, i1 noundef zeroext false)
  %56 = call noundef i32 @_ZN3tbb6atomicIjEaSEj(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %2) #4
  %57 = icmp sgt i32 %55, 0
  br i1 %57, label %58, label %.critedge.2

.critedge.2:                                      ; preds = %.loopexit.1
  call void @_Z7OMPWorkv()
  br label %.loopexit.2

58:                                               ; preds = %.loopexit.1
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = getelementptr inbounds i8, ptr %60, i64 64
  %62 = load ptr, ptr %61, align 8
  call void %62(ptr noundef nonnull align 8 dereferenceable(8) %59, i32 noundef %55, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @_Z7OMPWorkv()
  %63 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not10.2 = icmp eq i32 %63, %55
  br i1 %.not10.2, label %.loopexit.2, label %.lr.ph.2

.lr.ph.2:                                         ; preds = %58, %.lr.ph.2
  %64 = call i32 @sched_yield() #4
  %65 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not.2 = icmp eq i32 %65, %55
  br i1 %.not.2, label %.loopexit.2, label %.lr.ph.2, !llvm.loop !19

.loopexit.2:                                      ; preds = %.lr.ph.2, %58, %.critedge.2
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %66 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  call void @_ZN8OMP_TeamC2ERN5__kmp3rml10omp_serverE(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 8 dereferenceable(8) %66)
  %67 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %68 = load ptr, ptr %67, align 8, !tbaa !14
  %69 = getelementptr inbounds i8, ptr %68, i64 48
  %70 = load ptr, ptr %69, align 8
  %71 = call noundef i32 %70(ptr noundef nonnull align 8 dereferenceable(8) %67, i32 noundef 15, i1 noundef zeroext false)
  %72 = call noundef i32 @_ZN3tbb6atomicIjEaSEj(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %2) #4
  %73 = icmp sgt i32 %71, 0
  br i1 %73, label %74, label %.critedge.3

.critedge.3:                                      ; preds = %.loopexit.2
  call void @_Z7OMPWorkv()
  br label %.loopexit.3

74:                                               ; preds = %.loopexit.2
  %75 = load ptr, ptr getelementptr inbounds (i8, ptr @OMP_RunTime, i64 48), align 8, !tbaa !16
  %76 = load ptr, ptr %75, align 8, !tbaa !14
  %77 = getelementptr inbounds i8, ptr %76, i64 64
  %78 = load ptr, ptr %77, align 8
  call void %78(ptr noundef nonnull align 8 dereferenceable(8) %75, i32 noundef %71, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @_Z7OMPWorkv()
  %79 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not10.3 = icmp eq i32 %79, %71
  br i1 %.not10.3, label %.loopexit.3, label %.lr.ph.3

.lr.ph.3:                                         ; preds = %74, %.lr.ph.3
  %80 = call i32 @sched_yield() #4
  %81 = call noundef i32 @_ZNVK3tbb8internal11atomic_implIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not.3 = icmp eq i32 %81, %71
  br i1 %.not.3, label %.loopexit.3, label %.lr.ph.3, !llvm.loop !19

.loopexit.3:                                      ; preds = %.lr.ph.3, %74, %.critedge.3
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %82 = call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) @CompletionCount)
  br label %83

83:                                               ; preds = %8, %.loopexit.3, %16, %0
  ret void
}

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

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

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

; Function Attrs: nounwind
declare i32 @sched_yield() local_unnamed_addr #3

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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !9, i64 48}
!6 = !{!"_ZTS7RunTimeIN3tbb8internal3rml11tbb_factoryE10TBB_ClientE", !7, i64 0, !9, i64 40, !9, i64 48}
!7 = !{!"_ZTSN3tbb8internal3rml11tbb_factoryE", !8, i64 0, !9, i64 24, !9, i64 32}
!8 = !{!"_ZTSN3rml7factoryE", !9, i64 0, !9, i64 8, !9, i64 16}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !10, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !11, i64 0}
!16 = !{!17, !9, i64 48}
!17 = !{!"_ZTS7RunTimeIN5__kmp3rml11omp_factoryE10OMP_ClientE", !18, i64 0, !9, i64 40, !9, i64 48}
!18 = !{!"_ZTSN5__kmp3rml11omp_factoryE", !8, i64 0, !9, i64 24, !9, i64 32}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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