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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct._MODULE_INFORMATION_TYPE = type { ptr, %struct._heapRECORD, i32, i32, i32, %struct._CONTEXT_TYPE, i32, ptr, ptr, %struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE, i64, i64, i64, %struct._priorityqueueRECORD }
%struct._heapRECORD = type { ptr, i32, i32, i32 }
%struct._CONTEXT_TYPE = type { i32, ptr, ptr, ptr, i32, i8, ptr, ptr, i32, i32, i32, i32 }
%struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE = type { i8, ptr, i32, %struct._CONTEXT_TYPE, i8, i8, i8, i8, i32, i32 }
%struct._priorityqueueRECORD = type { ptr, i32, i8, i8 }
%struct._PARTITION_INFORMATION_TYPE = type { i8, ptr, ptr, i32, i32, i32, i32, i8, %struct._heapRECORD, %struct._CONTEXT_TYPE, i32, ptr, ptr, %struct._ERRORHANDLER_INFORMATION_TYPE, %struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE, i32, %struct._priorityqueueENTRY, %struct._priorityqueueRECORD, %struct._priorityqueueRECORD, %struct._priorityqueueRECORD, i32, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr }
%struct._ERRORHANDLER_INFORMATION_TYPE = type { i8, ptr, i32, %struct._CONTEXT_TYPE, i8, i8, i8, i8, i32 }
%struct._priorityqueueENTRY = type { i64, i64, ptr, ptr, ptr }
%struct._PARTITION_CONFIGURATION_TYPE = type { i32, ptr, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, ptr, i32, ptr, ptr }

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

; 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 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 i32 @PORT_GETCORE() #1

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

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

19:                                               ; preds = %3
  %20 = load ptr, ptr %7, 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 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %22, i32 0, i32 4
  %24 = load i32, ptr %23, align 4, !tbaa !18
  %25 = icmp eq i32 %24, 4
  br i1 %25, label %26, label %28

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

28:                                               ; preds = %19
  %29 = load ptr, ptr %7, 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 13
  store ptr %32, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %33, i32 0, i32 0
  %35 = load i8, ptr %34, align 8, !tbaa !22
  %36 = icmp ne i8 %35, 0
  br i1 %36, label %37, label %39

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

39:                                               ; preds = %28
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %40, i32 0, i32 8
  %42 = load ptr, ptr %41, align 8, !tbaa !11
  %43 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %42, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !23
  %45 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %44, i32 0, i32 20
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  %47 = icmp eq ptr %46, null
  br i1 %47, label %57, label %48

48:                                               ; preds = %39
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %49, i32 0, i32 8
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %51, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !23
  %54 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %53, i32 0, i32 21
  %55 = load i32, ptr %54, align 8, !tbaa !26
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %59

57:                                               ; preds = %48, %39
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 5, ptr %58, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %9, align 4
  br label %165

59:                                               ; preds = %48
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %60, i32 0, i32 8
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = call zeroext i8 @PORT_HOOK_BEFORE_CREATE_ERROR_HANDLER(ptr noundef %62, ptr noundef %63)
  %65 = icmp ne i8 %64, 0
  br i1 %65, label %68, label %66

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

68:                                               ; preds = %59
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %69, i32 0, i32 0
  store i8 1, ptr %70, align 8, !tbaa !22
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %72, i32 0, i32 1
  store ptr %71, ptr %73, align 8, !tbaa !27
  %74 = load i32, ptr %5, align 4, !tbaa !9
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %75, i32 0, i32 2
  store i32 %74, ptr %76, align 8, !tbaa !28
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %77, i32 0, i32 3
  %79 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %78, i32 0, i32 0
  %80 = load i32, ptr %79, align 8, !tbaa !29
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %90

82:                                               ; preds = %68
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %83, i32 0, i32 2
  %85 = load i32, ptr %84, align 8, !tbaa !30
  %86 = add i32 %85, 1
  store i32 %86, ptr %84, align 8, !tbaa !30
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %87, i32 0, i32 3
  %89 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %88, i32 0, i32 0
  store i32 %85, ptr %89, align 8, !tbaa !29
  br label %90

90:                                               ; preds = %82, %68
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %91, i32 0, i32 8
  %93 = load ptr, ptr %92, align 8, !tbaa !11
  %94 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %93, i32 0, i32 2
  %95 = load ptr, ptr %94, align 8, !tbaa !23
  %96 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %95, i32 0, i32 20
  %97 = load ptr, ptr %96, align 8, !tbaa !24
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %98, i32 0, i32 3
  %100 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %99, i32 0, i32 1
  store ptr %97, ptr %100, align 8, !tbaa !31
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %101, i32 0, i32 3
  %103 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %102, i32 0, i32 1
  %104 = load ptr, ptr %103, align 8, !tbaa !31
  %105 = ptrtoint ptr %104 to i32
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %106, i32 0, i32 8
  %108 = load ptr, ptr %107, align 8, !tbaa !11
  %109 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %108, i32 0, i32 2
  %110 = load ptr, ptr %109, align 8, !tbaa !23
  %111 = getelementptr inbounds %struct._PARTITION_CONFIGURATION_TYPE, ptr %110, i32 0, i32 21
  %112 = load i32, ptr %111, align 8, !tbaa !26
  %113 = add i32 %105, %112
  %114 = zext i32 %113 to i64
  %115 = inttoptr i64 %114 to ptr
  %116 = load ptr, ptr %8, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %116, i32 0, i32 3
  %118 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %117, i32 0, i32 2
  store ptr %115, ptr %118, align 8, !tbaa !32
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %119, i32 0, i32 3
  %121 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %120, i32 0, i32 4
  store i32 0, ptr %121, align 8, !tbaa !33
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %122, i32 0, i32 8
  %124 = load ptr, ptr %123, align 8, !tbaa !11
  %125 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %124, i32 0, i32 9
  %126 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %125, i32 0, i32 5
  %127 = load i8, ptr %126, align 4, !tbaa !34
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %128, i32 0, i32 3
  %130 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %129, i32 0, i32 5
  store i8 %127, ptr %130, align 4, !tbaa !35
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %132, i32 0, i32 3
  %134 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %133, i32 0, i32 6
  store ptr %131, ptr %134, align 8, !tbaa !36
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %135, i32 0, i32 3
  %137 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %136, i32 0, i32 7
  store ptr @RETURNPOINT_PARTITIONERRORHANDLER, ptr %137, align 8, !tbaa !37
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %138, i32 0, i32 3
  %140 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %139, i32 0, i32 8
  store i32 0, ptr %140, align 8, !tbaa !38
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %141, i32 0, i32 3
  %143 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %142, i32 0, i32 9
  store i32 0, ptr %143, align 4, !tbaa !39
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct._ERRORHANDLER_INFORMATION_TYPE, ptr %144, i32 0, i32 3
  %146 = getelementptr inbounds %struct._CONTEXT_TYPE, ptr %145, i32 0, i32 0
  %147 = load i32, ptr %146, align 8, !tbaa !29
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %148, i32 0, i32 3
  %150 = load i32, ptr %149, align 4, !tbaa !40
  %151 = icmp ugt i32 %147, %150
  br i1 %151, label %152, label %154

152:                                              ; preds = %90
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 5, ptr %153, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 1, ptr %9, align 4
  br label %165

154:                                              ; preds = %90
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %155, i32 0, i32 8
  %157 = load ptr, ptr %156, align 8, !tbaa !11
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = call zeroext i8 @PORT_HOOK_AFTER_CREATE_ERROR_HANDLER(ptr noundef %157, ptr noundef %158)
  %160 = icmp ne i8 %159, 0
  br i1 %160, label %163, label %161

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

163:                                              ; preds = %154
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 1, ptr %164, align 4, !tbaa !9
  call void @EXIT_CORE()
  store i32 0, ptr %9, align 4
  br label %165

165:                                              ; preds = %163, %161, %152, %66, %57, %37, %26, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %166 = load i32, ptr %9, align 4
  switch i32 %166, label %168 [
    i32 0, label %167
    i32 1, label %167
  ]

167:                                              ; preds = %165, %165
  ret void

168:                                              ; preds = %165
  unreachable
}

declare zeroext i8 @PORT_HOOK_BEFORE_CREATE_ERROR_HANDLER(ptr noundef, ptr noundef) #1

declare void @RETURNPOINT_PARTITIONERRORHANDLER() #1

