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

; 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.Harness::internal::Tracer" = type <{ i32, [4 x i8], ptr, ptr, i64, [8 x i8] }>
%class.State = type <{ %"class.Harness::SpinBarrier", %"class.rml::internal::job_automaton", %"class.rml::job", %"struct.tbb::atomic", %"struct.tbb::atomic", %"struct.tbb::atomic.8", [7 x i8] }>
%"class.Harness::SpinBarrier" = type <{ i32, %"struct.tbb::atomic.0", %"struct.tbb::atomic.0", i8, [3 x i8] }>
%"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 }
%"class.rml::internal::job_automaton" = type { %"struct.tbb::atomic.4" }
%"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 }
%"class.rml::job" = type { 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 }
%"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 { i8 }

@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@DelayMask = external dso_local global i32, align 4
@.str.17 = external hidden unnamed_addr constant [98 x i8], align 1
@__FUNCTION__._ZN5State8exerciseEb = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, ...) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5Coveri(i32 noundef) #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5State8exerciseEb(ptr noundef nonnull align 8 dereferenceable(41) %0, i1 noundef zeroext %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = zext i1 %1 to i8
  store i8 %7, ptr %4, align 1, !tbaa !9
  %8 = load ptr, ptr %3, align 8
  %9 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 0
  %10 = call noundef zeroext i1 @_ZN7Harness11SpinBarrier4waitEv(ptr noundef nonnull align 4 dereferenceable(13) %9)
  %11 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %12 = trunc i8 %11 to i1
  br i1 %12, label %13, label %45

13:                                               ; preds = %2
  call void @_Z5Coveri(i32 noundef 0)
  %14 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  %15 = call noundef zeroext i1 @_ZN3rml8internal13job_automaton11try_acquireEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
  br i1 %15, label %16, label %31

16:                                               ; preds = %13
  call void @_Z5Coveri(i32 noundef 1)
  %17 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 3
  %18 = call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) %17)
  %19 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  %20 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 2
  call void @_ZN3rml8internal13job_automaton15set_and_releaseEPNS_3jobE(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef %20)
  call void @_Z5Coveri(i32 noundef 2)
  %21 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  %22 = call noundef zeroext i1 @_ZN3rml8internal13job_automaton11try_acquireEv(ptr noundef nonnull align 8 dereferenceable(8) %21)
  br i1 %22, label %23, label %30

23:                                               ; preds = %16
  call void @_Z5Coveri(i32 noundef 3)
  %24 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  call void @_ZN3rml8internal13job_automaton7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
  call void @_Z5Coveri(i32 noundef 4)
  %25 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  %26 = call noundef zeroext i1 @_ZN3rml8internal13job_automaton11try_acquireEv(ptr noundef nonnull align 8 dereferenceable(8) %25)
  br i1 %26, label %27, label %29

27:                                               ; preds = %23
  call void @_Z5Coveri(i32 noundef 5)
  %28 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  call void @_ZN3rml8internal13job_automaton7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %28)
  br label %29

29:                                               ; preds = %27, %23
  br label %30

30:                                               ; preds = %29, %16
  call void @_Z5Coveri(i32 noundef 6)
  br label %32

31:                                               ; preds = %13
  call void @_Z5Coveri(i32 noundef 7)
  br label %32

32:                                               ; preds = %31, %30
  %33 = load i32, ptr @DelayMask, align 4, !tbaa !13
  %34 = and i32 %33, 16384
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %44

36:                                               ; preds = %32
  br label %37

37:                                               ; preds = %41, %36
  %38 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 5
  %39 = call noundef zeroext i1 @_ZNVK3tbb8internal11atomic_implIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %38)
  %40 = xor i1 %39, true
  br i1 %40, label %41, label %43

41:                                               ; preds = %37
  %42 = call i32 @sched_yield() #4
  br label %37, !llvm.loop !15

43:                                               ; preds = %37
  br label %44

44:                                               ; preds = %43, %32
  br label %68

45:                                               ; preds = %2
  %46 = load i32, ptr @DelayMask, align 4, !tbaa !13
  %47 = and i32 %46, 16384
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %67

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %50 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  %51 = call noundef ptr @_ZNK3rml8internal13job_automaton12wait_for_jobEv(ptr noundef nonnull align 8 dereferenceable(8) %50)
  store ptr %51, ptr %5, align 8, !tbaa !5
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 2
  %54 = icmp ne ptr %52, %53
  br i1 %54, label %55, label %58

