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

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

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 6, ptr %19, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %10, align 4
  br label %132

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

28:                                               ; preds = %20
  %29 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 4, ptr %29, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %10, align 4
  br label %132

30:                                               ; preds = %20
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = icmp ult i32 %31, 1
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = icmp ugt i32 %34, 63
  br i1 %35, label %36, label %38

36:                                               ; preds = %33, %30
  %37 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 4, ptr %37, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %10, align 4
  br label %132

38:                                               ; preds = %33
  %39 = load ptr, ptr %7, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %39, i32 0, i32 8
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %41, i32 0, i32 11
  %43 = load ptr, ptr %42, align 8, !tbaa !22
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %43, i64 %45
  store ptr %46, ptr %8, align 8, !tbaa !9
  %47 = load ptr, ptr %8, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %47, i32 0, i32 4
  %49 = load i32, ptr %48, align 8, !tbaa !23
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %51, label %53

51:                                               ; preds = %38
  %52 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 6, ptr %52, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %10, align 4
  br label %132

53:                                               ; preds = %38
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %55, i32 0, i32 3
  store i32 %54, ptr %56, align 4, !tbaa !25
  %57 = load ptr, ptr %8, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %57, i32 0, i32 11
  %59 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %58, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !26
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %86

62:                                               ; preds = %53
  %63 = load ptr, ptr %8, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %63, i32 0, i32 11
  %65 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %64, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !26
  store ptr %66, ptr %9, align 8, !tbaa !9
  %67 = load ptr, ptr %8, align 8, !tbaa !9
  %68 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %67, i32 0, i32 11
  call void @PRIORITYQUEUE_REMOVE(ptr noundef %68)
  %69 = load ptr, ptr %8, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %69, i32 0, i32 3
  %71 = load i32, ptr %70, align 4, !tbaa !25
  %72 = zext i32 %71 to i64
  %73 = load ptr, ptr %8, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %73, i32 0, i32 11
  %75 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %74, i32 0, i32 0
  store i64 %72, ptr %75, align 8, !tbaa !27
  %76 = load ptr, ptr %8, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %76, i32 0, i32 2
  %78 = load i32, ptr %77, align 8, !tbaa !28
  %79 = zext i32 %78 to i64
  %80 = load ptr, ptr %8, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %80, i32 0, i32 11
  %82 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %81, i32 0, i32 1
  store i64 %79, ptr %82, align 8, !tbaa !29
  %83 = load ptr, ptr %9, align 8, !tbaa !9
  %84 = load ptr, ptr %8, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %84, i32 0, i32 11
  call void @PRIORITYQUEUE_ENQUEUE(ptr noundef %83, ptr noundef %85)
  br label %86

86:                                               ; preds = %62, %53
  %87 = load ptr, ptr %8, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %87, i32 0, i32 14
  %89 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %88, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !30
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %122

92:                                               ; preds = %86
  %93 = load ptr, ptr %8, align 8, !tbaa !9
  %94 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %93, i32 0, i32 14
  %95 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %94, i32 0, i32 2
  %96 = load ptr, ptr %95, align 8, !tbaa !30
  store ptr %96, ptr %9, align 8, !tbaa !9
  %97 = load ptr, ptr %9, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct._priorityqueueRECORD, ptr %97, i32 0, i32 2
  %99 = load i8, ptr %98, align 4, !tbaa !31
  %100 = icmp ne i8 %99, 0
  br i1 %100, label %101, label %121

101:                                              ; preds = %92
  %102 = load ptr, ptr %8, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %102, i32 0, i32 14
  call void @PRIORITYQUEUE_REMOVE(ptr noundef %103)
  %104 = load ptr, ptr %8, align 8, !tbaa !9
  %105 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %104, i32 0, i32 3
  %106 = load i32, ptr %105, align 4, !tbaa !25
  %107 = zext i32 %106 to i64
  %108 = load ptr, ptr %8, align 8, !tbaa !9
  %109 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %108, i32 0, i32 14
  %110 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %109, i32 0, i32 0
  store i64 %107, ptr %110, align 8, !tbaa !32
  %111 = load ptr, ptr %8, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %111, i32 0, i32 2
  %113 = load i32, ptr %112, align 8, !tbaa !28
  %114 = zext i32 %113 to i64
  %115 = load ptr, ptr %8, align 8, !tbaa !9
  %116 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %115, i32 0, i32 14
  %117 = getelementptr inbounds %struct._priorityqueueENTRY, ptr %116, i32 0, i32 1
  store i64 %114, ptr %117, align 8, !tbaa !33
  %118 = load ptr, ptr %9, align 8, !tbaa !9
  %119 = load ptr, ptr %8, align 8, !tbaa !9
  %120 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %119, i32 0, i32 14
  call void @PRIORITYQUEUE_ENQUEUE(ptr noundef %118, ptr noundef %120)
  br label %121

121:                                              ; preds = %101, %92
  br label %122

122:                                              ; preds = %121, %86
  %123 = load ptr, ptr %7, align 8, !tbaa !9
  %124 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %123, i32 0, i32 8
  %125 = load ptr, ptr %124, align 8, !tbaa !11
  %126 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %125, i32 0, i32 6
  %127 = load i32, ptr %126, align 4, !tbaa !34
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %130

129:                                              ; preds = %122
  call void @PORT_YIELD()
  br label %130

130:                                              ; preds = %129, %122
  %131 = load ptr, ptr %6, align 8, !tbaa !9
  store i32 1, ptr %131, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 0, ptr %10, align 4
  br label %132

132:                                              ; preds = %130, %51, %36, %28, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %133 = load i32, ptr %10, align 4
  switch i32 %133, label %135 [
    i32 0, label %134
    i32 1, label %134
  ]

134:                                              ; preds = %132, %132
  ret void

135:                                              ; preds = %132
  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 152}
!23 = !{!24, !6, i64 24}
!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 = !{!24, !6, i64 20}
!26 = !{!24, !10, i64 160}
!27 = !{!24, !16, i64 144}
!28 = !{!24, !6, i64 16}
!29 = !{!24, !16, i64 152}
!30 = !{!24, !10, i64 280}
!31 = !{!17, !7, i64 12}
!32 = !{!24, !16, i64 264}
!33 = !{!24, !16, i64 272}
!34 = !{!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 @SET_PRIORITY(i32 noundef %0, i32 noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #1 {
  tail call void @ENTER_CORE() #2
  %4 = tail call i32 @PORT_GETCORE() #2
  %5 = zext i32 %4 to i64
  %6 = getelementptr inbounds [2 x %struct._MODULE_INFORMATION_TYPE], ptr @CORE_MODULE_INFORMATION, i64 0, i64 %5, i32 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %53, label %9

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %7, i64 144
  %11 = load i32, ptr %10, align 8, !tbaa !16
  %.not = icmp ule i32 %11, %0
  %12 = add i32 %1, -64
  %or.cond = icmp ult i32 %12, -63
  %or.cond42 = or i1 %.not, %or.cond
  br i1 %or.cond42, label %53, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %7, i64 152
  %15 = load ptr, ptr %14, align 8, !tbaa !20
  %16 = zext i32 %0 to i64
  %17 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %15, i64 %16
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  %19 = load i32, ptr %18, align 8, !tbaa !21
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %53, label %21

21:                                               ; preds = %13
  %22 = getelementptr inbounds i8, ptr %17, i64 20
  store i32 %1, ptr %22, align 4, !tbaa !23
  %23 = getelementptr inbounds i8, ptr %17, i64 160
  %24 = load ptr, ptr %23, align 8, !tbaa !24
  %.not39 = icmp eq ptr %24, null
  br i1 %.not39, label %33, label %25

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

33:                                               ; preds = %25, %21
  %34 = getelementptr inbounds i8, ptr %17, i64 264
  %35 = getelementptr inbounds i8, ptr %17, i64 280
  %36 = load ptr, ptr %35, align 8, !tbaa !28
  %.not40 = icmp eq ptr %36, null
  br i1 %.not40, label %47, label %37

37:                                               ; preds = %33
  %38 = getelementptr inbounds i8, ptr %36, i64 12
  %39 = load i8, ptr %38, align 4, !tbaa !29
  %.not41 = icmp eq i8 %39, 0
  br i1 %.not41, label %47, label %40

40:                                               ; preds = %37
  tail call void @PRIORITYQUEUE_REMOVE(ptr noundef nonnull %34) #2
  %41 = load i32, ptr %22, align 4, !tbaa !23
  %42 = zext i32 %41 to i64
  store i64 %42, ptr %34, align 8, !tbaa !30
  %43 = getelementptr inbounds i8, ptr %17, i64 16
  %44 = load i32, ptr %43, align 8, !tbaa !26
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds i8, ptr %17, i64 272
  store i64 %45, ptr %46, align 8, !tbaa !31
  tail call void @PRIORITYQUEUE_ENQUEUE(ptr noundef nonnull %36, ptr noundef nonnull %34) #2
  br label %47

47:                                               ; preds = %37, %40, %33
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 36
  %50 = load i32, ptr %49, align 4, !tbaa !32
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %47
  tail call void @PORT_YIELD() #2
  br label %53

53:                                               ; preds = %47, %52, %13, %9, %3
  %.sink = phi i32 [ 6, %3 ], [ 4, %9 ], [ 6, %13 ], [ 1, %52 ], [ 1, %47 ]
  store i32 %.sink, ptr %2, align 4, !tbaa !33
  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 152}
!21 = !{!22, !11, i64 24}
!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 = !{!22, !11, i64 20}
!24 = !{!22, !7, i64 160}
!25 = !{!22, !14, i64 144}
!26 = !{!22, !11, i64 16}
!27 = !{!22, !14, i64 152}
!28 = !{!22, !7, i64 280}
!29 = !{!15, !8, i64 12}
!30 = !{!22, !14, i64 264}
!31 = !{!22, !14, i64 272}
!32 = !{!17, !11, i64 36}
!33 = !{!11, !11, i64 0}


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