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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @TIMED_WAIT(i64 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store i64 %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @ENTER_CORE()
  %7 = call i32 @PORT_GETCORE()
  %8 = zext i32 %7 to i64
  %9 = getelementptr inbounds [2 x %struct._MODULE_INFORMATION_TYPE], ptr @CORE_MODULE_INFORMATION, i64 0, i64 %8
  store ptr %9, ptr %5, align 8, !tbaa !9
  %10 = load ptr, ptr %5, align 8, !tbaa !9
  %11 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %10, i32 0, i32 8
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %16

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

16:                                               ; preds = %2
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %17, i32 0, i32 8
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %19, i32 0, i32 12
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %16
  %24 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 6, ptr %24, align 4, !tbaa !18
  call void @EXIT_CORE()
  store i32 1, ptr %6, align 4
  br label %185

25:                                               ; preds = %16
  %26 = load i64, ptr %3, align 8, !tbaa !5
  %27 = icmp slt i64 %26, 0
  br i1 %27, label %28, label %31

28:                                               ; preds = %25
  %29 = load i64, ptr %3, align 8, !tbaa !5
  %30 = icmp ne i64 %29, -1
  br i1 %30, label %34, label %31

31:                                               ; preds = %28, %25
  %32 = load i64, ptr %3, align 8, !tbaa !5
  %33 = icmp eq i64 %32, -1
  br i1 %33, label %34, label %36

34:                                               ; preds = %31, %28
  %35 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 4, ptr %35, align 4, !tbaa !18
  call void @EXIT_CORE()
  store i32 1, ptr %6, align 4
  br label %185

36:                                               ; preds = %31
  %37 = load ptr, ptr %5, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %37, i32 0, i32 8
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %39, i32 0, i32 6
  %41 = load i32, ptr %40, align 4, !tbaa !23
  %42 = icmp ugt i32 %41, 0
  br i1 %42, label %52, label %43

43:                                               ; preds = %36
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %44, i32 0, i32 8
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %46, i32 0, i32 13
  %48 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %47, i32 0, i32 7
  %49 = load i8, ptr %48, align 1, !tbaa !24
  %50 = zext i8 %49 to i32
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %54

52:                                               ; preds = %43, %36
  %53 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 6, ptr %53, align 4, !tbaa !18
  call void @EXIT_CORE()
  store i32 1, ptr %6, align 4
  br label %185

54:                                               ; preds = %43
  %55 = load ptr, ptr %5, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %55, i32 0, i32 8
  %57 = load ptr, ptr %56, align 8, !tbaa !11
  %58 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %57, i32 0, i32 12
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %59, i32 0, i32 11
  call void @PRIORITYQUEUE_REMOVE(ptr noundef %60)
  %61 = load i64, ptr %3, align 8, !tbaa !5
  %62 = icmp eq i64 %61, 0
  br i1 %62, label %63, label %110

63:                                               ; preds = %54
  %64 = load ptr, ptr %5, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %64, i32 0, i32 8
  %66 = load ptr, ptr %65, align 8, !tbaa !11
  %67 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %66, i32 0, i32 12
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %69 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %68, i32 0, i32 4
  store i32 2, ptr %69, align 8, !tbaa !25
  %70 = load ptr, ptr %5, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %70, i32 0, i32 8
  %72 = load ptr, ptr %71, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %72, i32 0, i32 12
  %74 = load ptr, ptr %73, align 8, !tbaa !19
  %75 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %74, i32 0, i32 3
  %76 = load i32, ptr %75, align 4, !tbaa !27
  %77 = zext i32 %76 to i64
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %78, i32 0, i32 8
  %80 = load ptr, ptr %79, align 8, !tbaa !11
  %81 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %80, i32 0, i32 12
  %82 = load ptr, ptr %81, align 8, !tbaa !19
  %83 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %82, i32 0, i32 11
  %84 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %83, i32 0, i32 0
  store i64 %77, ptr %84, align 8, !tbaa !28
  %85 = load ptr, ptr %5, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %85, i32 0, i32 8
  %87 = load ptr, ptr %86, align 8, !tbaa !11
  %88 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %87, i32 0, i32 12
  %89 = load ptr, ptr %88, align 8, !tbaa !19
  %90 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %89, i32 0, i32 2
  %91 = load i32, ptr %90, align 8, !tbaa !29
  %92 = zext i32 %91 to i64
  %93 = load ptr, ptr %5, align 8, !tbaa !9
  %94 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %93, i32 0, i32 8
  %95 = load ptr, ptr %94, align 8, !tbaa !11
  %96 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %95, i32 0, i32 12
  %97 = load ptr, ptr %96, align 8, !tbaa !19
  %98 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %97, i32 0, i32 11
  %99 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %98, i32 0, i32 1
  store i64 %92, ptr %99, align 8, !tbaa !30
  %100 = load ptr, ptr %5, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %100, i32 0, i32 8
  %102 = load ptr, ptr %101, align 8, !tbaa !11
  %103 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %102, i32 0, i32 17
  %104 = load ptr, ptr %5, align 8, !tbaa !9
  %105 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %104, i32 0, i32 8
  %106 = load ptr, ptr %105, align 8, !tbaa !11
  %107 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %106, i32 0, i32 12
  %108 = load ptr, ptr %107, align 8, !tbaa !19
  %109 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %108, i32 0, i32 11
  call void @PRIORITYQUEUE_ENQUEUE(ptr noundef %103, ptr noundef %109)
  call void @PORT_YIELD()
  br label %183

110:                                              ; preds = %54
  %111 = load ptr, ptr %5, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %111, i32 0, i32 8
  %113 = load ptr, ptr %112, align 8, !tbaa !11
  %114 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %113, i32 0, i32 12
  %115 = load ptr, ptr %114, align 8, !tbaa !19
  %116 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %115, i32 0, i32 4
  store i32 4, ptr %116, align 8, !tbaa !25
  %117 = load ptr, ptr %5, align 8, !tbaa !9
  %118 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %117, i32 0, i32 10
  %119 = load i64, ptr %118, align 8, !tbaa !31
  %120 = load ptr, ptr %5, align 8, !tbaa !9
  %121 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %120, i32 0, i32 11
  %122 = load i64, ptr %121, align 8, !tbaa !32
  %123 = add nsw i64 %119, %122
  %124 = load ptr, ptr %5, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %124, i32 0, i32 8
  %126 = load ptr, ptr %125, align 8, !tbaa !11
  %127 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %126, i32 0, i32 12
  %128 = load ptr, ptr %127, align 8, !tbaa !19
  %129 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %128, i32 0, i32 8
  store i64 %123, ptr %129, align 8, !tbaa !33
  %130 = load ptr, ptr %5, align 8, !tbaa !9
  %131 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %130, i32 0, i32 8
  %132 = load ptr, ptr %131, align 8, !tbaa !11
  %133 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %132, i32 0, i32 12
  %134 = load ptr, ptr %133, align 8, !tbaa !19
  %135 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %134, i32 0, i32 9
  store i64 -1, ptr %135, align 8, !tbaa !34
  %136 = load ptr, ptr %5, align 8, !tbaa !9
  %137 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %136, i32 0, i32 10
  %138 = load i64, ptr %137, align 8, !tbaa !31
  %139 = load ptr, ptr %5, align 8, !tbaa !9
  %140 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %139, i32 0, i32 11
  %141 = load i64, ptr %140, align 8, !tbaa !32
  %142 = add nsw i64 %138, %141
  %143 = load i64, ptr %3, align 8, !tbaa !5
  %144 = add nsw i64 %142, %143
  %145 = load ptr, ptr %5, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %145, i32 0, i32 8
  %147 = load ptr, ptr %146, align 8, !tbaa !11
  %148 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %147, i32 0, i32 12
  %149 = load ptr, ptr %148, align 8, !tbaa !19
  %150 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %149, i32 0, i32 13
  %151 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %150, i32 0, i32 0
  store i64 %144, ptr %151, align 8, !tbaa !35
  %152 = load ptr, ptr %5, align 8, !tbaa !9
  %153 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %152, i32 0, i32 8
  %154 = load ptr, ptr %153, align 8, !tbaa !11
  %155 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %154, i32 0, i32 12
  %156 = load ptr, ptr %155, align 8, !tbaa !19
  %157 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %156, i32 0, i32 2
  %158 = load i32, ptr %157, align 8, !tbaa !29
  %159 = zext i32 %158 to i64
  %160 = load ptr, ptr %5, align 8, !tbaa !9
  %161 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %160, i32 0, i32 8
  %162 = load ptr, ptr %161, align 8, !tbaa !11
  %163 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %162, i32 0, i32 12
  %164 = load ptr, ptr %163, align 8, !tbaa !19
  %165 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %164, i32 0, i32 13
  %166 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %165, i32 0, i32 1
  store i64 %159, ptr %166, align 8, !tbaa !36
  %167 = load ptr, ptr %5, align 8, !tbaa !9
  %168 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %167, i32 0, i32 8
  %169 = load ptr, ptr %168, align 8, !tbaa !11
  %170 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %169, i32 0, i32 19
  %171 = load ptr, ptr %5, align 8, !tbaa !9
  %172 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %171, i32 0, i32 8
  %173 = load ptr, ptr %172, align 8, !tbaa !11
  %174 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %173, i32 0, i32 12
  %175 = load ptr, ptr %174, align 8, !tbaa !19
  %176 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %175, i32 0, i32 13
  call void @PRIORITYQUEUE_ENQUEUE(ptr noundef %170, ptr noundef %176)
  call void @PORT_YIELD()
  %177 = load ptr, ptr %5, align 8, !tbaa !9
  %178 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %177, i32 0, i32 8
  %179 = load ptr, ptr %178, align 8, !tbaa !11
  %180 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %179, i32 0, i32 12
  %181 = load ptr, ptr %180, align 8, !tbaa !19
  %182 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %181, i32 0, i32 13
  call void @PRIORITYQUEUE_REMOVE(ptr noundef %182)
  br label %183

183:                                              ; preds = %110, %63
  %184 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 1, ptr %184, align 4, !tbaa !18
  call void @EXIT_CORE()
  store i32 0, ptr %6, align 4
  br label %185

185:                                              ; preds = %183, %52, %34, %23, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  %186 = load i32, ptr %6, align 4
  switch i32 %186, label %188 [
    i32 0, label %187
    i32 1, label %187
  ]

187:                                              ; preds = %185, %185
  ret void

188:                                              ; preds = %185
  unreachable
}

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

declare void @ENTER_CORE() #2

declare i32 @PORT_GETCORE() #2

declare void @EXIT_CORE() #2

declare void @PRIORITYQUEUE_REMOVE(ptr noundef) #2

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

declare void @PORT_YIELD() #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"long long", !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, !14, i64 32, !14, i64 36, !14, i64 40, !15, i64 48, !14, i64 120, !10, i64 128, !10, i64 136, !16, i64 144, !6, i64 256, !6, i64 264, !6, i64 272, !17, i64 280}
!13 = !{!"_heapRECORD", !10, i64 0, !14, i64 8, !14, i64 12, !14, i64 16}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_CONTEXT_TYPE", !14, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !14, i64 32, !7, i64 36, !10, i64 40, !10, i64 48, !14, i64 56, !14, i64 60, !14, i64 64, !14, i64 68}
!16 = !{!"_HEALTHMONITORINGCALLBACK_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !14, i64 16, !15, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !14, i64 100, !14, i64 104}
!17 = !{!"_priorityqueueRECORD", !10, i64 0, !14, i64 8, !7, i64 12, !7, i64 13}
!18 = !{!14, !14, i64 0}
!19 = !{!20, !10, i64 160}
!20 = !{!"_PARTITION_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !10, i64 16, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !7, i64 40, !13, i64 48, !15, i64 72, !14, i64 144, !10, i64 152, !10, i64 160, !21, i64 168, !16, i64 272, !14, i64 384, !22, i64 392, !17, i64 432, !17, i64 448, !17, i64 464, !14, i64 480, !14, i64 484, !10, i64 488, !14, i64 496, !10, i64 504, !14, i64 512, !10, i64 520, !14, i64 528, !10, i64 536, !14, i64 544, !10, i64 552, !14, i64 560, !10, i64 568, !14, i64 576, !10, i64 584}
!21 = !{!"_ERRORHANDLER_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !14, i64 16, !15, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !14, i64 100}
!22 = !{!"_priorityqueueENTRY", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!23 = !{!20, !14, i64 36}
!24 = !{!20, !7, i64 267}
!25 = !{!26, !14, i64 24}
!26 = !{!"_PROCESS_INFORMATION_TYPE", !10, i64 0, !10, i64 8, !14, i64 16, !14, i64 20, !14, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !15, i64 72, !22, i64 144, !22, i64 184, !22, i64 224, !22, i64 264, !7, i64 304, !7, i64 305, !10, i64 312, !14, i64 320, !10, i64 328, !10, i64 336}
!27 = !{!26, !14, i64 20}
!28 = !{!26, !6, i64 144}
!29 = !{!26, !14, i64 16}
!30 = !{!26, !6, i64 152}
!31 = !{!12, !6, i64 256}
!32 = !{!12, !6, i64 264}
!33 = !{!26, !6, i64 56}
!34 = !{!26, !6, i64 64}
!35 = !{!26, !6, i64 224}
!36 = !{!26, !6, i64 232}


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

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

; Function Attrs: nounwind uwtable
define dso_local void @TIMED_WAIT(i64 noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  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 %56, label %9

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %7, i64 160
  %11 = load ptr, ptr %10, align 8, !tbaa !16
  %12 = icmp eq ptr %11, null
  br i1 %12, label %56, label %13

13:                                               ; preds = %9
  %or.cond3 = icmp slt i64 %0, 0
  br i1 %or.cond3, label %56, label %14

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %7, i64 36
  %16 = load i32, ptr %15, align 4, !tbaa !20
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %17, label %56

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %7, i64 267
  %19 = load i8, ptr %18, align 1, !tbaa !21
  %.not39 = icmp eq i8 %19, 0
  br i1 %.not39, label %20, label %56

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %11, i64 144
  tail call void @PRIORITYQUEUE_REMOVE(ptr noundef nonnull %21) #2
  %22 = icmp eq i64 %0, 0
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 160
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  %26 = getelementptr inbounds i8, ptr %25, i64 24
  br i1 %22, label %27, label %37

27:                                               ; preds = %20
  store i32 2, ptr %26, align 8, !tbaa !22
  %28 = getelementptr inbounds i8, ptr %25, i64 20
  %29 = load i32, ptr %28, align 4, !tbaa !24
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %25, i64 144
  store i64 %30, ptr %31, align 8, !tbaa !25
  %32 = getelementptr inbounds i8, ptr %25, i64 16
  %33 = load i32, ptr %32, align 8, !tbaa !26
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %25, i64 152
  store i64 %34, ptr %35, align 8, !tbaa !27
  %36 = getelementptr inbounds i8, ptr %23, i64 432
  tail call void @PRIORITYQUEUE_ENQUEUE(ptr noundef nonnull %36, ptr noundef nonnull %31) #2
  tail call void @PORT_YIELD() #2
  br label %56

37:                                               ; preds = %20
  store i32 4, ptr %26, align 8, !tbaa !22
  %38 = getelementptr inbounds i8, ptr %5, i64 256
  %39 = load i64, ptr %38, align 8, !tbaa !28
  %40 = getelementptr inbounds i8, ptr %5, i64 264
  %41 = load i64, ptr %40, align 8, !tbaa !29
  %42 = add nsw i64 %41, %39
  %43 = getelementptr inbounds i8, ptr %25, i64 56
  store i64 %42, ptr %43, align 8, !tbaa !30
  %44 = getelementptr inbounds i8, ptr %25, i64 64
  store i64 -1, ptr %44, align 8, !tbaa !31
  %45 = add nsw i64 %42, %0
  %46 = getelementptr inbounds i8, ptr %25, i64 224
  store i64 %45, ptr %46, align 8, !tbaa !32
  %47 = getelementptr inbounds i8, ptr %25, i64 16
  %48 = load i32, ptr %47, align 8, !tbaa !26
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds i8, ptr %25, i64 232
  store i64 %49, ptr %50, align 8, !tbaa !33
  %51 = getelementptr inbounds i8, ptr %23, i64 464
  tail call void @PRIORITYQUEUE_ENQUEUE(ptr noundef nonnull %51, ptr noundef nonnull %46) #2
  tail call void @PORT_YIELD() #2
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %52, i64 160
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  %55 = getelementptr inbounds i8, ptr %54, i64 224
  tail call void @PRIORITYQUEUE_REMOVE(ptr noundef nonnull %55) #2
  br label %56

56:                                               ; preds = %27, %37, %14, %17, %13, %9, %2
  %.sink = phi i32 [ 6, %2 ], [ 6, %9 ], [ 4, %13 ], [ 6, %17 ], [ 6, %14 ], [ 1, %37 ], [ 1, %27 ]
  store i32 %.sink, ptr %1, align 4, !tbaa !34
  tail call void @EXIT_CORE() #2
  ret void
}

declare void @ENTER_CORE() local_unnamed_addr #1

declare i32 @PORT_GETCORE() local_unnamed_addr #1

declare void @EXIT_CORE() local_unnamed_addr #1

declare void @PRIORITYQUEUE_REMOVE(ptr noundef) local_unnamed_addr #1

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

declare void @PORT_YIELD() local_unnamed_addr #1

attributes #0 = { 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 #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 }

!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, !7, i64 160}
!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, !11, i64 36}
!21 = !{!17, !8, i64 267}
!22 = !{!23, !11, i64 24}
!23 = !{!"_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}
!24 = !{!23, !11, i64 20}
!25 = !{!23, !14, i64 144}
!26 = !{!23, !11, i64 16}
!27 = !{!23, !14, i64 152}
!28 = !{!6, !14, i64 256}
!29 = !{!6, !14, i64 264}
!30 = !{!23, !14, i64 56}
!31 = !{!23, !14, i64 64}
!32 = !{!23, !14, i64 224}
!33 = !{!23, !14, i64 232}
!34 = !{!11, !11, i64 0}


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