; LLVM IR from HANDS-FREE/OpenRE :: 3_OS/STM32F1/RTOS/uCOS-II/CORE (os_task)

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

%struct.os_tcb = type { ptr, ptr, ptr, i32, i16, i16, ptr, ptr, ptr, ptr, ptr, i16, i32, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, ptr, i32, ptr, [1 x i32] }

@OSTCBPrioTbl = external global [64 x ptr], align 16
@OSTCBCur = external global ptr, align 8
@OSRdyTbl = external global [8 x i8], align 1
@OSRdyGrp = external global i8, align 1
@OSRunning = external global i8, align 1
@OSIntNesting = external global i8, align 1
@OSLockNesting = external global i8, align 1
@OSTaskCtr = external global i8, align 1
@OSTCBList = external global ptr, align 8
@OSTCBFreeList = external global ptr, align 8
@.str = external hidden unnamed_addr constant [2 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

declare i32 @OS_CPU_SR_Save() #1

declare void @OS_CPU_SR_Restore(i32 noundef) #1

declare void @OS_Sched() #1

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @OSTaskDel(i8 noundef zeroext %0) #2 {
  %2 = alloca i8, align 1
  %3 = alloca i8, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i8 %0, ptr %3, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !8
  %8 = load i8, ptr @OSIntNesting, align 1, !tbaa !5
  %9 = zext i8 %8 to i32
  %10 = icmp ugt i32 %9, 0
  br i1 %10, label %11, label %12

11:                                               ; preds = %1
  store i8 64, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %164

12:                                               ; preds = %1
  %13 = load i8, ptr %3, align 1, !tbaa !5
  %14 = zext i8 %13 to i32
  %15 = icmp eq i32 %14, 63
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  store i8 62, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %164

17:                                               ; preds = %12
  %18 = call i32 @OS_CPU_SR_Save()
  store i32 %18, ptr %6, align 4, !tbaa !8
  %19 = load i8, ptr %3, align 1, !tbaa !5
  %20 = zext i8 %19 to i32
  %21 = icmp eq i32 %20, 255
  br i1 %21, label %22, label %26

22:                                               ; preds = %17
  %23 = load ptr, ptr @OSTCBCur, align 8, !tbaa !10
  %24 = getelementptr inbounds %struct.os_tcb, ptr %23, i32 0, i32 15
  %25 = load i8, ptr %24, align 2, !tbaa !12
  store i8 %25, ptr %3, align 1, !tbaa !5
  br label %26

26:                                               ; preds = %22, %17
  %27 = load i8, ptr %3, align 1, !tbaa !5
  %28 = zext i8 %27 to i64
  %29 = getelementptr inbounds [64 x ptr], ptr @OSTCBPrioTbl, i64 0, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !10
  store ptr %30, ptr %5, align 8, !tbaa !10
  %31 = load ptr, ptr %5, align 8, !tbaa !10
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %35

33:                                               ; preds = %26
  %34 = load i32, ptr %6, align 4, !tbaa !8
  call void @OS_CPU_SR_Restore(i32 noundef %34)
  store i8 67, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %164

35:                                               ; preds = %26
  %36 = load ptr, ptr %5, align 8, !tbaa !10
  %37 = icmp eq ptr %36, inttoptr (i64 1 to ptr)
  br i1 %37, label %38, label %40

38:                                               ; preds = %35
  %39 = load i32, ptr %6, align 4, !tbaa !8
  call void @OS_CPU_SR_Restore(i32 noundef %39)
  store i8 61, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %164

40:                                               ; preds = %35
  %41 = load ptr, ptr %5, align 8, !tbaa !10
  %42 = getelementptr inbounds %struct.os_tcb, ptr %41, i32 0, i32 18
  %43 = load i8, ptr %42, align 1, !tbaa !15
  %44 = zext i8 %43 to i32
  %45 = xor i32 %44, -1
  %46 = trunc i32 %45 to i8
  %47 = zext i8 %46 to i32
  %48 = load ptr, ptr %5, align 8, !tbaa !10
  %49 = getelementptr inbounds %struct.os_tcb, ptr %48, i32 0, i32 17
  %50 = load i8, ptr %49, align 4, !tbaa !16
  %51 = zext i8 %50 to i64
  %52 = getelementptr inbounds [8 x i8], ptr @OSRdyTbl, i64 0, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !5
  %54 = zext i8 %53 to i32
  %55 = and i32 %54, %47
  %56 = trunc i32 %55 to i8
  store i8 %56, ptr %52, align 1, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !10
  %58 = getelementptr inbounds %struct.os_tcb, ptr %57, i32 0, i32 17
  %59 = load i8, ptr %58, align 4, !tbaa !16
  %60 = zext i8 %59 to i64
  %61 = getelementptr inbounds [8 x i8], ptr @OSRdyTbl, i64 0, i64 %60
  %62 = load i8, ptr %61, align 1, !tbaa !5
  %63 = zext i8 %62 to i32
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %77

65:                                               ; preds = %40
  %66 = load ptr, ptr %5, align 8, !tbaa !10
  %67 = getelementptr inbounds %struct.os_tcb, ptr %66, i32 0, i32 19
  %68 = load i8, ptr %67, align 2, !tbaa !17
  %69 = zext i8 %68 to i32
  %70 = xor i32 %69, -1
  %71 = trunc i32 %70 to i8
  %72 = zext i8 %71 to i32
  %73 = load i8, ptr @OSRdyGrp, align 1, !tbaa !5
  %74 = zext i8 %73 to i32
  %75 = and i32 %74, %72
  %76 = trunc i32 %75 to i8
  store i8 %76, ptr @OSRdyGrp, align 1, !tbaa !5
  br label %77

77:                                               ; preds = %65, %40
  %78 = load ptr, ptr %5, align 8, !tbaa !10
  %79 = getelementptr inbounds %struct.os_tcb, ptr %78, i32 0, i32 8
  %80 = load ptr, ptr %79, align 8, !tbaa !18
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %87

82:                                               ; preds = %77
  %83 = load ptr, ptr %5, align 8, !tbaa !10
  %84 = load ptr, ptr %5, align 8, !tbaa !10
  %85 = getelementptr inbounds %struct.os_tcb, ptr %84, i32 0, i32 8
  %86 = load ptr, ptr %85, align 8, !tbaa !18
  call void @OS_EventTaskRemove(ptr noundef %83, ptr noundef %86)
  br label %87

87:                                               ; preds = %82, %77
  %88 = load ptr, ptr %5, align 8, !tbaa !10
  %89 = getelementptr inbounds %struct.os_tcb, ptr %88, i32 0, i32 10
  %90 = load ptr, ptr %89, align 8, !tbaa !19
  store ptr %90, ptr %4, align 8, !tbaa !10
  %91 = load ptr, ptr %4, align 8, !tbaa !10
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %95

93:                                               ; preds = %87
  %94 = load ptr, ptr %4, align 8, !tbaa !10
  call void @OS_FlagUnlink(ptr noundef %94)
  br label %95

95:                                               ; preds = %93, %87
  %96 = load ptr, ptr %5, align 8, !tbaa !10
  %97 = getelementptr inbounds %struct.os_tcb, ptr %96, i32 0, i32 12
  store i32 0, ptr %97, align 4, !tbaa !20
  %98 = load ptr, ptr %5, align 8, !tbaa !10
  %99 = getelementptr inbounds %struct.os_tcb, ptr %98, i32 0, i32 13
  store i8 0, ptr %99, align 8, !tbaa !21
  %100 = load ptr, ptr %5, align 8, !tbaa !10
  %101 = getelementptr inbounds %struct.os_tcb, ptr %100, i32 0, i32 14
  store i8 0, ptr %101, align 1, !tbaa !22
  %102 = load i8, ptr @OSLockNesting, align 1, !tbaa !5
  %103 = zext i8 %102 to i32
  %104 = icmp ult i32 %103, 255
  br i1 %104, label %105, label %108

105:                                              ; preds = %95
  %106 = load i8, ptr @OSLockNesting, align 1, !tbaa !5
  %107 = add i8 %106, 1
  store i8 %107, ptr @OSLockNesting, align 1, !tbaa !5
  br label %108

108:                                              ; preds = %105, %95
  %109 = load i32, ptr %6, align 4, !tbaa !8
  call void @OS_CPU_SR_Restore(i32 noundef %109)
  call void @OS_Dummy()
  %110 = call i32 @OS_CPU_SR_Save()
  store i32 %110, ptr %6, align 4, !tbaa !8
  %111 = load i8, ptr @OSLockNesting, align 1, !tbaa !5
  %112 = zext i8 %111 to i32
  %113 = icmp ugt i32 %112, 0
  br i1 %113, label %114, label %117

114:                                              ; preds = %108
  %115 = load i8, ptr @OSLockNesting, align 1, !tbaa !5
  %116 = add i8 %115, -1
  store i8 %116, ptr @OSLockNesting, align 1, !tbaa !5
  br label %117

117:                                              ; preds = %114, %108
  %118 = load ptr, ptr %5, align 8, !tbaa !10
  call void @OSTaskDelHook(ptr noundef %118)
  %119 = load i8, ptr @OSTaskCtr, align 1, !tbaa !5
  %120 = add i8 %119, -1
  store i8 %120, ptr @OSTaskCtr, align 1, !tbaa !5
  %121 = load i8, ptr %3, align 1, !tbaa !5
  %122 = zext i8 %121 to i64
  %123 = getelementptr inbounds [64 x ptr], ptr @OSTCBPrioTbl, i64 0, i64 %122
  store ptr null, ptr %123, align 8, !tbaa !10
  %124 = load ptr, ptr %5, align 8, !tbaa !10
  %125 = getelementptr inbounds %struct.os_tcb, ptr %124, i32 0, i32 7
  %126 = load ptr, ptr %125, align 8, !tbaa !23
  %127 = icmp eq ptr %126, null
  br i1 %127, label %128, label %136

128:                                              ; preds = %117
  %129 = load ptr, ptr %5, align 8, !tbaa !10
  %130 = getelementptr inbounds %struct.os_tcb, ptr %129, i32 0, i32 6
  %131 = load ptr, ptr %130, align 8, !tbaa !24
  %132 = getelementptr inbounds %struct.os_tcb, ptr %131, i32 0, i32 7
  store ptr null, ptr %132, align 8, !tbaa !23
  %133 = load ptr, ptr %5, align 8, !tbaa !10
  %134 = getelementptr inbounds %struct.os_tcb, ptr %133, i32 0, i32 6
  %135 = load ptr, ptr %134, align 8, !tbaa !24
  store ptr %135, ptr @OSTCBList, align 8, !tbaa !10
  br label %151

136:                                              ; preds = %117
  %137 = load ptr, ptr %5, align 8, !tbaa !10
  %138 = getelementptr inbounds %struct.os_tcb, ptr %137, i32 0, i32 6
  %139 = load ptr, ptr %138, align 8, !tbaa !24
  %140 = load ptr, ptr %5, align 8, !tbaa !10
  %141 = getelementptr inbounds %struct.os_tcb, ptr %140, i32 0, i32 7
  %142 = load ptr, ptr %141, align 8, !tbaa !23
  %143 = getelementptr inbounds %struct.os_tcb, ptr %142, i32 0, i32 6
  store ptr %139, ptr %143, align 8, !tbaa !24
  %144 = load ptr, ptr %5, align 8, !tbaa !10
  %145 = getelementptr inbounds %struct.os_tcb, ptr %144, i32 0, i32 7
  %146 = load ptr, ptr %145, align 8, !tbaa !23
  %147 = load ptr, ptr %5, align 8, !tbaa !10
  %148 = getelementptr inbounds %struct.os_tcb, ptr %147, i32 0, i32 6
  %149 = load ptr, ptr %148, align 8, !tbaa !24
  %150 = getelementptr inbounds %struct.os_tcb, ptr %149, i32 0, i32 7
  store ptr %146, ptr %150, align 8, !tbaa !23
  br label %151

151:                                              ; preds = %136, %128
  %152 = load ptr, ptr @OSTCBFreeList, align 8, !tbaa !10
  %153 = load ptr, ptr %5, align 8, !tbaa !10
  %154 = getelementptr inbounds %struct.os_tcb, ptr %153, i32 0, i32 6
  store ptr %152, ptr %154, align 8, !tbaa !24
  %155 = load ptr, ptr %5, align 8, !tbaa !10
  store ptr %155, ptr @OSTCBFreeList, align 8, !tbaa !10
  %156 = load ptr, ptr %5, align 8, !tbaa !10
  %157 = getelementptr inbounds %struct.os_tcb, ptr %156, i32 0, i32 26
  store ptr @.str, ptr %157, align 8, !tbaa !25
  %158 = load i32, ptr %6, align 4, !tbaa !8
  call void @OS_CPU_SR_Restore(i32 noundef %158)
  %159 = load i8, ptr @OSRunning, align 1, !tbaa !5
  %160 = zext i8 %159 to i32
  %161 = icmp eq i32 %160, 1
  br i1 %161, label %162, label %163

162:                                              ; preds = %151
  call void @OS_Sched()
  br label %163

163:                                              ; preds = %162, %151
  store i8 0, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %164

164:                                              ; preds = %163, %38, %33, %16, %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %165 = load i8, ptr %2, align 1
  ret i8 %165
}

declare void @OS_EventTaskRemove(ptr noundef, ptr noundef) #1

declare void @OS_FlagUnlink(ptr noundef) #1

declare void @OS_Dummy() #1

declare void @OSTaskDelHook(ptr noundef) #1

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!13, !6, i64 82}
!13 = !{!"os_tcb", !11, i64 0, !11, i64 8, !11, i64 16, !9, i64 24, !14, i64 28, !14, i64 30, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !14, i64 72, !9, i64 76, !6, i64 80, !6, i64 81, !6, i64 82, !6, i64 83, !6, i64 84, !6, i64 85, !6, i64 86, !6, i64 87, !9, i64 88, !9, i64 92, !9, i64 96, !11, i64 104, !9, i64 112, !11, i64 120, !6, i64 128}
!14 = !{!"short", !6, i64 0}
!15 = !{!13, !6, i64 85}
!16 = !{!13, !6, i64 84}
!17 = !{!13, !6, i64 86}
!18 = !{!13, !11, i64 48}
!19 = !{!13, !11, i64 64}
!20 = !{!13, !9, i64 76}
!21 = !{!13, !6, i64 80}
!22 = !{!13, !6, i64 81}
!23 = !{!13, !11, i64 40}
!24 = !{!13, !11, i64 32}
!25 = !{!13, !11, i64 120}


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

@OSTCBPrioTbl = external local_unnamed_addr global [64 x ptr], align 16
@OSTCBCur = external local_unnamed_addr global ptr, align 8
@OSRdyTbl = external local_unnamed_addr global [8 x i8], align 1
@OSRdyGrp = external local_unnamed_addr global i8, align 1
@OSRunning = external local_unnamed_addr global i8, align 1
@OSIntNesting = external local_unnamed_addr global i8, align 1
@OSLockNesting = external local_unnamed_addr global i8, align 1
@OSTaskCtr = external local_unnamed_addr global i8, align 1
@OSTCBList = external local_unnamed_addr global ptr, align 8
@OSTCBFreeList = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

declare i32 @OS_CPU_SR_Save() local_unnamed_addr #0

declare void @OS_CPU_SR_Restore(i32 noundef) local_unnamed_addr #0

declare void @OS_Sched() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 68) i8 @OSTaskDel(i8 noundef zeroext %0) local_unnamed_addr #1 {
  %2 = load i8, ptr @OSIntNesting, align 1, !tbaa !5
  %.not = icmp eq i8 %2, 0
  br i1 %.not, label %3, label %79

3:                                                ; preds = %1
  %4 = icmp eq i8 %0, 63
  br i1 %4, label %79, label %5

5:                                                ; preds = %3
  %6 = tail call i32 @OS_CPU_SR_Save() #2
  %7 = icmp eq i8 %0, -1
  br i1 %7, label %8, label %12

8:                                                ; preds = %5
  %9 = load ptr, ptr @OSTCBCur, align 8, !tbaa !8
  %10 = getelementptr inbounds i8, ptr %9, i64 82
  %11 = load i8, ptr %10, align 2, !tbaa !10
  br label %12

12:                                               ; preds = %8, %5
  %.034 = phi i8 [ %11, %8 ], [ %0, %5 ]
  %13 = zext i8 %.034 to i64
  %14 = getelementptr inbounds [64 x ptr], ptr @OSTCBPrioTbl, i64 0, i64 %13
  %15 = load ptr, ptr %14, align 8, !tbaa !8
  %magicptr = ptrtoint ptr %15 to i64
  switch i64 %magicptr, label %18 [
    i64 0, label %16
    i64 1, label %17
  ]

16:                                               ; preds = %12
  tail call void @OS_CPU_SR_Restore(i32 noundef %6) #2
  br label %79

17:                                               ; preds = %12
  tail call void @OS_CPU_SR_Restore(i32 noundef %6) #2
  br label %79

18:                                               ; preds = %12
  %19 = getelementptr inbounds i8, ptr %15, i64 85
  %20 = load i8, ptr %19, align 1, !tbaa !14
  %21 = xor i8 %20, -1
  %22 = getelementptr inbounds i8, ptr %15, i64 84
  %23 = load i8, ptr %22, align 4, !tbaa !15
  %24 = zext i8 %23 to i64
  %25 = getelementptr inbounds [8 x i8], ptr @OSRdyTbl, i64 0, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %27 = and i8 %26, %21
  store i8 %27, ptr %25, align 1, !tbaa !5
  %28 = load i8, ptr %22, align 4, !tbaa !15
  %29 = zext i8 %28 to i64
  %30 = getelementptr inbounds [8 x i8], ptr @OSRdyTbl, i64 0, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !5
  %32 = icmp eq i8 %31, 0
  br i1 %32, label %33, label %39

33:                                               ; preds = %18
  %34 = getelementptr inbounds i8, ptr %15, i64 86
  %35 = load i8, ptr %34, align 2, !tbaa !16
  %36 = xor i8 %35, -1
  %37 = load i8, ptr @OSRdyGrp, align 1, !tbaa !5
  %38 = and i8 %37, %36
  store i8 %38, ptr @OSRdyGrp, align 1, !tbaa !5
  br label %39

39:                                               ; preds = %33, %18
  %40 = getelementptr inbounds i8, ptr %15, i64 48
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %.not40 = icmp eq ptr %41, null
  br i1 %.not40, label %43, label %42

42:                                               ; preds = %39
  tail call void @OS_EventTaskRemove(ptr noundef nonnull %15, ptr noundef nonnull %41) #2
  br label %43

43:                                               ; preds = %42, %39
  %44 = getelementptr inbounds i8, ptr %15, i64 64
  %45 = load ptr, ptr %44, align 8, !tbaa !18
  %.not41 = icmp eq ptr %45, null
  br i1 %.not41, label %47, label %46

46:                                               ; preds = %43
  tail call void @OS_FlagUnlink(ptr noundef nonnull %45) #2
  br label %47

47:                                               ; preds = %46, %43
  %48 = getelementptr inbounds i8, ptr %15, i64 76
  store i32 0, ptr %48, align 4, !tbaa !19
  %49 = getelementptr inbounds i8, ptr %15, i64 80
  store i8 0, ptr %49, align 8, !tbaa !20
  %50 = getelementptr inbounds i8, ptr %15, i64 81
  store i8 0, ptr %50, align 1, !tbaa !21
  %51 = load i8, ptr @OSLockNesting, align 1, !tbaa !5
  %.not42 = icmp eq i8 %51, -1
  br i1 %.not42, label %54, label %52

52:                                               ; preds = %47
  %53 = add nuw i8 %51, 1
  store i8 %53, ptr @OSLockNesting, align 1, !tbaa !5
  br label %54

54:                                               ; preds = %52, %47
  tail call void @OS_CPU_SR_Restore(i32 noundef %6) #2
  tail call void @OS_Dummy() #2
  %55 = tail call i32 @OS_CPU_SR_Save() #2
  %56 = load i8, ptr @OSLockNesting, align 1, !tbaa !5
  %.not43 = icmp eq i8 %56, 0
  br i1 %.not43, label %59, label %57

57:                                               ; preds = %54
  %58 = add i8 %56, -1
  store i8 %58, ptr @OSLockNesting, align 1, !tbaa !5
  br label %59

59:                                               ; preds = %57, %54
  tail call void @OSTaskDelHook(ptr noundef nonnull %15) #2
  %60 = load i8, ptr @OSTaskCtr, align 1, !tbaa !5
  %61 = add i8 %60, -1
  store i8 %61, ptr @OSTaskCtr, align 1, !tbaa !5
  store ptr null, ptr %14, align 8, !tbaa !8
  %62 = getelementptr inbounds i8, ptr %15, i64 40
  %63 = load ptr, ptr %62, align 8, !tbaa !22
  %64 = icmp eq ptr %63, null
  %65 = getelementptr inbounds i8, ptr %15, i64 32
  %66 = load ptr, ptr %65, align 8, !tbaa !23
  br i1 %64, label %67, label %69

67:                                               ; preds = %59
  %68 = getelementptr inbounds i8, ptr %66, i64 40
  store ptr null, ptr %68, align 8, !tbaa !22
  store ptr %66, ptr @OSTCBList, align 8, !tbaa !8
  br label %72

69:                                               ; preds = %59
  %70 = getelementptr inbounds i8, ptr %63, i64 32
  store ptr %66, ptr %70, align 8, !tbaa !23
  %71 = getelementptr inbounds i8, ptr %66, i64 40
  store ptr %63, ptr %71, align 8, !tbaa !22
  br label %72

72:                                               ; preds = %69, %67
  %73 = load ptr, ptr @OSTCBFreeList, align 8, !tbaa !8
  %74 = getelementptr inbounds i8, ptr %15, i64 32
  store ptr %73, ptr %74, align 8, !tbaa !23
  store ptr %15, ptr @OSTCBFreeList, align 8, !tbaa !8
  %75 = getelementptr inbounds i8, ptr %15, i64 120
  store ptr @.str, ptr %75, align 8, !tbaa !24
  tail call void @OS_CPU_SR_Restore(i32 noundef %55) #2
  %76 = load i8, ptr @OSRunning, align 1, !tbaa !5
  %77 = icmp eq i8 %76, 1
  br i1 %77, label %78, label %79

78:                                               ; preds = %72
  tail call void @OS_Sched() #2
  br label %79

79:                                               ; preds = %72, %78, %3, %1, %17, %16
  %.0 = phi i8 [ 67, %16 ], [ 61, %17 ], [ 64, %1 ], [ 62, %3 ], [ 0, %78 ], [ 0, %72 ]
  ret i8 %.0
}

declare void @OS_EventTaskRemove(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @OS_FlagUnlink(ptr noundef) local_unnamed_addr #0

declare void @OS_Dummy() local_unnamed_addr #0

declare void @OSTaskDelHook(ptr noundef) local_unnamed_addr #0

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !6, i64 82}
!11 = !{!"os_tcb", !9, i64 0, !9, i64 8, !9, i64 16, !12, i64 24, !13, i64 28, !13, i64 30, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !13, i64 72, !12, i64 76, !6, i64 80, !6, i64 81, !6, i64 82, !6, i64 83, !6, i64 84, !6, i64 85, !6, i64 86, !6, i64 87, !12, i64 88, !12, i64 92, !12, i64 96, !9, i64 104, !12, i64 112, !9, i64 120, !6, i64 128}
!12 = !{!"int", !6, i64 0}
!13 = !{!"short", !6, i64 0}
!14 = !{!11, !6, i64 85}
!15 = !{!11, !6, i64 84}
!16 = !{!11, !6, i64 86}
!17 = !{!11, !9, i64 48}
!18 = !{!11, !9, i64 64}
!19 = !{!11, !12, i64 76}
!20 = !{!11, !6, i64 80}
!21 = !{!11, !6, i64 81}
!22 = !{!11, !9, i64 40}
!23 = !{!11, !9, i64 32}
!24 = !{!11, !9, i64 120}


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