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

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

@CORE_MODULE_INFORMATION = external global [2 x %struct._MODULE_INFORMATION_TYPE], align 16
@CORE_CURRENT_CONTEXT = external global [2 x ptr], 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

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

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

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

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

28:                                               ; preds = %19
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %44

31:                                               ; preds = %28
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %32, i32 0, i32 8
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %34, i32 0, i32 3
  %36 = load i32, ptr %35, align 8, !tbaa !22
  call void @INITIALIZE_PARTITION_INFORMATION(i32 noundef %36, i8 noundef zeroext 1)
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %38, i32 0, i32 8
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %40, i32 0, i32 4
  store i32 %37, ptr %41, align 4, !tbaa !18
  call void @PORT_YIELD()
  br label %42

42:                                               ; preds = %43, %31
  br label %43

43:                                               ; preds = %42
  br label %42

44:                                               ; preds = %28
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = icmp eq i32 %45, 2
  br i1 %46, label %50, label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = icmp eq i32 %48, 3
  br i1 %49, label %50, label %151

50:                                               ; preds = %47, %44
  %51 = load ptr, ptr %5, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %51, i32 0, i32 8
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = icmp eq i32 %55, 2
  br i1 %56, label %57, label %62

57:                                               ; preds = %50
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 3
  br i1 %59, label %60, label %62

60:                                               ; preds = %57
  %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 %9, align 4
  br label %181

62:                                               ; preds = %57, %50
  %63 = load ptr, ptr %5, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %63, i32 0, i32 8
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !23
  store ptr %67, ptr %6, align 8, !tbaa !9
  %68 = load ptr, ptr %5, align 8, !tbaa !9
  %69 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %68, i32 0, i32 8
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  %71 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %70, i32 0, i32 7
  %72 = load i8, ptr %71, align 8, !tbaa !24
  %73 = icmp ne i8 %72, 0
  br i1 %73, label %74, label %79

74:                                               ; preds = %62
  %75 = load ptr, ptr %5, align 8, !tbaa !9
  %76 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %75, i32 0, i32 8
  %77 = load ptr, ptr %76, align 8, !tbaa !11
  %78 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %77, i32 0, i32 5
  store i32 4, ptr %78, align 8, !tbaa !25
  br label %84

79:                                               ; preds = %62
  %80 = load ptr, ptr %5, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %80, i32 0, i32 8
  %82 = load ptr, ptr %81, align 8, !tbaa !11
  %83 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %82, i32 0, i32 5
  store i32 2, ptr %83, align 8, !tbaa !25
  br label %84

84:                                               ; preds = %79, %74
  %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 3
  %89 = load i32, ptr %88, align 8, !tbaa !22
  call void @INITIALIZE_PARTITION_INFORMATION(i32 noundef %89, i8 noundef zeroext 1)
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = load ptr, ptr %5, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %91, i32 0, i32 8
  %93 = load ptr, ptr %92, align 8, !tbaa !11
  %94 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %93, i32 0, i32 4
  store i32 %90, ptr %94, align 4, !tbaa !18
  %95 = load ptr, ptr %5, align 8, !tbaa !9
  %96 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %95, i32 0, i32 8
  %97 = load ptr, ptr %96, align 8, !tbaa !11
  %98 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %97, i32 0, i32 9
  call void @PORT_PREPARECONTEXT(ptr noundef %98)
  %99 = load ptr, ptr %6, align 8, !tbaa !9
  %100 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %99, i32 0, i32 14
  %101 = load ptr, ptr %100, align 8, !tbaa !26
  store ptr %101, ptr %7, align 8, !tbaa !9
  %102 = load ptr, ptr %6, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %102, i32 0, i32 12
  %104 = load ptr, ptr %103, align 8, !tbaa !28
  store ptr %104, ptr %8, align 8, !tbaa !9
  br label %105

105:                                              ; preds = %117, %84
  %106 = load ptr, ptr %8, align 8, !tbaa !9
  %107 = ptrtoint ptr %106 to i32
  %108 = load ptr, ptr %6, align 8, !tbaa !9
  %109 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %108, i32 0, i32 12
  %110 = load ptr, ptr %109, align 8, !tbaa !28
  %111 = ptrtoint ptr %110 to i32
  %112 = load ptr, ptr %6, align 8, !tbaa !9
  %113 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %112, i32 0, i32 13
  %114 = load i32, ptr %113, align 8, !tbaa !29
  %115 = add i32 %111, %114
  %116 = icmp ult i32 %107, %115
  br i1 %116, label %117, label %125

