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

; 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 i32 @ulSetInterruptMask() #1

declare void @vClearInterruptMask(i32 noundef) #1

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

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

16:                                               ; preds = %16, %15
  br label %16

17:                                               ; preds = %3
  %18 = load i64, ptr %5, align 8, !tbaa !9
  %19 = icmp ult i64 %18, 1
  %20 = zext i1 %19 to i32
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %24

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

23:                                               ; preds = %23, %22
  br label %23

24:                                               ; preds = %17
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %25, ptr %7, align 8, !tbaa !5
  %26 = call i32 @ulSetInterruptMask()
  %27 = zext i32 %26 to i64
  store i64 %27, ptr %9, align 8, !tbaa !9
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %28, i32 0, i32 12
  %30 = load i64, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds [1 x i8], ptr %29, i64 0, i64 %30
  %32 = load volatile i8, ptr %31, align 1, !tbaa !13
  store i8 %32, ptr %8, align 1, !tbaa !13
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %33, i32 0, i32 12
  %35 = load i64, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds [1 x i8], ptr %34, i64 0, i64 %35
  store volatile i8 2, ptr %36, align 1, !tbaa !13
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %37, i32 0, i32 11
  %39 = load i64, ptr %5, align 8, !tbaa !9
  %40 = getelementptr inbounds [1 x i32], ptr %38, i64 0, i64 %39
  %41 = load volatile i32, ptr %40, align 4, !tbaa !14
  %42 = add i32 %41, 1
  store volatile i32 %42, ptr %40, align 4, !tbaa !14
  %43 = load i8, ptr %8, align 1, !tbaa !13
  %44 = zext i8 %43 to i32
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %196

46:                                               ; preds = %24
  %47 = load ptr, ptr %7, 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 4
  %50 = load ptr, ptr %49, align 8, !tbaa !16
  %51 = icmp eq ptr %50, null
  %52 = zext i1 %51 to i32
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %56

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

55:                                               ; preds = %55, %54
  br label %55

56:                                               ; preds = %46
  %57 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !9
  %58 = icmp eq i64 %57, 0
  br i1 %58, label %59, label %153

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %60, i32 0, i32 2
  %62 = getelementptr inbounds %struct.xLIST_ITEM, ptr %61, i32 0, i32 4
  %63 = load ptr, ptr %62, align 8, !tbaa !21
  store ptr %63, ptr %10, align 8, !tbaa !5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %64, i32 0, i32 2
  %66 = getelementptr inbounds %struct.xLIST_ITEM, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !22
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %68, i32 0, i32 2
  %70 = getelementptr inbounds %struct.xLIST_ITEM, ptr %69, i32 0, i32 1
  %71 = load ptr, ptr %70, align 8, !tbaa !23
  %72 = getelementptr inbounds %struct.xLIST_ITEM, ptr %71, i32 0, i32 2
  store ptr %67, ptr %72, align 8, !tbaa !24
  %73 = load ptr, ptr %7, 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 1
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  %77 = load ptr, ptr %7, 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 !22
  %81 = getelementptr inbounds %struct.xLIST_ITEM, ptr %80, i32 0, i32 1
  store ptr %76, ptr %81, align 8, !tbaa !25
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.xLIST, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !26
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %85, i32 0, i32 2
  %87 = icmp eq ptr %84, %86
  br i1 %87, label %88, label %95

88:                                               ; preds = %59
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %89, i32 0, i32 2
  %91 = getelementptr inbounds %struct.xLIST_ITEM, ptr %90, i32 0, i32 2
  %92 = load ptr, ptr %91, align 8, !tbaa !22
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.xLIST, ptr %93, i32 0, i32 1
  store ptr %92, ptr %94, align 8, !tbaa !26
  br label %95

95:                                               ; preds = %88, %59
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %96, i32 0, i32 2
  %98 = getelementptr inbounds %struct.xLIST_ITEM, ptr %97, i32 0, i32 4
  store ptr null, ptr %98, align 8, !tbaa !21
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.xLIST, ptr %99, i32 0, i32 0
  %101 = load volatile i64, ptr %100, align 8, !tbaa !29
  %102 = add i64 %101, -1
  store volatile i64 %102, ptr %100, align 8, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %103, i32 0, i32 4
  %105 = load i64, ptr %104, align 8, !tbaa !30
  %106 = load volatile i64, ptr @uxTopReadyPriority, align 8, !tbaa !9
  %107 = icmp ugt i64 %105, %106
  br i1 %107, label %108, label %112

108:                                              ; preds = %95
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %109, i32 0, i32 4
  %111 = load i64, ptr %110, align 8, !tbaa !30
  store volatile i64 %111, ptr @uxTopReadyPriority, align 8, !tbaa !9
  br label %112

112:                                              ; preds = %108, %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %113, i32 0, i32 4
  %115 = load i64, ptr %114, align 8, !tbaa !30
  %116 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %115
  %117 = getelementptr inbounds %struct.xLIST, ptr %116, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !26
  store ptr %118, ptr %11, align 8, !tbaa !5
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %120, i32 0, i32 2
  %122 = getelementptr inbounds %struct.xLIST_ITEM, ptr %121, i32 0, i32 1
  store ptr %119, ptr %122, align 8, !tbaa !23
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.xLIST_ITEM, ptr %123, i32 0, i32 2
  %125 = load ptr, ptr %124, align 8, !tbaa !24
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %126, i32 0, i32 2
  %128 = getelementptr inbounds %struct.xLIST_ITEM, ptr %127, i32 0, i32 2
  store ptr %125, ptr %128, align 8, !tbaa !22
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %129, i32 0, i32 2
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.xLIST_ITEM, ptr %131, i32 0, i32 2
  %133 = load ptr, ptr %132, align 8, !tbaa !24
  %134 = getelementptr inbounds %struct.xLIST_ITEM, ptr %133, i32 0, i32 1
  store ptr %130, ptr %134, align 8, !tbaa !25
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %135, i32 0, i32 2
  %137 = load ptr, ptr %11, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.xLIST_ITEM, ptr %137, i32 0, i32 2
  store ptr %136, ptr %138, align 8, !tbaa !24
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %139, i32 0, i32 4
  %141 = load i64, ptr %140, align 8, !tbaa !30
  %142 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %141
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %143, i32 0, i32 2
  %145 = getelementptr inbounds %struct.xLIST_ITEM, ptr %144, i32 0, i32 4
  store ptr %142, ptr %145, align 8, !tbaa !21
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %146, i32 0, i32 4
  %148 = load i64, ptr %147, align 8, !tbaa !30
  %149 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %148
  %150 = getelementptr inbounds %struct.xLIST, ptr %149, i32 0, i32 0
  %151 = load volatile i64, ptr %150, align 8, !tbaa !29
  %152 = add i64 %151, 1
  store volatile i64 %152, ptr %150, align 8, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %180

153:                                              ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %154 = load ptr, ptr getelementptr inbounds (%struct.xLIST, ptr @xPendingReadyList, i32 0, i32 1), align 8, !tbaa !26
  store ptr %154, ptr %12, align 8, !tbaa !5
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %156, i32 0, i32 3
  %158 = getelementptr inbounds %struct.xLIST_ITEM, ptr %157, i32 0, i32 1
  store ptr %155, ptr %158, align 8, !tbaa !31
  %159 = load ptr, ptr %12, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.xLIST_ITEM, ptr %159, i32 0, i32 2
  %161 = load ptr, ptr %160, align 8, !tbaa !24
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %162, i32 0, i32 3
  %164 = getelementptr inbounds %struct.xLIST_ITEM, ptr %163, i32 0, i32 2
  store ptr %161, ptr %164, align 8, !tbaa !32
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %165, i32 0, i32 3
  %167 = load ptr, ptr %12, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.xLIST_ITEM, ptr %167, i32 0, i32 2
  %169 = load ptr, ptr %168, align 8, !tbaa !24
  %170 = getelementptr inbounds %struct.xLIST_ITEM, ptr %169, i32 0, i32 1
  store ptr %166, ptr %170, align 8, !tbaa !25
  %171 = load ptr, ptr %7, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %171, i32 0, i32 3
  %173 = load ptr, ptr %12, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.xLIST_ITEM, ptr %173, i32 0, i32 2
  store ptr %172, ptr %174, align 8, !tbaa !24
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %175, i32 0, i32 3
  %177 = getelementptr inbounds %struct.xLIST_ITEM, ptr %176, i32 0, i32 4
  store ptr @xPendingReadyList, ptr %177, align 8, !tbaa !16
  %178 = load volatile i64, ptr @xPendingReadyList, align 8, !tbaa !29
  %179 = add i64 %178, 1
  store volatile i64 %179, ptr @xPendingReadyList, align 8, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %180

180:                                              ; preds = %153, %112
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %181, i32 0, i32 4
  %183 = load i64, ptr %182, align 8, !tbaa !30
  %184 = load volatile ptr, ptr @pxCurrentTCB, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.tskTaskControlBlock, ptr %184, i32 0, i32 4
  %186 = load i64, ptr %185, align 8, !tbaa !30
  %187 = icmp ugt i64 %183, %186
  br i1 %187, label %188, label %194

188:                                              ; preds = %180
  %189 = load ptr, ptr %6, align 8, !tbaa !5
  %190 = icmp ne ptr %189, null
  br i1 %190, label %191, label %193

191:                                              ; preds = %188
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 1, ptr %192, align 8, !tbaa !9
  br label %193

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

194:                                              ; preds = %180
  br label %195

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

196:                                              ; preds = %195, %24
  %197 = load i64, ptr %9, align 8, !tbaa !9
  %198 = trunc i64 %197 to i32
  call void @vClearInterruptMask(i32 noundef %198)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

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


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

declare i32 @ulSetInterruptMask() local_unnamed_addr #0

declare void @vClearInterruptMask(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @vTaskGenericNotifyGiveFromISR(ptr noundef %0, i64 noundef %1, ptr noundef writeonly %2) local_unnamed_addr #1 section "privileged_functions" {
  %4 = icmp eq ptr %0, null
  br i1 %4, label %5, label %7

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

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

7:                                                ; preds = %3
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %10, label %8

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

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

10:                                               ; preds = %7
  %11 = tail call i32 @ulSetInterruptMask() #2
  %12 = getelementptr inbounds i8, ptr %0, i64 196
  %13 = load volatile i8, ptr %12, align 1, !tbaa !7
  store volatile i8 2, ptr %12, align 1, !tbaa !7
  %14 = getelementptr inbounds i8, ptr %0, i64 192
  %15 = load volatile i32, ptr %14, align 4, !tbaa !10
  %16 = add i32 %15, 1
  store volatile i32 %16, ptr %14, align 4, !tbaa !10
  %17 = icmp eq i8 %13, 1
  br i1 %17, label %18, label %76

18:                                               ; preds = %10
  %19 = getelementptr inbounds i8, ptr %0, i64 88
  %20 = getelementptr inbounds i8, ptr %0, i64 120
  %21 = load ptr, ptr %20, align 8, !tbaa !12
  %.not49 = icmp eq ptr %21, null
  br i1 %.not49, label %24, label %22

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

23:                                               ; preds = %23, %22
  br label %23

24:                                               ; preds = %18
  %25 = load volatile i64, ptr @uxSchedulerSuspended, align 8, !tbaa !19
  %26 = icmp eq i64 %25, 0
  br i1 %26, label %27, label %58

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %0, i64 48
  %29 = getelementptr inbounds i8, ptr %0, i64 80
  %30 = load ptr, ptr %29, align 8, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  %32 = load ptr, ptr %31, align 8, !tbaa !21
  %33 = getelementptr inbounds i8, ptr %0, i64 56
  %34 = load ptr, ptr %33, align 8, !tbaa !22
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  store ptr %32, ptr %35, align 8, !tbaa !23
  %36 = getelementptr inbounds i8, ptr %32, i64 8
  store ptr %34, ptr %36, align 8, !tbaa !24
  %37 = getelementptr inbounds i8, ptr %30, i64 8
  %38 = load ptr, ptr %37, align 8, !tbaa !25
  %39 = icmp eq ptr %38, %28
  br i1 %39, label %40, label %41

40:                                               ; preds = %27
  store ptr %32, ptr %37, align 8, !tbaa !25
  br label %41

41:                                               ; preds = %40, %27
  %42 = load volatile i64, ptr %30, align 8, !tbaa !28
  %43 = add i64 %42, -1
  store volatile i64 %43, ptr %30, align 8, !tbaa !28
  %44 = getelementptr inbounds i8, ptr %0, i64 128
  %45 = load i64, ptr %44, align 8, !tbaa !29
  %46 = load volatile i64, ptr @uxTopReadyPriority, align 8, !tbaa !19
  %47 = icmp ugt i64 %45, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %41
  store volatile i64 %45, ptr @uxTopReadyPriority, align 8, !tbaa !19
  br label %49

49:                                               ; preds = %48, %41
  %50 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %45, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !25
  store ptr %51, ptr %33, align 8, !tbaa !22
  %52 = getelementptr inbounds i8, ptr %51, i64 16
  %53 = load ptr, ptr %52, align 8, !tbaa !23
  store ptr %53, ptr %31, align 8, !tbaa !21
  %54 = getelementptr inbounds i8, ptr %53, i64 8
  store ptr %28, ptr %54, align 8, !tbaa !24
  store ptr %28, ptr %52, align 8, !tbaa !23
  %55 = getelementptr inbounds [5 x %struct.xLIST], ptr @pxReadyTasksLists, i64 0, i64 %45
  store ptr %55, ptr %29, align 8, !tbaa !20
  %56 = load volatile i64, ptr %55, align 8, !tbaa !28
  %57 = add i64 %56, 1
  store volatile i64 %57, ptr %55, align 8, !tbaa !28
  br label %67

58:                                               ; preds = %24
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @xPendingReadyList, i64 8), align 8, !tbaa !25
  %60 = getelementptr inbounds i8, ptr %0, i64 96
  store ptr %59, ptr %60, align 8, !tbaa !30
  %61 = getelementptr inbounds i8, ptr %59, i64 16
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  %63 = getelementptr inbounds i8, ptr %0, i64 104
  store ptr %62, ptr %63, align 8, !tbaa !31
  %64 = getelementptr inbounds i8, ptr %62, i64 8
  store ptr %19, ptr %64, align 8, !tbaa !24
  store ptr %19, ptr %61, align 8, !tbaa !23
  store ptr @xPendingReadyList, ptr %20, align 8, !tbaa !12
  %65 = load volatile i64, ptr @xPendingReadyList, align 8, !tbaa !28
  %66 = add i64 %65, 1
  store volatile i64 %66, ptr @xPendingReadyList, align 8, !tbaa !28
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 128
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !29
  br label %67

67:                                               ; preds = %58, %49
  %68 = phi i64 [ %.pre, %58 ], [ %45, %49 ]
  %69 = load volatile ptr, ptr @pxCurrentTCB, align 8, !tbaa !32
  %70 = getelementptr inbounds i8, ptr %69, i64 128
  %71 = load i64, ptr %70, align 8, !tbaa !29
  %72 = icmp ugt i64 %68, %71
  br i1 %72, label %73, label %76

73:                                               ; preds = %67
  %.not50 = icmp eq ptr %2, null
  br i1 %.not50, label %75, label %74

74:                                               ; preds = %73
  store i64 1, ptr %2, align 8, !tbaa !19
  br label %75

75:                                               ; preds = %74, %73
  store volatile i64 1, ptr @xYieldPending, align 8, !tbaa !19
  br label %76

76:                                               ; preds = %75, %67, %10
  tail call void @vClearInterruptMask(i32 noundef %11) #2
  ret void
}

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


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