; 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.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 }
%struct.xLIST_ITEM = type { i32, ptr, ptr, ptr, ptr }

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

; 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

declare void @vPortExitCritical() #1

declare void @vPortYield() #1

; Function Attrs: nounwind uwtable
define dso_local i64 @xTaskGenericNotify(ptr noundef %0, i64 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) #2 section "privileged_functions" {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !11
  store i32 %3, ptr %9, align 4, !tbaa !11
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i64 1, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #3
  %16 = load i64, ptr %7, align 8, !tbaa !9
  %17 = icmp ult i64 %16, 1
  %18 = zext i1 %17 to i32
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %22

20:                                               ; preds = %5
  call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !13
  br label %21

21:                                               ; preds = %21, %20
  br label %21

22:                                               ; preds = %5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !14
  br label %26

26:                                               ; preds = %26, %25
  br label %26

27:                                               ; preds = %22
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %28, ptr %11, align 8, !tbaa !5
  call void @vPortEnterCritical()
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %38

31:                                               ; preds = %27
  %32 = load ptr, ptr %11, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %32, i32 0, i32 11
  %34 = load i64, ptr %7, align 8, !tbaa !9
  %35 = getelementptr inbounds [1 x i32], ptr %33, i64 0, i64 %34
  %36 = load volatile i32, ptr %35, align 4, !tbaa !11
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %36, ptr %37, align 4, !tbaa !11
  br label %38

38:                                               ; preds = %31, %27
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %39, i32 0, i32 12
  %41 = load i64, ptr %7, align 8, !tbaa !9
  %42 = getelementptr inbounds [1 x i8], ptr %40, i64 0, i64 %41
  %43 = load volatile i8, ptr %42, align 1, !tbaa !15
  store i8 %43, ptr %13, align 1, !tbaa !15
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %44, i32 0, i32 12
  %46 = load i64, ptr %7, align 8, !tbaa !9
  %47 = getelementptr inbounds [1 x i8], ptr %45, i64 0, i64 %46
  store volatile i8 2, ptr %47, align 1, !tbaa !15
  %48 = load i32, ptr %9, align 4, !tbaa !11
  switch i32 %48, label %82 [
    i32 1, label %49
    i32 2, label %57
    i32 3, label %64
    i32 4, label %70
    i32 0, label %90
  ]

49:                                               ; preds = %38
  %50 = load i32, ptr %8, align 4, !tbaa !11
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %51, i32 0, i32 11
  %53 = load i64, ptr %7, align 8, !tbaa !9
  %54 = getelementptr inbounds [1 x i32], ptr %52, i64 0, i64 %53
  %55 = load volatile i32, ptr %54, align 4, !tbaa !11
  %56 = or i32 %55, %50
  store volatile i32 %56, ptr %54, align 4, !tbaa !11
  br label %90

57:                                               ; preds = %38
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %58, i32 0, i32 11
  %60 = load i64, ptr %7, align 8, !tbaa !9
  %61 = getelementptr inbounds [1 x i32], ptr %59, i64 0, i64 %60
  %62 = load volatile i32, ptr %61, align 4, !tbaa !11
  %63 = add i32 %62, 1
  store volatile i32 %63, ptr %61, align 4, !tbaa !11
  br label %90

64:                                               ; preds = %38
  %65 = load i32, ptr %8, align 4, !tbaa !11
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %66, i32 0, i32 11
  %68 = load i64, ptr %7, align 8, !tbaa !9
  %69 = getelementptr inbounds [1 x i32], ptr %67, i64 0, i64 %68
  store volatile i32 %65, ptr %69, align 4, !tbaa !11
  br label %90

70:                                               ; preds = %38
  %71 = load i8, ptr %13, align 1, !tbaa !15
  %72 = zext i8 %71 to i32
  %73 = icmp ne i32 %72, 2
  br i1 %73, label %74, label %80

74:                                               ; preds = %70
  %75 = load i32, ptr %8, align 4, !tbaa !11
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %76, i32 0, i32 11
  %78 = load i64, ptr %7, align 8, !tbaa !9
  %79 = getelementptr inbounds [1 x i32], ptr %77, i64 0, i64 %78
  store volatile i32 %75, ptr %79, align 4, !tbaa !11
  br label %81

80:                                               ; preds = %70
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %80, %74
  br label %90

82:                                               ; preds = %38
  %83 = load volatile i32, ptr @xTickCount, align 4, !tbaa !11
  %84 = icmp eq i32 %83, 0
  %85 = zext i1 %84 to i32
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %89

87:                                               ; preds = %82
  call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !16
  br label %88

88:                                               ; preds = %88, %87
  br label %88

89:                                               ; preds = %82
  br label %90

90:                                               ; preds = %89, %81, %64, %57, %49, %38
  %91 = load i8, ptr %13, align 1, !tbaa !15
  %92 = zext i8 %91 to i32
  %93 = icmp eq i32 %92, 1
  br i1 %93, label %94, label %208

94:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %95, i32 0, i32 2
  %97 = getelementptr inbounds %struct.xLIST_ITEM, ptr %96, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !17
  store ptr %98, ptr %14, align 8, !tbaa !5
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %99, i32 0, i32 2
  %101 = getelementptr inbounds %struct.xLIST_ITEM, ptr %100, i32 0, i32 2
  %102 = load ptr, ptr %101, align 8, !tbaa !21
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %103, i32 0, i32 2
  %105 = getelementptr inbounds %struct.xLIST_ITEM, ptr %104, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !22
  %107 = getelementptr inbounds %struct.xLIST_ITEM, ptr %106, i32 0, i32 2
  store ptr %102, ptr %107, align 8, !tbaa !23
  %108 = load ptr, ptr %11, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %108, i32 0, i32 2
  %110 = getelementptr inbounds %struct.xLIST_ITEM, ptr %109, i32 0, i32 1
  %111 = load ptr, ptr %110, align 8, !tbaa !22
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %112, i32 0, i32 2
  %114 = getelementptr inbounds %struct.xLIST_ITEM, ptr %113, i32 0, i32 2
  %115 = load ptr, ptr %114, align 8, !tbaa !21
  %116 = getelementptr inbounds %struct.xLIST_ITEM, ptr %115, i32 0, i32 1
  store ptr %111, ptr %116, align 8, !tbaa !24
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.xLIST, ptr %117, i32 0, i32 1
  %119 = load ptr, ptr %118, align 8, !tbaa !25
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %120, i32 0, i32 2
  %122 = icmp eq ptr %119, %121
  br i1 %122, label %123, label %130

123:                                              ; preds = %94
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %124, i32 0, i32 2
  %126 = getelementptr inbounds %struct.xLIST_ITEM, ptr %125, i32 0, i32 2
  %127 = load ptr, ptr %126, align 8, !tbaa !21
  %128 = load ptr, ptr %14, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.xLIST, ptr %128, i32 0, i32 1
  store ptr %127, ptr %129, align 8, !tbaa !25
  br label %130

130:                                              ; preds = %123, %94
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %131, i32 0, i32 2
  %133 = getelementptr inbounds %struct.xLIST_ITEM, ptr %132, i32 0, i32 4
  store ptr null, ptr %133, align 8, !tbaa !17
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.xLIST, ptr %134, i32 0, i32 0
  %136 = load volatile i64, ptr %135, align 8, !tbaa !28
  %137 = add i64 %136, -1
  store volatile i64 %137, ptr %135, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %138, i32 0, i32 4
  %140 = load i64, ptr %139, align 8, !tbaa !29
  %141 = load volatile i64, ptr @uxTopReadyPriority, align 8, !tbaa !9
  %142 = icmp ugt i64 %140, %141
  br i1 %142, label %143, label %147

143:                                              ; preds = %130
  %144 = load ptr, ptr %11, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %144, i32 0, i32 4
  %146 = load i64, ptr %145, align 8, !tbaa !29
  store volatile i64 %146, ptr @uxTopReadyPriority, align 8, !tbaa !9
  br label %147

147:                                              ; preds = %143, %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %148 = load ptr, ptr %11, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %148, i32 0, i32 4
  %150 = load i64, ptr %149, align 8, !tbaa !29
  %151 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %150
  %152 = getelementptr inbounds %struct.xLIST, ptr %151, i32 0, i32 1
  %153 = load ptr, ptr %152, align 8, !tbaa !25
  store ptr %153, ptr %15, align 8, !tbaa !5
  %154 = load ptr, ptr %15, align 8, !tbaa !5
  %155 = load ptr, ptr %11, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %155, i32 0, i32 2
  %157 = getelementptr inbounds %struct.xLIST_ITEM, ptr %156, i32 0, i32 1
  store ptr %154, ptr %157, align 8, !tbaa !22
  %158 = load ptr, ptr %15, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.xLIST_ITEM, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !23
  %161 = load ptr, ptr %11, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %161, i32 0, i32 2
  %163 = getelementptr inbounds %struct.xLIST_ITEM, ptr %162, i32 0, i32 2
  store ptr %160, ptr %163, align 8, !tbaa !21
  %164 = load ptr, ptr %11, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %164, i32 0, i32 2
  %166 = load ptr, ptr %15, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.xLIST_ITEM, ptr %166, i32 0, i32 2
  %168 = load ptr, ptr %167, align 8, !tbaa !23
  %169 = getelementptr inbounds %struct.xLIST_ITEM, ptr %168, i32 0, i32 1
  store ptr %165, ptr %169, align 8, !tbaa !24
  %170 = load ptr, ptr %11, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %170, i32 0, i32 2
  %172 = load ptr, ptr %15, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.xLIST_ITEM, ptr %172, i32 0, i32 2
  store ptr %171, ptr %173, align 8, !tbaa !23
  %174 = load ptr, ptr %11, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %174, i32 0, i32 4
  %176 = load i64, ptr %175, align 8, !tbaa !29
  %177 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %176
  %178 = load ptr, ptr %11, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %178, i32 0, i32 2
  %180 = getelementptr inbounds %struct.xLIST_ITEM, ptr %179, i32 0, i32 4
  store ptr %177, ptr %180, align 8, !tbaa !17
  %181 = load ptr, ptr %11, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %181, i32 0, i32 4
  %183 = load i64, ptr %182, align 8, !tbaa !29
  %184 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %183
  %185 = getelementptr inbounds %struct.xLIST, ptr %184, i32 0, i32 0
  %186 = load volatile i64, ptr %185, align 8, !tbaa !28
  %187 = add i64 %186, 1
  store volatile i64 %187, ptr %185, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  %188 = load ptr, ptr %11, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %188, i32 0, i32 3
  %190 = getelementptr inbounds %struct.xLIST_ITEM, ptr %189, i32 0, i32 4
  %191 = load ptr, ptr %190, align 8, !tbaa !30
  %192 = icmp eq ptr %191, null
  %193 = zext i1 %192 to i32
  %194 = icmp eq i32 %193, 0
  br i1 %194, label %195, label %197

195:                                              ; preds = %147
  call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !31
  br label %196

196:                                              ; preds = %196, %195
  br label %196

197:                                              ; preds = %147
  %198 = load ptr, ptr %11, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %198, i32 0, i32 4
  %200 = load i64, ptr %199, align 8, !tbaa !29
  %201 = load volatile ptr, ptr @pxCurrentTCB, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %201, i32 0, i32 4
  %203 = load i64, ptr %202, align 8, !tbaa !29
  %204 = icmp ugt i64 %200, %203
  br i1 %204, label %205, label %206

205:                                              ; preds = %197
  call void @vPortYield()
  br label %207

206:                                              ; preds = %197
  br label %207

