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

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

@CORE_MODULE_INFORMATION = external global [2 x %struct._MODULE_INFORMATION_TYPE], align 16

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

24:                                               ; preds = %6
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 6, ptr %25, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

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

33:                                               ; preds = %26
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 6, ptr %34, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

35:                                               ; preds = %26
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %36, i32 0, i32 8
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %38, i32 0, i32 27
  %40 = load i32, ptr %39, align 8, !tbaa !22
  store i32 %40, ptr %14, align 4, !tbaa !9
  %41 = load i32, ptr %14, align 4, !tbaa !9
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %42, i32 0, i32 8
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %44, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !23
  %47 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %46, i32 0, i32 6
  %48 = load i32, ptr %47, align 8, !tbaa !24
  %49 = icmp uge i32 %41, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %35
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 5, ptr %51, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

52:                                               ; preds = %35
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  call void @GET_BUFFER_ID(ptr noundef %53, ptr noundef %14, ptr noundef %54)
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = icmp eq i32 %56, 1
  br i1 %57, label %58, label %60

58:                                               ; preds = %52
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 2, ptr %59, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

60:                                               ; preds = %52
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = icmp ult i32 %61, 1
  br i1 %62, label %66, label %63

63:                                               ; preds = %60
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = icmp ugt i32 %64, 512
  br i1 %65, label %66, label %68

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

68:                                               ; preds = %63
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = icmp ult i32 %69, 1
  br i1 %70, label %74, label %71

71:                                               ; preds = %68
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = icmp ugt i32 %72, 512
  br i1 %73, label %74, label %76

74:                                               ; preds = %71, %68
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 4, ptr %75, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

76:                                               ; preds = %71
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = icmp ne i32 %77, 1
  br i1 %78, label %79, label %84

79:                                               ; preds = %76
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 2
  br i1 %81, label %82, label %84

82:                                               ; preds = %79
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 4, ptr %83, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

84:                                               ; preds = %79, %76
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %85, i32 0, i32 8
  %87 = load ptr, ptr %86, align 8, !tbaa !11
  %88 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %87, i32 0, i32 28
  %89 = load ptr, ptr %88, align 8, !tbaa !26
  %90 = load i32, ptr %14, align 4, !tbaa !9
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %89, i64 %91
  store ptr %92, ptr %15, align 8, !tbaa !5
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %93, i32 0, i32 8
  %95 = load ptr, ptr %94, align 8, !tbaa !11
  %96 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %95, i32 0, i32 8
  %97 = load ptr, ptr %15, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %97, i32 0, i32 7
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = load i32, ptr %8, align 4, !tbaa !9
  %101 = mul i32 %99, %100
  call void @HEAP_ALLOCATE(ptr noundef %96, ptr noundef %98, i32 noundef %101, i8 noundef zeroext 0)
  %102 = load ptr, ptr %15, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %102, i32 0, i32 7
  %104 = load ptr, ptr %103, align 8, !tbaa !27
  %105 = icmp eq ptr %104, null
  br i1 %105, label %106, label %108

106:                                              ; preds = %84
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 5, ptr %107, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

108:                                              ; preds = %84
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %109, i32 0, i32 8
  %111 = load ptr, ptr %110, align 8, !tbaa !11
  %112 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %111, i32 0, i32 8
  %113 = load ptr, ptr %15, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %113, i32 0, i32 8
  %115 = load i32, ptr %9, align 4, !tbaa !9
  %116 = zext i32 %115 to i64
  %117 = mul i64 %116, 4
  %118 = trunc i64 %117 to i32
  call void @HEAP_ALLOCATE(ptr noundef %112, ptr noundef %114, i32 noundef %118, i8 noundef zeroext 0)
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %119, i32 0, i32 8
  %121 = load ptr, ptr %120, align 8, !tbaa !29
  %122 = icmp eq ptr %121, null
  br i1 %122, label %123, label %125

123:                                              ; preds = %108
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 5, ptr %124, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

