; LLVM IR from tangjz/acm-icpc :: 51nod (1274)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local global [50001 x i32], align 16
@e = external dso_local global [50001 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE1g = external hidden global [100003 x %"struct.std::pair"], align 16
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #0

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

16:                                               ; preds = %25, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %28

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %23
  call void @_ZN4Edge4readEv(ptr noundef nonnull align 4 dereferenceable(12) %24)
  br label %25

25:                                               ; preds = %21
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !9

28:                                               ; preds = %20
  %29 = load i32, ptr @m, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds %struct.Edge, ptr @e, i64 %30
  call void @_ZSt4sortIP4EdgeEvT_S2_(ptr noundef @e, ptr noundef %31)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %120, %28
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = load i32, ptr @m, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %121

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %39
  %41 = getelementptr inbounds %struct.Edge, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !11
  store i32 %42, ptr %6, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %97, %37
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = load i32, ptr @m, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %47, label %55

47:                                               ; preds = %43
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %49
  %51 = getelementptr inbounds %struct.Edge, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 4, !tbaa !11
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = icmp eq i32 %52, %53
  br label %55

55:                                               ; preds = %47, %43
  %56 = phi i1 [ false, %43 ], [ %54, %47 ]
  br i1 %56, label %58, label %57

57:                                               ; preds = %55
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %100

58:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.Edge, ptr %61, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %64
  %66 = getelementptr inbounds %struct.Edge, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !13
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %8, align 4, !tbaa !5
  %72 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %62, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %72, ptr %7, align 4
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %5, align 4, !tbaa !5
  %75 = sext i32 %73 to i64
  %76 = getelementptr inbounds [100003 x %"struct.std::pair"], ptr @_ZZ4mainE1g, i64 0, i64 %75
  %77 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %76, ptr noundef nonnull align 4 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %78 = load i32, ptr %3, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.Edge, ptr %80, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %82 = load i32, ptr %3, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %83
  %85 = getelementptr inbounds %struct.Edge, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 4, !tbaa !14
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %10, align 4, !tbaa !5
  %91 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %81, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %91, ptr %9, align 4
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %92 to i64
  %95 = getelementptr inbounds [100003 x %"struct.std::pair"], ptr @_ZZ4mainE1g, i64 0, i64 %94
  %96 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %95, ptr noundef nonnull align 4 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %97

97:                                               ; preds = %58
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %3, align 4, !tbaa !5
  br label %43, !llvm.loop !15

100:                                              ; preds = %57
  br label %101

101:                                              ; preds = %105, %100
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %5, align 4, !tbaa !5
  %104 = icmp ne i32 %102, 0
  br i1 %104, label %105, label %120

105:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100003 x %"struct.std::pair"], ptr @_ZZ4mainE1g, i64 0, i64 %107
  %109 = getelementptr inbounds %"struct.std::pair", ptr %108, i32 0, i32 0
  %110 = load i32, ptr %109, align 8, !tbaa !16
  store i32 %110, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %111 = load i32, ptr %5, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100003 x %"struct.std::pair"], ptr @_ZZ4mainE1g, i64 0, i64 %112
  %114 = getelementptr inbounds %"struct.std::pair", ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !18
  store i32 %115, ptr %12, align 4, !tbaa !5
  %116 = load i32, ptr %11, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %117
  %119 = load i32, ptr %12, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %118, i32 noundef %119)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %101, !llvm.loop !19

120:                                              ; preds = %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %32, !llvm.loop !20

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

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

126:                                              ; preds = %122
  store i32 12, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %135

127:                                              ; preds = %122
  %128 = load i32, ptr %14, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %13, i32 noundef %131)
  br label %132

132:                                              ; preds = %127
  %133 = load i32, ptr %14, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %14, align 4, !tbaa !5
  br label %122, !llvm.loop !21

135:                                              ; preds = %126
  %136 = load i32, ptr %13, align 4, !tbaa !5
  %137 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %136)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %138 = load i32, ptr %1, align 4
  ret i32 %138
}

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!12, !6, i64 8}
!12 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !6, i64 0}
!15 = distinct !{!15, !10}
!16 = !{!17, !6, i64 0}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = !{!17, !6, i64 4}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !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.Edge = type { i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local global [50001 x i32], align 16
@e = external dso_local global [50001 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE1g = external hidden global [100003 x %"struct.std::pair"], align 16
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.._crit_edge_crit_edge

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

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre68, %.._crit_edge_crit_edge ], [ %14, %.lr.ph ]
  %9 = getelementptr inbounds %struct.Edge, ptr @e, i64 %.pre-phi
  tail call void @_ZSt4sortIP4EdgeEvT_S2_(ptr noundef nonnull @e, ptr noundef nonnull %9)
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph44, label %._crit_edge45

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv
  tail call void @_ZN4Edge4readEv(ptr noundef nonnull align 4 dereferenceable(12) %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.loopexit.loopexit:                               ; preds = %.lr.ph41
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph44, %.loopexit.loopexit, %.critedge
  %.1.lcssa72 = phi i32 [ %.1.lcssa.ph, %.loopexit.loopexit ], [ %.1.lcssa.ph, %.critedge ], [ %.02542, %.lr.ph44 ]
  %16 = phi i32 [ %.pre, %.loopexit.loopexit ], [ %33, %.critedge ], [ %20, %.lr.ph44 ]
  %17 = icmp slt i32 %.1.lcssa72, %16
  br i1 %17, label %.lr.ph44, label %._crit_edge45, !llvm.loop !11

._crit_edge45:                                    ; preds = %.loopexit, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph48, label %._crit_edge49

.lr.ph44:                                         ; preds = %._crit_edge, %.loopexit
  %20 = phi i32 [ %16, %.loopexit ], [ %10, %._crit_edge ]
  %.02542 = phi i32 [ %.1.lcssa72, %.loopexit ], [ 0, %._crit_edge ]
  %21 = sext i32 %.02542 to i64
  %22 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %21, i32 2
  %23 = load i32, ptr %22, align 4, !tbaa !12
  %24 = icmp slt i32 %.02542, %20
  br i1 %24, label %.lr.ph33.preheader, label %.loopexit

.lr.ph33.preheader:                               ; preds = %.lr.ph44
  %25 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %21
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = load i32, ptr %26, align 4, !tbaa !12
  %28 = icmp eq i32 %27, %23
  br i1 %28, label %.lr.ph75, label %.critedge

.lr.ph33:                                         ; preds = %.lr.ph75
  %29 = getelementptr inbounds [50001 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv.next53
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %31 = load i32, ptr %30, align 4, !tbaa !12
  %32 = icmp eq i32 %31, %23
  br i1 %32, label %.lr.ph75, label %.critedge, !llvm.loop !14

.critedge:                                        ; preds = %.lr.ph75, %.lr.ph33, %.lr.ph33.preheader
  %33 = phi i32 [ %20, %.lr.ph33.preheader ], [ %55, %.lr.ph33 ], [ %55, %.lr.ph75 ]
  %.026.lcssa.ph.in = phi i64 [ 0, %.lr.ph33.preheader ], [ %indvars.iv.next55, %.lr.ph33 ], [ %indvars.iv.next55, %.lr.ph75 ]
  %.1.lcssa.ph.in = phi i64 [ %21, %.lr.ph33.preheader ], [ %indvars.iv.next53, %.lr.ph33 ], [ %indvars.iv.next53, %.lr.ph75 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  %34 = and i64 %.026.lcssa.ph.in, 4294967295
  %.not39 = icmp eq i64 %34, 0
  br i1 %.not39, label %.loopexit, label %.lr.ph41.preheader

.lr.ph41.preheader:                               ; preds = %.critedge
  %sext = shl i64 %.026.lcssa.ph.in, 32
  %35 = ashr exact i64 %sext, 32
  br label %.lr.ph41

.lr.ph75:                                         ; preds = %.lr.ph33.preheader, %.lr.ph33
  %36 = phi ptr [ %29, %.lr.ph33 ], [ %25, %.lr.ph33.preheader ]
  %indvars.iv5274 = phi i64 [ %indvars.iv.next53, %.lr.ph33 ], [ %21, %.lr.ph33.preheader ]
  %indvars.iv5473 = phi i64 [ %indvars.iv.next55, %.lr.ph33 ], [ 0, %.lr.ph33.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %37 = getelementptr inbounds i8, ptr %36, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !15
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %2, align 4, !tbaa !5
  %43 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %36, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %43, ptr %1, align 8
  %44 = or disjoint i64 %indvars.iv5473, 1
  %45 = getelementptr inbounds [100003 x %"struct.std::pair"], ptr @_ZZ4mainE1g, i64 0, i64 %indvars.iv5473
  %46 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %45, ptr noundef nonnull align 4 dereferenceable(8) %1) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %47 = load i32, ptr %36, align 4, !tbaa !16
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %4, align 4, !tbaa !5
  %52 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %37, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %52, ptr %3, align 8
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv5473, 2
  %53 = getelementptr inbounds [100003 x %"struct.std::pair"], ptr @_ZZ4mainE1g, i64 0, i64 %44
  %54 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %53, ptr noundef nonnull align 4 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %indvars.iv.next53 = add nsw i64 %indvars.iv5274, 1
  %55 = load i32, ptr @m, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next53, %56
  br i1 %57, label %.lr.ph33, label %.critedge, !llvm.loop !14

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %.lr.ph41
  %indvars.iv59 = phi i64 [ %35, %.lr.ph41.preheader ], [ %indvars.iv.next60, %.lr.ph41 ]
  %indvars.iv.next60 = add nsw i64 %indvars.iv59, -1
  %58 = getelementptr inbounds [100003 x %"struct.std::pair"], ptr @_ZZ4mainE1g, i64 0, i64 %indvars.iv.next60
  %59 = load i32, ptr %58, align 8, !tbaa !17
  %60 = getelementptr inbounds i8, ptr %58, i64 4
  %61 = load i32, ptr %60, align 4, !tbaa !19
  %62 = sext i32 %59 to i64
  %63 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %62
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %63, i32 noundef %61)
  %.not = icmp eq i64 %indvars.iv.next60, 0
  br i1 %.not, label %.loopexit.loopexit, label %.lr.ph41, !llvm.loop !20

._crit_edge49.loopexit:                           ; preds = %.lr.ph48
  %.pre67 = load i32, ptr %5, align 4, !tbaa !5
  br label %._crit_edge49

._crit_edge49:                                    ; preds = %._crit_edge49.loopexit, %._crit_edge45
  %64 = phi i32 [ %.pre67, %._crit_edge49.loopexit ], [ 0, %._crit_edge45 ]
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %64)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  ret i32 0

.lr.ph48:                                         ; preds = %._crit_edge45, %.lr.ph48
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.lr.ph48 ], [ 0, %._crit_edge45 ]
  %66 = getelementptr inbounds [50001 x i32], ptr @f, i64 0, i64 %indvars.iv63
  %67 = load i32, ptr %66, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %5, i32 noundef %67)
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = icmp slt i64 %indvars.iv.next64, %69
  br i1 %70, label %.lr.ph48, label %._crit_edge49.loopexit, !llvm.loop !21
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Edge4readEv(ptr noundef nonnull align 4 dereferenceable(12)) 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) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__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 #4

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

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

attributes #0 = { 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 #1 = { 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!13, !6, i64 8}
!13 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4, !6, i64 8}
!14 = distinct !{!14, !10}
!15 = !{!13, !6, i64 4}
!16 = !{!13, !6, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!18, !6, i64 4}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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