; LLVM IR from CactiLab/Sherloc-Cortex-M-CFVD :: Sherloc_runtime/freertos (tasks)

; 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.xLIST = type { i64, ptr, %struct.xMINI_LIST_ITEM }
%struct.xMINI_LIST_ITEM = type { i32, ptr, ptr }
%struct.xLIST_ITEM = type { i32, ptr, ptr, ptr, ptr }
%struct.tskTaskControlBlock = type { ptr, %struct.MPU_SETTINGS, %struct.xLIST_ITEM, %struct.xLIST_ITEM, i64, ptr, [10 x i8], i64, i64, i64, i64, [1 x i32], [1 x i8], i8, i8 }
%struct.MPU_SETTINGS = type { i32, [4 x %struct.MPURegionSettings] }
%struct.MPURegionSettings = type { i32, i32 }

@pxCurrentTCB = external dso_local global ptr, section "privileged_data", align 8
@uxCurrentNumberOfTasks = external hidden global i64, section "privileged_data", align 8
@uxSchedulerSuspended = external hidden global i64, section "privileged_data", align 8
@pxReadyTasksLists = external hidden global [5 x %struct.xLIST], section "privileged_data", align 16
@uxTopReadyPriority = external hidden global i64, section "privileged_data", align 8
@xYieldPending = external hidden global i64, section "privileged_data", align 8
@xPendingReadyList = external hidden global %struct.xLIST, section "privileged_data", align 8
@xPendedTicks = external hidden global i32, section "privileged_data", align 4

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

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

declare void @vPortEnterCritical() #1

; Function Attrs: nounwind uwtable
declare hidden void @prvResetNextTaskUnblockTime() #2 section "privileged_functions"

declare void @vPortExitCritical() #1

declare void @vPortYield() #1

; Function Attrs: nounwind uwtable
define dso_local i64 @xTaskResumeAll() #2 section "privileged_functions" {
  %1 = alloca ptr, align 8
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  store ptr null, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  store i64 0, ptr %2, align 8, !tbaa !9
  %7 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !9
  %8 = icmp eq i64 %7, 0
  br i1 %8, label %9, label %11

9:                                                ; preds = %0
  call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !11
  br label %10

10:                                               ; preds = %10, %9
  br label %10

11:                                               ; preds = %0
  call void @vPortEnterCritical()
  %12 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !9
  %13 = add i64 %12, -1
  store volatile i64 %13, ptr @uxSchedulerSuspended, align 8, !tbaa !9
  %14 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !9
  %15 = icmp eq i64 %14, 0
  br i1 %15, label %16, label %205

16:                                               ; preds = %11
  %17 = load volatile i64, ptr @uxCurrentNumberOfTasks, align 8, !tbaa !9
  %18 = icmp ugt i64 %17, 0
  br i1 %18, label %19, label %204

19:                                               ; preds = %16
  br label %20

20:                                               ; preds = %175, %19
  %21 = load volatile i64, ptr @xPendingReadyList, align 8, !tbaa !12
  %22 = icmp eq i64 %21, 0
  %23 = zext i1 %22 to i64
  %24 = select i1 %22, i64 1, i64 0
  %25 = icmp eq i64 %24, 0
  br i1 %25, label %26, label %176

26:                                               ; preds = %20
  %27 = load ptr, ptr getelementptr inbounds (%struct.xMINI_LIST_ITEM, ptr getelementptr inbounds (%struct.xLIST, ptr @xPendingReadyList, i32 0, i32 2), i32 0, i32 1), align 8, !tbaa !16
  %28 = getelementptr inbounds %struct.xLIST_ITEM, ptr %27, i32 0, i32 3
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  store ptr %29, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %30 = load ptr, ptr %1, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %30, i32 0, i32 3
  %32 = getelementptr inbounds %struct.xLIST_ITEM, ptr %31, i32 0, i32 4
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  store ptr %33, ptr %3, align 8, !tbaa !5
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %34, i32 0, i32 3
  %36 = getelementptr inbounds %struct.xLIST_ITEM, ptr %35, i32 0, i32 2
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = load ptr, ptr %1, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %38, i32 0, i32 3
  %40 = getelementptr inbounds %struct.xLIST_ITEM, ptr %39, i32 0, i32 1
  %41 = load ptr, ptr %40, align 8, !tbaa !23
  %42 = getelementptr inbounds %struct.xLIST_ITEM, ptr %41, i32 0, i32 2
  store ptr %37, ptr %42, align 8, !tbaa !24
  %43 = load ptr, ptr %1, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %43, i32 0, i32 3
  %45 = getelementptr inbounds %struct.xLIST_ITEM, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !23
  %47 = load ptr, ptr %1, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %47, i32 0, i32 3
  %49 = getelementptr inbounds %struct.xLIST_ITEM, ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !22
  %51 = getelementptr inbounds %struct.xLIST_ITEM, ptr %50, i32 0, i32 1
  store ptr %46, ptr %51, align 8, !tbaa !25
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.xLIST, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !26
  %55 = load ptr, ptr %1, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %55, i32 0, i32 3
  %57 = icmp eq ptr %54, %56
  br i1 %57, label %58, label %65

58:                                               ; preds = %26
  %59 = load ptr, ptr %1, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %59, i32 0, i32 3
  %61 = getelementptr inbounds %struct.xLIST_ITEM, ptr %60, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.xLIST, ptr %63, i32 0, i32 1
  store ptr %62, ptr %64, align 8, !tbaa !26
  br label %65

65:                                               ; preds = %58, %26
  %66 = load ptr, ptr %1, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %66, i32 0, i32 3
  %68 = getelementptr inbounds %struct.xLIST_ITEM, ptr %67, i32 0, i32 4
  store ptr null, ptr %68, align 8, !tbaa !19
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.xLIST, ptr %69, i32 0, i32 0
  %71 = load volatile i64, ptr %70, align 8, !tbaa !12
  %72 = add i64 %71, -1
  store volatile i64 %72, ptr %70, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !27
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %73 = load ptr, ptr %1, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %73, i32 0, i32 2
  %75 = getelementptr inbounds %struct.xLIST_ITEM, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !28
  store ptr %76, ptr %4, align 8, !tbaa !5
  %77 = load ptr, ptr %1, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %77, i32 0, i32 2
  %79 = getelementptr inbounds %struct.xLIST_ITEM, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !29
  %81 = load ptr, ptr %1, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %81, i32 0, i32 2
  %83 = getelementptr inbounds %struct.xLIST_ITEM, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !30
  %85 = getelementptr inbounds %struct.xLIST_ITEM, ptr %84, i32 0, i32 2
  store ptr %80, ptr %85, align 8, !tbaa !24
  %86 = load ptr, ptr %1, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %86, i32 0, i32 2
  %88 = getelementptr inbounds %struct.xLIST_ITEM, ptr %87, i32 0, i32 1
  %89 = load ptr, ptr %88, align 8, !tbaa !30
  %90 = load ptr, ptr %1, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %90, i32 0, i32 2
  %92 = getelementptr inbounds %struct.xLIST_ITEM, ptr %91, i32 0, i32 2
  %93 = load ptr, ptr %92, align 8, !tbaa !29
  %94 = getelementptr inbounds %struct.xLIST_ITEM, ptr %93, i32 0, i32 1
  store ptr %89, ptr %94, align 8, !tbaa !25
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.xLIST, ptr %95, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !26
  %98 = load ptr, ptr %1, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %98, i32 0, i32 2
  %100 = icmp eq ptr %97, %99
  br i1 %100, label %101, label %108

101:                                              ; preds = %65
  %102 = load ptr, ptr %1, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %102, i32 0, i32 2
  %104 = getelementptr inbounds %struct.xLIST_ITEM, ptr %103, i32 0, i32 2
  %105 = load ptr, ptr %104, align 8, !tbaa !29
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.xLIST, ptr %106, i32 0, i32 1
  store ptr %105, ptr %107, align 8, !tbaa !26
  br label %108

108:                                              ; preds = %101, %65
  %109 = load ptr, ptr %1, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %109, i32 0, i32 2
  %111 = getelementptr inbounds %struct.xLIST_ITEM, ptr %110, i32 0, i32 4
  store ptr null, ptr %111, align 8, !tbaa !28
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.xLIST, ptr %112, i32 0, i32 0
  %114 = load volatile i64, ptr %113, align 8, !tbaa !12
  %115 = add i64 %114, -1
  store volatile i64 %115, ptr %113, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %116 = load ptr, ptr %1, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %116, i32 0, i32 4
  %118 = load i64, ptr %117, align 8, !tbaa !31
  %119 = load volatile i64, ptr @uxTopReadyPriority, align 8, !tbaa !9
  %120 = icmp ugt i64 %118, %119
  br i1 %120, label %121, label %125

121:                                              ; preds = %108
  %122 = load ptr, ptr %1, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %122, i32 0, i32 4
  %124 = load i64, ptr %123, align 8, !tbaa !31
  store volatile i64 %124, ptr @uxTopReadyPriority, align 8, !tbaa !9
  br label %125

125:                                              ; preds = %121, %108
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %126 = load ptr, ptr %1, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %126, i32 0, i32 4
  %128 = load i64, ptr %127, align 8, !tbaa !31
  %129 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %128
  %130 = getelementptr inbounds %struct.xLIST, ptr %129, i32 0, i32 1
  %131 = load ptr, ptr %130, align 8, !tbaa !26
  store ptr %131, ptr %5, align 8, !tbaa !5
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = load ptr, ptr %1, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %133, i32 0, i32 2
  %135 = getelementptr inbounds %struct.xLIST_ITEM, ptr %134, i32 0, i32 1
  store ptr %132, ptr %135, align 8, !tbaa !30
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.xLIST_ITEM, ptr %136, i32 0, i32 2
  %138 = load ptr, ptr %137, align 8, !tbaa !24
  %139 = load ptr, ptr %1, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %139, i32 0, i32 2
  %141 = getelementptr inbounds %struct.xLIST_ITEM, ptr %140, i32 0, i32 2
  store ptr %138, ptr %141, align 8, !tbaa !29
  %142 = load ptr, ptr %1, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %142, i32 0, i32 2
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.xLIST_ITEM, ptr %144, i32 0, i32 2
  %146 = load ptr, ptr %145, align 8, !tbaa !24
  %147 = getelementptr inbounds %struct.xLIST_ITEM, ptr %146, i32 0, i32 1
  store ptr %143, ptr %147, align 8, !tbaa !25
  %148 = load ptr, ptr %1, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %148, i32 0, i32 2
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.xLIST_ITEM, ptr %150, i32 0, i32 2
  store ptr %149, ptr %151, align 8, !tbaa !24
  %152 = load ptr, ptr %1, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %152, i32 0, i32 4
  %154 = load i64, ptr %153, align 8, !tbaa !31
  %155 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %154
  %156 = load ptr, ptr %1, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %156, i32 0, i32 2
  %158 = getelementptr inbounds %struct.xLIST_ITEM, ptr %157, i32 0, i32 4
  store ptr %155, ptr %158, align 8, !tbaa !28
  %159 = load ptr, ptr %1, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %159, i32 0, i32 4
  %161 = load i64, ptr %160, align 8, !tbaa !31
  %162 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %161
  %163 = getelementptr inbounds %struct.xLIST, ptr %162, i32 0, i32 0
  %164 = load volatile i64, ptr %163, align 8, !tbaa !12
  %165 = add i64 %164, 1
  store volatile i64 %165, ptr %163, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  %166 = load ptr, ptr %1, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %166, i32 0, i32 4
  %168 = load i64, ptr %167, align 8, !tbaa !31
  %169 = load volatile ptr, ptr @pxCurrentTCB, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %169, i32 0, i32 4
  %171 = load i64, ptr %170, align 8, !tbaa !31
  %172 = icmp uge i64 %168, %171
  br i1 %172, label %173, label %174

173:                                              ; preds = %125
  store volatile i64 1, ptr @xYieldPending, align 8, !tbaa !9
  br label %175

174:                                              ; preds = %125
  br label %175

175:                                              ; preds = %174, %173
  br label %20, !llvm.loop !32

176:                                              ; preds = %20
  %177 = load ptr, ptr %1, align 8, !tbaa !5
  %178 = icmp ne ptr %177, null
  br i1 %178, label %179, label %180

179:                                              ; preds = %176
  call void @prvResetNextTaskUnblockTime()
  br label %180

180:                                              ; preds = %179, %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %181 = load volatile i32, ptr @xPendedTicks, align 4, !tbaa !34
  store i32 %181, ptr %6, align 4, !tbaa !34
  %182 = load i32, ptr %6, align 4, !tbaa !34
  %183 = icmp ugt i32 %182, 0
  br i1 %183, label %184, label %197

184:                                              ; preds = %180
  br label %185

185:                                              ; preds = %193, %184
  %186 = call i64 @xTaskIncrementTick()
  %187 = icmp ne i64 %186, 0
  br i1 %187, label %188, label %189

188:                                              ; preds = %185
  store volatile i64 1, ptr @xYieldPending, align 8, !tbaa !9
  br label %190

189:                                              ; preds = %185
  br label %190

190:                                              ; preds = %189, %188
  %191 = load i32, ptr %6, align 4, !tbaa !34
  %192 = add i32 %191, -1
  store i32 %192, ptr %6, align 4, !tbaa !34
  br label %193

193:                                              ; preds = %190
  %194 = load i32, ptr %6, align 4, !tbaa !34
  %195 = icmp ugt i32 %194, 0
  br i1 %195, label %185, label %196, !llvm.loop !35

196:                                              ; preds = %193
  store volatile i32 0, ptr @xPendedTicks, align 4, !tbaa !34
  br label %198

197:                                              ; preds = %180
  br label %198

198:                                              ; preds = %197, %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %199 = load volatile i64, ptr @xYieldPending, align 8, !tbaa !9
  %200 = icmp ne i64 %199, 0
  br i1 %200, label %201, label %202

201:                                              ; preds = %198
  store i64 1, ptr %2, align 8, !tbaa !9
  call void @vPortYield()
  br label %203

202:                                              ; preds = %198
  br label %203

203:                                              ; preds = %202, %201
  br label %204

204:                                              ; preds = %203, %16
  br label %206

205:                                              ; preds = %11
  br label %206

206:                                              ; preds = %205, %204
  call void @vPortExitCritical()
  %207 = load i64, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret i64 %207
}

; Function Attrs: nounwind uwtable
declare dso_local i64 @xTaskIncrementTick() #2 section "privileged_functions"

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{i64 2148440665}
!12 = !{!13, !10, i64 0}
!13 = !{!"xLIST", !10, i64 0, !6, i64 8, !14, i64 16}
!14 = !{!"xMINI_LIST_ITEM", !15, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"int", !7, i64 0}
!16 = !{!13, !6, i64 24}
!17 = !{!18, !6, i64 24}
!18 = !{!"xLIST_ITEM", !15, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!19 = !{!20, !6, i64 120}
!20 = !{!"tskTaskControlBlock", !6, i64 0, !21, i64 8, !18, i64 48, !18, i64 88, !10, i64 128, !6, i64 136, !7, i64 144, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !7, i64 192, !7, i64 196, !7, i64 197, !7, i64 198}
!21 = !{!"MPU_SETTINGS", !15, i64 0, !7, i64 4}
!22 = !{!20, !6, i64 104}
!23 = !{!20, !6, i64 96}
!24 = !{!18, !6, i64 16}
!25 = !{!18, !6, i64 8}
!26 = !{!13, !6, i64 8}
!27 = !{i64 2148442465}
!28 = !{!20, !6, i64 80}
!29 = !{!20, !6, i64 64}
!30 = !{!20, !6, i64 56}
!31 = !{!20, !10, i64 128}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!15, !15, i64 0}
!35 = distinct !{!35, !33}


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

%struct.xLIST = type { i64, ptr, %struct.xMINI_LIST_ITEM }
%struct.xMINI_LIST_ITEM = type { i32, ptr, ptr }

@pxCurrentTCB = external dso_local global ptr, section "privileged_data", align 8
@uxCurrentNumberOfTasks = external hidden global i64, section "privileged_data", align 8
@uxSchedulerSuspended = external hidden global i64, section "privileged_data", align 8
@pxReadyTasksLists = external hidden global [5 x %struct.xLIST], section "privileged_data", align 16
@uxTopReadyPriority = external hidden global i64, section "privileged_data", align 8
@xYieldPending = external hidden global i64, section "privileged_data", align 8
@xPendingReadyList = external hidden global %struct.xLIST, section "privileged_data", align 8
@xPendedTicks = external hidden global i32, section "privileged_data", align 4

declare void @vPortEnterCritical() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @prvResetNextTaskUnblockTime() local_unnamed_addr #1 section "privileged_functions"

declare void @vPortExitCritical() local_unnamed_addr #0

declare void @vPortYield() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i64 0, 2) i64 @xTaskResumeAll() local_unnamed_addr #1 section "privileged_functions" {
  %1 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !5
  %2 = icmp eq i64 %1, 0
  br i1 %2, label %3, label %5

3:                                                ; preds = %0
  tail call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !9
  br label %4

4:                                                ; preds = %4, %3
  br label %4

5:                                                ; preds = %0
  tail call void @vPortEnterCritical() #2
  %6 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !5
  %7 = add i64 %6, -1
  store volatile i64 %7, ptr @uxSchedulerSuspended, align 8, !tbaa !5
  %8 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !5
  %9 = icmp eq i64 %8, 0
  br i1 %9, label %10, label %77

10:                                               ; preds = %5
  %11 = load volatile i64, ptr @uxCurrentNumberOfTasks, align 8, !tbaa !5
  %.not = icmp eq i64 %11, 0
  br i1 %.not, label %77, label %.preheader52

.preheader52:                                     ; preds = %10
  %12 = load volatile i64, ptr @xPendingReadyList, align 8, !tbaa !10
  %.not4553 = icmp eq i64 %12, 0
  br i1 %.not4553, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader52, %66
  %13 = load ptr, ptr getelementptr inbounds (i8, ptr @xPendingReadyList, i64 24), align 8, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %13, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %15, i64 88
  %17 = getelementptr inbounds i8, ptr %15, i64 120
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %15, i64 104
  %20 = load ptr, ptr %19, align 8, !tbaa !21
  %21 = getelementptr inbounds i8, ptr %15, i64 96
  %22 = load ptr, ptr %21, align 8, !tbaa !22
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  store ptr %20, ptr %23, align 8, !tbaa !23
  %24 = getelementptr inbounds i8, ptr %20, i64 8
  store ptr %22, ptr %24, align 8, !tbaa !24
  %25 = getelementptr inbounds i8, ptr %18, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !25
  %27 = icmp eq ptr %26, %16
  br i1 %27, label %28, label %29

28:                                               ; preds = %.lr.ph
  store ptr %20, ptr %25, align 8, !tbaa !25
  br label %29

29:                                               ; preds = %28, %.lr.ph
  store ptr null, ptr %17, align 8, !tbaa !18
  %30 = load volatile i64, ptr %18, align 8, !tbaa !10
  %31 = add i64 %30, -1
  store volatile i64 %31, ptr %18, align 8, !tbaa !10
  tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !26
  %32 = getelementptr inbounds i8, ptr %15, i64 48
  %33 = getelementptr inbounds i8, ptr %15, i64 80
  %34 = load ptr, ptr %33, align 8, !tbaa !27
  %35 = getelementptr inbounds i8, ptr %15, i64 64
  %36 = load ptr, ptr %35, align 8, !tbaa !28
  %37 = getelementptr inbounds i8, ptr %15, i64 56
  %38 = load ptr, ptr %37, align 8, !tbaa !29
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  store ptr %36, ptr %39, align 8, !tbaa !23
  %40 = getelementptr inbounds i8, ptr %36, i64 8
  store ptr %38, ptr %40, align 8, !tbaa !24
  %41 = getelementptr inbounds i8, ptr %34, i64 8
  %42 = load ptr, ptr %41, align 8, !tbaa !25
  %43 = icmp eq ptr %42, %32
  br i1 %43, label %44, label %45

44:                                               ; preds = %29
  store ptr %36, ptr %41, align 8, !tbaa !25
  br label %45

45:                                               ; preds = %44, %29
  %46 = load volatile i64, ptr %34, align 8, !tbaa !10
  %47 = add i64 %46, -1
  store volatile i64 %47, ptr %34, align 8, !tbaa !10
  %48 = getelementptr inbounds i8, ptr %15, i64 128
  %49 = load i64, ptr %48, align 8, !tbaa !30
  %50 = load volatile i64, ptr @uxTopReadyPriority, align 8, !tbaa !5
  %51 = icmp ugt i64 %49, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %45
  store volatile i64 %49, ptr @uxTopReadyPriority, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %52, %45
  %54 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %49, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !25
  store ptr %55, ptr %37, align 8, !tbaa !29
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  %57 = load ptr, ptr %56, align 8, !tbaa !23
  store ptr %57, ptr %35, align 8, !tbaa !28
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  store ptr %32, ptr %58, align 8, !tbaa !24
  store ptr %32, ptr %56, align 8, !tbaa !23
  %59 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %49
  store ptr %59, ptr %33, align 8, !tbaa !27
  %60 = load volatile i64, ptr %59, align 8, !tbaa !10
  %61 = add i64 %60, 1
  store volatile i64 %61, ptr %59, align 8, !tbaa !10
  %62 = load volatile ptr, ptr @pxCurrentTCB, align 8, !tbaa !31
  %63 = getelementptr inbounds i8, ptr %62, i64 128
  %64 = load i64, ptr %63, align 8, !tbaa !30
  %.not51 = icmp ult i64 %49, %64
  br i1 %.not51, label %66, label %65

65:                                               ; preds = %53
  store volatile i64 1, ptr @xYieldPending, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %53, %65
  %67 = load volatile i64, ptr @xPendingReadyList, align 8, !tbaa !10
  %.not45 = icmp eq i64 %67, 0
  br i1 %.not45, label %._crit_edge, label %.lr.ph, !llvm.loop !32

._crit_edge:                                      ; preds = %66
  tail call void @prvResetNextTaskUnblockTime()
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader52, %._crit_edge
  %68 = load volatile i32, ptr @xPendedTicks, align 4, !tbaa !34
  %.not47 = icmp eq i32 %68, 0
  br i1 %.not47, label %74, label %.preheader

.preheader:                                       ; preds = %._crit_edge.thread, %71
  %.0 = phi i32 [ %72, %71 ], [ %68, %._crit_edge.thread ]
  %69 = tail call i64 @xTaskIncrementTick()
  %.not48 = icmp eq i64 %69, 0
  br i1 %.not48, label %71, label %70

70:                                               ; preds = %.preheader
  store volatile i64 1, ptr @xYieldPending, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %.preheader, %70
  %72 = add i32 %.0, -1
  %.not49 = icmp eq i32 %72, 0
  br i1 %.not49, label %73, label %.preheader, !llvm.loop !35

73:                                               ; preds = %71
  store volatile i32 0, ptr @xPendedTicks, align 4, !tbaa !34
  br label %74

74:                                               ; preds = %._crit_edge.thread, %73
  %75 = load volatile i64, ptr @xYieldPending, align 8, !tbaa !5
  %.not50 = icmp eq i64 %75, 0
  br i1 %.not50, label %77, label %76

76:                                               ; preds = %74
  tail call void @vPortYield() #2
  br label %77

77:                                               ; preds = %5, %10, %74, %76
  %.042 = phi i64 [ 1, %76 ], [ 0, %74 ], [ 0, %10 ], [ 0, %5 ]
  tail call void @vPortExitCritical() #2
  ret i64 %.042
}

; Function Attrs: nounwind uwtable
declare dso_local i64 @xTaskIncrementTick() local_unnamed_addr #1 section "privileged_functions"

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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 2148440665}
!10 = !{!11, !6, i64 0}
!11 = !{!"xLIST", !6, i64 0, !12, i64 8, !13, i64 16}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"xMINI_LIST_ITEM", !14, i64 0, !12, i64 8, !12, i64 16}
!14 = !{!"int", !7, i64 0}
!15 = !{!11, !12, i64 24}
!16 = !{!17, !12, i64 24}
!17 = !{!"xLIST_ITEM", !14, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!18 = !{!19, !12, i64 120}
!19 = !{!"tskTaskControlBlock", !12, i64 0, !20, i64 8, !17, i64 48, !17, i64 88, !6, i64 128, !12, i64 136, !7, i64 144, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !7, i64 192, !7, i64 196, !7, i64 197, !7, i64 198}
!20 = !{!"MPU_SETTINGS", !14, i64 0, !7, i64 4}
!21 = !{!19, !12, i64 104}
!22 = !{!19, !12, i64 96}
!23 = !{!17, !12, i64 16}
!24 = !{!17, !12, i64 8}
!25 = !{!11, !12, i64 8}
!26 = !{i64 2148442465}
!27 = !{!19, !12, i64 80}
!28 = !{!19, !12, i64 64}
!29 = !{!19, !12, i64 56}
!30 = !{!19, !6, i64 128}
!31 = !{!12, !12, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!14, !14, i64 0}
!35 = distinct !{!35, !33}


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