117:                                              ; preds = %105
  %118 = load ptr, ptr %7, align 8, !tbaa !9
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = load ptr, ptr %8, align 8, !tbaa !9
  store i32 %119, ptr %120, align 4, !tbaa !5
  %121 = load ptr, ptr %7, align 8, !tbaa !9
  %122 = getelementptr inbounds i32, ptr %121, i32 1
  store ptr %122, ptr %7, align 8, !tbaa !9
  %123 = load ptr, ptr %8, align 8, !tbaa !9
  %124 = getelementptr inbounds i32, ptr %123, i32 1
  store ptr %124, ptr %8, align 8, !tbaa !9
  br label %105, !llvm.loop !30

125:                                              ; preds = %105
  %126 = load ptr, ptr %5, align 8, !tbaa !9
  %127 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %126, i32 0, i32 8
  %128 = load ptr, ptr %127, align 8, !tbaa !11
  %129 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %128, i32 0, i32 9
  %130 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %129, i32 0, i32 10
  store i32 6, ptr %130, align 8, !tbaa !32
  %131 = load ptr, ptr %5, align 8, !tbaa !9
  %132 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %131, i32 0, i32 8
  %133 = load ptr, ptr %132, align 8, !tbaa !11
  %134 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %133, i32 0, i32 9
  %135 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %134, i32 0, i32 10
  %136 = load i32, ptr %135, align 8, !tbaa !32
  %137 = load ptr, ptr %5, align 8, !tbaa !9
  %138 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %137, i32 0, i32 8
  %139 = load ptr, ptr %138, align 8, !tbaa !11
  %140 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %139, i32 0, i32 9
  %141 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %140, i32 0, i32 11
  store i32 %136, ptr %141, align 4, !tbaa !33
  %142 = load ptr, ptr %5, align 8, !tbaa !9
  %143 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %142, i32 0, i32 8
  %144 = load ptr, ptr %143, align 8, !tbaa !11
  %145 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %144, i32 0, i32 9
  %146 = call i32 @PORT_GETCORE()
  %147 = zext i32 %146 to i64
  %148 = getelementptr inbounds [2 x ptr], ptr @CORE_CURRENT_CONTEXT, i64 0, i64 %147
  store ptr %145, ptr %148, align 8, !tbaa !9
  call void @PORT_SWITCH()
  br label %149

149:                                              ; preds = %150, %125
  br label %150

150:                                              ; preds = %149
  br label %149

151:                                              ; preds = %47
  %152 = load i32, ptr %3, align 4, !tbaa !5
  %153 = icmp eq i32 %152, 4
  br i1 %153, label %154, label %179

154:                                              ; preds = %151
  %155 = load ptr, ptr %5, align 8, !tbaa !9
  %156 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %155, i32 0, i32 8
  %157 = load ptr, ptr %156, align 8, !tbaa !11
  %158 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %157, i32 0, i32 4
  %159 = load i32, ptr %158, align 4, !tbaa !18
  %160 = icmp eq i32 %159, 4
  br i1 %160, label %161, label %163

161:                                              ; preds = %154
  %162 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 2, ptr %162, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %9, align 4
  br label %181

163:                                              ; preds = %154
  %164 = load i32, ptr %3, align 4, !tbaa !5
  %165 = load ptr, ptr %5, align 8, !tbaa !9
  %166 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %165, i32 0, i32 8
  %167 = load ptr, ptr %166, align 8, !tbaa !11
  %168 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %167, i32 0, i32 4
  store i32 %164, ptr %168, align 4, !tbaa !18
  %169 = load ptr, ptr %5, align 8, !tbaa !9
  %170 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %169, i32 0, i32 8
  %171 = load ptr, ptr %170, align 8, !tbaa !11
  %172 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %171, i32 0, i32 0
  store i8 1, ptr %172, align 8, !tbaa !34
  %173 = load ptr, ptr %4, align 8, !tbaa !9
  call void @SCHEDULER_STARTPROCESSSCHEDULER(ptr noundef %173)
  %174 = load ptr, ptr %5, align 8, !tbaa !9
  %175 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %174, i32 0, i32 8
  %176 = load ptr, ptr %175, align 8, !tbaa !11
  %177 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %176, i32 0, i32 9
  %178 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %177, i32 0, i32 10
  store i32 7, ptr %178, align 8, !tbaa !32
  call void @EXIT_CORE()
  store i32 1, ptr %9, align 4
  br label %181

179:                                              ; preds = %151
  %180 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 4, ptr %180, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 0, ptr %9, align 4
  br label %181

181:                                              ; preds = %179, %163, %161, %60, %26, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  %182 = load i32, ptr %9, align 4
  switch i32 %182, label %184 [
    i32 0, label %183
    i32 1, label %183
  ]

183:                                              ; preds = %181, %181
  ret void

184:                                              ; preds = %181
  unreachable
}

declare void @INITIALIZE_PARTITION_INFORMATION(i32 noundef, i8 noundef zeroext) #1

declare void @PORT_YIELD() #1

declare void @PORT_PREPARECONTEXT(ptr noundef) #1

declare void @PORT_SWITCH() #1

declare void @SCHEDULER_STARTPROCESSSCHEDULER(ptr noundef) #1

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 28}
!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, !6, i64 24}
!23 = !{!19, !10, i64 16}
!24 = !{!19, !7, i64 40}
!25 = !{!19, !6, i64 32}
!26 = !{!27, !10, i64 80}
!27 = !{!"_PARTITION_CONFIGURATION_TYPE", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !10, i64 48, !6, i64 56, !10, i64 64, !6, i64 72, !10, i64 80, !6, i64 88, !10, i64 96, !6, i64 104, !10, i64 112, !6, i64 120, !10, i64 128, !6, i64 136, !10, i64 144, !6, i64 152, !10, i64 160, !10, i64 168, !6, i64 176, !10, i64 184, !10, i64 192}
!28 = !{!27, !10, i64 64}
!29 = !{!27, !6, i64 72}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!19, !6, i64 136}
!33 = !{!19, !6, i64 140}
!34 = !{!19, !7, i64 0}


; 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
@CORE_CURRENT_CONTEXT = external local_unnamed_addr global [2 x ptr], 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

; Function Attrs: nounwind uwtable
define dso_local void @SET_PARTITION_MODE(i32 noundef %0, ptr noundef %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, i32 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %9

8:                                                ; preds = %2
  store i32 6, ptr %1, align 4, !tbaa !16
  br label %74

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %6, i64 28
  %11 = load i32, ptr %10, align 4, !tbaa !17
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %14

13:                                               ; preds = %9
  store i32 6, ptr %1, align 4, !tbaa !16
  br label %74

14:                                               ; preds = %9
  %15 = icmp eq i32 %0, 1
  br i1 %15, label %16, label %22

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %6, i64 24
  %18 = load i32, ptr %17, align 8, !tbaa !21
  tail call void @INITIALIZE_PARTITION_INFORMATION(i32 noundef %18, i8 noundef zeroext 1) #2
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 28
  store i32 1, ptr %20, align 4, !tbaa !17
  tail call void @PORT_YIELD() #2
  br label %21

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

22:                                               ; preds = %14
  %23 = and i32 %0, -2
  %or.cond = icmp eq i32 %23, 2
  br i1 %or.cond, label %24, label %65

24:                                               ; preds = %22
  %25 = icmp eq i32 %0, 3
  %26 = icmp eq i32 %11, 2
  %or.cond3 = and i1 %25, %26
  br i1 %or.cond3, label %27, label %28

27:                                               ; preds = %24
  store i32 6, ptr %1, align 4, !tbaa !16
  br label %74

28:                                               ; preds = %24
  %29 = getelementptr inbounds i8, ptr %6, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !22
  %31 = getelementptr inbounds i8, ptr %6, i64 40
  %32 = load i8, ptr %31, align 8, !tbaa !23
  %.not = icmp eq i8 %32, 0
  %spec.select = select i1 %.not, i32 2, i32 4
  %33 = getelementptr inbounds i8, ptr %6, i64 32
  store i32 %spec.select, ptr %33, align 8
  %34 = getelementptr inbounds i8, ptr %6, i64 24
  %35 = load i32, ptr %34, align 8, !tbaa !21
  tail call void @INITIALIZE_PARTITION_INFORMATION(i32 noundef %35, i8 noundef zeroext 1) #2
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i64 28
  store i32 %0, ptr %37, align 4, !tbaa !17
  %38 = getelementptr inbounds i8, ptr %36, i64 72
  tail call void @PORT_PREPARECONTEXT(ptr noundef nonnull %38) #2
  %39 = getelementptr inbounds i8, ptr %30, i64 64
  %40 = load ptr, ptr %39, align 8, !tbaa !24
  %41 = ptrtoint ptr %40 to i64
  %42 = trunc i64 %41 to i32
  %43 = getelementptr inbounds i8, ptr %30, i64 72
  %44 = load i32, ptr %43, align 8, !tbaa !26
  %45 = add i32 %44, %42
  %46 = icmp ugt i32 %45, %42
  br i1 %46, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %28
  %47 = getelementptr inbounds i8, ptr %30, i64 80
  %48 = load ptr, ptr %47, align 8, !tbaa !27
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.050 = phi ptr [ %51, %.lr.ph ], [ %40, %.lr.ph.preheader ]
  %.04549 = phi ptr [ %50, %.lr.ph ], [ %48, %.lr.ph.preheader ]
  %49 = load i32, ptr %.04549, align 4, !tbaa !16
  store i32 %49, ptr %.050, align 4, !tbaa !16
  %50 = getelementptr inbounds i8, ptr %.04549, i64 4
  %51 = getelementptr inbounds i8, ptr %.050, i64 4
  %52 = ptrtoint ptr %51 to i64
  %53 = trunc i64 %52 to i32
  %54 = load i32, ptr %43, align 8, !tbaa !26
  %55 = add i32 %54, %42
  %56 = icmp ugt i32 %55, %53
  br i1 %56, label %.lr.ph, label %._crit_edge, !llvm.loop !28

._crit_edge:                                      ; preds = %.lr.ph, %28
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 136
  store i32 6, ptr %58, align 8, !tbaa !30
  %59 = getelementptr inbounds i8, ptr %57, i64 140
  store i32 6, ptr %59, align 4, !tbaa !31
  %60 = getelementptr inbounds i8, ptr %57, i64 72
  %61 = tail call i32 @PORT_GETCORE() #2
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds [2 x ptr], ptr @CORE_CURRENT_CONTEXT, i64 0, i64 %62
  store ptr %60, ptr %63, align 8, !tbaa !32
  tail call void @PORT_SWITCH() #2
  br label %64

64:                                               ; preds = %64, %._crit_edge
  br label %64

65:                                               ; preds = %22
  %66 = icmp eq i32 %0, 4
  br i1 %66, label %67, label %73

67:                                               ; preds = %65
  %68 = icmp eq i32 %11, 4
  br i1 %68, label %69, label %70

69:                                               ; preds = %67
  store i32 2, ptr %1, align 4, !tbaa !16
  br label %74

70:                                               ; preds = %67
  store i32 4, ptr %10, align 4, !tbaa !17
  store i8 1, ptr %6, align 8, !tbaa !33
  tail call void @SCHEDULER_STARTPROCESSSCHEDULER(ptr noundef %1) #2
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 136
  store i32 7, ptr %72, align 8, !tbaa !30
  br label %74

73:                                               ; preds = %65
  store i32 4, ptr %1, align 4, !tbaa !16
  br label %74

74:                                               ; preds = %73, %70, %69, %27, %13, %8
  tail call void @EXIT_CORE() #2
  ret void
}

declare void @INITIALIZE_PARTITION_INFORMATION(i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

declare void @PORT_YIELD() local_unnamed_addr #0

declare void @PORT_PREPARECONTEXT(ptr noundef) local_unnamed_addr #0

declare void @PORT_SWITCH() local_unnamed_addr #0

declare void @SCHEDULER_STARTPROCESSSCHEDULER(ptr noundef) local_unnamed_addr #0

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 = !{!11, !11, i64 0}
!17 = !{!18, !11, i64 28}
!18 = !{!"_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, !19, i64 168, !13, i64 272, !11, i64 384, !20, 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}
!19 = !{!"_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}
!20 = !{!"_priorityqueueENTRY", !14, i64 0, !14, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!21 = !{!18, !11, i64 24}
!22 = !{!18, !7, i64 16}
!23 = !{!18, !8, i64 40}
!24 = !{!25, !7, i64 64}
!25 = !{!"_PARTITION_CONFIGURATION_TYPE", !11, i64 0, !7, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !7, i64 48, !11, i64 56, !7, i64 64, !11, i64 72, !7, i64 80, !11, i64 88, !7, i64 96, !11, i64 104, !7, i64 112, !11, i64 120, !7, i64 128, !11, i64 136, !7, i64 144, !11, i64 152, !7, i64 160, !7, i64 168, !11, i64 176, !7, i64 184, !7, i64 192}
!26 = !{!25, !11, i64 72}
!27 = !{!25, !7, i64 80}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!18, !11, i64 136}
!31 = !{!18, !11, i64 140}
!32 = !{!7, !7, i64 0}
!33 = !{!18, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass