; LLVM IR from reyadussalahin/problem-solving :: ad_hoc/constructive_algorithm/codeforces/F1506E (Solution)

; 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"

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@mn = external dso_local global [200020 x i32], align 16
@mx = external dso_local global [200020 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::priority_queue", align 8
  %7 = alloca %"class.std::priority_queue", align 8
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %149, %0
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %154

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #6
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %7)
          to label %25 unwind label %31

25:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %96, %25
  %27 = load i32, ptr %11, align 4, !tbaa !5
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %35, label %30

30:                                               ; preds = %26
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %100

31:                                               ; preds = %23
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %8, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %9, align 4
  br label %153

35:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %36 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %12)
          to label %37 unwind label %57

37:                                               ; preds = %35
  %38 = load i32, ptr %12, align 4, !tbaa !5
  %39 = load i32, ptr %10, align 4, !tbaa !5
  %40 = icmp eq i32 %38, %39
  br i1 %40, label %41, label %61

41:                                               ; preds = %37
  %42 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %43 unwind label %57

43:                                               ; preds = %41
  %44 = load i32, ptr %42, align 4, !tbaa !5
  %45 = mul nsw i32 -1, %44
  %46 = load i32, ptr %11, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [200020 x i32], ptr @mn, i64 0, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %49 unwind label %57

49:                                               ; preds = %43
  %50 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %7)
          to label %51 unwind label %57

51:                                               ; preds = %49
  %52 = load i32, ptr %50, align 4, !tbaa !5
  %53 = load i32, ptr %11, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [200020 x i32], ptr @mx, i64 0, i64 %54
  store i32 %52, ptr %55, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %7)
          to label %56 unwind label %57

56:                                               ; preds = %51
  br label %94

57:                                               ; preds = %51, %49, %43, %41, %35
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %8, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %9, align 4
  br label %99

61:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %62 = load i32, ptr %10, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %13, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %74, %61
  %65 = load i32, ptr %13, align 4, !tbaa !5
  %66 = load i32, ptr %12, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %86

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %70 = load i32, ptr %13, align 4, !tbaa !5
  %71 = mul nsw i32 -1, %70
  store i32 %71, ptr %14, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %72 unwind label %77

72:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(25) %7, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %73 unwind label %81

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %13, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %13, align 4, !tbaa !5
  br label %64, !llvm.loop !9

77:                                               ; preds = %69
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %8, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %85

81:                                               ; preds = %72
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %8, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %9, align 4
  br label %85

85:                                               ; preds = %81, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %99

86:                                               ; preds = %68
  %87 = load i32, ptr %12, align 4, !tbaa !5
  %88 = load i32, ptr %11, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [200020 x i32], ptr @mx, i64 0, i64 %89
  store i32 %87, ptr %90, align 4, !tbaa !5
  %91 = load i32, ptr %11, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [200020 x i32], ptr @mn, i64 0, i64 %92
  store i32 %87, ptr %93, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %86, %56
  %95 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %95, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %96

96:                                               ; preds = %94
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %11, align 4, !tbaa !5
  br label %26, !llvm.loop !11

99:                                               ; preds = %85, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %152

100:                                              ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %113, %100
  %102 = load i32, ptr %15, align 4, !tbaa !5
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %120

106:                                              ; preds = %101
  %107 = load i32, ptr %15, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [200020 x i32], ptr @mn, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %110)
          to label %112 unwind label %116

112:                                              ; preds = %106
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %15, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %15, align 4, !tbaa !5
  br label %101, !llvm.loop !12

116:                                              ; preds = %106
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %8, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %152

120:                                              ; preds = %105
  %121 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2)
          to label %122 unwind label %128

122:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %139, %122
  %124 = load i32, ptr %16, align 4, !tbaa !5
  %125 = load i32, ptr %5, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %132, label %127

127:                                              ; preds = %123
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %146

128:                                              ; preds = %146, %120
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %8, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %9, align 4
  br label %152

132:                                              ; preds = %123
  %133 = load i32, ptr %16, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [200020 x i32], ptr @mx, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %136)
          to label %138 unwind label %142

138:                                              ; preds = %132
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %16, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %16, align 4, !tbaa !5
  br label %123, !llvm.loop !13

142:                                              ; preds = %132
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %8, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %152

146:                                              ; preds = %127
  %147 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2)
          to label %148 unwind label %128

148:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %3, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %3, align 4, !tbaa !5
  br label %18, !llvm.loop !14

152:                                              ; preds = %142, %128, %116, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %7) #6
  br label %153

153:                                              ; preds = %152, %31
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %156

154:                                              ; preds = %22
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %155 = load i32, ptr %1, align 4
  ret i32 %155

156:                                              ; preds = %153
  %157 = load ptr, ptr %8, align 8
  %158 = load i32, ptr %9, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #5 align 2

attributes #0 = { mustprogress norecurse 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 = { mustprogress 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 #4 = { mustprogress 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 #5 = { inlinehint mustprogress 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 #6 = { 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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


; 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"

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@mn = external dso_local local_unnamed_addr global [200020 x i32], align 16
@mx = external dso_local local_unnamed_addr global [200020 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::priority_queue", align 8
  %4 = alloca %"class.std::priority_queue", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph45, label %._crit_edge46

._crit_edge46:                                    ; preds = %._crit_edge42, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph45:                                         ; preds = %0, %._crit_edge42
  %.02443 = phi i32 [ %60, %._crit_edge42 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph35, label %._crit_edge38

.preheader:                                       ; preds = %44
  %14 = icmp sgt i32 %46, 0
  br i1 %14, label %.lr.ph37, label %._crit_edge38

.lr.ph35:                                         ; preds = %.lr.ph45, %44
  %indvars.iv = phi i64 [ %indvars.iv.next, %44 ], [ 0, %.lr.ph45 ]
  %.02032 = phi i32 [ %45, %44 ], [ 0, %.lr.ph45 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %5)
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = icmp eq i32 %16, %.02032
  br i1 %17, label %18, label %29

18:                                               ; preds = %.lr.ph35
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = sub nsw i32 0, %20
  %22 = getelementptr inbounds [200020 x i32], ptr @mn, i64 0, i64 %indvars.iv
  store i32 %21, ptr %22, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %23 unwind label %27

23:                                               ; preds = %18
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds [200020 x i32], ptr @mx, i64 0, i64 %indvars.iv
  store i32 %25, ptr %26, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
          to label %._crit_edge55 unwind label %27

._crit_edge55:                                    ; preds = %23
  %.pre = load i32, ptr %5, align 4, !tbaa !5
  br label %44

27:                                               ; preds = %23, %18
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %49

29:                                               ; preds = %.lr.ph35
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %storemerge30 = add nsw i32 %.02032, 1
  store i32 %storemerge30, ptr %6, align 4, !tbaa !5
  %30 = icmp slt i32 %storemerge30, %16
  br i1 %30, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %35, %29
  %.lcssa = phi i32 [ %16, %29 ], [ %37, %35 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %31 = getelementptr inbounds [200020 x i32], ptr @mx, i64 0, i64 %indvars.iv
  store i32 %.lcssa, ptr %31, align 4, !tbaa !5
  %32 = getelementptr inbounds [200020 x i32], ptr @mn, i64 0, i64 %indvars.iv
  store i32 %.lcssa, ptr %32, align 4, !tbaa !5
  br label %44

.lr.ph:                                           ; preds = %29, %35
  %storemerge.in31 = phi i32 [ %36, %35 ], [ %.02032, %29 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %33 = xor i32 %storemerge.in31, -1
  store i32 %33, ptr %7, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %34 unwind label %39

34:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  invoke void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %35 unwind label %41

35:                                               ; preds = %34
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %storemerge = add nsw i32 %36, 1
  store i32 %storemerge, ptr %6, align 4, !tbaa !5
  %37 = load i32, ptr %5, align 4, !tbaa !5
  %38 = icmp slt i32 %storemerge, %37
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !9

39:                                               ; preds = %.lr.ph
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  br label %43

41:                                               ; preds = %34
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %43

43:                                               ; preds = %41, %39
  %.pn = phi { ptr, i32 } [ %42, %41 ], [ %40, %39 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %49

44:                                               ; preds = %._crit_edge55, %._crit_edge
  %45 = phi i32 [ %.pre, %._crit_edge55 ], [ %.lcssa, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = icmp slt i64 %indvars.iv.next, %47
  br i1 %48, label %.lr.ph35, label %.preheader, !llvm.loop !11

49:                                               ; preds = %43, %27
  %.pn26 = phi { ptr, i32 } [ %28, %27 ], [ %.pn, %43 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn26

._crit_edge38:                                    ; preds = %.lr.ph37, %.lr.ph45, %.preheader
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.lr.ph41, label %._crit_edge42

.lr.ph37:                                         ; preds = %.preheader, %.lr.ph37
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph37 ], [ 0, %.preheader ]
  %53 = getelementptr inbounds [200020 x i32], ptr @mn, i64 0, i64 %indvars.iv49
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %54)
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = icmp slt i64 %indvars.iv.next50, %57
  br i1 %58, label %.lr.ph37, label %._crit_edge38, !llvm.loop !12

._crit_edge42:                                    ; preds = %.lr.ph41, %._crit_edge38
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  call void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %60 = add nuw nsw i32 %.02443, 1
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %.lr.ph45, label %._crit_edge46, !llvm.loop !13

.lr.ph41:                                         ; preds = %._crit_edge38, %.lr.ph41
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %.lr.ph41 ], [ 0, %._crit_edge38 ]
  %63 = getelementptr inbounds [200020 x i32], ptr @mx, i64 0, i64 %indvars.iv52
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %64)
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next53, %67
  br i1 %68, label %.lr.ph41, label %._crit_edge42, !llvm.loop !14
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIiSt6vectorIiSaIiEESt4lessIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #5 align 2

attributes #0 = { mustprogress norecurse 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 = { nofree nounwind "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 = { mustprogress 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 #4 = { mustprogress 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 #5 = { inlinehint mustprogress 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 #6 = { 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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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