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

; 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._BLACKBOARD_INFORMATION_TYPE = type { i32, ptr, i32, i32, ptr, i32, %struct._priorityqueueRECORD }
%struct._PROCESS_INFORMATION_TYPE = type { ptr, ptr, i32, i32, i32, i64, i64, i64, i64, i64, %struct._CONTEXT_TYPE, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, %struct._priorityqueueENTRY, i8, i8, ptr, i32, ptr, ptr }

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

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

declare void @ENTER_CORE() #1

declare i32 @PORT_GETCORE() #1

declare void @EXIT_CORE() #1

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

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

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

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

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

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

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

43:                                               ; preds = %33
  %44 = load ptr, ptr %11, align 8, !tbaa !11
  %45 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %44, i32 0, i32 8
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  %47 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %46, i32 0, i32 30
  %48 = load ptr, ptr %47, align 8, !tbaa !24
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %48, i64 %50
  store ptr %51, ptr %12, align 8, !tbaa !11
  %52 = load ptr, ptr %12, align 8, !tbaa !11
  %53 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %52, i32 0, i32 2
  %54 = load i32, ptr %53, align 8, !tbaa !25
  %55 = icmp eq i32 %54, 2
  br i1 %55, label %56, label %84

56:                                               ; preds = %43
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %75, %56
  %58 = load i32, ptr %13, align 4, !tbaa !5
  %59 = load ptr, ptr %12, align 8, !tbaa !11
  %60 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %59, i32 0, i32 5
  %61 = load i32, ptr %60, align 8, !tbaa !27
  %62 = icmp ult i32 %58, %61
  br i1 %62, label %63, label %78

63:                                               ; preds = %57
  %64 = load ptr, ptr %12, align 8, !tbaa !11
  %65 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %64, i32 0, i32 4
  %66 = load ptr, ptr %65, align 8, !tbaa !28
  %67 = load i32, ptr %13, align 4, !tbaa !5
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds i8, ptr %66, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !29
  %71 = load ptr, ptr %8, align 8, !tbaa !11
  %72 = load i32, ptr %13, align 4, !tbaa !5
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds i8, ptr %71, i64 %73
  store i8 %70, ptr %74, align 1, !tbaa !29
  br label %75

75:                                               ; preds = %63
  %76 = load i32, ptr %13, align 4, !tbaa !5
  %77 = add i32 %76, 1
  store i32 %77, ptr %13, align 4, !tbaa !5
  br label %57, !llvm.loop !30

78:                                               ; preds = %57
  %79 = load ptr, ptr %12, align 8, !tbaa !11
  %80 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %79, i32 0, i32 5
  %81 = load i32, ptr %80, align 8, !tbaa !27
  %82 = load ptr, ptr %9, align 8, !tbaa !11
  store i32 %81, ptr %82, align 4, !tbaa !5
  %83 = load ptr, ptr %10, align 8, !tbaa !11
  store i32 1, ptr %83, align 4, !tbaa !5
  call void @EXIT_CORE()
  store i32 1, ptr %14, align 4
  br label %132

84:                                               ; preds = %43
  %85 = load ptr, ptr %11, align 8, !tbaa !11
  %86 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %85, i32 0, i32 8
  %87 = load ptr, ptr %86, align 8, !tbaa !13
  %88 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %87, i32 0, i32 3
  %89 = load i32, ptr %88, align 8, !tbaa !32
  %90 = load ptr, ptr %11, align 8, !tbaa !11
  %91 = getelementptr inbounds %struct._MODULE_INFORMATION_TYPE, ptr %90, i32 0, i32 8
  %92 = load ptr, ptr %91, align 8, !tbaa !13
  %93 = getelementptr inbounds %struct._PARTITION_INFORMATION_TYPE, ptr %92, i32 0, i32 12
  %94 = load ptr, ptr %93, align 8, !tbaa !19
  %95 = getelementptr inbounds %struct._PROCESS_INFORMATION_TYPE, ptr %94, i32 0, i32 2
  %96 = load i32, ptr %95, align 8, !tbaa !33
  %97 = load ptr, ptr %12, align 8, !tbaa !11
  %98 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %97, i32 0, i32 6
  %99 = load i64, ptr %7, align 8, !tbaa !9
  %100 = load ptr, ptr %10, align 8, !tbaa !11
  call void @WAIT_RESOURCE(i32 noundef %89, i32 noundef %96, ptr noundef %98, i64 noundef %99, ptr noundef %100)
  %101 = load ptr, ptr %10, align 8, !tbaa !11
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp eq i32 %102, 1
  br i1 %103, label %104, label %131

104:                                              ; preds = %84
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %123, %104
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = load ptr, ptr %12, align 8, !tbaa !11
  %108 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %107, i32 0, i32 5
  %109 = load i32, ptr %108, align 8, !tbaa !27
  %110 = icmp ult i32 %106, %109
  br i1 %110, label %111, label %126

111:                                              ; preds = %105
  %112 = load ptr, ptr %12, align 8, !tbaa !11
  %113 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !28
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = zext i32 %115 to i64
  %117 = getelementptr inbounds i8, ptr %114, i64 %116
  %118 = load i8, ptr %117, align 1, !tbaa !29
  %119 = load ptr, ptr %8, align 8, !tbaa !11
  %120 = load i32, ptr %13, align 4, !tbaa !5
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds i8, ptr %119, i64 %121
  store i8 %118, ptr %122, align 1, !tbaa !29
  br label %123

123:                                              ; preds = %111
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = add i32 %124, 1
  store i32 %125, ptr %13, align 4, !tbaa !5
  br label %105, !llvm.loop !35

126:                                              ; preds = %105
  %127 = load ptr, ptr %12, align 8, !tbaa !11
  %128 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %127, i32 0, i32 5
  %129 = load i32, ptr %128, align 8, !tbaa !27
  %130 = load ptr, ptr %9, align 8, !tbaa !11
  store i32 %129, ptr %130, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %126, %84
  call void @EXIT_CORE()
  store i32 0, ptr %14, align 4
  br label %132

132:                                              ; preds = %131, %78, %41, %31, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %133 = load i32, ptr %14, align 4
  switch i32 %133, label %135 [
    i32 0, label %134
    i32 1, label %134
  ]

134:                                              ; preds = %132, %132
  ret void

135:                                              ; preds = %132
  unreachable
}

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

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

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

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


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

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

declare void @ENTER_CORE() local_unnamed_addr #0

declare i32 @PORT_GETCORE() local_unnamed_addr #0

declare void @EXIT_CORE() local_unnamed_addr #0

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

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

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

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

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

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

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %9, i64 552
  %23 = load ptr, ptr %22, align 8, !tbaa !22
  %24 = zext i32 %0 to i64
  %25 = getelementptr inbounds %struct._BLACKBOARD_INFORMATION_TYPE, ptr %23, i64 %24
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  %27 = load i32, ptr %26, align 8, !tbaa !23
  %28 = icmp eq i32 %27, 2
  br i1 %28, label %.preheader, label %40

.preheader:                                       ; preds = %21
  %29 = getelementptr inbounds i8, ptr %25, i64 32
  %30 = load i32, ptr %29, align 8, !tbaa !25
  %.not47 = icmp eq i32 %30, 0
  br i1 %.not47, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %.preheader
  %31 = getelementptr inbounds i8, ptr %25, i64 24
  br label %32

32:                                               ; preds = %.lr.ph43, %32
  %indvars.iv51 = phi i64 [ 0, %.lr.ph43 ], [ %indvars.iv.next52, %32 ]
  %33 = load ptr, ptr %31, align 8, !tbaa !26
  %34 = getelementptr inbounds i8, ptr %33, i64 %indvars.iv51
  %35 = load i8, ptr %34, align 1, !tbaa !27
  %36 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv51
  store i8 %35, ptr %36, align 1, !tbaa !27
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %37 = load i32, ptr %29, align 8, !tbaa !25
  %38 = zext i32 %37 to i64
  %39 = icmp ult i64 %indvars.iv.next52, %38
  br i1 %39, label %32, label %._crit_edge44, !llvm.loop !28

._crit_edge44:                                    ; preds = %32, %.preheader
  %.lcssa = phi i32 [ 0, %.preheader ], [ %37, %32 ]
  store i32 %.lcssa, ptr %3, align 4, !tbaa !16
  store i32 1, ptr %4, align 4, !tbaa !16
  br label %59

40:                                               ; preds = %21
  %41 = getelementptr inbounds i8, ptr %9, i64 24
  %42 = load i32, ptr %41, align 8, !tbaa !30
  %43 = getelementptr inbounds i8, ptr %14, i64 16
  %44 = load i32, ptr %43, align 8, !tbaa !31
  %45 = getelementptr inbounds i8, ptr %25, i64 40
  tail call void @WAIT_RESOURCE(i32 noundef %42, i32 noundef %44, ptr noundef nonnull %45, i64 noundef %1, ptr noundef %4) #2
  %46 = load i32, ptr %4, align 4, !tbaa !16
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %.preheader39, label %59

.preheader39:                                     ; preds = %40
  %48 = getelementptr inbounds i8, ptr %25, i64 32
  %49 = load i32, ptr %48, align 8, !tbaa !25
  %.not46 = icmp eq i32 %49, 0
  br i1 %.not46, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader39
  %50 = getelementptr inbounds i8, ptr %25, i64 24
  br label %51

51:                                               ; preds = %.lr.ph, %51
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %51 ]
  %52 = load ptr, ptr %50, align 8, !tbaa !26
  %53 = getelementptr inbounds i8, ptr %52, i64 %indvars.iv
  %54 = load i8, ptr %53, align 1, !tbaa !27
  %55 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  store i8 %54, ptr %55, align 1, !tbaa !27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %56 = load i32, ptr %48, align 8, !tbaa !25
  %57 = zext i32 %56 to i64
  %58 = icmp ult i64 %indvars.iv.next, %57
  br i1 %58, label %51, label %._crit_edge, !llvm.loop !33

._crit_edge:                                      ; preds = %51, %.preheader39
  %.lcssa40 = phi i32 [ 0, %.preheader39 ], [ %56, %51 ]
  store i32 %.lcssa40, ptr %3, align 4, !tbaa !16
  br label %59

59:                                               ; preds = %40, %._crit_edge, %._crit_edge44, %20, %16, %11
  tail call void @EXIT_CORE() #2
  ret void
}

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

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

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

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


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