declare zeroext i8 @PORT_HOOK_AFTER_CREATE_ERROR_HANDLER(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!20, !7, i64 0}
!23 = !{!19, !6, i64 16}
!24 = !{!25, !6, i64 128}
!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 = !{!25, !10, i64 136}
!27 = !{!20, !6, i64 8}
!28 = !{!20, !10, i64 16}
!29 = !{!20, !10, i64 24}
!30 = !{!12, !10, i64 32}
!31 = !{!20, !6, i64 32}
!32 = !{!20, !6, i64 40}
!33 = !{!20, !10, i64 56}
!34 = !{!19, !7, i64 108}
!35 = !{!20, !7, i64 60}
!36 = !{!20, !6, i64 64}
!37 = !{!20, !6, i64 72}
!38 = !{!20, !10, i64 80}
!39 = !{!20, !10, i64 84}
!40 = !{!12, !10, i64 36}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct._MODULE_INFORMATION_TYPE = type { ptr, %struct._heapRECORD, i32, i32, i32, %struct._CONTEXT_TYPE, i32, ptr, ptr, %struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE, i64, i64, i64, %struct._priorityqueueRECORD }
%struct._heapRECORD = type { ptr, i32, i32, i32 }
%struct._CONTEXT_TYPE = type { i32, ptr, ptr, ptr, i32, i8, ptr, ptr, i32, i32, i32, i32 }
%struct._HEALTHMONITORINGCALLBACK_INFORMATION_TYPE = type { i8, ptr, i32, %struct._CONTEXT_TYPE, i8, i8, i8, i8, i32, i32 }
%struct._priorityqueueRECORD = type { ptr, i32, i8, i8 }

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

declare void @ENTER_CORE() local_unnamed_addr #0

declare void @EXIT_CORE() local_unnamed_addr #0

declare i32 @PORT_GETCORE() local_unnamed_addr #0

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

10:                                               ; preds = %3
  %11 = getelementptr inbounds i8, ptr %8, i64 28
  %12 = load i32, ptr %11, align 4, !tbaa !16
  %13 = icmp eq i32 %12, 4
  br i1 %13, label %68, label %14

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %8, i64 168
  %16 = load i8, ptr %15, align 8, !tbaa !20
  %.not = icmp eq i8 %16, 0
  br i1 %.not, label %17, label %68

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %8, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  %20 = getelementptr inbounds i8, ptr %19, i64 128
  %21 = load ptr, ptr %20, align 8, !tbaa !22
  %22 = icmp eq ptr %21, null
  br i1 %22, label %68, label %23

23:                                               ; preds = %17
  %24 = getelementptr inbounds i8, ptr %19, i64 136
  %25 = load i32, ptr %24, align 8, !tbaa !24
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %68, label %27

27:                                               ; preds = %23
  %28 = tail call zeroext i8 @PORT_HOOK_BEFORE_CREATE_ERROR_HANDLER(ptr noundef nonnull %8, ptr noundef nonnull %15) #2
  %.not40 = icmp eq i8 %28, 0
  br i1 %.not40, label %68, label %29

29:                                               ; preds = %27
  store i8 1, ptr %15, align 8, !tbaa !20
  %30 = getelementptr inbounds i8, ptr %8, i64 176
  store ptr %0, ptr %30, align 8, !tbaa !25
  %31 = getelementptr inbounds i8, ptr %8, i64 184
  store i32 %1, ptr %31, align 8, !tbaa !26
  %32 = getelementptr inbounds i8, ptr %8, i64 192
  %33 = load i32, ptr %32, align 8, !tbaa !27
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %29
  %36 = getelementptr inbounds i8, ptr %6, i64 32
  %37 = load i32, ptr %36, align 8, !tbaa !28
  %38 = add i32 %37, 1
  store i32 %38, ptr %36, align 8, !tbaa !28
  store i32 %37, ptr %32, align 8, !tbaa !27
  br label %39

39:                                               ; preds = %35, %29
  %40 = phi i32 [ %37, %35 ], [ %33, %29 ]
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %43, i64 128
  %45 = load ptr, ptr %44, align 8, !tbaa !22
  %46 = getelementptr inbounds i8, ptr %8, i64 200
  store ptr %45, ptr %46, align 8, !tbaa !29
  %47 = ptrtoint ptr %45 to i64
  %48 = trunc i64 %47 to i32
  %49 = getelementptr inbounds i8, ptr %43, i64 136
  %50 = load i32, ptr %49, align 8, !tbaa !24
  %51 = add i32 %50, %48
  %52 = zext i32 %51 to i64
  %53 = inttoptr i64 %52 to ptr
  %54 = getelementptr inbounds i8, ptr %8, i64 208
  store ptr %53, ptr %54, align 8, !tbaa !30
  %55 = getelementptr inbounds i8, ptr %8, i64 224
  store i32 0, ptr %55, align 8, !tbaa !31
  %56 = getelementptr inbounds i8, ptr %41, i64 108
  %57 = load i8, ptr %56, align 4, !tbaa !32
  %58 = getelementptr inbounds i8, ptr %8, i64 228
  store i8 %57, ptr %58, align 4, !tbaa !33
  %59 = getelementptr inbounds i8, ptr %8, i64 232
  store ptr %0, ptr %59, align 8, !tbaa !34
  %60 = getelementptr inbounds i8, ptr %8, i64 240
  store ptr @RETURNPOINT_PARTITIONERRORHANDLER, ptr %60, align 8, !tbaa !35
  %61 = getelementptr inbounds i8, ptr %8, i64 248
  store i32 0, ptr %61, align 8, !tbaa !36
  %62 = getelementptr inbounds i8, ptr %8, i64 252
  store i32 0, ptr %62, align 4, !tbaa !37
  %63 = getelementptr inbounds i8, ptr %6, i64 36
  %64 = load i32, ptr %63, align 4, !tbaa !38
  %65 = icmp ugt i32 %40, %64
  br i1 %65, label %68, label %66

