; LLVM IR from lfarcaro/ARINC653_ARMV7A_Z7000 :: ARINC653_ARMV7A_Z7000.sw/ARINC653_ARMV7A_Z7000/src/ARINC653 (RESUME)

; 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._MODULE_INFORMATION_TYPE = type { ptr, %struct._heapRECORD, i32, i32, i32, %struct._CONTEXT_TYPE, i32, ptr, ptr, %struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE, i64, i64, i64, %struct._priorityqueueRECORD }
%struct._heapRECORD = type { ptr, i32, i32, i32 }
%struct._CONTEXT_TYPE = type { i32, ptr, ptr, ptr, i32, i8, ptr, ptr, i32, i32, i32, i32 }
%struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE = type { i8, ptr, i32, %struct._CONTEXT_TYPE, i8, i8, i8, i8, i32, i32 }
%struct._priorityqueueRECORD = type { ptr, i32, i8, i8 }
%struct._PARTITION_INFORMATION_TYPE = type { i8, ptr, ptr, i32, i32, i32, i32, i8, %struct._heapRECORD, %struct._CONTEXT_TYPE, i32, ptr, ptr, %struct._ERRORHANDLER_INFORMATION_TYPE, %struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE, i32, %struct._priorityqueueENTRY, %struct._priorityqueueRECORD, %struct._priorityqueueRECORD, %struct._priorityqueueRECORD, i32, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr }
%struct._ERRORHANDLER_INFORMATION_TYPE = type { i8, ptr, i32, %struct._CONTEXT_TYPE, i8, i8, i8, i8, i32 }
%struct._priorityqueueENTRY = type { i64, i64, ptr, ptr, ptr }
%struct._PROCESS_INFORMATION_TYPE = type { ptr, ptr, i32, i32, i32, i64, i64, i64, i64, i64, %struct._CONTEXT_TYPE, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, i8, i8, ptr, i32, ptr, ptr }
%struct._PROCESS_ATTRIBUTE_TYPE = type { ptr, ptr, i32, i32, i64, i64, i32 }

@CORE_MODULE_INFORMATION = external global [2 x %struct._MODULE_INFORMATION_TYPE], align 16

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

declare void @ENTER_CORE() #1

declare i32 @PORT_GETCORE() #1

declare void @EXIT_CORE() #1

declare void @PRIORITYQUEUE_REMOVE(ptr noundef) #1

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

declare void @PORT_YIELD() #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 void @RESUME(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @ENTER_CORE()
  %8 = call i32 @PORT_GETCORE()
  %9 = zext i32 %8 to i64
  %10 = getelementptr inbounds [2 x %struct._MODULE_INFORMATION_TYPE], ptr @CORE_MODULE_INFORMATION, i64 0, i64 %9
  store ptr %10, ptr %5, align 8, !tbaa !9
  %11 = load ptr, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %11, i32 0, i32 8
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %17

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 6, ptr %16, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %7, align 4
  br label %191

17:                                               ; preds = %2
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %19, i32 0, i32 8
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %21, i32 0, i32 10
  %23 = load i32, ptr %22, align 8, !tbaa !18
  %24 = icmp uge i32 %18, %23
  br i1 %24, label %25, label %27

25:                                               ; preds = %17
  %26 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 4, ptr %26, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %7, align 4
  br label %191

27:                                               ; preds = %17
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %28, i32 0, i32 8
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %30, i32 0, i32 12
  %32 = load ptr, ptr %31, align 8, !tbaa !22
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %47

34:                                               ; preds = %27
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %36, i32 0, i32 8
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %38, i32 0, i32 12
  %40 = load ptr, ptr %39, align 8, !tbaa !22
  %41 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 8, !tbaa !23
  %43 = icmp eq i32 %35, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %34
  %45 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 4, ptr %45, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %7, align 4
  br label %191

46:                                               ; preds = %34
  br label %47

47:                                               ; preds = %46, %27
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %48, i32 0, i32 8
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  %51 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %50, i32 0, i32 11
  %52 = load ptr, ptr %51, align 8, !tbaa !25
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %52, i64 %54
  store ptr %55, ptr %6, align 8, !tbaa !9
  %56 = load ptr, ptr %6, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %56, i32 0, i32 4
  %58 = load i32, ptr %57, align 8, !tbaa !26
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %62

60:                                               ; preds = %47
  %61 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 6, ptr %61, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %7, align 4
  br label %191