125:                                              ; preds = %108
  %126 = load ptr, ptr %13, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %126, i32 0, i32 8
  %128 = load ptr, ptr %127, align 8, !tbaa !11
  %129 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %128, i32 0, i32 8
  %130 = load ptr, ptr %15, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %130, i32 0, i32 1
  call void @HEAP_ALLOCATE(ptr noundef %129, ptr noundef %131, i32 noundef 30, i8 noundef zeroext 0)
  %132 = load ptr, ptr %15, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %132, i32 0, i32 1
  %134 = load ptr, ptr %133, align 8, !tbaa !30
  %135 = icmp eq ptr %134, null
  br i1 %135, label %136, label %138

136:                                              ; preds = %125
  %137 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 5, ptr %137, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

138:                                              ; preds = %125
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = load ptr, ptr %15, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %140, i32 0, i32 1
  %142 = load ptr, ptr %141, align 8, !tbaa !30
  %143 = call zeroext i8 @COMMON_COPYSTRING(ptr noundef %139, ptr noundef %142, i32 noundef 30)
  %144 = icmp ne i8 %143, 0
  br i1 %144, label %147, label %145

145:                                              ; preds = %138
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 5, ptr %146, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %16, align 4
  br label %180

147:                                              ; preds = %138
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %148, i32 0, i32 8
  %150 = load ptr, ptr %149, align 8, !tbaa !11
  %151 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %150, i32 0, i32 27
  %152 = load i32, ptr %151, align 8, !tbaa !22
  %153 = load ptr, ptr %15, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %153, i32 0, i32 0
  store i32 %152, ptr %154, align 8, !tbaa !31
  %155 = load i32, ptr %8, align 4, !tbaa !9
  %156 = load ptr, ptr %15, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %156, i32 0, i32 2
  store i32 %155, ptr %157, align 8, !tbaa !32
  %158 = load i32, ptr %9, align 4, !tbaa !9
  %159 = load ptr, ptr %15, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %159, i32 0, i32 3
  store i32 %158, ptr %160, align 4, !tbaa !33
  %161 = load i32, ptr %10, align 4, !tbaa !9
  %162 = load ptr, ptr %15, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %162, i32 0, i32 4
  store i32 %161, ptr %163, align 8, !tbaa !34
  %164 = load ptr, ptr %15, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._BUFFER_INFORMATION_TYPE, ptr %164, i32 0, i32 9
  %166 = load i32, ptr %10, align 4, !tbaa !9
  %167 = icmp eq i32 %166, 2
  %168 = zext i1 %167 to i64
  %169 = select i1 %167, i32 1, i32 0
  %170 = trunc i32 %169 to i8
  call void @PRIORITYQUEUE_CLEAR(ptr noundef %165, i8 noundef zeroext %170, i8 noundef zeroext 0)
  %171 = load ptr, ptr %13, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %171, i32 0, i32 8
  %173 = load ptr, ptr %172, align 8, !tbaa !11
  %174 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %173, i32 0, i32 27
  %175 = load i32, ptr %174, align 8, !tbaa !22
  %176 = add i32 %175, 1
  store i32 %176, ptr %174, align 8, !tbaa !22
  %177 = load i32, ptr %14, align 4, !tbaa !9
  %178 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %177, ptr %178, align 4, !tbaa !9
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 1, ptr %179, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 0, ptr %16, align 4
  br label %180

180:                                              ; preds = %147, %145, %136, %123, %106, %82, %74, %66, %58, %50, %33, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %181 = load i32, ptr %16, align 4
  switch i32 %181, label %183 [
    i32 0, label %182
    i32 1, label %182
  ]

182:                                              ; preds = %180, %180
  ret void

183:                                              ; preds = %180
  unreachable
}

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

declare void @ENTER_CORE() #2

declare i32 @PORT_GETCORE() #2

declare void @EXIT_CORE() #2

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

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 528}
!23 = !{!19, !6, i64 16}
!24 = !{!25, !10, i64 32}
!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 536}
!27 = !{!28, !6, i64 40}
!28 = !{!"_BUFFER_INFORMATION_TYPE", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40, !6, i64 48, !17, i64 56}
!29 = !{!28, !6, i64 48}
!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}


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

@CORE_MODULE_INFORMATION = external local_unnamed_addr global [2 x %struct._MODULE_INFORMATION_TYPE], align 16

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

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

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

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

19:                                               ; preds = %14
  %20 = getelementptr inbounds i8, ptr %11, i64 528
  %21 = load i32, ptr %20, align 8, !tbaa !21
  store i32 %21, ptr %7, align 4, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %11, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !22
  %24 = getelementptr inbounds i8, ptr %23, i64 32
  %25 = load i32, ptr %24, align 8, !tbaa !23
  %.not = icmp ult i32 %21, %25
  br i1 %.not, label %27, label %26

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

27:                                               ; preds = %19
  call void @GET_BUFFER_ID(ptr noundef %0, ptr noundef nonnull %7, ptr noundef %5)
  %28 = load i32, ptr %5, align 4, !tbaa !16
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  store i32 2, ptr %5, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %86

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

33:                                               ; preds = %31
  store i32 4, ptr %5, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %86

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

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

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

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

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

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

53:                                               ; preds = %40
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 48
  %56 = getelementptr inbounds i8, ptr %46, i64 48
  %57 = shl nuw nsw i32 %2, 2
  call void @HEAP_ALLOCATE(ptr noundef nonnull %55, ptr noundef nonnull %56, i32 noundef %57, i8 noundef zeroext 0) #3
  %58 = load ptr, ptr %56, align 8, !tbaa !28
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %53
  store i32 5, ptr %5, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %86

61:                                               ; preds = %53
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 48
  %64 = getelementptr inbounds i8, ptr %46, i64 8
  call void @HEAP_ALLOCATE(ptr noundef nonnull %63, ptr noundef nonnull %64, i32 noundef 30, i8 noundef zeroext 0) #3
  %65 = load ptr, ptr %64, align 8, !tbaa !29
  %66 = icmp eq ptr %65, null
  br i1 %66, label %67, label %68

67:                                               ; preds = %61
  store i32 5, ptr %5, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %86

68:                                               ; preds = %61
  %69 = call zeroext i8 @COMMON_COPYSTRING(ptr noundef %0, ptr noundef nonnull %65, i32 noundef 30) #3
  %.not59 = icmp eq i8 %69, 0
  br i1 %.not59, label %70, label %71

70:                                               ; preds = %68
  store i32 5, ptr %5, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %86

71:                                               ; preds = %68
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 528
  %74 = load i32, ptr %73, align 8, !tbaa !21
  store i32 %74, ptr %46, align 8, !tbaa !30
  %75 = getelementptr inbounds i8, ptr %46, i64 16
  store i32 %1, ptr %75, align 8, !tbaa !31
  %76 = getelementptr inbounds i8, ptr %46, i64 20
  store i32 %2, ptr %76, align 4, !tbaa !32
  %77 = getelementptr inbounds i8, ptr %46, i64 24
  store i32 %3, ptr %77, align 8, !tbaa !33
  %78 = getelementptr inbounds i8, ptr %46, i64 56
  %79 = icmp eq i32 %3, 2
  %80 = zext i1 %79 to i8
  call void @PRIORITYQUEUE_CLEAR(ptr noundef nonnull %78, i8 noundef zeroext %80, i8 noundef zeroext 0) #3
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %81, i64 528
  %83 = load i32, ptr %82, align 8, !tbaa !21
  %84 = add i32 %83, 1
  store i32 %84, ptr %82, align 8, !tbaa !21
  %85 = load i32, ptr %7, align 4, !tbaa !16
  store i32 %85, ptr %4, align 4, !tbaa !16
  store i32 1, ptr %5, align 4, !tbaa !16
  call void @EXIT_CORE() #3
  br label %86

86:                                               ; preds = %71, %70, %67, %60, %52, %39, %36, %33, %30, %26, %18, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  ret void
}

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

declare void @ENTER_CORE() local_unnamed_addr #2

declare i32 @PORT_GETCORE() local_unnamed_addr #2

declare void @EXIT_CORE() local_unnamed_addr #2

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

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 528}
!22 = !{!18, !7, i64 16}
!23 = !{!24, !11, i64 32}
!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 536}
!26 = !{!27, !7, i64 40}
!27 = !{!"_BUFFER_INFORMATION_TYPE", !11, i64 0, !7, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !7, i64 40, !7, i64 48, !15, i64 56}
!28 = !{!27, !7, i64 48}
!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}


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