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

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@pre = external dso_local global [1001 x i32], align 16
@seq = external dso_local global [1001 x i32], align 16
@que = external dso_local global [1001 x i32], align 16
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@vis = external dso_local global [1001 x i8], align 16
@e = external dso_local global [20002 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7AddEdgeii(i32 noundef, i32 noundef) #0

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

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

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

12:                                               ; preds = %22, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @t, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i32, ptr @seq, i64 %19
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %20)
  br label %22

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

25:                                               ; preds = %16
  br label %26

26:                                               ; preds = %30, %25
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr @m, align 4, !tbaa !5
  %29 = icmp ne i32 %27, 0
  br i1 %29, label %30, label %34

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %3, ptr noundef %4)
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z7AddEdgeii(i32 noundef %32, i32 noundef %33)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %26, !llvm.loop !11

34:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %130, %34
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  store i32 7, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %133

40:                                               ; preds = %35
  store i32 0, ptr @R, align 4, !tbaa !5
  store i32 0, ptr @L, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 1001, i1 false)
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1001 x i8], ptr @vis, i64 0, i64 %42
  store i8 1, ptr %43, align 1, !tbaa !12
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load i32, ptr @R, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @R, align 4, !tbaa !5
  %47 = sext i32 %45 to i64
  %48 = getelementptr inbounds [1001 x i32], ptr @que, i64 0, i64 %47
  store i32 %44, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %101, %40
  %50 = load i32, ptr @L, align 4, !tbaa !5
  %51 = load i32, ptr @R, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %53, label %102

53:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %54 = load i32, ptr @L, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr @L, align 4, !tbaa !5
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds [1001 x i32], ptr @que, i64 0, i64 %56
  store ptr %57, ptr %7, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %58 = load ptr, ptr %7, align 8, !tbaa !14
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [1001 x i32], ptr @pre, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  store i32 %62, ptr %8, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %95, %53
  %64 = load i32, ptr %8, align 4, !tbaa !5
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %67, label %66

66:                                               ; preds = %63
  store i32 12, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %101

67:                                               ; preds = %63
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [20002 x %struct.Edge], ptr @e, i64 0, i64 %69
  %71 = getelementptr inbounds %struct.Edge, ptr %70, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !16
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [1001 x i8], ptr @vis, i64 0, i64 %73
  %75 = load i8, ptr %74, align 1, !tbaa !12, !range !18, !noundef !19
  %76 = trunc i8 %75 to i1
  br i1 %76, label %94, label %77

77:                                               ; preds = %67
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [20002 x %struct.Edge], ptr @e, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.Edge, ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !16
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1001 x i8], ptr @vis, i64 0, i64 %83
  store i8 1, ptr %84, align 1, !tbaa !12
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [20002 x %struct.Edge], ptr @e, i64 0, i64 %86
  %88 = getelementptr inbounds %struct.Edge, ptr %87, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !16
  %90 = load i32, ptr @R, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr @R, align 4, !tbaa !5
  %92 = sext i32 %90 to i64
  %93 = getelementptr inbounds [1001 x i32], ptr @que, i64 0, i64 %92
  store i32 %89, ptr %93, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %77, %67
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [20002 x %struct.Edge], ptr @e, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.Edge, ptr %98, i32 0, i32 0
  %100 = load i32, ptr %99, align 8, !tbaa !20
  store i32 %100, ptr %8, align 4, !tbaa !5
  br label %63, !llvm.loop !21

101:                                              ; preds = %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %49, !llvm.loop !22

102:                                              ; preds = %49
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  store i8 1, ptr %9, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %119, %102
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = load i32, ptr @t, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 15, ptr %6, align 4
  br label %122

108:                                              ; preds = %103
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1001 x i32], ptr @seq, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1001 x i8], ptr @vis, i64 0, i64 %113
  %115 = load i8, ptr %114, align 1, !tbaa !12, !range !18, !noundef !19
  %116 = trunc i8 %115 to i1
  br i1 %116, label %118, label %117

117:                                              ; preds = %108
  store i8 0, ptr %9, align 1, !tbaa !12
  store i32 15, ptr %6, align 4
  br label %122

118:                                              ; preds = %108
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %10, align 4, !tbaa !5
  br label %103, !llvm.loop !23