55:                                               ; preds = %49
  %56 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef @.str.17, i64 noundef 92, ptr noundef @__FUNCTION__._ZN5State8exerciseEb)
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %56, ptr noundef @.str.19, ptr noundef %57)
  br label %58

58:                                               ; preds = %55, %49
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 2
  %61 = icmp eq ptr %59, %60
  br i1 %61, label %62, label %63

62:                                               ; preds = %58
  br label %64

63:                                               ; preds = %58
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 93, ptr noundef @.str.20, ptr noundef null)
  br label %64

64:                                               ; preds = %63, %62
  %65 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 5
  %66 = call noundef zeroext i1 @_ZN3tbb6atomicIbEaSEb(ptr noundef nonnull align 1 dereferenceable(1) %65, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %67

67:                                               ; preds = %64, %45
  call void @_Z5Coveri(i32 noundef 8)
  br label %68

68:                                               ; preds = %67, %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %69 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 1
  %70 = call noundef zeroext i1 @_ZN3rml8internal13job_automaton8try_plugERPNS_3jobE(ptr noundef nonnull align 8 dereferenceable(8) %69, ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %70, label %71, label %92

71:                                               ; preds = %68
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 2
  %74 = icmp eq ptr %72, %73
  br i1 %74, label %78, label %75

75:                                               ; preds = %71
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = icmp ne ptr %76, null
  br i1 %77, label %79, label %78

78:                                               ; preds = %75, %71
  br label %80

79:                                               ; preds = %75
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 100, ptr noundef @.str.21, ptr noundef null)
  br label %80

80:                                               ; preds = %79, %78
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = icmp ne ptr %81, null
  br i1 %82, label %83, label %90

83:                                               ; preds = %80
  %84 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %85 = trunc i8 %84 to i1
  %86 = zext i1 %85 to i32
  %87 = add nsw i32 9, %86
  call void @_Z5Coveri(i32 noundef %87)
  %88 = getelementptr inbounds %class.State, ptr %8, i32 0, i32 4
  %89 = call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) %88)
  br label %91

90:                                               ; preds = %80
  call void @_Z5Coveri(i32 noundef 11)
  br label %91

91:                                               ; preds = %90, %83
  br label %97

92:                                               ; preds = %68
  %93 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %94 = trunc i8 %93 to i1
  %95 = zext i1 %94 to i32
  %96 = add nsw i32 12, %95
  call void @_Z5Coveri(i32 noundef %96)
  br label %97

97:                                               ; preds = %92, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Harness11SpinBarrier4waitEv(ptr noundef nonnull align 4 dereferenceable(13)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3rml8internal13job_automaton11try_acquireEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNVK3tbb8internal11atomic_implIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3tbb6atomicIbEaSEb(ptr noundef nonnull align 1 dereferenceable(1), i1 noundef zeroext) #2 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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.Harness::internal::Tracer" = type <{ i32, [4 x i8], ptr, ptr, i64, [8 x i8] }>

@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@DelayMask = external dso_local local_unnamed_addr global i32, align 4
@.str.17 = external hidden unnamed_addr constant [98 x i8], align 1
@__FUNCTION__._ZN5State8exerciseEb = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [14 x i8], align 1

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33), i32 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, ...) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5Coveri(i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5State8exerciseEb(ptr noundef nonnull align 8 dereferenceable(41) %0, i1 noundef zeroext %1) local_unnamed_addr #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = tail call noundef zeroext i1 @_ZN7Harness11SpinBarrier4waitEv(ptr noundef nonnull align 4 dereferenceable(13) %0)
  br i1 %1, label %5, label %23

5:                                                ; preds = %2
  tail call void @_Z5Coveri(i32 noundef 0)
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = tail call noundef zeroext i1 @_ZN3rml8internal13job_automaton11try_acquireEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %7, label %8, label %16

8:                                                ; preds = %5
  tail call void @_Z5Coveri(i32 noundef 1)
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = tail call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) %9)
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN3rml8internal13job_automaton15set_and_releaseEPNS_3jobE(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull %11)
  tail call void @_Z5Coveri(i32 noundef 2)
  %12 = tail call noundef zeroext i1 @_ZN3rml8internal13job_automaton11try_acquireEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %12, label %13, label %16

13:                                               ; preds = %8
  tail call void @_Z5Coveri(i32 noundef 3)
  tail call void @_ZN3rml8internal13job_automaton7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  tail call void @_Z5Coveri(i32 noundef 4)
  %14 = tail call noundef zeroext i1 @_ZN3rml8internal13job_automaton11try_acquireEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %14, label %15, label %16

15:                                               ; preds = %13
  tail call void @_Z5Coveri(i32 noundef 5)
  tail call void @_ZN3rml8internal13job_automaton7releaseEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br label %16

16:                                               ; preds = %5, %8, %15, %13
  %.sink = phi i32 [ 6, %13 ], [ 6, %15 ], [ 6, %8 ], [ 7, %5 ]
  tail call void @_Z5Coveri(i32 noundef %.sink)
  %17 = load i32, ptr @DelayMask, align 4, !tbaa !5
  %18 = and i32 %17, 16384
  %.not8 = icmp eq i32 %18, 0
  br i1 %.not8, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %16
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  %20 = tail call noundef zeroext i1 @_ZNVK3tbb8internal11atomic_implIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %19)
  br i1 %20, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %21 = tail call i32 @sched_yield() #4
  %22 = tail call noundef zeroext i1 @_ZNVK3tbb8internal11atomic_implIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %19)
  br i1 %22, label %.loopexit, label %.lr.ph, !llvm.loop !9

23:                                               ; preds = %2
  %24 = load i32, ptr @DelayMask, align 4, !tbaa !5
  %25 = and i32 %24, 16384
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %34, label %26

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = tail call noundef ptr @_ZNK3rml8internal13job_automaton12wait_for_jobEv(ptr noundef nonnull align 8 dereferenceable(8) %27)
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  %.not7 = icmp eq ptr %28, %29
  br i1 %.not7, label %.thread, label %30

30:                                               ; preds = %26
  %31 = tail call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef nonnull @.str.17, i64 noundef 92, ptr noundef nonnull @__FUNCTION__._ZN5State8exerciseEb)
  tail call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %31, ptr noundef nonnull @.str.19, ptr noundef %28)
  tail call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 93, ptr noundef nonnull @.str.20, ptr noundef null)
  br label %.thread

.thread:                                          ; preds = %26, %30
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  %33 = tail call noundef zeroext i1 @_ZN3tbb6atomicIbEaSEb(ptr noundef nonnull align 1 dereferenceable(1) %32, i1 noundef zeroext true)
  br label %34

34:                                               ; preds = %.thread, %23
  tail call void @_Z5Coveri(i32 noundef 8)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %.preheader, %16, %34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = call noundef zeroext i1 @_ZN3rml8internal13job_automaton8try_plugERPNS_3jobE(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %36, label %37, label %50

37:                                               ; preds = %.loopexit
  %38 = load ptr, ptr %3, align 8
  %39 = getelementptr inbounds i8, ptr %0, i64 24
  %40 = icmp ne ptr %38, %39
  %41 = icmp ne ptr %38, null
  %or.cond = and i1 %40, %41
  br i1 %or.cond, label %42, label %43

42:                                               ; preds = %37
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 100, ptr noundef nonnull @.str.21, ptr noundef null)
  %.pr = load ptr, ptr %3, align 8, !tbaa !11
  br label %43

43:                                               ; preds = %37, %42
  %44 = phi ptr [ %38, %37 ], [ %.pr, %42 ]
  %.not9 = icmp eq ptr %44, null
  br i1 %.not9, label %49, label %45

45:                                               ; preds = %43
  %46 = select i1 %1, i32 10, i32 9
  call void @_Z5Coveri(i32 noundef %46)
  %47 = getelementptr inbounds i8, ptr %0, i64 36
  %48 = call noundef i32 @_ZN3tbb8internal27atomic_impl_with_arithmeticIiicEppEv(ptr noundef nonnull align 4 dereferenceable(4) %47)
  br label %52

49:                                               ; preds = %43
  call void @_Z5Coveri(i32 noundef 11)
  br label %52

50:                                               ; preds = %.loopexit
  %51 = select i1 %1, i32 13, i32 12
  call void @_Z5Coveri(i32 noundef %51)
  br label %52

52:                                               ; preds = %45, %49, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Harness11SpinBarrier4waitEv(ptr noundef nonnull align 4 dereferenceable(13)) local_unnamed_addr #2 align 2

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

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

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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