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

; 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._QUEUINGPORT_INFORMATION_TYPE = type { i32, ptr, i32, i32, i32, i32, i32, i32, i8, ptr, ptr, %struct._priorityqueueRECORD }
%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

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

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

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

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

25:                                               ; preds = %5
  %26 = load ptr, ptr %11, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %26, i32 0, i32 8
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %28, i32 0, i32 12
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %34

32:                                               ; preds = %25
  %33 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 6, ptr %33, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %15, align 4
  br label %193

34:                                               ; preds = %25
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = load ptr, ptr %11, 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 !13
  %39 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %38, i32 0, i32 25
  %40 = load i32, ptr %39, align 8, !tbaa !23
  %41 = icmp uge i32 %35, %40
  br i1 %41, label %42, label %44

42:                                               ; preds = %34
  %43 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 4, ptr %43, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %15, align 4
  br label %193

44:                                               ; preds = %34
  %45 = load ptr, ptr %11, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %45, i32 0, i32 8
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %47, i32 0, i32 26
  %49 = load ptr, ptr %48, align 8, !tbaa !24
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %49, i64 %51
  store ptr %52, ptr %12, align 8, !tbaa !9
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = load ptr, ptr %12, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %54, i32 0, i32 2
  %56 = load i32, ptr %55, align 8, !tbaa !25
  %57 = icmp ugt i32 %53, %56
  br i1 %57, label %58, label %60

58:                                               ; preds = %44
  %59 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 5, ptr %59, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %15, align 4
  br label %193

60:                                               ; preds = %44
  %61 = load i64, ptr %9, align 8, !tbaa !11
  %62 = icmp slt i64 %61, 0
  br i1 %62, label %63, label %68

63:                                               ; preds = %60
  %64 = load i64, ptr %9, align 8, !tbaa !11
  %65 = icmp ne i64 %64, -1
  br i1 %65, label %66, label %68

66:                                               ; preds = %63
  %67 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 4, ptr %67, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %15, align 4
  br label %193

68:                                               ; preds = %63, %60
  %69 = load ptr, ptr %12, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %69, i32 0, i32 4
  %71 = load i32, ptr %70, align 8, !tbaa !27
  %72 = icmp ne i32 %71, 1
  br i1 %72, label %73, label %75

73:                                               ; preds = %68
  %74 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 6, ptr %74, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %15, align 4
  br label %193

75:                                               ; preds = %68
  %76 = load ptr, ptr %12, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %76, i32 0, i32 6
  %78 = load i32, ptr %77, align 8, !tbaa !28
  %79 = load ptr, ptr %12, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %79, i32 0, i32 3
  %81 = load i32, ptr %80, align 4, !tbaa !29
  %82 = icmp uge i32 %78, %81
  br i1 %82, label %89, label %83

83:                                               ; preds = %75
  %84 = load ptr, ptr %12, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %84, i32 0, i32 11
  %86 = getelementptr inbounds %struct._priorityqueueRECORD, ptr %85, i32 0, i32 1
  %87 = load i32, ptr %86, align 8, !tbaa !30
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %120, label %89

89:                                               ; preds = %83, %75
  %90 = load ptr, ptr %11, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %90, i32 0, i32 8
  %92 = load ptr, ptr %91, align 8, !tbaa !13
  %93 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %92, i32 0, i32 12
  %94 = load ptr, ptr %93, align 8, !tbaa !19
  %95 = icmp eq ptr %94, null
  br i1 %95, label %96, label %98

96:                                               ; preds = %89
  %97 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 3, ptr %97, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %15, align 4
  br label %193