66:                                               ; preds = %39
  %67 = tail call zeroext i8 @PORT_HOOK_AFTER_CREATE_ERROR_HANDLER(ptr noundef nonnull %41, ptr noundef nonnull %15) #2
  %.not41 = icmp eq i8 %67, 0
  %. = select i1 %.not41, i32 5, i32 1
  br label %68

68:                                               ; preds = %66, %39, %27, %17, %23, %14, %10, %3
  %.sink = phi i32 [ 6, %3 ], [ 6, %10 ], [ 2, %14 ], [ 5, %23 ], [ 5, %17 ], [ 5, %27 ], [ 5, %39 ], [ %., %66 ]
  store i32 %.sink, ptr %2, align 4, !tbaa !39
  tail call void @EXIT_CORE() #2
  ret void
}

declare zeroext i8 @PORT_HOOK_BEFORE_CREATE_ERROR_HANDLER(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @RETURNPOINT_PARTITIONERRORHANDLER() #0

declare zeroext i8 @PORT_HOOK_AFTER_CREATE_ERROR_HANDLER(ptr noundef, ptr noundef) local_unnamed_addr #0

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 136}
!6 = !{!"_MODULE_INFORMATION_TYPE", !7, i64 0, !10, i64 8, !11, i64 32, !11, i64 36, !11, i64 40, !12, i64 48, !11, i64 120, !7, i64 128, !7, i64 136, !13, i64 144, !14, i64 256, !14, i64 264, !14, i64 272, !15, i64 280}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_heapRECORD", !7, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_CONTEXT_TYPE", !11, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !8, i64 36, !7, i64 40, !7, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68}
!13 = !{!"_HEALTHMONITORINGCALLBACK_INFORMATION_TYPE", !8, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 96, !8, i64 97, !8, i64 98, !8, i64 99, !11, i64 100, !11, i64 104}
!14 = !{!"long long", !8, i64 0}
!15 = !{!"_priorityqueueRECORD", !7, i64 0, !11, i64 8, !8, i64 12, !8, i64 13}
!16 = !{!17, !11, i64 28}
!17 = !{!"_PARTITION_INFORMATION_TYPE", !8, i64 0, !7, i64 8, !7, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !8, i64 40, !10, i64 48, !12, i64 72, !11, i64 144, !7, i64 152, !7, i64 160, !18, i64 168, !13, i64 272, !11, i64 384, !19, i64 392, !15, i64 432, !15, i64 448, !15, i64 464, !11, i64 480, !11, i64 484, !7, i64 488, !11, i64 496, !7, i64 504, !11, i64 512, !7, i64 520, !11, i64 528, !7, i64 536, !11, i64 544, !7, i64 552, !11, i64 560, !7, i64 568, !11, i64 576, !7, i64 584}
!18 = !{!"_ERRORHANDLER_INFORMATION_TYPE", !8, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 96, !8, i64 97, !8, i64 98, !8, i64 99, !11, i64 100}
!19 = !{!"_priorityqueueENTRY", !14, i64 0, !14, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!20 = !{!18, !8, i64 0}
!21 = !{!17, !7, i64 16}
!22 = !{!23, !7, i64 128}
!23 = !{!"_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}
!24 = !{!23, !11, i64 136}
!25 = !{!18, !7, i64 8}
!26 = !{!18, !11, i64 16}
!27 = !{!18, !11, i64 24}
!28 = !{!6, !11, i64 32}
!29 = !{!18, !7, i64 32}
!30 = !{!18, !7, i64 40}
!31 = !{!18, !11, i64 56}
!32 = !{!17, !8, i64 108}
!33 = !{!18, !8, i64 60}
!34 = !{!18, !7, i64 64}
!35 = !{!18, !7, i64 72}
!36 = !{!18, !11, i64 80}
!37 = !{!18, !11, i64 84}
!38 = !{!6, !11, i64 36}
!39 = !{!11, !11, i64 0}


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