122:                                              ; preds = %117, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %123

123:                                              ; preds = %122
  %124 = load i8, ptr %9, align 1, !tbaa !12, !range !18, !noundef !19
  %125 = trunc i8 %124 to i1
  br i1 %125, label %126, label %129

126:                                              ; preds = %123
  %127 = load i32, ptr @ans, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr @ans, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %126, %123
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %5, align 4, !tbaa !5
  br label %35, !llvm.loop !24

133:                                              ; preds = %39
  %134 = load i32, ptr @ans, align 4, !tbaa !5
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %134)
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!17, !6, i64 4}
!17 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!17, !6, i64 0}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !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 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@pre = external dso_local local_unnamed_addr global [1001 x i32], align 16
@seq = external dso_local global [1001 x i32], align 16
@que = external dso_local local_unnamed_addr global [1001 x i32], align 16
@L = external dso_local local_unnamed_addr global i32, align 4
@R = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@vis = external dso_local local_unnamed_addr global [1001 x i8], align 16
@e = external dso_local local_unnamed_addr global [20002 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7AddEdgeii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %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, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %.preheader26

.preheader26:                                     ; preds = %.lr.ph, %0
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @m, align 4, !tbaa !5
  %.not28 = icmp eq i32 %6, 0
  br i1 %.not28, label %.preheader25, label %.lr.ph29

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %8 = getelementptr inbounds i32, ptr @seq, i64 %indvars.iv
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %8)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = load i32, ptr @t, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = icmp slt i64 %indvars.iv.next, %11
  br i1 %12, label %.lr.ph, label %.preheader26, !llvm.loop !9

.preheader25:                                     ; preds = %.lr.ph29, %.preheader26
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %.not2145 = icmp slt i32 %13, 1
  br i1 %.not2145, label %.preheader25._crit_edge, label %.lr.ph40.us.preheader

.preheader25._crit_edge:                          ; preds = %.preheader25
  %.pre = load i32, ptr @ans, align 4, !tbaa !5
  br label %60

.lr.ph40.us.preheader:                            ; preds = %.preheader25
  %14 = load i32, ptr @t, align 4, !tbaa !5
  %.not2241 = icmp sgt i32 %14, 0
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %15 = add nuw i32 %13, 1
  %wide.trip.count79 = zext i32 %15 to i64
  %wide.trip.count = zext nneg i32 %14 to i64
  br label %.lr.ph40.us

.lr.ph40.us:                                      ; preds = %.lr.ph40.us.preheader, %.loopexit24.us
  %indvars.iv76 = phi i64 [ 1, %.lr.ph40.us.preheader ], [ %indvars.iv.next77, %.loopexit24.us ]
  %16 = phi i32 [ %ans.promoted, %.lr.ph40.us.preheader ], [ %27, %.loopexit24.us ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1001) @vis, i8 0, i64 1001, i1 false)
  %17 = getelementptr inbounds [1001 x i8], ptr @vis, i64 0, i64 %indvars.iv76
  store i8 1, ptr %17, align 1, !tbaa !11
  %18 = trunc nuw nsw i64 %indvars.iv76 to i32
  store i32 %18, ptr @que, align 16, !tbaa !5
  br label %28

19:                                               ; preds = %.lr.ph43.us
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
  br i1 %exitcond.not, label %.critedge.us, label %.lr.ph43.us, !llvm.loop !13

.critedge.us:                                     ; preds = %19, %..preheader_crit_edge.us
  %20 = add nsw i32 %16, 1
  store i32 %20, ptr @ans, align 4, !tbaa !5
  br label %.loopexit24.us

.lr.ph43.us:                                      ; preds = %..preheader_crit_edge.us, %19
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %19 ], [ 0, %..preheader_crit_edge.us ]
  %21 = getelementptr inbounds [1001 x i32], ptr @seq, i64 0, i64 %indvars.iv73
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1001 x i8], ptr @vis, i64 0, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !11, !range !14, !noundef !15
  %26 = trunc nuw i8 %25 to i1
  br i1 %26, label %19, label %.loopexit24.us

.loopexit24.us:                                   ; preds = %.lr.ph43.us, %.critedge.us
  %27 = phi i32 [ %20, %.critedge.us ], [ %16, %.lr.ph43.us ]
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79
  br i1 %exitcond80.not, label %._crit_edge, label %.lr.ph40.us, !llvm.loop !16

28:                                               ; preds = %.lr.ph40.us, %.loopexit.us
  %indvars.iv70 = phi i64 [ 0, %.lr.ph40.us ], [ %indvars.iv.next71, %.loopexit.us ]
  %29 = phi i32 [ 1, %.lr.ph40.us ], [ %51, %.loopexit.us ]
  %R.promoted3839.us = phi i32 [ 1, %.lr.ph40.us ], [ %R.promoted37.us, %.loopexit.us ]
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %30 = getelementptr inbounds [1001 x i32], ptr @que, i64 0, i64 %indvars.iv70
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1001 x i32], ptr @pre, i64 0, i64 %32
  %.01730.us = load i32, ptr %33, align 4, !tbaa !5
  %.not2331.us = icmp eq i32 %.01730.us, 0
  br i1 %.not2331.us, label %.loopexit.us, label %.lr.ph33.us

.lr.ph33.us:                                      ; preds = %28, %48
  %34 = phi i32 [ %49, %48 ], [ %29, %28 ]
  %R.promoted36.us = phi i32 [ %R.promoted35.us, %48 ], [ %R.promoted3839.us, %28 ]
  %.01732.us = phi i32 [ %.017.us, %48 ], [ %.01730.us, %28 ]
  %35 = phi i32 [ %50, %48 ], [ %R.promoted3839.us, %28 ]
  %36 = sext i32 %.01732.us to i64
  %37 = getelementptr inbounds [20002 x %struct.Edge], ptr @e, i64 0, i64 %36
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !17
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1001 x i8], ptr @vis, i64 0, i64 %40
  %42 = load i8, ptr %41, align 1, !tbaa !11, !range !14, !noundef !15
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %48, label %44

44:                                               ; preds = %.lr.ph33.us
  store i8 1, ptr %41, align 1, !tbaa !11
  %45 = add nsw i32 %35, 1
  %46 = sext i32 %35 to i64
  %47 = getelementptr inbounds [1001 x i32], ptr @que, i64 0, i64 %46
  store i32 %39, ptr %47, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %44, %.lr.ph33.us
  %49 = phi i32 [ %34, %.lr.ph33.us ], [ %45, %44 ]
  %R.promoted35.us = phi i32 [ %R.promoted36.us, %.lr.ph33.us ], [ %45, %44 ]
  %50 = phi i32 [ %35, %.lr.ph33.us ], [ %45, %44 ]
  %.017.us = load i32, ptr %37, align 8, !tbaa !5
  %.not23.us = icmp eq i32 %.017.us, 0
  br i1 %.not23.us, label %.loopexit.us, label %.lr.ph33.us, !llvm.loop !19

.loopexit.us:                                     ; preds = %48, %28
  %51 = phi i32 [ %29, %28 ], [ %49, %48 ]
  %R.promoted37.us = phi i32 [ %R.promoted3839.us, %28 ], [ %R.promoted35.us, %48 ]
  %52 = sext i32 %R.promoted37.us to i64
  %53 = icmp slt i64 %indvars.iv.next71, %52
  br i1 %53, label %28, label %..preheader_crit_edge.us, !llvm.loop !20

..preheader_crit_edge.us:                         ; preds = %.loopexit.us
  br i1 %.not2241, label %.lr.ph43.us, label %.critedge.us

.lr.ph29:                                         ; preds = %.preheader26, %.lr.ph29
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = load i32, ptr %1, align 4, !tbaa !5
  call void @_Z7AddEdgeii(i32 noundef %55, i32 noundef %56)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %57 = load i32, ptr @m, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %57, 0
  br i1 %.not, label %.preheader25, label %.lr.ph29, !llvm.loop !21

._crit_edge:                                      ; preds = %.loopexit24.us
  %59 = trunc nuw nsw i64 %indvars.iv.next71 to i32
  store i32 %51, ptr @R, align 4, !tbaa !5
  store i32 %59, ptr @L, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %.preheader25._crit_edge, %._crit_edge
  %61 = phi i32 [ %.pre, %.preheader25._crit_edge ], [ %27, %._crit_edge ]
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %61)
  ret i32 0
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 4}
!18 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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