98:                                               ; preds = %89
  %99 = load ptr, ptr %11, align 8, !tbaa !9
  %100 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %99, i32 0, i32 8
  %101 = load ptr, ptr %100, align 8, !tbaa !13
  %102 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %101, i32 0, i32 3
  %103 = load i32, ptr %102, align 8, !tbaa !31
  %104 = load ptr, ptr %11, 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 !13
  %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 2
  %110 = load i32, ptr %109, align 8, !tbaa !32
  %111 = load ptr, ptr %12, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %111, i32 0, i32 11
  %113 = load i64, ptr %9, align 8, !tbaa !11
  %114 = load ptr, ptr %10, align 8, !tbaa !9
  call void @WAIT_RESOURCE(i32 noundef %103, i32 noundef %110, ptr noundef %112, i64 noundef %113, ptr noundef %114)
  %115 = load ptr, ptr %10, align 8, !tbaa !9
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = icmp ne i32 %116, 1
  br i1 %117, label %118, label %119

118:                                              ; preds = %98
  call void @EXIT_CORE()
  store i32 1, ptr %15, align 4
  br label %193

119:                                              ; preds = %98
  br label %120

120:                                              ; preds = %119, %83
  %121 = load ptr, ptr %12, align 8, !tbaa !9
  %122 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %121, i32 0, i32 7
  %123 = load i32, ptr %122, align 4, !tbaa !34
  %124 = load ptr, ptr %12, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %124, i32 0, i32 6
  %126 = load i32, ptr %125, align 8, !tbaa !28
  %127 = add i32 %123, %126
  store i32 %127, ptr %13, align 4, !tbaa !5
  %128 = load i32, ptr %13, align 4, !tbaa !5
  %129 = load ptr, ptr %12, align 8, !tbaa !9
  %130 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %129, i32 0, i32 3
  %131 = load i32, ptr %130, align 4, !tbaa !29
  %132 = icmp uge i32 %128, %131
  br i1 %132, label %133, label %139

133:                                              ; preds = %120
  %134 = load ptr, ptr %12, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %134, i32 0, i32 3
  %136 = load i32, ptr %135, align 4, !tbaa !29
  %137 = load i32, ptr %13, align 4, !tbaa !5
  %138 = sub i32 %137, %136
  store i32 %138, ptr %13, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %133, %120
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %162, %139
  %141 = load i32, ptr %14, align 4, !tbaa !5
  %142 = load i32, ptr %8, align 4, !tbaa !5
  %143 = icmp ult i32 %141, %142
  br i1 %143, label %144, label %165

144:                                              ; preds = %140
  %145 = load ptr, ptr %7, align 8, !tbaa !9
  %146 = load i32, ptr %14, align 4, !tbaa !5
  %147 = zext i32 %146 to i64
  %148 = getelementptr inbounds i8, ptr %145, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !35
  %150 = load ptr, ptr %12, align 8, !tbaa !9
  %151 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %150, i32 0, i32 9
  %152 = load ptr, ptr %151, align 8, !tbaa !36
  %153 = load i32, ptr %13, align 4, !tbaa !5
  %154 = load ptr, ptr %12, align 8, !tbaa !9
  %155 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %154, i32 0, i32 2
  %156 = load i32, ptr %155, align 8, !tbaa !25
  %157 = mul i32 %153, %156
  %158 = load i32, ptr %14, align 4, !tbaa !5
  %159 = add i32 %157, %158
  %160 = zext i32 %159 to i64
  %161 = getelementptr inbounds i8, ptr %152, i64 %160
  store i8 %149, ptr %161, align 1, !tbaa !35
  br label %162

162:                                              ; preds = %144
  %163 = load i32, ptr %14, align 4, !tbaa !5
  %164 = add i32 %163, 1
  store i32 %164, ptr %14, align 4, !tbaa !5
  br label %140, !llvm.loop !37

165:                                              ; preds = %140
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = load ptr, ptr %12, align 8, !tbaa !9
  %168 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %167, i32 0, i32 10
  %169 = load ptr, ptr %168, align 8, !tbaa !39
  %170 = load i32, ptr %13, align 4, !tbaa !5
  %171 = zext i32 %170 to i64
  %172 = getelementptr inbounds i32, ptr %169, i64 %171
  store i32 %166, ptr %172, align 4, !tbaa !5
  %173 = load ptr, ptr %12, align 8, !tbaa !9
  %174 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %173, i32 0, i32 6
  %175 = load i32, ptr %174, align 8, !tbaa !28
  %176 = add i32 %175, 1
  store i32 %176, ptr %174, align 8, !tbaa !28
  %177 = load ptr, ptr %12, align 8, !tbaa !9
  %178 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %177, i32 0, i32 11
  %179 = getelementptr inbounds %struct._priorityqueueRECORD, ptr %178, i32 0, i32 1
  %180 = load i32, ptr %179, align 8, !tbaa !30
  %181 = icmp eq i32 %180, 0
  br i1 %181, label %191, label %182

182:                                              ; preds = %165
  %183 = load ptr, ptr %11, align 8, !tbaa !9
  %184 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %183, i32 0, i32 8
  %185 = load ptr, ptr %184, align 8, !tbaa !13
  %186 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %185, i32 0, i32 3
  %187 = load i32, ptr %186, align 8, !tbaa !31
  %188 = load ptr, ptr %12, align 8, !tbaa !9
  %189 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %188, i32 0, i32 11
  %190 = load ptr, ptr %10, align 8, !tbaa !9
  call void @SIGNAL_RESOURCE(i32 noundef %187, ptr noundef %189, i8 noundef zeroext 1, ptr noundef %190)
  br label %191

191:                                              ; preds = %182, %165
  %192 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 1, ptr %192, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 0, ptr %15, align 4
  br label %193

193:                                              ; preds = %191, %118, %96, %73, %66, %58, %42, %32, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %194 = load i32, ptr %15, align 4
  switch i32 %194, label %196 [
    i32 0, label %195
    i32 1, label %195
  ]

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

196:                                              ; preds = %193
  unreachable
}

declare void @WAIT_RESOURCE(i32 noundef, i32 noundef, ptr noundef, i64 noundef, 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, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !10, i64 136}
!14 = !{!"_MODULE_INFORMATION_TYPE", !10, i64 0, !15, i64 8, !6, i64 32, !6, i64 36, !6, i64 40, !16, i64 48, !6, i64 120, !10, i64 128, !10, i64 136, !17, i64 144, !12, i64 256, !12, i64 264, !12, i64 272, !18, i64 280}
!15 = !{!"_heapRECORD", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!16 = !{!"_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}
!17 = !{!"_HEALTHMONITORINGCALLBACK_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !6, i64 16, !16, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !6, i64 100, !6, i64 104}
!18 = !{!"_priorityqueueRECORD", !10, i64 0, !6, i64 8, !7, i64 12, !7, i64 13}
!19 = !{!20, !10, i64 160}
!20 = !{!"_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, !15, i64 48, !16, i64 72, !6, i64 144, !10, i64 152, !10, i64 160, !21, i64 168, !17, i64 272, !6, i64 384, !22, i64 392, !18, i64 432, !18, i64 448, !18, 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}
!21 = !{!"_ERRORHANDLER_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !6, i64 16, !16, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !6, i64 100}
!22 = !{!"_priorityqueueENTRY", !12, i64 0, !12, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!23 = !{!20, !6, i64 512}
!24 = !{!20, !10, i64 520}
!25 = !{!26, !6, i64 16}
!26 = !{!"_QUEUINGPORT_INFORMATION_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, !7, i64 40, !10, i64 48, !10, i64 56, !18, i64 64}
!27 = !{!26, !6, i64 24}
!28 = !{!26, !6, i64 32}
!29 = !{!26, !6, i64 20}
!30 = !{!26, !6, i64 72}
!31 = !{!20, !6, i64 24}
!32 = !{!33, !6, i64 16}
!33 = !{!"_PROCESS_INFORMATION_TYPE", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !16, i64 72, !22, i64 144, !22, i64 184, !22, i64 224, !22, i64 264, !7, i64 304, !7, i64 305, !10, i64 312, !6, i64 320, !10, i64 328, !10, i64 336}
!34 = !{!26, !6, i64 36}
!35 = !{!7, !7, i64 0}
!36 = !{!26, !10, i64 48}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!26, !10, i64 56}


; 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._QUEUINGPORT_INFORMATION_TYPE = type { i32, ptr, i32, i32, i32, i32, i32, i32, i8, ptr, ptr, %struct._priorityqueueRECORD }

@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 @SIGNAL_RESOURCE(i32 noundef, ptr noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #0

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

11:                                               ; preds = %5
  %12 = getelementptr inbounds i8, ptr %9, i64 160
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %14 = icmp eq ptr %13, null
  br i1 %14, label %.sink.split, label %15

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %9, i64 512
  %17 = load i32, ptr %16, align 8, !tbaa !20
  %.not = icmp ugt i32 %17, %0
  br i1 %.not, label %18, label %.sink.split

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %9, i64 520
  %20 = load ptr, ptr %19, align 8, !tbaa !21
  %21 = zext i32 %0 to i64
  %22 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %20, i64 %21
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load i32, ptr %23, align 8, !tbaa !22
  %25 = icmp ult i32 %24, %2
  br i1 %25, label %.sink.split, label %26

26:                                               ; preds = %18
  %or.cond = icmp slt i64 %3, -1
  br i1 %or.cond, label %.sink.split, label %27

27:                                               ; preds = %26
  %28 = getelementptr inbounds i8, ptr %22, i64 24
  %29 = load i32, ptr %28, align 8, !tbaa !24
  %.not59 = icmp eq i32 %29, 1
  br i1 %.not59, label %30, label %.sink.split

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %22, i64 32
  %32 = load i32, ptr %31, align 8, !tbaa !25
  %33 = getelementptr inbounds i8, ptr %22, i64 20
  %34 = load i32, ptr %33, align 4, !tbaa !26
  %.not60 = icmp ult i32 %32, %34
  br i1 %.not60, label %35, label %39

35:                                               ; preds = %30
  %36 = getelementptr inbounds i8, ptr %22, i64 72
  %37 = load i32, ptr %36, align 8, !tbaa !27
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %46, label %39

39:                                               ; preds = %30, %35
  %40 = getelementptr inbounds i8, ptr %9, i64 24
  %41 = load i32, ptr %40, align 8, !tbaa !28
  %42 = getelementptr inbounds i8, ptr %13, i64 16
  %43 = load i32, ptr %42, align 8, !tbaa !29
  %44 = getelementptr inbounds i8, ptr %22, i64 64
  tail call void @WAIT_RESOURCE(i32 noundef %41, i32 noundef %43, ptr noundef nonnull %44, i64 noundef %3, ptr noundef %4) #2
  %45 = load i32, ptr %4, align 4, !tbaa !31
  %.not61 = icmp eq i32 %45, 1
  br i1 %.not61, label %._crit_edge66, label %97

._crit_edge66:                                    ; preds = %39
  %.pre = load i32, ptr %31, align 8, !tbaa !25
  %.pre67 = load i32, ptr %33, align 4, !tbaa !26
  br label %46

46:                                               ; preds = %._crit_edge66, %35
  %47 = phi i32 [ %.pre67, %._crit_edge66 ], [ %34, %35 ]
  %48 = phi i32 [ %.pre, %._crit_edge66 ], [ %32, %35 ]
  %49 = getelementptr inbounds i8, ptr %22, i64 36
  %50 = load i32, ptr %49, align 4, !tbaa !32
  %51 = add i32 %48, %50
  %.not62 = icmp ult i32 %51, %47
  %52 = select i1 %.not62, i32 0, i32 %47
  %spec.select = sub i32 %51, %52
  %.not64 = icmp eq i32 %2, 0
  br i1 %.not64, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %46
  %53 = getelementptr inbounds i8, ptr %22, i64 48
  %wide.trip.count = zext i32 %2 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %54 = icmp eq i32 %2, 1
  br i1 %54, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 4294967294
  br label %55

55:                                               ; preds = %55, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.1, %55 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %55 ]
  %56 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv
  %57 = load i8, ptr %56, align 1, !tbaa !33
  %58 = load ptr, ptr %53, align 8, !tbaa !34
  %59 = load i32, ptr %23, align 8, !tbaa !22
  %60 = mul i32 %59, %spec.select
  %61 = trunc nuw i64 %indvars.iv to i32
  %62 = add i32 %60, %61
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds i8, ptr %58, i64 %63
  store i8 %57, ptr %64, align 1, !tbaa !33
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %65 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv.next
  %66 = load i8, ptr %65, align 1, !tbaa !33
  %67 = load ptr, ptr %53, align 8, !tbaa !34
  %68 = load i32, ptr %23, align 8, !tbaa !22
  %69 = mul i32 %68, %spec.select
  %70 = trunc nuw i64 %indvars.iv.next to i32
  %71 = add i32 %69, %70
  %72 = zext i32 %71 to i64
  %73 = getelementptr inbounds i8, ptr %67, i64 %72
  store i8 %66, ptr %73, align 1, !tbaa !33
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %55, !llvm.loop !35

._crit_edge.loopexit.unr-lcssa:                   ; preds = %55, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.1, %55 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %74 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv.unr
  %75 = load i8, ptr %74, align 1, !tbaa !33
  %76 = load ptr, ptr %53, align 8, !tbaa !34
  %77 = load i32, ptr %23, align 8, !tbaa !22
  %78 = mul i32 %77, %spec.select
  %79 = trunc nuw i64 %indvars.iv.unr to i32
  %80 = add i32 %78, %79
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i8, ptr %76, i64 %81
  store i8 %75, ptr %82, align 1, !tbaa !33
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %46
  %83 = getelementptr inbounds i8, ptr %22, i64 56
  %84 = load ptr, ptr %83, align 8, !tbaa !37
  %85 = zext i32 %spec.select to i64
  %86 = getelementptr inbounds i32, ptr %84, i64 %85
  store i32 %2, ptr %86, align 4, !tbaa !31
  %87 = load i32, ptr %31, align 8, !tbaa !25
  %88 = add i32 %87, 1
  store i32 %88, ptr %31, align 8, !tbaa !25
  %89 = getelementptr inbounds i8, ptr %22, i64 72
  %90 = load i32, ptr %89, align 8, !tbaa !27
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %.sink.split, label %92

92:                                               ; preds = %._crit_edge
  %93 = getelementptr inbounds i8, ptr %22, i64 64
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i64 24
  %96 = load i32, ptr %95, align 8, !tbaa !28
  tail call void @SIGNAL_RESOURCE(i32 noundef %96, ptr noundef nonnull %93, i8 noundef zeroext 1, ptr noundef %4) #2
  br label %.sink.split

.sink.split:                                      ; preds = %._crit_edge, %92, %27, %26, %18, %15, %11, %5
  %.sink = phi i32 [ 6, %5 ], [ 6, %11 ], [ 4, %15 ], [ 5, %18 ], [ 4, %26 ], [ 6, %27 ], [ 1, %92 ], [ 1, %._crit_edge ]
  store i32 %.sink, ptr %4, align 4, !tbaa !31
  br label %97

97:                                               ; preds = %.sink.split, %39
  tail call void @EXIT_CORE() #2
  ret void
}

declare void @WAIT_RESOURCE(i32 noundef, i32 noundef, ptr noundef, i64 noundef, 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 = !{!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 512}
!21 = !{!17, !7, i64 520}
!22 = !{!23, !11, i64 16}
!23 = !{!"_QUEUINGPORT_INFORMATION_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, !8, i64 40, !7, i64 48, !7, i64 56, !15, i64 64}
!24 = !{!23, !11, i64 24}
!25 = !{!23, !11, i64 32}
!26 = !{!23, !11, i64 20}
!27 = !{!23, !11, i64 72}
!28 = !{!17, !11, i64 24}
!29 = !{!30, !11, i64 16}
!30 = !{!"_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}
!31 = !{!11, !11, i64 0}
!32 = !{!23, !11, i64 36}
!33 = !{!8, !8, i64 0}
!34 = !{!23, !7, i64 48}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!23, !7, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass