; 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

declare void @WAIT_RESOURCE(i32 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef) #1

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

22:                                               ; preds = %5
  %23 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 6, ptr %23, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

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

31:                                               ; preds = %24
  %32 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 6, ptr %32, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

33:                                               ; preds = %24
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = load ptr, ptr %11, align 8, !tbaa !11
  %36 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %35, i32 0, i32 8
  %37 = load ptr, ptr %36, align 8, !tbaa !13
  %38 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %37, i32 0, i32 25
  %39 = load i32, ptr %38, align 8, !tbaa !23
  %40 = icmp uge i32 %34, %39
  br i1 %40, label %41, label %43

41:                                               ; preds = %33
  %42 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 4, ptr %42, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

43:                                               ; preds = %33
  %44 = load ptr, ptr %11, align 8, !tbaa !11
  %45 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %44, i32 0, i32 8
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  %47 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %46, i32 0, i32 26
  %48 = load ptr, ptr %47, align 8, !tbaa !24
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %48, i64 %50
  store ptr %51, ptr %12, align 8, !tbaa !11
  %52 = load i64, ptr %7, align 8, !tbaa !9
  %53 = icmp slt i64 %52, 0
  br i1 %53, label %54, label %59

54:                                               ; preds = %43
  %55 = load i64, ptr %7, align 8, !tbaa !9
  %56 = icmp ne i64 %55, -1
  br i1 %56, label %57, label %59

57:                                               ; preds = %54
  %58 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 4, ptr %58, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

59:                                               ; preds = %54, %43
  %60 = load ptr, ptr %12, align 8, !tbaa !11
  %61 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %60, i32 0, i32 4
  %62 = load i32, ptr %61, align 8, !tbaa !25
  %63 = icmp ne i32 %62, 2
  br i1 %63, label %64, label %66

64:                                               ; preds = %59
  %65 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 6, ptr %65, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

66:                                               ; preds = %59
  %67 = load ptr, ptr %12, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %67, i32 0, i32 6
  %69 = load i32, ptr %68, align 8, !tbaa !27
  %70 = icmp ugt i32 %69, 0
  br i1 %70, label %71, label %146

71:                                               ; preds = %66
  %72 = load ptr, ptr %12, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %72, i32 0, i32 10
  %74 = load ptr, ptr %73, align 8, !tbaa !28
  %75 = load ptr, ptr %12, align 8, !tbaa !11
  %76 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %75, i32 0, i32 7
  %77 = load i32, ptr %76, align 4, !tbaa !29
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %74, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load ptr, ptr %9, align 8, !tbaa !11
  store i32 %80, ptr %81, align 4, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %107, %71
  %83 = load i32, ptr %13, align 4, !tbaa !5
  %84 = load ptr, ptr %9, align 8, !tbaa !11
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = icmp ult i32 %83, %85
  br i1 %86, label %87, label %110

87:                                               ; preds = %82
  %88 = load ptr, ptr %12, align 8, !tbaa !11
  %89 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %88, i32 0, i32 9
  %90 = load ptr, ptr %89, align 8, !tbaa !30
  %91 = load ptr, ptr %12, align 8, !tbaa !11
  %92 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %91, i32 0, i32 7
  %93 = load i32, ptr %92, align 4, !tbaa !29
  %94 = load ptr, ptr %12, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %94, i32 0, i32 2
  %96 = load i32, ptr %95, align 8, !tbaa !31
  %97 = mul i32 %93, %96
  %98 = load i32, ptr %13, align 4, !tbaa !5
  %99 = add i32 %97, %98
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds i8, ptr %90, i64 %100
  %102 = load i8, ptr %101, align 1, !tbaa !32
  %103 = load ptr, ptr %8, align 8, !tbaa !11
  %104 = load i32, ptr %13, align 4, !tbaa !5
  %105 = zext i32 %104 to i64
  %106 = getelementptr inbounds i8, ptr %103, i64 %105
  store i8 %102, ptr %106, align 1, !tbaa !32
  br label %107

107:                                              ; preds = %87
  %108 = load i32, ptr %13, align 4, !tbaa !5
  %109 = add i32 %108, 1
  store i32 %109, ptr %13, align 4, !tbaa !5
  br label %82, !llvm.loop !33

110:                                              ; preds = %82
  %111 = load ptr, ptr %12, align 8, !tbaa !11
  %112 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %111, i32 0, i32 6
  %113 = load i32, ptr %112, align 8, !tbaa !27
  %114 = add i32 %113, -1
  store i32 %114, ptr %112, align 8, !tbaa !27
  %115 = load ptr, ptr %12, align 8, !tbaa !11
  %116 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %115, i32 0, i32 7
  %117 = load i32, ptr %116, align 4, !tbaa !29
  %118 = add i32 %117, 1
  store i32 %118, ptr %116, align 4, !tbaa !29
  %119 = load ptr, ptr %12, align 8, !tbaa !11
  %120 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %119, i32 0, i32 7
  %121 = load i32, ptr %120, align 4, !tbaa !29
  %122 = load ptr, ptr %12, align 8, !tbaa !11
  %123 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %122, i32 0, i32 3
  %124 = load i32, ptr %123, align 4, !tbaa !35
  %125 = icmp uge i32 %121, %124
  br i1 %125, label %126, label %134

126:                                              ; preds = %110
  %127 = load ptr, ptr %12, align 8, !tbaa !11
  %128 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %127, i32 0, i32 3
  %129 = load i32, ptr %128, align 4, !tbaa !35
  %130 = load ptr, ptr %12, align 8, !tbaa !11
  %131 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %130, i32 0, i32 7
  %132 = load i32, ptr %131, align 4, !tbaa !29
  %133 = sub i32 %132, %129
  store i32 %133, ptr %131, align 4, !tbaa !29
  br label %134

134:                                              ; preds = %126, %110
  %135 = load ptr, ptr %12, align 8, !tbaa !11
  %136 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %135, i32 0, i32 8
  %137 = load i8, ptr %136, align 8, !tbaa !36
  %138 = icmp ne i8 %137, 0
  br i1 %138, label %139, label %143

139:                                              ; preds = %134
  %140 = load ptr, ptr %12, align 8, !tbaa !11
  %141 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %140, i32 0, i32 8
  store i8 0, ptr %141, align 8, !tbaa !36
  %142 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 5, ptr %142, align 4, !tbaa !5
  br label %145

143:                                              ; preds = %134
  %144 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 1, ptr %144, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %143, %139
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

146:                                              ; preds = %66
  %147 = load ptr, ptr %11, align 8, !tbaa !11
  %148 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %147, i32 0, i32 8
  %149 = load ptr, ptr %148, align 8, !tbaa !13
  %150 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %149, i32 0, i32 12
  %151 = load ptr, ptr %150, align 8, !tbaa !19
  %152 = icmp eq ptr %151, null
  br i1 %152, label %153, label %155

153:                                              ; preds = %146
  %154 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 3, ptr %154, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

155:                                              ; preds = %146
  %156 = load ptr, ptr %11, align 8, !tbaa !11
  %157 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %156, i32 0, i32 8
  %158 = load ptr, ptr %157, align 8, !tbaa !13
  %159 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %158, i32 0, i32 3
  %160 = load i32, ptr %159, align 8, !tbaa !37
  %161 = load ptr, ptr %11, align 8, !tbaa !11
  %162 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %161, i32 0, i32 8
  %163 = load ptr, ptr %162, align 8, !tbaa !13
  %164 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %163, i32 0, i32 12
  %165 = load ptr, ptr %164, align 8, !tbaa !19
  %166 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %165, i32 0, i32 2
  %167 = load i32, ptr %166, align 8, !tbaa !38
  %168 = load ptr, ptr %12, align 8, !tbaa !11
  %169 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %168, i32 0, i32 11
  %170 = load i64, ptr %7, align 8, !tbaa !9
  %171 = load ptr, ptr %10, align 8, !tbaa !11
  call void @WAIT_RESOURCE(i32 noundef %160, i32 noundef %167, ptr noundef %169, i64 noundef %170, ptr noundef %171)
  %172 = load ptr, ptr %10, align 8, !tbaa !11
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = icmp ne i32 %173, 1
  br i1 %174, label %175, label %176

175:                                              ; preds = %155
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %255

176:                                              ; preds = %155
  %177 = load ptr, ptr %12, align 8, !tbaa !11
  %178 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %177, i32 0, i32 10
  %179 = load ptr, ptr %178, align 8, !tbaa !28
  %180 = load ptr, ptr %12, align 8, !tbaa !11
  %181 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %180, i32 0, i32 7
  %182 = load i32, ptr %181, align 4, !tbaa !29
  %183 = zext i32 %182 to i64
  %184 = getelementptr inbounds i32, ptr %179, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = load ptr, ptr %9, align 8, !tbaa !11
  store i32 %185, ptr %186, align 4, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %187

187:                                              ; preds = %212, %176
  %188 = load i32, ptr %13, align 4, !tbaa !5
  %189 = load ptr, ptr %9, align 8, !tbaa !11
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = icmp ult i32 %188, %190
  br i1 %191, label %192, label %215

192:                                              ; preds = %187
  %193 = load ptr, ptr %12, align 8, !tbaa !11
  %194 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %193, i32 0, i32 9
  %195 = load ptr, ptr %194, align 8, !tbaa !30
  %196 = load ptr, ptr %12, align 8, !tbaa !11
  %197 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %196, i32 0, i32 7
  %198 = load i32, ptr %197, align 4, !tbaa !29
  %199 = load ptr, ptr %12, align 8, !tbaa !11
  %200 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %199, i32 0, i32 2
  %201 = load i32, ptr %200, align 8, !tbaa !31
  %202 = mul i32 %198, %201
  %203 = load i32, ptr %13, align 4, !tbaa !5
  %204 = add i32 %202, %203
  %205 = zext i32 %204 to i64
  %206 = getelementptr inbounds i8, ptr %195, i64 %205
  %207 = load i8, ptr %206, align 1, !tbaa !32
  %208 = load ptr, ptr %8, align 8, !tbaa !11
  %209 = load i32, ptr %13, align 4, !tbaa !5
  %210 = zext i32 %209 to i64
  %211 = getelementptr inbounds i8, ptr %208, i64 %210
  store i8 %207, ptr %211, align 1, !tbaa !32
  br label %212

212:                                              ; preds = %192
  %213 = load i32, ptr %13, align 4, !tbaa !5
  %214 = add i32 %213, 1
  store i32 %214, ptr %13, align 4, !tbaa !5
  br label %187, !llvm.loop !40

215:                                              ; preds = %187
  %216 = load ptr, ptr %12, align 8, !tbaa !11
  %217 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %216, i32 0, i32 6
  %218 = load i32, ptr %217, align 8, !tbaa !27
  %219 = add i32 %218, -1
  store i32 %219, ptr %217, align 8, !tbaa !27
  %220 = load ptr, ptr %12, align 8, !tbaa !11
  %221 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %220, i32 0, i32 7
  %222 = load i32, ptr %221, align 4, !tbaa !29
  %223 = add i32 %222, 1
  store i32 %223, ptr %221, align 4, !tbaa !29
  %224 = load ptr, ptr %12, align 8, !tbaa !11
  %225 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %224, i32 0, i32 7
  %226 = load i32, ptr %225, align 4, !tbaa !29
  %227 = load ptr, ptr %12, align 8, !tbaa !11
  %228 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %227, i32 0, i32 3
  %229 = load i32, ptr %228, align 4, !tbaa !35
  %230 = icmp uge i32 %226, %229
  br i1 %230, label %231, label %239

231:                                              ; preds = %215
  %232 = load ptr, ptr %12, align 8, !tbaa !11
  %233 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %232, i32 0, i32 3
  %234 = load i32, ptr %233, align 4, !tbaa !35
  %235 = load ptr, ptr %12, align 8, !tbaa !11
  %236 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %235, i32 0, i32 7
  %237 = load i32, ptr %236, align 4, !tbaa !29
  %238 = sub i32 %237, %234
  store i32 %238, ptr %236, align 4, !tbaa !29
  br label %239

239:                                              ; preds = %231, %215
  %240 = load ptr, ptr %12, align 8, !tbaa !11
  %241 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %240, i32 0, i32 11
  %242 = getelementptr inbounds %struct._priorityqueueRECORD, ptr %241, i32 0, i32 1
  %243 = load i32, ptr %242, align 8, !tbaa !41
  %244 = icmp eq i32 %243, 0
  br i1 %244, label %254, label %245

245:                                              ; preds = %239
  %246 = load ptr, ptr %11, align 8, !tbaa !11
  %247 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %246, i32 0, i32 8
  %248 = load ptr, ptr %247, align 8, !tbaa !13
  %249 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %248, i32 0, i32 3
  %250 = load i32, ptr %249, align 8, !tbaa !37
  %251 = load ptr, ptr %12, align 8, !tbaa !11
  %252 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %251, i32 0, i32 11
  %253 = load ptr, ptr %10, align 8, !tbaa !11
  call void @SIGNAL_RESOURCE(i32 noundef %250, ptr noundef %252, i8 noundef zeroext 1, ptr noundef %253)
  br label %254

254:                                              ; preds = %245, %239
  call void @EXIT_CORE()
  store i32 0, ptr %14, align 4
  br label %255

255:                                              ; preds = %254, %175, %153, %145, %64, %57, %41, %31, %22
  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
  %256 = load i32, ptr %14, align 4
  switch i32 %256, label %258 [
    i32 0, label %257
    i32 1, label %257
  ]

257:                                              ; preds = %255, %255
  ret void

258:                                              ; preds = %255
  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 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !12, i64 136}
!14 = !{!"_MODULE_INFORMATION_TYPE", !12, i64 0, !15, i64 8, !6, i64 32, !6, i64 36, !6, i64 40, !16, i64 48, !6, i64 120, !12, i64 128, !12, i64 136, !17, i64 144, !10, i64 256, !10, i64 264, !10, i64 272, !18, i64 280}
!15 = !{!"_heapRECORD", !12, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!16 = !{!"_CONTEXT_TYPE", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !6, i64 32, !7, i64 36, !12, i64 40, !12, i64 48, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68}
!17 = !{!"_HEALTHMONITORINGCALLBACK_INFORMATION_TYPE", !7, i64 0, !12, 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", !12, i64 0, !6, i64 8, !7, i64 12, !7, i64 13}
!19 = !{!20, !12, i64 160}
!20 = !{!"_PARTITION_INFORMATION_TYPE", !7, i64 0, !12, i64 8, !12, 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, !12, i64 152, !12, 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, !12, i64 488, !6, i64 496, !12, i64 504, !6, i64 512, !12, i64 520, !6, i64 528, !12, i64 536, !6, i64 544, !12, i64 552, !6, i64 560, !12, i64 568, !6, i64 576, !12, i64 584}
!21 = !{!"_ERRORHANDLER_INFORMATION_TYPE", !7, i64 0, !12, 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", !10, i64 0, !10, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!23 = !{!20, !6, i64 512}
!24 = !{!20, !12, i64 520}
!25 = !{!26, !6, i64 24}
!26 = !{!"_QUEUINGPORT_INFORMATION_TYPE", !6, i64 0, !12, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !7, i64 40, !12, i64 48, !12, i64 56, !18, i64 64}
!27 = !{!26, !6, i64 32}
!28 = !{!26, !12, i64 56}
!29 = !{!26, !6, i64 36}
!30 = !{!26, !12, i64 48}
!31 = !{!26, !6, i64 16}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!26, !6, i64 20}
!36 = !{!26, !7, i64 40}
!37 = !{!20, !6, i64 24}
!38 = !{!39, !6, i64 16}
!39 = !{!"_PROCESS_INFORMATION_TYPE", !12, i64 0, !12, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !16, i64 72, !22, i64 144, !22, i64 184, !22, i64 224, !22, i64 264, !7, i64 304, !7, i64 305, !12, i64 312, !6, i64 320, !12, i64 328, !12, i64 336}
!40 = distinct !{!40, !34}
!41 = !{!26, !6, i64 72}


; 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

declare void @WAIT_RESOURCE(i32 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @RECEIVE_QUEUING_MESSAGE(i32 noundef %0, i64 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture 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 %11, label %12

11:                                               ; preds = %5
  store i32 6, ptr %4, align 4, !tbaa !16
  br label %116

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

16:                                               ; preds = %12
  store i32 6, ptr %4, align 4, !tbaa !16
  br label %116

17:                                               ; preds = %12
  %18 = getelementptr inbounds i8, ptr %9, i64 512
  %19 = load i32, ptr %18, align 8, !tbaa !21
  %.not = icmp ugt i32 %19, %0
  br i1 %.not, label %21, label %20

20:                                               ; preds = %17
  store i32 4, ptr %4, align 4, !tbaa !16
  br label %116

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %9, i64 520
  %23 = load ptr, ptr %22, align 8, !tbaa !22
  %24 = zext i32 %0 to i64
  %25 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %23, i64 %24
  %or.cond = icmp slt i64 %1, -1
  br i1 %or.cond, label %26, label %27

26:                                               ; preds = %21
  store i32 4, ptr %4, align 4, !tbaa !16
  br label %116

27:                                               ; preds = %21
  %28 = getelementptr inbounds i8, ptr %25, i64 24
  %29 = load i32, ptr %28, align 8, !tbaa !23
  %.not74 = icmp eq i32 %29, 2
  br i1 %.not74, label %31, label %30

30:                                               ; preds = %27
  store i32 6, ptr %4, align 4, !tbaa !16
  br label %116

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %25, i64 32
  %33 = load i32, ptr %32, align 8, !tbaa !25
  %.not75 = icmp eq i32 %33, 0
  br i1 %.not75, label %70, label %34

34:                                               ; preds = %31
  %35 = getelementptr inbounds i8, ptr %25, i64 56
  %36 = load ptr, ptr %35, align 8, !tbaa !26
  %37 = getelementptr inbounds i8, ptr %25, i64 36
  %38 = load i32, ptr %37, align 4, !tbaa !27
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %36, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !16
  store i32 %41, ptr %3, align 4, !tbaa !16
  %.not85 = icmp eq i32 %41, 0
  br i1 %.not85, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %34
  %42 = getelementptr inbounds i8, ptr %25, i64 48
  %43 = getelementptr inbounds i8, ptr %25, i64 16
  br label %44

44:                                               ; preds = %.lr.ph, %44
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %44 ]
  %45 = load ptr, ptr %42, align 8, !tbaa !28
  %46 = load i32, ptr %37, align 4, !tbaa !27
  %47 = load i32, ptr %43, align 8, !tbaa !29
  %48 = mul i32 %47, %46
  %49 = trunc nuw i64 %indvars.iv to i32
  %50 = add i32 %48, %49
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds i8, ptr %45, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !30
  %54 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  store i8 %53, ptr %54, align 1, !tbaa !30
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = load i32, ptr %3, align 4, !tbaa !16
  %56 = zext i32 %55 to i64
  %57 = icmp ult i64 %indvars.iv.next, %56
  br i1 %57, label %44, label %._crit_edge, !llvm.loop !31

._crit_edge:                                      ; preds = %44, %34
  %58 = load <2 x i32>, ptr %32, align 8, !tbaa !16
  %59 = add <2 x i32> %58, <i32 -1, i32 1>
  store <2 x i32> %59, ptr %32, align 8, !tbaa !16
  %60 = getelementptr inbounds i8, ptr %25, i64 20
  %61 = load i32, ptr %60, align 4, !tbaa !33
  %62 = extractelement <2 x i32> %59, i64 1
  %.not78 = icmp ult i32 %62, %61
  br i1 %.not78, label %65, label %63

63:                                               ; preds = %._crit_edge
  %64 = sub i32 %62, %61
  store i32 %64, ptr %37, align 4, !tbaa !27
  br label %65

65:                                               ; preds = %63, %._crit_edge
  %66 = getelementptr inbounds i8, ptr %25, i64 40
  %67 = load i8, ptr %66, align 8, !tbaa !34
  %.not79 = icmp eq i8 %67, 0
  br i1 %.not79, label %69, label %68

68:                                               ; preds = %65
  store i8 0, ptr %66, align 8, !tbaa !34
  br label %69

69:                                               ; preds = %65, %68
  %storemerge = phi i32 [ 5, %68 ], [ 1, %65 ]
  store i32 %storemerge, ptr %4, align 4, !tbaa !16
  br label %116

70:                                               ; preds = %31
  %71 = getelementptr inbounds i8, ptr %9, i64 24
  %72 = load i32, ptr %71, align 8, !tbaa !35
  %73 = getelementptr inbounds i8, ptr %14, i64 16
  %74 = load i32, ptr %73, align 8, !tbaa !36
  %75 = getelementptr inbounds i8, ptr %25, i64 64
  tail call void @WAIT_RESOURCE(i32 noundef %72, i32 noundef %74, ptr noundef nonnull %75, i64 noundef %1, ptr noundef %4) #2
  %76 = load i32, ptr %4, align 4, !tbaa !16
  %.not76 = icmp eq i32 %76, 1
  br i1 %.not76, label %77, label %116

77:                                               ; preds = %70
  %78 = getelementptr inbounds i8, ptr %25, i64 56
  %79 = load ptr, ptr %78, align 8, !tbaa !26
  %80 = getelementptr inbounds i8, ptr %25, i64 36
  %81 = load i32, ptr %80, align 4, !tbaa !27
  %82 = zext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %79, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !16
  store i32 %84, ptr %3, align 4, !tbaa !16
  %.not86 = icmp eq i32 %84, 0
  br i1 %.not86, label %._crit_edge84, label %.lr.ph83

.lr.ph83:                                         ; preds = %77
  %85 = getelementptr inbounds i8, ptr %25, i64 48
  %86 = getelementptr inbounds i8, ptr %25, i64 16
  br label %87

87:                                               ; preds = %.lr.ph83, %87
  %indvars.iv88 = phi i64 [ 0, %.lr.ph83 ], [ %indvars.iv.next89, %87 ]
  %88 = load ptr, ptr %85, align 8, !tbaa !28
  %89 = load i32, ptr %80, align 4, !tbaa !27
  %90 = load i32, ptr %86, align 8, !tbaa !29
  %91 = mul i32 %90, %89
  %92 = trunc nuw i64 %indvars.iv88 to i32
  %93 = add i32 %91, %92
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds i8, ptr %88, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !30
  %97 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv88
  store i8 %96, ptr %97, align 1, !tbaa !30
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %98 = load i32, ptr %3, align 4, !tbaa !16
  %99 = zext i32 %98 to i64
  %100 = icmp ult i64 %indvars.iv.next89, %99
  br i1 %100, label %87, label %._crit_edge84, !llvm.loop !38

._crit_edge84:                                    ; preds = %87, %77
  %101 = load <2 x i32>, ptr %32, align 8, !tbaa !16
  %102 = add <2 x i32> %101, <i32 -1, i32 1>
  store <2 x i32> %102, ptr %32, align 8, !tbaa !16
  %103 = getelementptr inbounds i8, ptr %25, i64 20
  %104 = load i32, ptr %103, align 4, !tbaa !33
  %105 = extractelement <2 x i32> %102, i64 1
  %.not77 = icmp ult i32 %105, %104
  br i1 %.not77, label %108, label %106

106:                                              ; preds = %._crit_edge84
  %107 = sub i32 %105, %104
  store i32 %107, ptr %80, align 4, !tbaa !27
  br label %108

108:                                              ; preds = %106, %._crit_edge84
  %109 = getelementptr inbounds i8, ptr %25, i64 72
  %110 = load i32, ptr %109, align 8, !tbaa !39
  %111 = icmp eq i32 %110, 0
  br i1 %111, label %116, label %112

112:                                              ; preds = %108
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds i8, ptr %113, i64 24
  %115 = load i32, ptr %114, align 8, !tbaa !35
  tail call void @SIGNAL_RESOURCE(i32 noundef %115, ptr noundef nonnull %75, i8 noundef zeroext 1, ptr noundef nonnull %4) #2
  br label %116

116:                                              ; preds = %108, %112, %70, %69, %30, %26, %20, %16, %11
  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 = !{!11, !11, i64 0}
!17 = !{!18, !7, i64 160}
!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 512}
!22 = !{!18, !7, i64 520}
!23 = !{!24, !11, i64 24}
!24 = !{!"_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}
!25 = !{!24, !11, i64 32}
!26 = !{!24, !7, i64 56}
!27 = !{!24, !11, i64 36}
!28 = !{!24, !7, i64 48}
!29 = !{!24, !11, i64 16}
!30 = !{!8, !8, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!24, !11, i64 20}
!34 = !{!24, !8, i64 40}
!35 = !{!18, !11, i64 24}
!36 = !{!37, !11, i64 16}
!37 = !{!"_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, !20, i64 144, !20, i64 184, !20, i64 224, !20, i64 264, !8, i64 304, !8, i64 305, !7, i64 312, !11, i64 320, !7, i64 328, !7, i64 336}
!38 = distinct !{!38, !32}
!39 = !{!24, !11, i64 72}


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