; LLVM IR from kmilo17pet/QuarkTS-cpp :: src/kernel.ll (ZN3qOS4core12checkIfReadyEv)

; 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::listIterator" = type { ptr, ptr, ptr, ptr }
%"class.qOS::core" = type { %"class.qOS::taskEvent", %"class.qOS::task", ptr, ptr, [10 x %"struct.qOS::pq::queueStack_t"], %"class.qOS::prioQueue", i32, %"struct.qOS::notificationSpreader_t", i64, [5 x %"class.qOS::list"], ptr, ptr, %"class.qOS::list" }
%"class.qOS::taskEvent" = type { ptr, i8, i8, i8, i8, i64, ptr, ptr, ptr }
%"class.qOS::task" = type <{ %"class.qOS::node", ptr, ptr, ptr, ptr, ptr, i64, [11 x i8], [5 x i8], %"class.qOS::timer", i32, [4 x i8], i64, i32, i32, i32, i8, i8, [2 x i8] }>
%"class.qOS::node" = type { ptr, ptr, ptr, ptr }
%"class.qOS::timer" = type { ptr, i64, i64 }
%"struct.qOS::pq::queueStack_t" = type { ptr, ptr }
%"class.qOS::prioQueue" = type { ptr, i32, ptr, ptr, i64 }
%"struct.qOS::notificationSpreader_t" = type { i8, ptr }
%"class.qOS::list" = type { %"class.qOS::node", ptr, ptr, i64 }

@_ZN3qOS4task12BIT_SHUTDOWNE = external constant i32, align 4
@_ZN3qOS4task18BIT_REMOVE_REQUESTE = external constant i32, align 4
@_ZN3qOS4task16EVENT_FLAGS_MASKE = external constant i32, align 4

; Function Attrs: nounwind
declare void @_ZN3qOS4task8setFlagsEjb(ptr noundef nonnull align 8 dereferenceable(150), i32 noundef, i1 noundef zeroext) #0

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN3qOS4list6insertEPvNS_12listPositionE(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN3qOS4core12checkIfReadyEv(ptr noundef nonnull align 8 dereferenceable(800) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca %"class.qOS::listIterator", align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  store i8 0, ptr %3, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %10 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 5
  %11 = call noundef ptr @_ZN3qOS9prioQueue3getEv(ptr noundef nonnull align 8 dereferenceable(40) %10) #4
  store ptr %11, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp ne ptr null, %12
  br i1 %13, label %14, label %19

14:                                               ; preds = %1
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %"class.qOS::task", ptr %15, i32 0, i32 17
  store i8 2, ptr %16, align 1, !tbaa !11
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load i32, ptr @_ZN3qOS4task12BIT_SHUTDOWNE, align 4, !tbaa !18
  call void @_ZN3qOS4task8setFlagsEjb(ptr noundef nonnull align 8 dereferenceable(150) %17, i32 noundef %18, i1 noundef zeroext true) #4
  br label %19

19:                                               ; preds = %14, %1
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #4
  %20 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 10
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  call void @_ZN3qOS4list5beginEv(ptr dead_on_unwind writable sret(%"class.qOS::listIterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(56) %21) #4
  br label %22

22:                                               ; preds = %126, %19
  %23 = call noundef zeroext i1 @_ZNK3qOS12listIterator8untilEndEv(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  br i1 %23, label %25, label %24

24:                                               ; preds = %22
  store i32 2, ptr %7, align 4
  br label %128

25:                                               ; preds = %22
  %26 = call noundef ptr @_ZN3qOS12listIterator3getIPNS_4taskEEET_v(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  store ptr %26, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 7
  %28 = getelementptr inbounds %"struct.qOS::notificationSpreader_t", ptr %27, i32 0, i32 0
  %29 = load i8, ptr %28, align 8, !tbaa !26
  %30 = icmp ne i8 3, %29
  br i1 %30, label %31, label %40

31:                                               ; preds = %25
  %32 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 7
  %33 = getelementptr inbounds %"struct.qOS::notificationSpreader_t", ptr %32, i32 0, i32 0
  %34 = load i8, ptr %33, align 8, !tbaa !26
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 7
  %37 = getelementptr inbounds %"struct.qOS::notificationSpreader_t", ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !27
  %39 = call noundef zeroext i1 @_ZN3qOS4core6notifyENS_10notifyModeERNS_4taskEPv(ptr noundef nonnull align 8 dereferenceable(800) %9, i8 noundef zeroext %34, ptr noundef nonnull align 8 dereferenceable(150) %35, ptr noundef %38) #4
  store i32 2, ptr %7, align 4
  br label %128

40:                                               ; preds = %25
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i32, ptr @_ZN3qOS4task12BIT_SHUTDOWNE, align 4, !tbaa !18
  %43 = call noundef zeroext i1 @_ZNK3qOS4task7getFlagEj(ptr noundef nonnull align 8 dereferenceable(150) %41, i32 noundef %42) #4
  br i1 %43, label %44, label %93

44:                                               ; preds = %40
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.qOS::task", ptr %45, i32 0, i32 17
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = icmp eq i8 2, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %44
  store i8 1, ptr %3, align 1, !tbaa !9
  br label %92

50:                                               ; preds = %44
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call noundef zeroext i1 @_ZNK3qOS4task15deadLineReachedEv(ptr noundef nonnull align 8 dereferenceable(150) %51) #4
  br i1 %52, label %53, label %58

53:                                               ; preds = %50
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.qOS::task", ptr %54, i32 0, i32 9
  call void @_ZN3qOS5timer6reloadEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #4
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.qOS::task", ptr %56, i32 0, i32 17
  store i8 1, ptr %57, align 1, !tbaa !11
  store i8 1, ptr %3, align 1, !tbaa !9
  br label %91

58:                                               ; preds = %50
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = call noundef zeroext i8 @_ZN3qOS4task16queueCheckEventsEv(ptr noundef nonnull align 8 dereferenceable(150) %59) #4
  store i8 %60, ptr %4, align 1, !tbaa !28
  %61 = icmp ne i8 0, %60
  br i1 %61, label %62, label %66

62:                                               ; preds = %58
  %63 = load i8, ptr %4, align 1, !tbaa !28
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %"class.qOS::task", ptr %64, i32 0, i32 17
  store i8 %63, ptr %65, align 1, !tbaa !11
  store i8 1, ptr %3, align 1, !tbaa !9
  br label %90

66:                                               ; preds = %58
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.qOS::task", ptr %67, i32 0, i32 14
  %69 = load volatile i32, ptr %68, align 4, !tbaa !29
  %70 = icmp ugt i32 %69, 0
  br i1 %70, label %71, label %74

71:                                               ; preds = %66
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.qOS::task", ptr %72, i32 0, i32 17
  store i8 3, ptr %73, align 1, !tbaa !11
  store i8 1, ptr %3, align 1, !tbaa !9
  br label %89

74:                                               ; preds = %66
  %75 = load i32, ptr @_ZN3qOS4task16EVENT_FLAGS_MASKE, align 4, !tbaa !18
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %"class.qOS::task", ptr %76, i32 0, i32 15
  %78 = load volatile i32, ptr %77, align 8, !tbaa !30
  %79 = and i32 %75, %78
  %80 = zext i32 %79 to i64
  %81 = icmp ne i64 0, %80
  br i1 %81, label %82, label %85

82:                                               ; preds = %74
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %"class.qOS::task", ptr %83, i32 0, i32 17
  store i8 8, ptr %84, align 1, !tbaa !11
  store i8 1, ptr %3, align 1, !tbaa !9
  br label %88

85:                                               ; preds = %74
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %"class.qOS::task", ptr %86, i32 0, i32 17
  store i8 0, ptr %87, align 1, !tbaa !11
  br label %88

88:                                               ; preds = %85, %82
  br label %89

89:                                               ; preds = %88, %71
  br label %90

90:                                               ; preds = %89, %62
  br label %91

91:                                               ; preds = %90, %53
  br label %92

92:                                               ; preds = %91, %49
  br label %93

93:                                               ; preds = %92, %40
  %94 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 10
  %95 = load ptr, ptr %94, align 8, !tbaa !19
  %96 = call noundef ptr @_ZN3qOS4list6removeENS_12listPositionEPv(ptr noundef nonnull align 8 dereferenceable(56) %95, i32 noundef -1, ptr noundef null) #4
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = load i32, ptr @_ZN3qOS4task18BIT_REMOVE_REQUESTE, align 4, !tbaa !18
  %99 = call noundef zeroext i1 @_ZNK3qOS4task7getFlagEj(ptr noundef nonnull align 8 dereferenceable(150) %97, i32 noundef %98) #4
  br i1 %99, label %100, label %105

100:                                              ; preds = %93
  call void @_ZN3qOS8critical5enterEv() #4
  %101 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 5
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN3qOS9prioQueue7cleanUpERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(40) %101, ptr noundef nonnull align 8 dereferenceable(150) %102) #4
  call void @_ZN3qOS8critical4exitEv() #4
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = load i32, ptr @_ZN3qOS4task18BIT_REMOVE_REQUESTE, align 4, !tbaa !18
  call void @_ZN3qOS4task8setFlagsEjb(ptr noundef nonnull align 8 dereferenceable(150) %103, i32 noundef %104, i1 noundef zeroext false) #4
  br label %125

105:                                              ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %"class.qOS::task", ptr %106, i32 0, i32 17
  %108 = load i8, ptr %107, align 1, !tbaa !11
  %109 = icmp ne i8 0, %108
  br i1 %109, label %110, label %117

110:                                              ; preds = %105
  %111 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 9
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %"class.qOS::task", ptr %112, i32 0, i32 16
  %114 = load i8, ptr %113, align 4, !tbaa !31
  %115 = zext i8 %114 to i64
  %116 = getelementptr inbounds [5 x %"class.qOS::list"], ptr %111, i64 0, i64 %115
  br label %120

117:                                              ; preds = %105
  %118 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 11
  %119 = load ptr, ptr %118, align 8, !tbaa !32
  br label %120

120:                                              ; preds = %117, %110
  %121 = phi ptr [ %116, %110 ], [ %119, %117 ]
  store ptr %121, ptr %8, align 8, !tbaa !5
  %122 = load ptr, ptr %8, align 8, !tbaa !5
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = call noundef zeroext i1 @_ZN3qOS4list6insertEPvNS_12listPositionE(ptr noundef nonnull align 8 dereferenceable(56) %122, ptr noundef %123, i32 noundef -2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %125

125:                                              ; preds = %120, %100
  br label %126

126:                                              ; preds = %125
  %127 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS12listIteratorppEi(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 0) #4
  br label %22, !llvm.loop !33

128:                                              ; preds = %31, %24
  call void @_ZN3qOS12listIteratorD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  br label %129

129:                                              ; preds = %128
  %130 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 7
  %131 = getelementptr inbounds %"struct.qOS::notificationSpreader_t", ptr %130, i32 0, i32 0
  store i8 3, ptr %131, align 8, !tbaa !26
  %132 = getelementptr inbounds %"class.qOS::core", ptr %9, i32 0, i32 7
  %133 = getelementptr inbounds %"struct.qOS::notificationSpreader_t", ptr %132, i32 0, i32 1
  store ptr null, ptr %133, align 8, !tbaa !27
  %134 = load i8, ptr %3, align 1, !tbaa !9, !range !35, !noundef !36
  %135 = trunc i8 %134 to i1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  ret i1 %135
}

; Function Attrs: nounwind
declare noundef ptr @_ZN3qOS9prioQueue3getEv(ptr noundef nonnull align 8 dereferenceable(40)) #0

; Function Attrs: nounwind
declare void @_ZN3qOS4list5beginEv(ptr dead_on_unwind writable sret(%"class.qOS::listIterator") align 8, ptr noundef nonnull align 8 dereferenceable(56)) #0

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qOS12listIterator8untilEndEv(ptr noundef nonnull align 8 dereferenceable(32)) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3qOS4core6notifyENS_10notifyModeERNS_4taskEPv(ptr noundef nonnull align 8 dereferenceable(800), i8 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(150), ptr noundef) #2 align 2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qOS4task7getFlagEj(ptr noundef nonnull align 8 dereferenceable(150), i32 noundef) #0

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qOS4task15deadLineReachedEv(ptr noundef nonnull align 8 dereferenceable(150)) #0

; Function Attrs: nounwind
declare void @_ZN3qOS5timer6reloadEv(ptr noundef nonnull align 8 dereferenceable(24)) #0

; Function Attrs: nounwind
declare noundef zeroext i8 @_ZN3qOS4task16queueCheckEventsEv(ptr noundef nonnull align 8 dereferenceable(150)) #0

; Function Attrs: nounwind
declare noundef ptr @_ZN3qOS4list6removeENS_12listPositionEPv(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, ptr noundef) #0

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

; Function Attrs: nounwind
declare void @_ZN3qOS9prioQueue7cleanUpERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(150)) #0

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

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS12listIteratorppEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nosync 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 = { 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 #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 = !{!12, !17, i64 149}
!12 = !{!"_ZTSN3qOS4taskE", !13, i64 0, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !14, i64 72, !7, i64 80, !15, i64 96, !16, i64 120, !14, i64 128, !16, i64 136, !16, i64 140, !16, i64 144, !7, i64 148, !17, i64 149}
!13 = !{!"_ZTSN3qOS4nodeE", !6, i64 8, !6, i64 16, !6, i64 24}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN3qOS5timerE", !14, i64 8, !14, i64 16}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN3qOS7triggerE", !7, i64 0}
!18 = !{!16, !16, i64 0}
!19 = !{!20, !6, i64 728}
!20 = !{!"_ZTSN3qOS4coreE", !21, i64 0, !12, i64 48, !6, i64 200, !6, i64 208, !7, i64 216, !22, i64 376, !16, i64 416, !23, i64 424, !14, i64 440, !7, i64 448, !6, i64 728, !6, i64 736, !25, i64 744}
!21 = !{!"_ZTSN3qOS9taskEventE", !17, i64 8, !10, i64 9, !10, i64 10, !10, i64 11, !14, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!22 = !{!"_ZTSN3qOS9prioQueueE", !16, i64 8, !6, i64 16, !6, i64 24, !14, i64 32}
!23 = !{!"_ZTSN3qOS22notificationSpreader_tE", !24, i64 0, !6, i64 8}
!24 = !{!"_ZTSN3qOS10notifyModeE", !7, i64 0}
!25 = !{!"_ZTSN3qOS4listE", !13, i64 0, !6, i64 32, !6, i64 40, !14, i64 48}
!26 = !{!20, !24, i64 424}
!27 = !{!20, !6, i64 432}
!28 = !{!17, !17, i64 0}
!29 = !{!12, !16, i64 140}
!30 = !{!12, !16, i64 144}
!31 = !{!12, !7, i64 148}
!32 = !{!20, !6, i64 736}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{i8 0, i8 2}
!36 = !{}


; 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::listIterator" = type { ptr, ptr, ptr, ptr }
%"class.qOS::list" = type { %"class.qOS::node", ptr, ptr, i64 }
%"class.qOS::node" = type { ptr, ptr, ptr, ptr }

@_ZN3qOS4task12BIT_SHUTDOWNE = external local_unnamed_addr constant i32, align 4
@_ZN3qOS4task18BIT_REMOVE_REQUESTE = external local_unnamed_addr constant i32, align 4
@_ZN3qOS4task16EVENT_FLAGS_MASKE = external local_unnamed_addr constant i32, align 4

; Function Attrs: nounwind
declare void @_ZN3qOS4task8setFlagsEjb(ptr noundef nonnull align 8 dereferenceable(150), i32 noundef, i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN3qOS4list6insertEPvNS_12listPositionE(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, i32 noundef) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN3qOS4core12checkIfReadyEv(ptr noundef nonnull align 8 dereferenceable(800) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %"class.qOS::listIterator", align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 376
  %4 = tail call noundef ptr @_ZN3qOS9prioQueue3getEv(ptr noundef nonnull align 8 dereferenceable(40) %3) #4
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %8, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %4, i64 149
  store i8 2, ptr %6, align 1, !tbaa !5
  %7 = load i32, ptr @_ZN3qOS4task12BIT_SHUTDOWNE, align 4, !tbaa !15
  tail call void @_ZN3qOS4task8setFlagsEjb(ptr noundef nonnull align 8 dereferenceable(150) %4, i32 noundef %7, i1 noundef zeroext true) #4
  br label %8

8:                                                ; preds = %5, %1
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #4
  %9 = getelementptr inbounds i8, ptr %0, i64 728
  %10 = load ptr, ptr %9, align 8, !tbaa !16
  call void @_ZN3qOS4list5beginEv(ptr dead_on_unwind nonnull writable sret(%"class.qOS::listIterator") align 8 %2, ptr noundef nonnull align 8 dereferenceable(56) %10) #4
  %11 = call noundef zeroext i1 @_ZNK3qOS12listIterator8untilEndEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  br i1 %11, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %8
  %12 = getelementptr inbounds i8, ptr %0, i64 424
  %13 = load i32, ptr @_ZN3qOS4task12BIT_SHUTDOWNE, align 4
  %14 = load i32, ptr @_ZN3qOS4task16EVENT_FLAGS_MASKE, align 4
  %15 = load i32, ptr @_ZN3qOS4task18BIT_REMOVE_REQUESTE, align 4
  %16 = getelementptr inbounds i8, ptr %0, i64 448
  %17 = getelementptr inbounds i8, ptr %0, i64 736
  br label %18

18:                                               ; preds = %.lr.ph, %62
  %.036 = phi i1 [ false, %.lr.ph ], [ %.1, %62 ]
  %19 = call noundef ptr @_ZN3qOS12listIterator3getIPNS_4taskEEET_v(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %20 = load i8, ptr %12, align 8, !tbaa !24
  %.not28 = icmp eq i8 %20, 3
  br i1 %.not28, label %25, label %21

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %0, i64 432
  %23 = load ptr, ptr %22, align 8, !tbaa !25
  %24 = call noundef zeroext i1 @_ZN3qOS4core6notifyENS_10notifyModeERNS_4taskEPv(ptr noundef nonnull align 8 dereferenceable(800) %0, i8 noundef zeroext %20, ptr noundef nonnull align 8 dereferenceable(150) %19, ptr noundef %23) #4
  br label %.loopexit

25:                                               ; preds = %18
  %26 = call noundef zeroext i1 @_ZNK3qOS4task7getFlagEj(ptr noundef nonnull align 8 dereferenceable(150) %19, i32 noundef %13) #4
  br i1 %26, label %27, label %44

27:                                               ; preds = %25
  %28 = getelementptr inbounds i8, ptr %19, i64 149
  %29 = load i8, ptr %28, align 1, !tbaa !5
  %30 = icmp eq i8 %29, 2
  br i1 %30, label %44, label %31

31:                                               ; preds = %27
  %32 = call noundef zeroext i1 @_ZNK3qOS4task15deadLineReachedEv(ptr noundef nonnull align 8 dereferenceable(150) %19) #4
  br i1 %32, label %33, label %35

33:                                               ; preds = %31
  %34 = getelementptr inbounds i8, ptr %19, i64 96
  call void @_ZN3qOS5timer6reloadEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #4
  br label %.sink.split

35:                                               ; preds = %31
  %36 = call noundef zeroext i8 @_ZN3qOS4task16queueCheckEventsEv(ptr noundef nonnull align 8 dereferenceable(150) %19) #4
  %.not29 = icmp eq i8 %36, 0
  br i1 %.not29, label %37, label %.sink.split

37:                                               ; preds = %35
  %38 = getelementptr inbounds i8, ptr %19, i64 140
  %39 = load volatile i32, ptr %38, align 4, !tbaa !26
  %.not30 = icmp eq i32 %39, 0
  br i1 %.not30, label %40, label %.sink.split

40:                                               ; preds = %37
  %41 = getelementptr inbounds i8, ptr %19, i64 144
  %42 = load volatile i32, ptr %41, align 8, !tbaa !27
  %43 = and i32 %42, %14
  %.not31 = icmp ne i32 %43, 0
  %. = select i1 %.not31, i8 8, i8 0
  %.036. = select i1 %.not31, i1 true, i1 %.036
  br label %.sink.split

.sink.split:                                      ; preds = %40, %37, %35, %33
  %.sink = phi i8 [ 1, %33 ], [ %36, %35 ], [ 3, %37 ], [ %., %40 ]
  %.1.ph = phi i1 [ true, %33 ], [ true, %35 ], [ true, %37 ], [ %.036., %40 ]
  store i8 %.sink, ptr %28, align 1, !tbaa !5
  br label %44

44:                                               ; preds = %.sink.split, %27, %25
  %.1 = phi i1 [ %.036, %25 ], [ true, %27 ], [ %.1.ph, %.sink.split ]
  %45 = load ptr, ptr %9, align 8, !tbaa !16
  %46 = call noundef ptr @_ZN3qOS4list6removeENS_12listPositionEPv(ptr noundef nonnull align 8 dereferenceable(56) %45, i32 noundef -1, ptr noundef null) #4
  %47 = call noundef zeroext i1 @_ZNK3qOS4task7getFlagEj(ptr noundef nonnull align 8 dereferenceable(150) %19, i32 noundef %15) #4
  br i1 %47, label %48, label %49

48:                                               ; preds = %44
  call void @_ZN3qOS8critical5enterEv() #4
  call void @_ZN3qOS9prioQueue7cleanUpERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(150) %19) #4
  call void @_ZN3qOS8critical4exitEv() #4
  call void @_ZN3qOS4task8setFlagsEjb(ptr noundef nonnull align 8 dereferenceable(150) %19, i32 noundef %15, i1 noundef zeroext false) #4
  br label %62

49:                                               ; preds = %44
  %50 = getelementptr inbounds i8, ptr %19, i64 149
  %51 = load i8, ptr %50, align 1, !tbaa !5
  %.not32 = icmp eq i8 %51, 0
  br i1 %.not32, label %57, label %52

52:                                               ; preds = %49
  %53 = getelementptr inbounds i8, ptr %19, i64 148
  %54 = load i8, ptr %53, align 4, !tbaa !28
  %55 = zext i8 %54 to i64
  %56 = getelementptr inbounds [5 x %"class.qOS::list"], ptr %16, i64 0, i64 %55
  br label %59

57:                                               ; preds = %49
  %58 = load ptr, ptr %17, align 8, !tbaa !29
  br label %59

59:                                               ; preds = %57, %52
  %60 = phi ptr [ %56, %52 ], [ %58, %57 ]
  %61 = call noundef zeroext i1 @_ZN3qOS4list6insertEPvNS_12listPositionE(ptr noundef nonnull align 8 dereferenceable(56) %60, ptr noundef nonnull %19, i32 noundef -2) #4
  br label %62

62:                                               ; preds = %48, %59
  %63 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN3qOS12listIteratorppEi(ptr noundef nonnull align 8 dereferenceable(32) %2, i32 noundef 0) #4
  %64 = call noundef zeroext i1 @_ZNK3qOS12listIterator8untilEndEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  br i1 %64, label %18, label %.loopexit, !llvm.loop !30

.loopexit:                                        ; preds = %62, %8, %21
  %.034 = phi i1 [ %.036, %21 ], [ false, %8 ], [ %.1, %62 ]
  call void @_ZN3qOS12listIteratorD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #4
  %65 = getelementptr inbounds i8, ptr %0, i64 424
  store i8 3, ptr %65, align 8, !tbaa !24
  %66 = getelementptr inbounds i8, ptr %0, i64 432
  store ptr null, ptr %66, align 8, !tbaa !25
  ret i1 %.034
}

; Function Attrs: nounwind
declare noundef ptr @_ZN3qOS9prioQueue3getEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN3qOS4list5beginEv(ptr dead_on_unwind writable sret(%"class.qOS::listIterator") align 8, ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #0

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qOS12listIterator8untilEndEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3qOS4core6notifyENS_10notifyModeERNS_4taskEPv(ptr noundef nonnull align 8 dereferenceable(800), i8 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(150), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qOS4task7getFlagEj(ptr noundef nonnull align 8 dereferenceable(150), i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK3qOS4task15deadLineReachedEv(ptr noundef nonnull align 8 dereferenceable(150)) local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN3qOS5timer6reloadEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

; Function Attrs: nounwind
declare noundef zeroext i8 @_ZN3qOS4task16queueCheckEventsEv(ptr noundef nonnull align 8 dereferenceable(150)) local_unnamed_addr #0

; Function Attrs: nounwind
declare noundef ptr @_ZN3qOS4list6removeENS_12listPositionEPv(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN3qOS8critical5enterEv() local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN3qOS9prioQueue7cleanUpERKNS_4taskE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(150)) local_unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN3qOS8critical4exitEv() local_unnamed_addr #0

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync 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 = { 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 #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, !14, i64 149}
!6 = !{!"_ZTSN3qOS4taskE", !7, i64 0, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !11, i64 72, !9, i64 80, !12, i64 96, !13, i64 120, !11, i64 128, !13, i64 136, !13, i64 140, !13, i64 144, !9, i64 148, !14, i64 149}
!7 = !{!"_ZTSN3qOS4nodeE", !8, i64 8, !8, i64 16, !8, i64 24}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"_ZTSN3qOS5timerE", !11, i64 8, !11, i64 16}
!13 = !{!"int", !9, i64 0}
!14 = !{!"_ZTSN3qOS7triggerE", !9, i64 0}
!15 = !{!13, !13, i64 0}
!16 = !{!17, !8, i64 728}
!17 = !{!"_ZTSN3qOS4coreE", !18, i64 0, !6, i64 48, !8, i64 200, !8, i64 208, !9, i64 216, !20, i64 376, !13, i64 416, !21, i64 424, !11, i64 440, !9, i64 448, !8, i64 728, !8, i64 736, !23, i64 744}
!18 = !{!"_ZTSN3qOS9taskEventE", !14, i64 8, !19, i64 9, !19, i64 10, !19, i64 11, !11, i64 16, !8, i64 24, !8, i64 32, !8, i64 40}
!19 = !{!"bool", !9, i64 0}
!20 = !{!"_ZTSN3qOS9prioQueueE", !13, i64 8, !8, i64 16, !8, i64 24, !11, i64 32}
!21 = !{!"_ZTSN3qOS22notificationSpreader_tE", !22, i64 0, !8, i64 8}
!22 = !{!"_ZTSN3qOS10notifyModeE", !9, i64 0}
!23 = !{!"_ZTSN3qOS4listE", !7, i64 0, !8, i64 32, !8, i64 40, !11, i64 48}
!24 = !{!17, !22, i64 424}
!25 = !{!17, !8, i64 432}
!26 = !{!6, !13, i64 140}
!27 = !{!6, !13, i64 144}
!28 = !{!6, !9, i64 148}
!29 = !{!17, !8, i64 736}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass