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

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

@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

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

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

28:                                               ; preds = %7
  %29 = load ptr, ptr %15, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %29, i32 0, i32 8
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %31, i32 0, i32 4
  %33 = load i32, ptr %32, align 4, !tbaa !18
  %34 = icmp eq i32 %33, 4
  br i1 %34, label %35, label %37

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

37:                                               ; preds = %28
  %38 = load ptr, ptr %15, align 8, !tbaa !5
  %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 25
  %42 = load i32, ptr %41, align 8, !tbaa !22
  store i32 %42, ptr %16, align 4, !tbaa !9
  %43 = load i32, ptr %16, align 4, !tbaa !9
  %44 = load ptr, ptr %15, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %44, i32 0, i32 8
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %46, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !23
  %49 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %48, i32 0, i32 5
  %50 = load i32, ptr %49, align 4, !tbaa !24
  %51 = icmp uge i32 %43, %50
  br i1 %51, label %52, label %54

52:                                               ; preds = %37
  %53 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 5, ptr %53, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

54:                                               ; preds = %37
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  call void @GET_QUEUING_PORT_ID(ptr noundef %55, ptr noundef %16, ptr noundef %56)
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %62

60:                                               ; preds = %54
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 2, ptr %61, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

62:                                               ; preds = %54
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = icmp ult i32 %63, 1
  br i1 %64, label %68, label %65

65:                                               ; preds = %62
  %66 = load i32, ptr %10, align 4, !tbaa !9
  %67 = icmp ugt i32 %66, 512
  br i1 %67, label %68, label %70

68:                                               ; preds = %65, %62
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 4, ptr %69, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

70:                                               ; preds = %65
  %71 = load i32, ptr %9, align 4, !tbaa !9
  %72 = icmp ult i32 %71, 1
  br i1 %72, label %76, label %73

73:                                               ; preds = %70
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = icmp ugt i32 %74, 512
  br i1 %75, label %76, label %78

76:                                               ; preds = %73, %70
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 4, ptr %77, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

78:                                               ; preds = %73
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = icmp ne i32 %79, 1
  br i1 %80, label %81, label %86

81:                                               ; preds = %78
  %82 = load i32, ptr %11, align 4, !tbaa !9
  %83 = icmp ne i32 %82, 2
  br i1 %83, label %84, label %86

84:                                               ; preds = %81
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 5, ptr %85, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

86:                                               ; preds = %81, %78
  %87 = load i32, ptr %12, align 4, !tbaa !9
  %88 = icmp ne i32 %87, 1
  br i1 %88, label %89, label %94

89:                                               ; preds = %86
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = icmp ne i32 %90, 2
  br i1 %91, label %92, label %94

92:                                               ; preds = %89
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 5, ptr %93, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

94:                                               ; preds = %89, %86
  %95 = load ptr, ptr %15, align 8, !tbaa !5
  %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 26
  %99 = load ptr, ptr %98, align 8, !tbaa !26
  %100 = load i32, ptr %16, align 4, !tbaa !9
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %99, i64 %101
  store ptr %102, ptr %17, align 8, !tbaa !5
  %103 = load ptr, ptr %15, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %103, i32 0, i32 8
  %105 = load ptr, ptr %104, align 8, !tbaa !11
  %106 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %105, i32 0, i32 8
  %107 = load ptr, ptr %17, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %107, i32 0, i32 9
  %109 = load i32, ptr %10, align 4, !tbaa !9
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = mul i32 %109, %110
  call void @HEAP_ALLOCATE(ptr noundef %106, ptr noundef %108, i32 noundef %111, i8 noundef zeroext 0)
  %112 = load ptr, ptr %17, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %112, i32 0, i32 9
  %114 = load ptr, ptr %113, align 8, !tbaa !27
  %115 = icmp eq ptr %114, null
  br i1 %115, label %116, label %118

116:                                              ; preds = %94
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 5, ptr %117, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

118:                                              ; preds = %94
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %119, i32 0, i32 8
  %121 = load ptr, ptr %120, align 8, !tbaa !11
  %122 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %121, i32 0, i32 8
  %123 = load ptr, ptr %17, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %123, i32 0, i32 10
  %125 = load i32, ptr %10, align 4, !tbaa !9
  %126 = zext i32 %125 to i64
  %127 = mul i64 %126, 4
  %128 = trunc i64 %127 to i32
  call void @HEAP_ALLOCATE(ptr noundef %122, ptr noundef %124, i32 noundef %128, i8 noundef zeroext 0)
  %129 = load ptr, ptr %17, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %129, i32 0, i32 10
  %131 = load ptr, ptr %130, align 8, !tbaa !29
  %132 = icmp eq ptr %131, null
  br i1 %132, label %133, label %135

133:                                              ; preds = %118
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 5, ptr %134, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

135:                                              ; preds = %118
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %136, i32 0, i32 8
  %138 = load ptr, ptr %137, align 8, !tbaa !11
  %139 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %138, i32 0, i32 8
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %140, i32 0, i32 1
  call void @HEAP_ALLOCATE(ptr noundef %139, ptr noundef %141, i32 noundef 30, i8 noundef zeroext 0)
  %142 = load ptr, ptr %17, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %142, i32 0, i32 1
  %144 = load ptr, ptr %143, align 8, !tbaa !30
  %145 = icmp eq ptr %144, null
  br i1 %145, label %146, label %148

146:                                              ; preds = %135
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 5, ptr %147, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

148:                                              ; preds = %135
  %149 = load ptr, ptr %8, align 8, !tbaa !5
  %150 = load ptr, ptr %17, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %150, i32 0, i32 1
  %152 = load ptr, ptr %151, align 8, !tbaa !30
  %153 = call zeroext i8 @COMMON_COPYSTRING(ptr noundef %149, ptr noundef %152, i32 noundef 30)
  %154 = icmp ne i8 %153, 0
  br i1 %154, label %157, label %155

155:                                              ; preds = %148
  %156 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 5, ptr %156, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %18, align 4
  br label %193

157:                                              ; preds = %148
  %158 = load ptr, ptr %15, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %158, i32 0, i32 8
  %160 = load ptr, ptr %159, align 8, !tbaa !11
  %161 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %160, i32 0, i32 25
  %162 = load i32, ptr %161, align 8, !tbaa !22
  %163 = load ptr, ptr %17, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %163, i32 0, i32 0
  store i32 %162, ptr %164, align 8, !tbaa !31
  %165 = load i32, ptr %9, align 4, !tbaa !9
  %166 = load ptr, ptr %17, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %166, i32 0, i32 2
  store i32 %165, ptr %167, align 8, !tbaa !32
  %168 = load i32, ptr %10, align 4, !tbaa !9
  %169 = load ptr, ptr %17, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %169, i32 0, i32 3
  store i32 %168, ptr %170, align 4, !tbaa !33
  %171 = load i32, ptr %11, align 4, !tbaa !9
  %172 = load ptr, ptr %17, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %172, i32 0, i32 4
  store i32 %171, ptr %173, align 8, !tbaa !34
  %174 = load i32, ptr %12, align 4, !tbaa !9
  %175 = load ptr, ptr %17, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %175, i32 0, i32 5
  store i32 %174, ptr %176, align 4, !tbaa !35
  %177 = load ptr, ptr %17, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %177, i32 0, i32 11
  %179 = load i32, ptr %12, align 4, !tbaa !9
  %180 = icmp eq i32 %179, 2
  %181 = zext i1 %180 to i64
  %182 = select i1 %180, i32 1, i32 0
  %183 = trunc i32 %182 to i8
  call void @PRIORITYQUEUE_CLEAR(ptr noundef %178, i8 noundef zeroext %183, i8 noundef zeroext 0)
  %184 = load ptr, ptr %15, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %184, i32 0, i32 8
  %186 = load ptr, ptr %185, align 8, !tbaa !11
  %187 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %186, i32 0, i32 25
  %188 = load i32, ptr %187, align 8, !tbaa !22
  %189 = add i32 %188, 1
  store i32 %189, ptr %187, align 8, !tbaa !22
  %190 = load i32, ptr %16, align 4, !tbaa !9
  %191 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 %190, ptr %191, align 4, !tbaa !9
  %192 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 1, ptr %192, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 0, ptr %18, align 4
  br label %193

193:                                              ; preds = %157, %155, %146, %133, %116, %92, %84, %76, %68, %60, %52, %35, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  %194 = load i32, ptr %18, 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
}

; Function Attrs: nounwind uwtable
declare dso_local void @GET_QUEUING_PORT_ID(ptr noundef, ptr noundef, ptr noundef) #2

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

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

declare void @PRIORITYQUEUE_CLEAR(ptr noundef, i8 noundef zeroext, i8 noundef zeroext) #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 136}
!12 = !{!"_MODULE_INFORMATION_TYPE", !6, i64 0, !13, i64 8, !10, i64 32, !10, i64 36, !10, i64 40, !14, i64 48, !10, i64 120, !6, i64 128, !6, i64 136, !15, i64 144, !16, i64 256, !16, i64 264, !16, i64 272, !17, i64 280}
!13 = !{!"_heapRECORD", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!14 = !{!"_CONTEXT_TYPE", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !7, i64 36, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68}
!15 = !{!"_HEALTHMONITORINGCALLBACK_INFORMATION_TYPE", !7, i64 0, !6, i64 8, !10, i64 16, !14, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !10, i64 100, !10, i64 104}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"_priorityqueueRECORD", !6, i64 0, !10, i64 8, !7, i64 12, !7, i64 13}
!18 = !{!19, !10, i64 28}
!19 = !{!"_PARTITION_INFORMATION_TYPE", !7, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40, !13, i64 48, !14, i64 72, !10, i64 144, !6, i64 152, !6, i64 160, !20, i64 168, !15, i64 272, !10, i64 384, !21, i64 392, !17, i64 432, !17, i64 448, !17, i64 464, !10, i64 480, !10, i64 484, !6, i64 488, !10, i64 496, !6, i64 504, !10, i64 512, !6, i64 520, !10, i64 528, !6, i64 536, !10, i64 544, !6, i64 552, !10, i64 560, !6, i64 568, !10, i64 576, !6, i64 584}
!20 = !{!"_ERRORHANDLER_INFORMATION_TYPE", !7, i64 0, !6, i64 8, !10, i64 16, !14, i64 24, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !10, i64 100}
!21 = !{!"_priorityqueueENTRY", !16, i64 0, !16, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!22 = !{!19, !10, i64 512}
!23 = !{!19, !6, i64 16}
!24 = !{!25, !10, i64 28}
!25 = !{!"_PARTITION_CONFIGURATION_TYPE", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !6, i64 48, !10, i64 56, !6, i64 64, !10, i64 72, !6, i64 80, !10, i64 88, !6, i64 96, !10, i64 104, !6, i64 112, !10, i64 120, !6, i64 128, !10, i64 136, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 168, !10, i64 176, !6, i64 184, !6, i64 192}
!26 = !{!19, !6, i64 520}
!27 = !{!28, !6, i64 48}
!28 = !{!"_QUEUINGPORT_INFORMATION_TYPE", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40, !6, i64 48, !6, i64 56, !17, i64 64}
!29 = !{!28, !6, i64 56}
!30 = !{!28, !6, i64 8}
!31 = !{!28, !10, i64 0}
!32 = !{!28, !10, i64 16}
!33 = !{!28, !10, i64 20}
!34 = !{!28, !10, i64 24}
!35 = !{!28, !10, i64 28}


; 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

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

declare void @ENTER_CORE() local_unnamed_addr #1

declare i32 @PORT_GETCORE() local_unnamed_addr #1

declare void @EXIT_CORE() local_unnamed_addr #1

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

14:                                               ; preds = %7
  store i32 6, ptr %6, align 4, !tbaa !16
  tail call void @EXIT_CORE() #3
  br label %91

15:                                               ; preds = %7
  %16 = getelementptr inbounds i8, ptr %12, i64 28
  %17 = load i32, ptr %16, align 4, !tbaa !17
  %18 = icmp eq i32 %17, 4
  br i1 %18, label %19, label %20

19:                                               ; preds = %15
  store i32 6, ptr %6, align 4, !tbaa !16
  tail call void @EXIT_CORE() #3
  br label %91

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %12, i64 512
  %22 = load i32, ptr %21, align 8, !tbaa !21
  store i32 %22, ptr %8, align 4, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %12, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %24, i64 28
  %26 = load i32, ptr %25, align 4, !tbaa !23
  %.not = icmp ult i32 %22, %26
  br i1 %.not, label %28, label %27

27:                                               ; preds = %20
  store i32 5, ptr %6, align 4, !tbaa !16
  tail call void @EXIT_CORE() #3
  br label %91

28:                                               ; preds = %20
  call void @GET_QUEUING_PORT_ID(ptr noundef %0, ptr noundef nonnull %8, ptr noundef %6)
  %29 = load i32, ptr %6, align 4, !tbaa !16
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  store i32 2, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

32:                                               ; preds = %28
  %33 = add i32 %2, -513
  %or.cond = icmp ult i32 %33, -512
  br i1 %or.cond, label %34, label %35

34:                                               ; preds = %32
  store i32 4, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

35:                                               ; preds = %32
  %36 = add i32 %1, -513
  %or.cond3 = icmp ult i32 %36, -512
  br i1 %or.cond3, label %37, label %38

37:                                               ; preds = %35
  store i32 4, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

38:                                               ; preds = %35
  %39 = add i32 %3, -3
  %or.cond5 = icmp ult i32 %39, -2
  br i1 %or.cond5, label %40, label %41

40:                                               ; preds = %38
  store i32 5, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

41:                                               ; preds = %38
  %42 = add i32 %4, -3
  %or.cond7 = icmp ult i32 %42, -2
  br i1 %or.cond7, label %43, label %44

43:                                               ; preds = %41
  store i32 5, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

44:                                               ; preds = %41
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 520
  %47 = load ptr, ptr %46, align 8, !tbaa !25
  %48 = load i32, ptr %8, align 4, !tbaa !16
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds %struct._QUEUINGPORT_INFORMATION_TYPE, ptr %47, i64 %49
  %51 = getelementptr inbounds i8, ptr %45, i64 48
  %52 = getelementptr inbounds i8, ptr %50, i64 48
  %53 = mul nuw nsw i32 %2, %1
  call void @HEAP_ALLOCATE(ptr noundef nonnull %51, ptr noundef nonnull %52, i32 noundef %53, i8 noundef zeroext 0) #3
  %54 = load ptr, ptr %52, align 8, !tbaa !26
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %57

56:                                               ; preds = %44
  store i32 5, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

57:                                               ; preds = %44
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %58, i64 48
  %60 = getelementptr inbounds i8, ptr %50, i64 56
  %61 = shl nuw nsw i32 %2, 2
  call void @HEAP_ALLOCATE(ptr noundef nonnull %59, ptr noundef nonnull %60, i32 noundef %61, i8 noundef zeroext 0) #3
  %62 = load ptr, ptr %60, align 8, !tbaa !28
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %65

64:                                               ; preds = %57
  store i32 5, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

65:                                               ; preds = %57
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i64 48
  %68 = getelementptr inbounds i8, ptr %50, i64 8
  call void @HEAP_ALLOCATE(ptr noundef nonnull %67, ptr noundef nonnull %68, i32 noundef 30, i8 noundef zeroext 0) #3
  %69 = load ptr, ptr %68, align 8, !tbaa !29
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %72

71:                                               ; preds = %65
  store i32 5, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

72:                                               ; preds = %65
  %73 = call zeroext i8 @COMMON_COPYSTRING(ptr noundef %0, ptr noundef nonnull %69, i32 noundef 30) #3
  %.not66 = icmp eq i8 %73, 0
  br i1 %.not66, label %74, label %75

74:                                               ; preds = %72
  store i32 5, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

75:                                               ; preds = %72
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 512
  %78 = load i32, ptr %77, align 8, !tbaa !21
  store i32 %78, ptr %50, align 8, !tbaa !30
  %79 = getelementptr inbounds i8, ptr %50, i64 16
  store i32 %1, ptr %79, align 8, !tbaa !31
  %80 = getelementptr inbounds i8, ptr %50, i64 20
  store i32 %2, ptr %80, align 4, !tbaa !32
  %81 = getelementptr inbounds i8, ptr %50, i64 24
  store i32 %3, ptr %81, align 8, !tbaa !33
  %82 = getelementptr inbounds i8, ptr %50, i64 28
  store i32 %4, ptr %82, align 4, !tbaa !34
  %83 = getelementptr inbounds i8, ptr %50, i64 64
  %84 = icmp eq i32 %4, 2
  %85 = zext i1 %84 to i8
  call void @PRIORITYQUEUE_CLEAR(ptr noundef nonnull %83, i8 noundef zeroext %85, i8 noundef zeroext 0) #3
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = getelementptr inbounds i8, ptr %86, i64 512
  %88 = load i32, ptr %87, align 8, !tbaa !21
  %89 = add i32 %88, 1
  store i32 %89, ptr %87, align 8, !tbaa !21
  %90 = load i32, ptr %8, align 4, !tbaa !16
  store i32 %90, ptr %5, align 4, !tbaa !16
  store i32 1, ptr %6, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %91

91:                                               ; preds = %75, %74, %71, %64, %56, %43, %40, %37, %34, %31, %27, %19, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @GET_QUEUING_PORT_ID(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare zeroext i8 @COMMON_COPYSTRING(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @PRIORITYQUEUE_CLEAR(ptr noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

attributes #0 = { mustprogress 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, !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 512}
!22 = !{!18, !7, i64 16}
!23 = !{!24, !11, i64 28}
!24 = !{!"_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}
!25 = !{!18, !7, i64 520}
!26 = !{!27, !7, i64 48}
!27 = !{!"_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}
!28 = !{!27, !7, i64 56}
!29 = !{!27, !7, i64 8}
!30 = !{!27, !11, i64 0}
!31 = !{!27, !11, i64 16}
!32 = !{!27, !11, i64 20}
!33 = !{!27, !11, i64 24}
!34 = !{!27, !11, i64 28}


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