62:                                               ; preds = %47
  %63 = load ptr, ptr %6, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !27
  %66 = getelementptr inbounds %struct._PROCESS_ATTRIBUTE_TYPE, ptr %65, i32 0, i32 4
  %67 = load i64, ptr %66, align 8, !tbaa !28
  %68 = icmp ne i64 %67, 0
  br i1 %68, label %69, label %71

69:                                               ; preds = %62
  %70 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 6, ptr %70, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %7, align 4
  br label %191

71:                                               ; preds = %62
  %72 = load ptr, ptr %6, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %72, i32 0, i32 15
  %74 = load i8, ptr %73, align 8, !tbaa !30
  %75 = icmp ne i8 %74, 0
  br i1 %75, label %78, label %76

76:                                               ; preds = %71
  %77 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 2, ptr %77, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %7, align 4
  br label %191

78:                                               ; preds = %71
  %79 = load ptr, ptr %6, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %79, i32 0, i32 16
  %81 = load i8, ptr %80, align 1, !tbaa !31
  %82 = icmp ne i8 %81, 0
  br i1 %82, label %83, label %86

83:                                               ; preds = %78
  %84 = load ptr, ptr %6, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %84, i32 0, i32 13
  call void @PRIORITYQUEUE_REMOVE(ptr noundef %85)
  br label %86

86:                                               ; preds = %83, %78
  %87 = load ptr, ptr %6, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %87, i32 0, i32 15
  store i8 0, ptr %88, align 8, !tbaa !30
  %89 = load ptr, ptr %6, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %89, i32 0, i32 16
  store i8 0, ptr %90, align 1, !tbaa !31
  %91 = load ptr, ptr %5, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %91, i32 0, i32 10
  %93 = load i64, ptr %92, align 8, !tbaa !32
  %94 = load ptr, ptr %5, align 8, !tbaa !9
  %95 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %94, i32 0, i32 11
  %96 = load i64, ptr %95, align 8, !tbaa !33
  %97 = add nsw i64 %93, %96
  %98 = load ptr, ptr %6, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %98, i32 0, i32 6
  store i64 %97, ptr %99, align 8, !tbaa !34
  %100 = load ptr, ptr %6, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !27
  %103 = getelementptr inbounds %struct._PROCESS_ATTRIBUTE_TYPE, ptr %102, i32 0, i32 5
  %104 = load i64, ptr %103, align 8, !tbaa !35
  %105 = icmp ne i64 %104, -1
  br i1 %105, label %106, label %118

106:                                              ; preds = %86
  %107 = load ptr, ptr %6, align 8, !tbaa !9
  %108 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %107, i32 0, i32 6
  %109 = load i64, ptr %108, align 8, !tbaa !34
  %110 = load ptr, ptr %6, align 8, !tbaa !9
  %111 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !27
  %113 = getelementptr inbounds %struct._PROCESS_ATTRIBUTE_TYPE, ptr %112, i32 0, i32 5
  %114 = load i64, ptr %113, align 8, !tbaa !35
  %115 = add nsw i64 %109, %114
  %116 = load ptr, ptr %6, align 8, !tbaa !9
  %117 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %116, i32 0, i32 7
  store i64 %115, ptr %117, align 8, !tbaa !36
  br label %121

118:                                              ; preds = %86
  %119 = load ptr, ptr %6, align 8, !tbaa !9
  %120 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %119, i32 0, i32 7
  store i64 -1, ptr %120, align 8, !tbaa !36
  br label %121

121:                                              ; preds = %118, %106
  %122 = load ptr, ptr %6, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %122, i32 0, i32 13
  %124 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %123, i32 0, i32 2
  %125 = load ptr, ptr %124, align 8, !tbaa !37
  %126 = icmp ne ptr %125, null
  br i1 %126, label %156, label %127

127:                                              ; preds = %121
  %128 = load ptr, ptr %6, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %128, i32 0, i32 14
  %130 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %129, i32 0, i32 2
  %131 = load ptr, ptr %130, align 8, !tbaa !38
  %132 = icmp ne ptr %131, null
  br i1 %132, label %156, label %133

133:                                              ; preds = %127
  %134 = load ptr, ptr %6, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %134, i32 0, i32 4
  store i32 2, ptr %135, align 8, !tbaa !26
  %136 = load ptr, ptr %6, align 8, !tbaa !9
  %137 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %136, i32 0, i32 3
  %138 = load i32, ptr %137, align 4, !tbaa !39
  %139 = zext i32 %138 to i64
  %140 = load ptr, ptr %6, align 8, !tbaa !9
  %141 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %140, i32 0, i32 11
  %142 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %141, i32 0, i32 0
  store i64 %139, ptr %142, align 8, !tbaa !40
  %143 = load ptr, ptr %6, align 8, !tbaa !9
  %144 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %143, i32 0, i32 2
  %145 = load i32, ptr %144, align 8, !tbaa !23
  %146 = zext i32 %145 to i64
  %147 = load ptr, ptr %6, align 8, !tbaa !9
  %148 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %147, i32 0, i32 11
  %149 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %148, i32 0, i32 1
  store i64 %146, ptr %149, align 8, !tbaa !41
  %150 = load ptr, ptr %5, align 8, !tbaa !9
  %151 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %150, i32 0, i32 8
  %152 = load ptr, ptr %151, align 8, !tbaa !11
  %153 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %152, i32 0, i32 17
  %154 = load ptr, ptr %6, align 8, !tbaa !9
  %155 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %154, i32 0, i32 11
  call void @PRIORITYQUEUE_ENQUEUE(ptr noundef %153, ptr noundef %155)
  br label %156

156:                                              ; preds = %133, %127, %121
  %157 = load ptr, ptr %6, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %157, i32 0, i32 7
  %159 = load i64, ptr %158, align 8, !tbaa !36
  %160 = icmp ne i64 %159, -1
  br i1 %160, label %161, label %181

161:                                              ; preds = %156
  %162 = load ptr, ptr %6, align 8, !tbaa !9
  %163 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %162, i32 0, i32 7
  %164 = load i64, ptr %163, align 8, !tbaa !36
  %165 = load ptr, ptr %6, align 8, !tbaa !9
  %166 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %165, i32 0, i32 12
  %167 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %166, i32 0, i32 0
  store i64 %164, ptr %167, align 8, !tbaa !42
  %168 = load ptr, ptr %6, align 8, !tbaa !9
  %169 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %168, i32 0, i32 2
  %170 = load i32, ptr %169, align 8, !tbaa !23
  %171 = zext i32 %170 to i64
  %172 = load ptr, ptr %6, align 8, !tbaa !9
  %173 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %172, i32 0, i32 12
  %174 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %173, i32 0, i32 1
  store i64 %171, ptr %174, align 8, !tbaa !43
  %175 = load ptr, ptr %5, align 8, !tbaa !9
  %176 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %175, i32 0, i32 8
  %177 = load ptr, ptr %176, align 8, !tbaa !11
  %178 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %177, i32 0, i32 18
  %179 = load ptr, ptr %6, align 8, !tbaa !9
  %180 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %179, i32 0, i32 12
  call void @PRIORITYQUEUE_ENQUEUE(ptr noundef %178, ptr noundef %180)
  br label %181

181:                                              ; preds = %161, %156
  %182 = load ptr, ptr %5, align 8, !tbaa !9
  %183 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %182, i32 0, i32 8
  %184 = load ptr, ptr %183, align 8, !tbaa !11
  %185 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %184, i32 0, i32 6
  %186 = load i32, ptr %185, align 4, !tbaa !44
  %187 = icmp eq i32 %186, 0
  br i1 %187, label %188, label %189

188:                                              ; preds = %181
  call void @PORT_YIELD()
  br label %189

189:                                              ; preds = %188, %181
  %190 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 1, ptr %190, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 0, ptr %7, align 4
  br label %191

191:                                              ; preds = %189, %76, %69, %60, %44, %25, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  %192 = load i32, ptr %7, align 4
  switch i32 %192, label %194 [
    i32 0, label %193
    i32 1, label %193
  ]

193:                                              ; preds = %191, %191
  ret void

194:                                              ; preds = %191
  unreachable
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 136}
!12 = !{!"_MODULE_INFORMATION_TYPE", !10, i64 0, !13, i64 8, !6, i64 32, !6, i64 36, !6, i64 40, !14, i64 48, !6, i64 120, !10, i64 128, !10, i64 136, !15, i64 144, !16, i64 256, !16, i64 264, !16, i64 272, !17, i64 280}
!13 = !{!"_heapRECORD", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!14 = !{!"_CONTEXT_TYPE", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !6, i64 32, !7, i64 36, !10, i64 40, !10, i64 48, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68}
!15 = !{!"_HEALTHMONITORINGCALLBACK_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !6, i64 16, !14, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !6, i64 100, !6, i64 104}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"_priorityqueueRECORD", !10, i64 0, !6, i64 8, !7, i64 12, !7, i64 13}
!18 = !{!19, !6, i64 144}
!19 = !{!"_PARTITION_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !7, i64 40, !13, i64 48, !14, i64 72, !6, i64 144, !10, i64 152, !10, i64 160, !20, i64 168, !15, i64 272, !6, i64 384, !21, i64 392, !17, i64 432, !17, i64 448, !17, i64 464, !6, i64 480, !6, i64 484, !10, i64 488, !6, i64 496, !10, i64 504, !6, i64 512, !10, i64 520, !6, i64 528, !10, i64 536, !6, i64 544, !10, i64 552, !6, i64 560, !10, i64 568, !6, i64 576, !10, i64 584}
!20 = !{!"_ERRORHANDLER_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !6, i64 16, !14, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !6, i64 100}
!21 = !{!"_priorityqueueENTRY", !16, i64 0, !16, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!22 = !{!19, !10, i64 160}
!23 = !{!24, !6, i64 16}
!24 = !{!"_PROCESS_INFORMATION_TYPE", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !14, i64 72, !21, i64 144, !21, i64 184, !21, i64 224, !21, i64 264, !7, i64 304, !7, i64 305, !10, i64 312, !6, i64 320, !10, i64 328, !10, i64 336}
!25 = !{!19, !10, i64 152}
!26 = !{!24, !6, i64 24}
!27 = !{!24, !10, i64 0}
!28 = !{!29, !16, i64 24}
!29 = !{!"_PROCESS_ATTRIBUTE_TYPE", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !16, i64 24, !16, i64 32, !6, i64 40}
!30 = !{!24, !7, i64 304}
!31 = !{!24, !7, i64 305}
!32 = !{!12, !16, i64 256}
!33 = !{!12, !16, i64 264}
!34 = !{!24, !16, i64 40}
!35 = !{!29, !16, i64 32}
!36 = !{!24, !16, i64 48}
!37 = !{!24, !10, i64 240}
!38 = !{!24, !10, i64 280}
!39 = !{!24, !6, i64 20}
!40 = !{!24, !16, i64 144}
!41 = !{!24, !16, i64 152}
!42 = !{!24, !16, i64 184}
!43 = !{!24, !16, i64 192}
!44 = !{!19, !6, i64 36}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct._MODULE_INFORMATION_TYPE = type { ptr, %struct._heapRECORD, i32, i32, i32, %struct._CONTEXT_TYPE, i32, ptr, ptr, %struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE, i64, i64, i64, %struct._priorityqueueRECORD }
%struct._heapRECORD = type { ptr, i32, i32, i32 }
%struct._CONTEXT_TYPE = type { i32, ptr, ptr, ptr, i32, i8, ptr, ptr, i32, i32, i32, i32 }
%struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE = type { i8, ptr, i32, %struct._CONTEXT_TYPE, i8, i8, i8, i8, i32, i32 }
%struct._priorityqueueRECORD = type { ptr, i32, i8, i8 }
%struct._PROCESS_INFORMATION_TYPE = type { ptr, ptr, i32, i32, i32, i64, i64, i64, i64, i64, %struct._CONTEXT_TYPE, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, i8, i8, ptr, i32, ptr, ptr }
%struct._priorityqueueENTRY = type { i64, i64, ptr, ptr, ptr }

@CORE_MODULE_INFORMATION = external local_unnamed_addr global [2 x %struct._MODULE_INFORMATION_TYPE], align 16

declare void @ENTER_CORE() local_unnamed_addr #0

declare i32 @PORT_GETCORE() local_unnamed_addr #0

declare void @EXIT_CORE() local_unnamed_addr #0

declare void @PRIORITYQUEUE_REMOVE(ptr noundef) local_unnamed_addr #0

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

declare void @PORT_YIELD() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @RESUME(i32 noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 {
  tail call void @ENTER_CORE() #2
  %3 = tail call i32 @PORT_GETCORE() #2
  %4 = zext i32 %3 to i64
  %5 = getelementptr inbounds [2 x %struct._MODULE_INFORMATION_TYPE], ptr @CORE_MODULE_INFORMATION, i64 0, i64 %4
  %6 = getelementptr inbounds i8, ptr %5, i64 136
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %83, label %9

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %7, i64 144
  %11 = load i32, ptr %10, align 8, !tbaa !16
  %.not = icmp ugt i32 %11, %0
  br i1 %.not, label %12, label %83

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %7, i64 160
  %14 = load ptr, ptr %13, align 8, !tbaa !20
  %.not50 = icmp eq ptr %14, null
  br i1 %.not50, label %19, label %15

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %14, i64 16
  %17 = load i32, ptr %16, align 8, !tbaa !21
  %18 = icmp eq i32 %17, %0
  br i1 %18, label %83, label %19

19:                                               ; preds = %15, %12
  %20 = getelementptr inbounds i8, ptr %7, i64 152
  %21 = load ptr, ptr %20, align 8, !tbaa !23
  %22 = zext i32 %0 to i64
  %23 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %21, i64 %22
  %24 = getelementptr inbounds i8, ptr %23, i64 24
  %25 = load i32, ptr %24, align 8, !tbaa !24
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %83, label %27

27:                                               ; preds = %19
  %28 = load ptr, ptr %23, align 8, !tbaa !25
  %29 = getelementptr inbounds i8, ptr %28, i64 24
  %30 = load i64, ptr %29, align 8, !tbaa !26
  %.not51 = icmp eq i64 %30, 0
  br i1 %.not51, label %31, label %83

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %23, i64 304
  %33 = load i8, ptr %32, align 8, !tbaa !28
  %.not52 = icmp eq i8 %33, 0
  br i1 %.not52, label %83, label %34

34:                                               ; preds = %31
  %35 = getelementptr inbounds i8, ptr %23, i64 305
  %36 = load i8, ptr %35, align 1, !tbaa !29
  %.not53 = icmp eq i8 %36, 0
  br i1 %.not53, label %39, label %37

37:                                               ; preds = %34
  %38 = getelementptr inbounds i8, ptr %23, i64 224
  tail call void @PRIORITYQUEUE_REMOVE(ptr noundef nonnull %38) #2
  %.pre = load ptr, ptr %23, align 8, !tbaa !25
  br label %39

39:                                               ; preds = %37, %34
  %40 = phi ptr [ %.pre, %37 ], [ %28, %34 ]
  store i8 0, ptr %32, align 8, !tbaa !28
  store i8 0, ptr %35, align 1, !tbaa !29
  %41 = getelementptr inbounds i8, ptr %5, i64 256
  %42 = load i64, ptr %41, align 8, !tbaa !30
  %43 = getelementptr inbounds i8, ptr %5, i64 264
  %44 = load i64, ptr %43, align 8, !tbaa !31
  %45 = add nsw i64 %44, %42
  %46 = getelementptr inbounds i8, ptr %23, i64 40
  store i64 %45, ptr %46, align 8, !tbaa !32
  %47 = getelementptr inbounds i8, ptr %40, i64 32
  %48 = load i64, ptr %47, align 8, !tbaa !33
  %.not54 = icmp eq i64 %48, -1
  %49 = add nsw i64 %48, %45
  %spec.select = select i1 %.not54, i64 -1, i64 %49
  %50 = getelementptr inbounds i8, ptr %23, i64 48
  store i64 %spec.select, ptr %50, align 8
  %51 = getelementptr inbounds i8, ptr %23, i64 240
  %52 = load ptr, ptr %51, align 8, !tbaa !34
  %.not55 = icmp eq ptr %52, null
  br i1 %.not55, label %53, label %67

53:                                               ; preds = %39
  %54 = getelementptr inbounds i8, ptr %23, i64 280
  %55 = load ptr, ptr %54, align 8, !tbaa !35
  %.not56 = icmp eq ptr %55, null
  br i1 %.not56, label %56, label %67

56:                                               ; preds = %53
  store i32 2, ptr %24, align 8, !tbaa !24
  %57 = getelementptr inbounds i8, ptr %23, i64 20
  %58 = load i32, ptr %57, align 4, !tbaa !36
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds i8, ptr %23, i64 144
  store i64 %59, ptr %60, align 8, !tbaa !37
  %61 = getelementptr inbounds i8, ptr %23, i64 16
  %62 = load i32, ptr %61, align 8, !tbaa !21
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds i8, ptr %23, i64 152
  store i64 %63, ptr %64, align 8, !tbaa !38
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 432
  tail call void @PRIORITYQUEUE_ENQUEUE(ptr noundef nonnull %66, ptr noundef nonnull %60) #2
  %.pre58 = load i64, ptr %50, align 8, !tbaa !39
  br label %67

67:                                               ; preds = %56, %53, %39
  %68 = phi i64 [ %.pre58, %56 ], [ %spec.select, %53 ], [ %spec.select, %39 ]
  %.not57 = icmp eq i64 %68, -1
  br i1 %.not57, label %77, label %69

69:                                               ; preds = %67
  %70 = getelementptr inbounds i8, ptr %23, i64 184
  store i64 %68, ptr %70, align 8, !tbaa !40
  %71 = getelementptr inbounds i8, ptr %23, i64 16
  %72 = load i32, ptr %71, align 8, !tbaa !21
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds i8, ptr %23, i64 192
  store i64 %73, ptr %74, align 8, !tbaa !41
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %75, i64 448
  tail call void @PRIORITYQUEUE_ENQUEUE(ptr noundef nonnull %76, ptr noundef nonnull %70) #2
  br label %77

77:                                               ; preds = %69, %67
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 36
  %80 = load i32, ptr %79, align 4, !tbaa !42
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %77
  tail call void @PORT_YIELD() #2
  br label %83

83:                                               ; preds = %77, %82, %31, %27, %19, %15, %9, %2
  %.sink = phi i32 [ 6, %2 ], [ 4, %9 ], [ 4, %15 ], [ 6, %19 ], [ 6, %27 ], [ 2, %31 ], [ 1, %82 ], [ 1, %77 ]
  store i32 %.sink, ptr %1, align 4, !tbaa !43
  tail call void @EXIT_CORE() #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 = !{!6, !7, i64 136}
!6 = !{!"_MODULE_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !11, i64 32, !11, i64 36, !11, i64 40, !12, i64 48, !11, i64 120, !7, i64 128, !7, i64 136, !13, i64 144, !14, i64 256, !14, i64 264, !14, i64 272, !15, i64 280}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_heapRECORD", !7, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_CONTEXT_TYPE", !11, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !8, i64 36, !7, i64 40, !7, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68}
!13 = !{!"_HEALTHMONITORINGCALLBACK_INFORMATION_TYPE", !8, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 96, !8, i64 97, !8, i64 98, !8, i64 99, !11, i64 100, !11, i64 104}
!14 = !{!"long long", !8, i64 0}
!15 = !{!"_priorityqueueRECORD", !7, i64 0, !11, i64 8, !8, i64 12, !8, i64 13}
!16 = !{!17, !11, i64 144}
!17 = !{!"_PARTITION_INFORMATION_TYPE", !8, i64 0, !7, i64 8, !7, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !8, i64 40, !10, i64 48, !12, i64 72, !11, i64 144, !7, i64 152, !7, i64 160, !18, i64 168, !13, i64 272, !11, i64 384, !19, i64 392, !15, i64 432, !15, i64 448, !15, i64 464, !11, i64 480, !11, i64 484, !7, i64 488, !11, i64 496, !7, i64 504, !11, i64 512, !7, i64 520, !11, i64 528, !7, i64 536, !11, i64 544, !7, i64 552, !11, i64 560, !7, i64 568, !11, i64 576, !7, i64 584}
!18 = !{!"_ERRORHANDLER_INFORMATION_TYPE", !8, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 96, !8, i64 97, !8, i64 98, !8, i64 99, !11, i64 100}
!19 = !{!"_priorityqueueENTRY", !14, i64 0, !14, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!20 = !{!17, !7, i64 160}
!21 = !{!22, !11, i64 16}
!22 = !{!"_PROCESS_INFORMATION_TYPE", !7, i64 0, !7, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !12, i64 72, !19, i64 144, !19, i64 184, !19, i64 224, !19, i64 264, !8, i64 304, !8, i64 305, !7, i64 312, !11, i64 320, !7, i64 328, !7, i64 336}
!23 = !{!17, !7, i64 152}
!24 = !{!22, !11, i64 24}
!25 = !{!22, !7, i64 0}
!26 = !{!27, !14, i64 24}
!27 = !{!"_PROCESS_ATTRIBUTE_TYPE", !7, i64 0, !7, i64 8, !11, i64 16, !11, i64 20, !14, i64 24, !14, i64 32, !11, i64 40}
!28 = !{!22, !8, i64 304}
!29 = !{!22, !8, i64 305}
!30 = !{!6, !14, i64 256}
!31 = !{!6, !14, i64 264}
!32 = !{!22, !14, i64 40}
!33 = !{!27, !14, i64 32}
!34 = !{!22, !7, i64 240}
!35 = !{!22, !7, i64 280}
!36 = !{!22, !11, i64 20}
!37 = !{!22, !14, i64 144}
!38 = !{!22, !14, i64 152}
!39 = !{!22, !14, i64 48}
!40 = !{!22, !14, i64 184}
!41 = !{!22, !14, i64 192}
!42 = !{!17, !11, i64 36}
!43 = !{!11, !11, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass