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

; 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.std::pair" = type { i32, i32 }
%"struct.std::greater" = type { i8 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local global [9 x [150001 x i32]], align 16
@a = external dso_local global [150001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.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 %"struct.std::greater", align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %11

11:                                               ; preds = %115, %0
  %12 = load i32, ptr @t, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @t, align 4, !tbaa !5
  %14 = icmp ne i32 %12, 0
  br i1 %14, label %15, label %125

15:                                               ; preds = %11
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %32, %15
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %35

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [150001 x %"struct.std::pair"], ptr @a, i64 0, i64 %24
  %26 = getelementptr inbounds %"struct.std::pair", ptr %25, i32 0, i32 0
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [150001 x %"struct.std::pair"], ptr @a, i64 0, i64 %28
  %30 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 1
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %26, ptr noundef %30)
  br label %32

32:                                               ; preds = %22
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

35:                                               ; preds = %21
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds %"struct.std::pair", ptr @a, i64 %37
  %39 = getelementptr inbounds %"struct.std::pair", ptr %38, i64 1
  call void @_ZSt4sortIPSt4pairIiiESt7greaterIS1_EEvT_S5_T0_(ptr noundef getelementptr inbounds (%"struct.std::pair", ptr @a, i64 1), ptr noundef %39)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %112, %35
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %40
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %47
  %49 = getelementptr inbounds [150001 x i32], ptr %48, i64 0, i64 0
  store i32 -1061109567, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %108, %45
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp sle i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %111

55:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [150001 x %"struct.std::pair"], ptr @a, i64 0, i64 %57
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !11
  store i32 %60, ptr %7, align 4, !tbaa !5
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %85

63:                                               ; preds = %55
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sub nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %67
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sub nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [150001 x i32], ptr %68, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp sgt i32 %64, %73
  br i1 %74, label %75, label %85

75:                                               ; preds = %63
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [150001 x i32], ptr %79, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  store i32 %84, ptr %7, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %75, %63, %55
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %87
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [150001 x i32], ptr %88, i64 0, i64 %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [150001 x %"struct.std::pair"], ptr @a, i64 0, i64 %95
  %97 = getelementptr inbounds %"struct.std::pair", ptr %96, i32 0, i32 1
  %98 = load i32, ptr %97, align 4, !tbaa !13
  %99 = sub nsw i32 %93, %98
  store i32 %99, ptr %8, align 4, !tbaa !5
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %92, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %103
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [150001 x i32], ptr %104, i64 0, i64 %106
  store i32 %101, ptr %107, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %108

108:                                              ; preds = %85
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %6, align 4, !tbaa !5
  br label %50, !llvm.loop !14

111:                                              ; preds = %54
  br label %112

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

115:                                              ; preds = %44
  %116 = load i32, ptr @m, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %117
  %119 = load i32, ptr @n, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [150001 x i32], ptr %118, i64 0, i64 %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  %122 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %121, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %123)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %11, !llvm.loop !16

125:                                              ; preds = %11
  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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiESt7greaterIS1_EEvT_S5_T0_(ptr noundef, ptr noundef) #3

; 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)) #4

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 = { inlinehint 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 = { 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 #5 = { 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 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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"

%"struct.std::pair" = type { i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local global [9 x [150001 x i32]], align 16
@a = external dso_local global [150001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.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 i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not47 = icmp eq i32 %4, 0
  br i1 %.not47, label %._crit_edge50, label %.lr.ph49

.lr.ph49:                                         ; preds = %0, %._crit_edge45
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %.not2934 = icmp slt i32 %7, 1
  br i1 %.not2934, label %.lr.ph49.._crit_edge_crit_edge, label %.lr.ph

.lr.ph49.._crit_edge_crit_edge:                   ; preds = %.lr.ph49
  %.pre68 = sext i32 %7 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph49.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre68, %.lr.ph49.._crit_edge_crit_edge ], [ %21, %.lr.ph ]
  %gep = getelementptr %"struct.std::pair", ptr getelementptr inbounds (i8, ptr @a, i64 8), i64 %.pre-phi
  call void @_ZSt4sortIPSt4pairIiiESt7greaterIS1_EEvT_S5_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 8), ptr noundef nonnull %gep)
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %.not3041 = icmp slt i32 %8, 0
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br i1 %.not3041, label %._crit_edge45, label %.lr.ph44

.lr.ph44:                                         ; preds = %._crit_edge
  %9 = icmp slt i32 %.pre, 1
  br i1 %9, label %.lr.ph44.split.us, label %.lr.ph44.split

.lr.ph44.split.us:                                ; preds = %.lr.ph44
  %10 = add nuw i32 %8, 1
  %wide.trip.count = zext i32 %10 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %11 = icmp ult i32 %8, 3
  br i1 %11, label %._crit_edge45.loopexit.unr-lcssa, label %.lr.ph44.split.us.new

.lr.ph44.split.us.new:                            ; preds = %.lr.ph44.split.us
  %unroll_iter = and i64 %wide.trip.count, 4294967292
  br label %12

12:                                               ; preds = %12, %.lr.ph44.split.us.new
  %indvars.iv65 = phi i64 [ 0, %.lr.ph44.split.us.new ], [ %indvars.iv.next66.3, %12 ]
  %niter = phi i64 [ 0, %.lr.ph44.split.us.new ], [ %niter.next.3, %12 ]
  %13 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv65
  store i32 -1061109567, ptr %13, align 16, !tbaa !5
  %indvars.iv.next66 = or disjoint i64 %indvars.iv65, 1
  %14 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv.next66
  store i32 -1061109567, ptr %14, align 4, !tbaa !5
  %indvars.iv.next66.1 = or disjoint i64 %indvars.iv65, 2
  %15 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv.next66.1
  store i32 -1061109567, ptr %15, align 8, !tbaa !5
  %indvars.iv.next66.2 = or disjoint i64 %indvars.iv65, 3
  %16 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv.next66.2
  store i32 -1061109567, ptr %16, align 4, !tbaa !5
  %indvars.iv.next66.3 = add nuw nsw i64 %indvars.iv65, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge45.loopexit.unr-lcssa, label %12, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph49, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph49 ]
  %17 = getelementptr inbounds [150001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %17, ptr noundef nonnull %18)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %.not29.not = icmp slt i64 %indvars.iv, %21
  br i1 %.not29.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge45.loopexit.unr-lcssa:                 ; preds = %12, %.lr.ph44.split.us
  %indvars.iv65.unr = phi i64 [ 0, %.lr.ph44.split.us ], [ %indvars.iv.next66.3, %12 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge45, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge45.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv65.epil = phi i64 [ %indvars.iv.next66.epil, %.epil.preheader ], [ %indvars.iv65.unr, %._crit_edge45.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge45.loopexit.unr-lcssa ]
  %22 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv65.epil
  store i32 -1061109567, ptr %22, align 4, !tbaa !5
  %indvars.iv.next66.epil = add nuw nsw i64 %indvars.iv65.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge45, label %.epil.preheader, !llvm.loop !12

._crit_edge45:                                    ; preds = %._crit_edge40, %._crit_edge45.loopexit.unr-lcssa, %.epil.preheader, %._crit_edge
  %23 = phi i32 [ %.pre, %._crit_edge ], [ %.pre, %.epil.preheader ], [ %.pre, %._crit_edge45.loopexit.unr-lcssa ], [ %47, %._crit_edge40 ]
  %.lcssa33 = phi i32 [ %8, %._crit_edge ], [ %8, %.epil.preheader ], [ %8, %._crit_edge45.loopexit.unr-lcssa ], [ %48, %._crit_edge40 ]
  %24 = sext i32 %.lcssa33 to i64
  %25 = sext i32 %23 to i64
  %26 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %24, i64 %25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %26, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %30 = load i32, ptr @t, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %._crit_edge50, label %.lr.ph49, !llvm.loop !14

.lr.ph44.split:                                   ; preds = %.lr.ph44, %._crit_edge40
  %32 = phi i32 [ %47, %._crit_edge40 ], [ %.pre, %.lr.ph44 ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %._crit_edge40 ], [ 0, %.lr.ph44 ]
  %33 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv62
  store i32 -1061109567, ptr %33, align 4, !tbaa !5
  %.not3136 = icmp slt i32 %32, 1
  br i1 %.not3136, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %.lr.ph44.split
  %.not32 = icmp eq i64 %indvars.iv62, 0
  %34 = add nsw i64 %indvars.iv62, -1
  br i1 %.not32, label %.lr.ph39.split.us, label %.lr.ph39.split

.lr.ph39.split.us:                                ; preds = %.lr.ph39, %.lr.ph39.split.us
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph39.split.us ], [ 1, %.lr.ph39 ]
  %35 = getelementptr inbounds [150001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv59
  %36 = load i32, ptr %35, align 8, !tbaa !15
  %37 = add nsw i64 %indvars.iv59, -1
  %38 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 0, i64 %37
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %39 = getelementptr inbounds i8, ptr %35, i64 4
  %40 = load i32, ptr %39, align 4, !tbaa !17
  %41 = sub nsw i32 %36, %40
  store i32 %41, ptr %1, align 4, !tbaa !5
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %38, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 0, i64 %indvars.iv59
  store i32 %43, ptr %44, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %.not31.us.not = icmp slt i64 %indvars.iv59, %46
  br i1 %.not31.us.not, label %.lr.ph39.split.us, label %._crit_edge40, !llvm.loop !18

._crit_edge40:                                    ; preds = %.lr.ph39.split, %.lr.ph39.split.us, %.lr.ph44.split
  %47 = phi i32 [ %32, %.lr.ph44.split ], [ %45, %.lr.ph39.split.us ], [ %62, %.lr.ph39.split ]
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %.not30.not = icmp slt i64 %indvars.iv62, %49
  br i1 %.not30.not, label %.lr.ph44.split, label %._crit_edge45, !llvm.loop !19

.lr.ph39.split:                                   ; preds = %.lr.ph39, %.lr.ph39.split
  %indvars.iv56 = phi i64 [ %indvars.iv.next57, %.lr.ph39.split ], [ 1, %.lr.ph39 ]
  %50 = getelementptr inbounds [150001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv56
  %51 = load i32, ptr %50, align 8, !tbaa !15
  %52 = add nsw i64 %indvars.iv56, -1
  %53 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %34, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %spec.select = call i32 @llvm.smin.i32(i32 %51, i32 %54)
  %55 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv62, i64 %52
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %56 = getelementptr inbounds i8, ptr %50, i64 4
  %57 = load i32, ptr %56, align 4, !tbaa !17
  %58 = sub nsw i32 %spec.select, %57
  store i32 %58, ptr %1, align 4, !tbaa !5
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %55, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = getelementptr inbounds [9 x [150001 x i32]], ptr @f, i64 0, i64 %indvars.iv62, i64 %indvars.iv56
  store i32 %60, ptr %61, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %.not31.not = icmp slt i64 %indvars.iv56, %63
  br i1 %.not31.not, label %.lr.ph39.split, label %._crit_edge40, !llvm.loop !18

._crit_edge50:                                    ; preds = %._crit_edge45, %0
  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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiESt7greaterIS1_EEvT_S5_T0_(ptr noundef, ptr noundef) local_unnamed_addr #3

; 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 #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5

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 = { inlinehint 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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !20}
!20 = !{!"llvm.loop.unswitch.partial.disable"}


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