207:                                              ; preds = %206, %205
  br label %209

208:                                              ; preds = %90
  br label %209

209:                                              ; preds = %208, %207
  call void @vPortExitCritical()
  %210 = load i64, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret i64 %210
}

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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i64 2148497296}
!14 = !{i64 2148497437}
!15 = !{!7, !7, i64 0}
!16 = !{i64 2148497717}
!17 = !{!18, !6, i64 80}
!18 = !{!"tskTaskControlBlock", !6, i64 0, !19, i64 8, !20, i64 48, !20, 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}
!19 = !{!"MPU_SETTINGS", !12, i64 0, !7, i64 4}
!20 = !{!"xLIST_ITEM", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!21 = !{!18, !6, i64 64}
!22 = !{!18, !6, i64 56}
!23 = !{!20, !6, i64 16}
!24 = !{!20, !6, i64 8}
!25 = !{!26, !6, i64 8}
!26 = !{!"xLIST", !10, i64 0, !6, i64 8, !27, i64 16}
!27 = !{!"xMINI_LIST_ITEM", !12, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!26, !10, i64 0}
!29 = !{!18, !10, i64 128}
!30 = !{!18, !6, i64 120}
!31 = !{i64 2148502104}


; 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
@xTickCount = external hidden global i32, section "privileged_data", align 4
@pxReadyTasksLists = external hidden global [5 x %struct.xLIST], section "privileged_data", align 16
@uxTopReadyPriority = external hidden global i64, section "privileged_data", align 8

declare void @vPortEnterCritical() local_unnamed_addr #0

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 @xTaskGenericNotify(ptr noundef %0, i64 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef writeonly %4) local_unnamed_addr #1 section "privileged_functions" {
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %8, label %6

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

7:                                                ; preds = %7, %6
  br label %7

8:                                                ; preds = %5
  %9 = icmp eq ptr %0, null
  br i1 %9, label %10, label %12

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

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

12:                                               ; preds = %8
  tail call void @vPortEnterCritical() #2
  %.not54 = icmp eq ptr %4, null
  br i1 %.not54, label %16, label %13

13:                                               ; preds = %12
  %14 = getelementptr inbounds i8, ptr %0, i64 192
  %15 = load volatile i32, ptr %14, align 4, !tbaa !7
  store i32 %15, ptr %4, align 4, !tbaa !7
  br label %16

16:                                               ; preds = %13, %12
  %17 = getelementptr inbounds i8, ptr %0, i64 196
  %18 = load volatile i8, ptr %17, align 1, !tbaa !11
  store volatile i8 2, ptr %17, align 1, !tbaa !11
  switch i32 %3, label %32 [
    i32 1, label %19
    i32 2, label %23
    i32 3, label %27
    i32 4, label %29
    i32 0, label %36
  ]

19:                                               ; preds = %16
  %20 = getelementptr inbounds i8, ptr %0, i64 192
  %21 = load volatile i32, ptr %20, align 4, !tbaa !7
  %22 = or i32 %21, %2
  store volatile i32 %22, ptr %20, align 4, !tbaa !7
  br label %36

23:                                               ; preds = %16
  %24 = getelementptr inbounds i8, ptr %0, i64 192
  %25 = load volatile i32, ptr %24, align 4, !tbaa !7
  %26 = add i32 %25, 1
  store volatile i32 %26, ptr %24, align 4, !tbaa !7
  br label %36

27:                                               ; preds = %16
  %28 = getelementptr inbounds i8, ptr %0, i64 192
  store volatile i32 %2, ptr %28, align 4, !tbaa !7
  br label %36

29:                                               ; preds = %16
  %.not55 = icmp eq i8 %18, 2
  br i1 %.not55, label %.thread, label %30

30:                                               ; preds = %29
  %31 = getelementptr inbounds i8, ptr %0, i64 192
  store volatile i32 %2, ptr %31, align 4, !tbaa !7
  br label %36

32:                                               ; preds = %16
  %33 = load volatile i32, ptr @xTickCount, align 4, !tbaa !7
  %.not56 = icmp eq i32 %33, 0
  br i1 %.not56, label %36, label %34

34:                                               ; preds = %32
  tail call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !12
  br label %35

35:                                               ; preds = %35, %34
  br label %35

36:                                               ; preds = %32, %30, %27, %23, %19, %16
  %37 = icmp eq i8 %18, 1
  br i1 %37, label %38, label %.thread

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %0, i64 48
  %40 = getelementptr inbounds i8, ptr %0, i64 80
  %41 = load ptr, ptr %40, align 8, !tbaa !13
  %42 = getelementptr inbounds i8, ptr %0, i64 64
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = getelementptr inbounds i8, ptr %0, i64 56
  %45 = load ptr, ptr %44, align 8, !tbaa !20
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  store ptr %43, ptr %46, align 8, !tbaa !21
  %47 = getelementptr inbounds i8, ptr %43, i64 8
  store ptr %45, ptr %47, align 8, !tbaa !22
  %48 = getelementptr inbounds i8, ptr %41, i64 8
  %49 = load ptr, ptr %48, align 8, !tbaa !23
  %50 = icmp eq ptr %49, %39
  br i1 %50, label %51, label %52

51:                                               ; preds = %38
  store ptr %43, ptr %48, align 8, !tbaa !23
  br label %52

52:                                               ; preds = %51, %38
  %53 = load volatile i64, ptr %41, align 8, !tbaa !26
  %54 = add i64 %53, -1
  store volatile i64 %54, ptr %41, align 8, !tbaa !26
  %55 = getelementptr inbounds i8, ptr %0, i64 128
  %56 = load i64, ptr %55, align 8, !tbaa !27
  %57 = load volatile i64, ptr @uxTopReadyPriority, align 8, !tbaa !28
  %58 = icmp ugt i64 %56, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %52
  store volatile i64 %56, ptr @uxTopReadyPriority, align 8, !tbaa !28
  br label %60

60:                                               ; preds = %59, %52
  %61 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %56, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  store ptr %62, ptr %44, align 8, !tbaa !20
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %64 = load ptr, ptr %63, align 8, !tbaa !21
  store ptr %64, ptr %42, align 8, !tbaa !19
  %65 = getelementptr inbounds i8, ptr %64, i64 8
  store ptr %39, ptr %65, align 8, !tbaa !22
  store ptr %39, ptr %63, align 8, !tbaa !21
  %66 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %56
  store ptr %66, ptr %40, align 8, !tbaa !13
  %67 = load volatile i64, ptr %66, align 8, !tbaa !26
  %68 = add i64 %67, 1
  store volatile i64 %68, ptr %66, align 8, !tbaa !26
  %69 = getelementptr inbounds i8, ptr %0, i64 120
  %70 = load ptr, ptr %69, align 8, !tbaa !29
  %.not57 = icmp eq ptr %70, null
  br i1 %.not57, label %73, label %71

71:                                               ; preds = %60
  tail call void asm sideeffect " cpsid i ", "~{memory},~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !30
  br label %72

72:                                               ; preds = %72, %71
  br label %72

73:                                               ; preds = %60
  %74 = load volatile ptr, ptr @pxCurrentTCB, align 8, !tbaa !31
  %75 = getelementptr inbounds i8, ptr %74, i64 128
  %76 = load i64, ptr %75, align 8, !tbaa !27
  %77 = icmp ugt i64 %56, %76
  br i1 %77, label %78, label %.thread

78:                                               ; preds = %73
  tail call void @vPortYield() #2
  br label %.thread

.thread:                                          ; preds = %29, %36, %78, %73
  %.059 = phi i64 [ 1, %36 ], [ 1, %78 ], [ 1, %73 ], [ 0, %29 ]
  tail call void @vPortExitCritical() #2
  ret i64 %.059
}

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


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