; LLVM IR from kmilo17pet/QuarkTS-cpp :: check/simple_dry_test.ll (Z9otherTaskRN3qOS9taskEventE)

; 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.qOS::co::handle" = type { i32, ptr }
%"class.qOS::co::semaphore" = type { i64 }
%"class.qOS::co::coContext" = type { i32, %"class.qOS::timer" }
%"class.qOS::timer" = type { ptr, i64, i64 }
%"struct.qOS::logger::source_location" = type { ptr, ptr, i64, i64 }

@__dso_handle = external hidden global i8
@.str = external hidden unnamed_addr constant [82 x i8], align 1
@_ZN3qOS6logger3endE = external constant ptr, align 8
@otherTaskCrHandle = external dso_local global %"class.qOS::co::handle", align 8
@sem = external dso_local global %"class.qOS::co::semaphore", align 8
@.str.26 = external hidden unnamed_addr constant [10 x i8], align 1
@_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx = external hidden global %"class.qOS::co::coContext", align 8
@_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx = external hidden global i64, align 8

; Function Attrs: nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) #0

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

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

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger3outENS0_11logSeverityERKNS0_15source_locationE(i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3qOS6logger15source_location7currentEPKcS3_mm(ptr dead_on_unwind noalias writable sret(%"struct.qOS::logger::source_location") align 8, ptr noundef, ptr noundef, i64 noundef, i64 noundef) #4 align 2

declare noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef) #5

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

declare noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(150)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(150) ptr @_ZN3qOS9taskEvent8thisTaskEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3qOS2co7reenterEv() #2

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #0

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare void @__cxa_guard_abort(ptr) #0

; Function Attrs: nounwind
declare void @__cxa_guard_release(ptr) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3qOS2co9coContextneEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3qOS2co9coContextclEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS2co9coContextaSEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3qOS2co7restartEv() #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9otherTaskRN3qOS9taskEventE(ptr noundef nonnull align 8 dereferenceable(48) %0) #6 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.qOS::logger::source_location", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = call noundef zeroext i1 @_ZNK3qOS9taskEvent9firstCallEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #0
  br i1 %7, label %8, label %15

8:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #0
  call void @_ZN3qOS6logger15source_location7currentEPKcS3_mm(ptr dead_on_unwind writable sret(%"struct.qOS::logger::source_location") align 8 %3, ptr noundef @.str, ptr noundef @.str.26, i64 noundef 109, i64 noundef 9) #0
  %9 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger3outENS0_11logSeverityERKNS0_15source_locationE(i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(32) %3) #0
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call noundef nonnull align 8 dereferenceable(150) ptr @_ZN3qOS9taskEvent8thisTaskEv(ptr noundef nonnull align 8 dereferenceable(48) %10) #0
  %12 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(128) %9, ptr noundef nonnull align 8 dereferenceable(150) %11)
  %13 = load ptr, ptr @_ZN3qOS6logger3endE, align 8, !tbaa !5
  %14 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(128) %12, ptr noundef %13)
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #0
  br label %15

15:                                               ; preds = %8, %1
  call void @_ZN3qOS2co7reenterEv() #0
  %16 = load atomic i8, ptr @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx acquire, align 8
  %17 = icmp eq i8 %16, 0
  br i1 %17, label %18, label %24, !prof !9

18:                                               ; preds = %15
  %19 = call i32 @__cxa_guard_acquire(ptr @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx) #0
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %18
  invoke void @_ZN3qOS2co9coContextC2Ev(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx)
          to label %22 unwind label %29

22:                                               ; preds = %21
  %23 = call i32 @__cxa_atexit(ptr @_ZN3qOS2co9coContextD2Ev, ptr @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx) #0
  br label %24

24:                                               ; preds = %22, %18, %15
  call void @_ZN3qOS2co9coContext10saveHandleERNS0_6handleE(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, ptr noundef nonnull align 8 dereferenceable(16) @otherTaskCrHandle) #0
  br label %25

25:                                               ; preds = %54, %24
  %26 = call noundef zeroext i1 @_ZNK3qOS2co9coContextneEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef -1)
  br i1 %26, label %27, label %56

27:                                               ; preds = %25
  br i1 false, label %28, label %34

28:                                               ; preds = %27
  br label %33

29:                                               ; preds = %21
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %4, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %5, align 4
  call void @__cxa_guard_abort(ptr @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx) #0
  br label %57

33:                                               ; preds = %28
  br label %54

34:                                               ; preds = %27
  br i1 false, label %35, label %37

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %49, %47, %39, %35
  br label %56

37:                                               ; preds = %34
  %38 = call noundef i32 @_ZNK3qOS2co9coContextclEv(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx)
  switch i32 %38, label %51 [
    i32 0, label %39
    i32 113, label %45
  ]

39:                                               ; preds = %37
  call void @_ZN3qOS2co7restartEv() #0
  %40 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS2co9coContextaSEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef 0)
  br label %36

41:                                               ; No predecessors!
  %42 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS2co9coContextaSEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef 113)
  br label %43

43:                                               ; preds = %41
  br i1 false, label %44, label %49

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44, %37
  %46 = call noundef zeroext i1 @_ZN3qOS2co9coContext10semTrylockERNS0_9semaphoreE(ptr noundef nonnull align 8 dereferenceable(8) @sem) #0
  br i1 %46, label %48, label %47

47:                                               ; preds = %45
  br label %36

48:                                               ; preds = %45
  br label %50

49:                                               ; preds = %43
  br label %36

50:                                               ; preds = %48
  call void @_ZN3qOS2co9semSignalERNS0_9semaphoreE(ptr noundef nonnull align 8 dereferenceable(8) @sem) #0
  call void @_ZN3qOS2co9coContext9semSignalERNS0_9semaphoreE(ptr noundef nonnull align 8 dereferenceable(8) @sem) #0
  br label %51

51:                                               ; preds = %50, %37
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53, %33
  %55 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS2co9coContextaSEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef -1)
  br label %25, !llvm.loop !10

56:                                               ; preds = %36, %25
  ret void

57:                                               ; preds = %29
  %58 = load ptr, ptr %4, align 8
  %59 = load i32, ptr %5, align 4
  %60 = insertvalue { ptr, i32 } poison, ptr %58, 0
  %61 = insertvalue { ptr, i32 } %60, i32 %59, 1
  resume { ptr, i32 } %61
}

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

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

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

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

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

!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 = !{!"branch_weights", i32 1, i32 1048575}
!10 = distinct !{!10, !11}
!11 = !{!"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.qOS::co::handle" = type { i32, ptr }
%"class.qOS::co::semaphore" = type { i64 }
%"class.qOS::co::coContext" = type { i32, %"class.qOS::timer" }
%"class.qOS::timer" = type { ptr, i64, i64 }
%"struct.qOS::logger::source_location" = type { ptr, ptr, i64, i64 }

@__dso_handle = external hidden global i8
@.str = external hidden unnamed_addr constant [82 x i8], align 1
@_ZN3qOS6logger3endE = external local_unnamed_addr constant ptr, align 8
@otherTaskCrHandle = external dso_local global %"class.qOS::co::handle", align 8
@sem = external dso_local global %"class.qOS::co::semaphore", align 8
@.str.26 = external hidden unnamed_addr constant [10 x i8], align 1
@_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx = external hidden global %"class.qOS::co::coContext", align 8
@_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx = external hidden global i64, align 8

; Function Attrs: nofree nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) local_unnamed_addr #0

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

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

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger3outENS0_11logSeverityERKNS0_15source_locationE(i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3qOS6logger15source_location7currentEPKcS3_mm(ptr dead_on_unwind noalias writable sret(%"struct.qOS::logger::source_location") align 8, ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #4 align 2

declare noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef) local_unnamed_addr #5

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

declare noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 8 dereferenceable(150)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(150) ptr @_ZN3qOS9taskEvent8thisTaskEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3qOS2co7reenterEv() local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #0

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3qOS2co9coContextneEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3qOS2co9coContextclEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS2co9coContextaSEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3qOS2co7restartEv() local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9otherTaskRN3qOS9taskEventE(ptr noundef nonnull align 8 dereferenceable(48) %0) local_unnamed_addr #6 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"struct.qOS::logger::source_location", align 8
  %3 = tail call noundef zeroext i1 @_ZNK3qOS9taskEvent9firstCallEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #7
  br i1 %3, label %4, label %10

4:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  call void @_ZN3qOS6logger15source_location7currentEPKcS3_mm(ptr dead_on_unwind nonnull writable sret(%"struct.qOS::logger::source_location") align 8 %2, ptr noundef nonnull @.str, ptr noundef nonnull @.str.26, i64 noundef 109, i64 noundef 9) #7
  %5 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger3outENS0_11logSeverityERKNS0_15source_locationE(i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  %6 = call noundef nonnull align 8 dereferenceable(150) ptr @_ZN3qOS9taskEvent8thisTaskEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #7
  %7 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(128) %5, ptr noundef nonnull align 8 dereferenceable(150) %6)
  %8 = load ptr, ptr @_ZN3qOS6logger3endE, align 8, !tbaa !5
  %9 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZN3qOS6logger7_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(128) %7, ptr noundef %8)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  br label %10

10:                                               ; preds = %4, %1
  call void @_ZN3qOS2co7reenterEv() #7
  %11 = load atomic i8, ptr @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx acquire, align 8
  %12 = icmp eq i8 %11, 0
  br i1 %12, label %13, label %18, !prof !9

13:                                               ; preds = %10
  %14 = call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx) #7
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %18, label %15

15:                                               ; preds = %13
  invoke void @_ZN3qOS2co9coContextC2Ev(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx)
          to label %16 unwind label %20

16:                                               ; preds = %15
  %17 = call i32 @__cxa_atexit(ptr nonnull @_ZN3qOS2co9coContextD2Ev, ptr nonnull @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, ptr nonnull @__dso_handle) #7
  call void @__cxa_guard_release(ptr nonnull @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx) #7
  br label %18

18:                                               ; preds = %16, %13, %10
  call void @_ZN3qOS2co9coContext10saveHandleERNS0_6handleE(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, ptr noundef nonnull align 8 dereferenceable(16) @otherTaskCrHandle) #7
  %19 = call noundef zeroext i1 @_ZNK3qOS2co9coContextneEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef -1)
  br i1 %19, label %.lr.ph, label %.loopexit

20:                                               ; preds = %15
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_guard_abort(ptr nonnull @_ZGVZ9otherTaskRN3qOS9taskEventEE6co_ctx) #7
  resume { ptr, i32 } %21

.lr.ph:                                           ; preds = %18, %28
  %22 = call noundef i32 @_ZNK3qOS2co9coContextclEv(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx)
  switch i32 %22, label %28 [
    i32 0, label %23
    i32 113, label %25
  ]

23:                                               ; preds = %.lr.ph
  call void @_ZN3qOS2co7restartEv() #7
  %24 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS2co9coContextaSEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef 0)
  br label %.loopexit

25:                                               ; preds = %.lr.ph
  %26 = call noundef zeroext i1 @_ZN3qOS2co9coContext10semTrylockERNS0_9semaphoreE(ptr noundef nonnull align 8 dereferenceable(8) @sem) #7
  br i1 %26, label %27, label %.loopexit

27:                                               ; preds = %25
  call void @_ZN3qOS2co9semSignalERNS0_9semaphoreE(ptr noundef nonnull align 8 dereferenceable(8) @sem) #7
  call void @_ZN3qOS2co9coContext9semSignalERNS0_9semaphoreE(ptr noundef nonnull align 8 dereferenceable(8) @sem) #7
  br label %28

28:                                               ; preds = %.lr.ph, %27
  %29 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS2co9coContextaSEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef -1)
  %30 = call noundef zeroext i1 @_ZNK3qOS2co9coContextneEi(ptr noundef nonnull align 8 dereferenceable(32) @_ZZ9otherTaskRN3qOS9taskEventEE6co_ctx, i32 noundef -1)
  br i1 %30, label %.lr.ph, label %.loopexit, !llvm.loop !10

.loopexit:                                        ; preds = %28, %25, %18, %23
  ret void
}

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

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

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

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

attributes #0 = { nofree nounwind }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 = { "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 = { 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 #7 = { 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 = !{!"branch_weights", i32 1, i32 1048575}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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