; LLVM IR from tangjz/acm-icpc :: lydsy (1736)

; 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<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [90001 x i32], align 16
@ans = external dso_local global i32, align 4
@Q = external dso_local global %"class.std::priority_queue", align 8
@vis = external dso_local global [90001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL2dx = external hidden constant [4 x i32], align 16
@_ZL2dy = external hidden constant [4 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

19:                                               ; preds = %67, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %70

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %61, %24
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %66

30:                                               ; preds = %25
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr @a, i64 %32
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %33)
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %50, label %37

37:                                               ; preds = %30
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = sub nsw i32 %39, 1
  %41 = icmp eq i32 %38, %40
  br i1 %41, label %50, label %42

42:                                               ; preds = %37
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %50, label %45

45:                                               ; preds = %42
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  %49 = icmp eq i32 %46, %48
  br i1 %49, label %50, label %60

50:                                               ; preds = %45, %42, %37, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sub nsw i32 0, %54
  store i32 %55, ptr %7, align 4, !tbaa !5
  %56 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %56, ptr %6, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %58
  store i8 1, ptr %59, align 1, !tbaa !9
  br label %60

60:                                               ; preds = %50, %45
  br label %61

61:                                               ; preds = %60
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %5, align 4, !tbaa !5
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %3, align 4, !tbaa !5
  br label %25, !llvm.loop !11

66:                                               ; preds = %29
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !13

70:                                               ; preds = %23
  br label %71

71:                                               ; preds = %153, %70
  %72 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %73 = xor i1 %72, true
  br i1 %73, label %74, label %154

74:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %75 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %75, i64 8, i1 false)
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %76 = getelementptr inbounds %"struct.std::pair", ptr %8, i32 0, i32 0
  %77 = load i32, ptr %76, align 4, !tbaa !14
  %78 = sub nsw i32 0, %77
  %79 = getelementptr inbounds %"struct.std::pair", ptr %8, i32 0, i32 1
  %80 = load i32, ptr %79, align 4, !tbaa !16
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sub nsw i32 %78, %83
  %85 = load i32, ptr @ans, align 4, !tbaa !5
  %86 = add nsw i32 %85, %84
  store i32 %86, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %87 = getelementptr inbounds %"struct.std::pair", ptr %8, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !16
  %89 = load i32, ptr @m, align 4, !tbaa !5
  %90 = sdiv i32 %88, %89
  store i32 %90, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %91 = getelementptr inbounds %"struct.std::pair", ptr %8, i32 0, i32 1
  %92 = load i32, ptr %91, align 4, !tbaa !16
  %93 = load i32, ptr @m, align 4, !tbaa !5
  %94 = srem i32 %92, %93
  store i32 %94, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %150, %74
  %96 = load i32, ptr %11, align 4, !tbaa !5
  %97 = icmp slt i32 %96, 4
  br i1 %97, label %99, label %98

98:                                               ; preds = %95
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %153

99:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [4 x i32], ptr @_ZL2dx, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %100, %104
  store i32 %105, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %106 = load i32, ptr %10, align 4, !tbaa !5
  %107 = load i32, ptr %11, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [4 x i32], ptr @_ZL2dy, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = add nsw i32 %106, %110
  store i32 %111, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = icmp sge i32 %112, 0
  br i1 %113, label %114, label %149

114:                                              ; preds = %99
  %115 = load i32, ptr %12, align 4, !tbaa !5
  %116 = load i32, ptr @n, align 4, !tbaa !5
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %118, label %149

118:                                              ; preds = %114
  %119 = load i32, ptr %13, align 4, !tbaa !5
  %120 = icmp sge i32 %119, 0
  br i1 %120, label %121, label %149

121:                                              ; preds = %118
  %122 = load i32, ptr %13, align 4, !tbaa !5
  %123 = load i32, ptr @m, align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %125, label %149

125:                                              ; preds = %121
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = load i32, ptr @m, align 4, !tbaa !5
  %128 = mul nsw i32 %126, %127
  %129 = load i32, ptr %13, align 4, !tbaa !5
  %130 = add nsw i32 %128, %129
  store i32 %130, ptr %14, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %131
  %133 = load i8, ptr %132, align 1, !tbaa !9, !range !17, !noundef !18
  %134 = trunc i8 %133 to i1
  br i1 %134, label %149, label %135

135:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %136 = getelementptr inbounds %"struct.std::pair", ptr %8, i32 0, i32 0
  %137 = load i32, ptr %136, align 4, !tbaa !14
  %138 = sub nsw i32 0, %137
  store i32 %138, ptr %17, align 4, !tbaa !5
  %139 = load i32, ptr %14, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %140
  %142 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %141)
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sub nsw i32 0, %143
  store i32 %144, ptr %16, align 4, !tbaa !5
  %145 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %14)
  store i64 %145, ptr %15, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %15)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  %146 = load i32, ptr %14, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %147
  store i8 1, ptr %148, align 1, !tbaa !9
  br label %149

149:                                              ; preds = %135, %125, %121, %118, %114, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %11, align 4, !tbaa !5
  br label %95, !llvm.loop !19

153:                                              ; preds = %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %71, !llvm.loop !20

154:                                              ; preds = %71
  %155 = load i32, ptr @ans, align 4, !tbaa !5
  %156 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %155)
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

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

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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!16 = !{!15, !6, i64 4}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


; 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<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [90001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@Q = external dso_local global %"class.std::priority_queue", align 8
@vis = external dso_local local_unnamed_addr global [90001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL2dx = external hidden local_unnamed_addr constant [4 x i32], align 16
@_ZL2dy = external hidden local_unnamed_addr constant [4 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  %11 = load i32, ptr @m, align 4
  %12 = icmp sgt i32 %11, 0
  %or.cond57 = select i1 %10, i1 %12, i1 false
  br i1 %or.cond57, label %.preheader, label %._crit_edge35

.preheader:                                       ; preds = %0, %._crit_edge
  %13 = phi i32 [ %56, %._crit_edge ], [ 0, %0 ]
  %14 = phi i32 [ %57, %._crit_edge ], [ %11, %0 ]
  %.033 = phi i32 [ %58, %._crit_edge ], [ 0, %0 ]
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %16 = icmp eq i32 %.033, 0
  br i1 %16, label %.lr.ph.split.us, label %17

17:                                               ; preds = %.lr.ph
  %18 = sext i32 %13 to i64
  %19 = getelementptr inbounds i32, ptr @a, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = sub nsw i32 0, %24
  store i32 %25, ptr %3, align 4, !tbaa !5
  %26 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %26, ptr %2, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %28
  store i8 1, ptr %29, align 1, !tbaa !9
  %.pre46 = load i32, ptr @m, align 4, !tbaa !5
  %30 = add nsw i32 %27, 1
  store i32 %30, ptr %1, align 4, !tbaa !5
  %31 = icmp sgt i32 %.pre46, 1
  br i1 %31, label %.lr.ph.split, label %._crit_edge

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %32 = phi i32 [ %46, %.lr.ph.split.us ], [ %13, %.lr.ph ]
  %.02731.us = phi i32 [ %45, %.lr.ph.split.us ], [ 0, %.lr.ph ]
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr @a, i64 %33
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %34)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sub nsw i32 0, %39
  store i32 %40, ptr %3, align 4, !tbaa !5
  %41 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %41, ptr %2, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %42 = load i32, ptr %1, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %43
  store i8 1, ptr %44, align 1, !tbaa !9
  %45 = add nuw nsw i32 %.02731.us, 1
  %46 = add nsw i32 %42, 1
  store i32 %46, ptr %1, align 4, !tbaa !5
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = icmp slt i32 %45, %47
  br i1 %48, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !11

._crit_edge35:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %49 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %49, label %._crit_edge39, label %.lr.ph38.preheader

.lr.ph38.preheader:                               ; preds = %._crit_edge35
  %.pre50 = load i32, ptr @_ZL2dx, align 16, !tbaa !5
  %.pre51 = load i32, ptr @_ZL2dy, align 16, !tbaa !5
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 4), align 4
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 4), align 4
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 8), align 8
  %53 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 8), align 8
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dx, i64 12), align 4
  %55 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2dy, i64 12), align 4
  br label %.lr.ph38

._crit_edge:                                      ; preds = %82, %.lr.ph.split.us, %17, %.preheader
  %56 = phi i32 [ %13, %.preheader ], [ %30, %17 ], [ %46, %.lr.ph.split.us ], [ %86, %82 ]
  %57 = phi i32 [ %14, %.preheader ], [ %.pre46, %17 ], [ %47, %.lr.ph.split.us ], [ %83, %82 ]
  %58 = add nuw nsw i32 %.033, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %.preheader, label %._crit_edge35, !llvm.loop !13

.lr.ph.split:                                     ; preds = %17, %82
  %61 = phi i32 [ %86, %82 ], [ %30, %17 ]
  %.02731 = phi i32 [ %85, %82 ], [ 1, %17 ]
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr @a, i64 %62
  %64 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %63)
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  %67 = icmp eq i32 %.033, %66
  br i1 %67, label %72, label %68

68:                                               ; preds = %.lr.ph.split
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = add nsw i32 %69, -1
  %71 = icmp eq i32 %.02731, %70
  br i1 %71, label %72, label %._crit_edge47

._crit_edge47:                                    ; preds = %68
  %.pre48 = load i32, ptr %1, align 4, !tbaa !5
  br label %82

72:                                               ; preds = %68, %.lr.ph.split
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %73 = load i32, ptr %1, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sub nsw i32 0, %76
  store i32 %77, ptr %3, align 4, !tbaa !5
  %78 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %78, ptr %2, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %79 = load i32, ptr %1, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %80
  store i8 1, ptr %81, align 1, !tbaa !9
  %.pre49 = load i32, ptr @m, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %._crit_edge47, %72
  %83 = phi i32 [ %69, %._crit_edge47 ], [ %.pre49, %72 ]
  %84 = phi i32 [ %.pre48, %._crit_edge47 ], [ %79, %72 ]
  %85 = add nuw nsw i32 %.02731, 1
  %86 = add nsw i32 %84, 1
  store i32 %86, ptr %1, align 4, !tbaa !5
  %87 = icmp slt i32 %85, %83
  br i1 %87, label %.lr.ph.split, label %._crit_edge, !llvm.loop !15

.lr.ph38:                                         ; preds = %.lr.ph38.preheader, %.loopexit
  %88 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %.sroa.0.0.copyload = load i32, ptr %88, align 4
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %88, i64 4
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %89 = sub nsw i32 0, %.sroa.0.0.copyload
  %90 = sext i32 %.sroa.5.0.copyload to i64
  %91 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = add i32 %92, %.sroa.0.0.copyload
  %94 = load i32, ptr @ans, align 4, !tbaa !5
  %95 = sub i32 %94, %93
  store i32 %95, ptr @ans, align 4, !tbaa !5
  %96 = load i32, ptr @m, align 4, !tbaa !5
  %97 = sdiv i32 %.sroa.5.0.copyload, %96
  %98 = srem i32 %.sroa.5.0.copyload, %96
  %99 = add nsw i32 %.pre50, %97
  %100 = add nsw i32 %.pre51, %98
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %101 = icmp sgt i32 %99, -1
  br i1 %101, label %102, label %124

102:                                              ; preds = %.lr.ph38
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = icmp slt i32 %99, %103
  %105 = icmp sgt i32 %100, -1
  %106 = icmp slt i32 %100, %96
  %107 = and i1 %105, %106
  %or.cond = select i1 %104, i1 %107, i1 false
  br i1 %or.cond, label %108, label %124

108:                                              ; preds = %102
  %109 = mul nsw i32 %96, %99
  %110 = add nuw nsw i32 %109, %100
  store i32 %110, ptr %4, align 4, !tbaa !5
  %111 = zext nneg i32 %110 to i64
  %112 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !9, !range !17, !noundef !18
  %114 = trunc nuw i8 %113 to i1
  br i1 %114, label %124, label %115

115:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 %89, ptr %7, align 4, !tbaa !5
  %116 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %111
  %117 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %116)
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sub nsw i32 0, %118
  store i32 %119, ptr %6, align 4, !tbaa !5
  %120 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %120, ptr %5, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %121 = load i32, ptr %4, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %122
  store i8 1, ptr %123, align 1, !tbaa !9
  br label %124

124:                                              ; preds = %115, %108, %102, %.lr.ph38
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %125 = add nsw i32 %50, %97
  %126 = add nsw i32 %51, %98
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %127 = icmp sgt i32 %125, -1
  br i1 %127, label %128, label %151

128:                                              ; preds = %124
  %129 = load i32, ptr @n, align 4, !tbaa !5
  %130 = icmp slt i32 %125, %129
  %131 = icmp sgt i32 %126, -1
  %or.cond3.1 = select i1 %130, i1 %131, i1 false
  br i1 %or.cond3.1, label %132, label %151

132:                                              ; preds = %128
  %133 = load i32, ptr @m, align 4, !tbaa !5
  %134 = icmp slt i32 %126, %133
  br i1 %134, label %135, label %151

135:                                              ; preds = %132
  %136 = mul nsw i32 %133, %125
  %137 = add nuw nsw i32 %136, %126
  store i32 %137, ptr %4, align 4, !tbaa !5
  %138 = zext nneg i32 %137 to i64
  %139 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %138
  %140 = load i8, ptr %139, align 1, !tbaa !9, !range !17, !noundef !18
  %141 = trunc nuw i8 %140 to i1
  br i1 %141, label %151, label %142

142:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 %89, ptr %7, align 4, !tbaa !5
  %143 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %138
  %144 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %143)
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = sub nsw i32 0, %145
  store i32 %146, ptr %6, align 4, !tbaa !5
  %147 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %147, ptr %5, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %148 = load i32, ptr %4, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %149
  store i8 1, ptr %150, align 1, !tbaa !9
  br label %151

151:                                              ; preds = %142, %135, %132, %128, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %152 = add nsw i32 %52, %97
  %153 = add nsw i32 %53, %98
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %154 = icmp sgt i32 %152, -1
  br i1 %154, label %155, label %178

155:                                              ; preds = %151
  %156 = load i32, ptr @n, align 4, !tbaa !5
  %157 = icmp slt i32 %152, %156
  %158 = icmp sgt i32 %153, -1
  %or.cond3.2 = select i1 %157, i1 %158, i1 false
  br i1 %or.cond3.2, label %159, label %178

159:                                              ; preds = %155
  %160 = load i32, ptr @m, align 4, !tbaa !5
  %161 = icmp slt i32 %153, %160
  br i1 %161, label %162, label %178

162:                                              ; preds = %159
  %163 = mul nsw i32 %160, %152
  %164 = add nuw nsw i32 %163, %153
  store i32 %164, ptr %4, align 4, !tbaa !5
  %165 = zext nneg i32 %164 to i64
  %166 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %165
  %167 = load i8, ptr %166, align 1, !tbaa !9, !range !17, !noundef !18
  %168 = trunc nuw i8 %167 to i1
  br i1 %168, label %178, label %169

169:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 %89, ptr %7, align 4, !tbaa !5
  %170 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %165
  %171 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %170)
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = sub nsw i32 0, %172
  store i32 %173, ptr %6, align 4, !tbaa !5
  %174 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %174, ptr %5, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %175 = load i32, ptr %4, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %176
  store i8 1, ptr %177, align 1, !tbaa !9
  br label %178

178:                                              ; preds = %169, %162, %159, %155, %151
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %179 = add nsw i32 %54, %97
  %180 = add nsw i32 %55, %98
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %181 = icmp sgt i32 %179, -1
  br i1 %181, label %182, label %.loopexit

182:                                              ; preds = %178
  %183 = load i32, ptr @n, align 4, !tbaa !5
  %184 = icmp slt i32 %179, %183
  %185 = icmp sgt i32 %180, -1
  %or.cond3.3 = select i1 %184, i1 %185, i1 false
  br i1 %or.cond3.3, label %186, label %.loopexit

186:                                              ; preds = %182
  %187 = load i32, ptr @m, align 4, !tbaa !5
  %188 = icmp slt i32 %180, %187
  br i1 %188, label %189, label %.loopexit

189:                                              ; preds = %186
  %190 = mul nsw i32 %187, %179
  %191 = add nuw nsw i32 %190, %180
  store i32 %191, ptr %4, align 4, !tbaa !5
  %192 = zext nneg i32 %191 to i64
  %193 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %192
  %194 = load i8, ptr %193, align 1, !tbaa !9, !range !17, !noundef !18
  %195 = trunc nuw i8 %194 to i1
  br i1 %195, label %.loopexit, label %196

196:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 %89, ptr %7, align 4, !tbaa !5
  %197 = getelementptr inbounds [90001 x i32], ptr @a, i64 0, i64 %192
  %198 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %197)
  %199 = load i32, ptr %198, align 4, !tbaa !5
  %200 = sub nsw i32 0, %199
  store i32 %200, ptr %6, align 4, !tbaa !5
  %201 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %201, ptr %5, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %202 = load i32, ptr %4, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [90001 x i8], ptr @vis, i64 0, i64 %203
  store i8 1, ptr %204, align 1, !tbaa !9
  br label %.loopexit

.loopexit:                                        ; preds = %196, %189, %186, %182, %178
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %205 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %205, label %._crit_edge39, label %.lr.ph38, !llvm.loop !19

._crit_edge39:                                    ; preds = %.loopexit, %._crit_edge35
  %206 = load i32, ptr @ans, align 4, !tbaa !5
  %207 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %206)
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !12, !16}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !12}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass