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

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

@cnt = external dso_local global i32, align 4
@rt = external dso_local global i32, align 4
@last = external dso_local global i32, align 4
@dep = external dso_local global [2000003 x i32], align 16
@par = external dso_local global [2000003 x i32], align 16
@f = external dso_local global [2000003 x i32], align 16
@m = external dso_local global i32, align 4
@tail = external dso_local global ptr, align 8
@sta = external dso_local global [100001 x ptr], align 16
@buf = external dso_local global [1000001 x i8], align 16
@mx = external dso_local global i32, align 4
@lnk = external dso_local global [2000003 x i32], align 16
@st = external dso_local global [21 x [2000003 x i32]], align 16
@e = external dso_local global [2000003 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6appendi(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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %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.Edge, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = call noundef i32 @_Z7newNodei(i32 noundef 0)
  store i32 %13, ptr @rt, align 4, !tbaa !5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, 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 %15

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

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

20:                                               ; preds = %15
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @buf)
  %22 = load i32, ptr @rt, align 4, !tbaa !5
  store i32 %22, ptr @last, align 4, !tbaa !5
  %23 = load ptr, ptr @tail, align 8, !tbaa !9
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100001 x ptr], ptr @sta, i64 0, i64 %25
  store ptr %23, ptr %26, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %44, %20
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = icmp ne i8 %31, 0
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %27
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %36
  %38 = load i8, ptr %37, align 1, !tbaa !11
  %39 = sext i8 %38 to i32
  %40 = sub nsw i32 %39, 97
  call void @_Z6appendi(i32 noundef %40)
  %41 = load i32, ptr @last, align 4, !tbaa !5
  %42 = load ptr, ptr @tail, align 8, !tbaa !9
  %43 = getelementptr inbounds i32, ptr %42, i32 1
  store ptr %43, ptr @tail, align 8, !tbaa !9
  store i32 %41, ptr %42, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %34
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %4, align 4, !tbaa !5
  br label %27, !llvm.loop !12

47:                                               ; preds = %33
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !14

51:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %78, %51
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = load i32, ptr @cnt, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %58 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 0
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [2000003 x i32], ptr @lnk, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  store i32 %65, ptr %58, align 4, !tbaa !15
  %66 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 1
  %67 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %67, ptr %66, align 4, !tbaa !17
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [2000003 x %struct.Edge], ptr @e, i64 0, i64 %69
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %70, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [2000003 x i32], ptr @lnk, i64 0, i64 %76
  store i32 %71, ptr %77, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %57
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %5, align 4, !tbaa !5
  br label %52, !llvm.loop !19

81:                                               ; preds = %56
  %82 = load i32, ptr @rt, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %82)
  %83 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  br label %84

84:                                               ; preds = %135, %81
  %85 = load i32, ptr @m, align 4, !tbaa !5
  %86 = add nsw i32 %85, -1
  store i32 %86, ptr @m, align 4, !tbaa !5
  %87 = icmp ne i32 %85, 0
  br i1 %87, label %88, label %141

88:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %7, ptr noundef %8, ptr noundef %9)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = sub nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100001 x ptr], ptr @sta, i64 0, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = sub nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %94, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  store i32 %99, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = sub nsw i32 %100, %101
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %104 = load i32, ptr @mx, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 1
  store i32 %105, ptr %12, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %132, %88
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = icmp sge i32 %107, 0
  br i1 %108, label %110, label %109

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

110:                                              ; preds = %106
  %111 = load i32, ptr %12, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [21 x [2000003 x i32]], ptr @st, i64 0, i64 %112
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [2000003 x i32], ptr %113, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = load i32, ptr %11, align 4, !tbaa !5
  %122 = icmp sge i32 %120, %121
  br i1 %122, label %123, label %131

123:                                              ; preds = %110
  %124 = load i32, ptr %12, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [21 x [2000003 x i32]], ptr @st, i64 0, i64 %125
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [2000003 x i32], ptr %126, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  store i32 %130, ptr %10, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %123, %110
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = add nsw i32 %133, -1
  store i32 %134, ptr %12, align 4, !tbaa !5
  br label %106, !llvm.loop !20

135:                                              ; preds = %109
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [2000003 x i32], ptr @f, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %139)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %84, !llvm.loop !21

141:                                              ; preds = %84
  ret i32 0
}

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

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

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 = { nocallback nofree 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 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 #5 = { "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 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}


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

@cnt = external dso_local local_unnamed_addr global i32, align 4
@rt = external dso_local local_unnamed_addr global i32, align 4
@last = external dso_local local_unnamed_addr global i32, align 4
@dep = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@par = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@f = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@m = external dso_local global i32, align 4
@tail = external dso_local local_unnamed_addr global ptr, align 8
@sta = external dso_local local_unnamed_addr global [100001 x ptr], align 16
@buf = external dso_local global [1000001 x i8], align 16
@mx = external dso_local local_unnamed_addr global i32, align 4
@lnk = external dso_local local_unnamed_addr global [2000003 x i32], align 16
@st = external dso_local local_unnamed_addr global [21 x [2000003 x i32]], align 16
@e = external dso_local local_unnamed_addr global [2000003 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6appendi(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 uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call noundef i32 @_Z7newNodei(i32 noundef 0)
  store i32 %4, ptr @rt, align 4, !tbaa !5
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph33, label %.preheader

.preheader:                                       ; preds = %._crit_edge, %0
  %8 = load i32, ptr @cnt, align 4, !tbaa !5
  %.not34 = icmp slt i32 %8, 2
  br i1 %.not34, label %._crit_edge37, label %.lr.ph36.preheader

.lr.ph36.preheader:                               ; preds = %.preheader
  %9 = add nuw i32 %8, 1
  %wide.trip.count = zext i32 %9 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %10 = icmp eq i32 %9, 3
  br i1 %10, label %._crit_edge37.loopexit.unr-lcssa, label %.lr.ph36.preheader.new

.lr.ph36.preheader.new:                           ; preds = %.lr.ph36.preheader
  %11 = and i64 %wide.trip.count, 4294967294
  %12 = add nsw i64 %11, -4
  br label %.lr.ph36

.lr.ph33:                                         ; preds = %0, %._crit_edge
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %._crit_edge ], [ 0, %0 ]
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @buf)
  %14 = load i32, ptr @rt, align 4, !tbaa !5
  store i32 %14, ptr @last, align 4, !tbaa !5
  %15 = load ptr, ptr @tail, align 8, !tbaa !9
  %16 = getelementptr inbounds [100001 x ptr], ptr @sta, i64 0, i64 %indvars.iv47
  store ptr %15, ptr %16, align 8, !tbaa !9
  %17 = load i8, ptr @buf, align 16, !tbaa !11
  %.not2829 = icmp eq i8 %17, 0
  br i1 %.not2829, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph33
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next48, %19
  br i1 %20, label %.lr.ph33, label %.preheader, !llvm.loop !12

.lr.ph:                                           ; preds = %.lr.ph33, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph33 ]
  %21 = phi i8 [ %28, %.lr.ph ], [ %17, %.lr.ph33 ]
  %22 = sext i8 %21 to i32
  %23 = add nsw i32 %22, -97
  tail call void @_Z6appendi(i32 noundef %23)
  %24 = load i32, ptr @last, align 4, !tbaa !5
  %25 = load ptr, ptr @tail, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  store ptr %26, ptr @tail, align 8, !tbaa !9
  store i32 %24, ptr %25, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = getelementptr inbounds [1000001 x i8], ptr @buf, i64 0, i64 %indvars.iv.next
  %28 = load i8, ptr %27, align 1, !tbaa !11
  %.not28 = icmp eq i8 %28, 0
  br i1 %.not28, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge37.loopexit.unr-lcssa:                 ; preds = %.lr.ph36, %.lr.ph36.preheader
  %indvars.iv50.unr = phi i64 [ 2, %.lr.ph36.preheader ], [ %indvars.iv.next51.1, %.lr.ph36 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge37, label %.lr.ph36.epil

.lr.ph36.epil:                                    ; preds = %._crit_edge37.loopexit.unr-lcssa
  %29 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %indvars.iv50.unr
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [2000003 x i32], ptr @lnk, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds [2000003 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv50.unr
  store i32 %33, ptr %34, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx.epil = getelementptr inbounds i8, ptr %34, i64 4
  %35 = trunc nuw nsw i64 %indvars.iv50.unr to i32
  store i32 %35, ptr %.sroa.4.0..sroa_idx.epil, align 4, !tbaa !5
  store i32 %35, ptr %32, align 4, !tbaa !5
  br label %._crit_edge37

._crit_edge37:                                    ; preds = %.lr.ph36.epil, %._crit_edge37.loopexit.unr-lcssa, %.preheader
  %36 = load i32, ptr @rt, align 4, !tbaa !5
  tail call void @_Z3dfsi(i32 noundef %36)
  %37 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = add nsw i32 %38, -1
  store i32 %39, ptr @m, align 4, !tbaa !5
  %.not2643 = icmp eq i32 %38, 0
  br i1 %.not2643, label %._crit_edge46, label %.lr.ph45

.lr.ph36:                                         ; preds = %.lr.ph36, %.lr.ph36.preheader.new
  %indvars.iv50 = phi i64 [ 2, %.lr.ph36.preheader.new ], [ %indvars.iv.next51.1, %.lr.ph36 ]
  %niter = phi i64 [ 0, %.lr.ph36.preheader.new ], [ %niter.next.1, %.lr.ph36 ]
  %40 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %indvars.iv50
  %41 = load i32, ptr %40, align 8, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [2000003 x i32], ptr @lnk, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = getelementptr inbounds [2000003 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv50
  store i32 %44, ptr %45, align 16, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %45, i64 4
  %46 = trunc nuw nsw i64 %indvars.iv50 to i32
  store i32 %46, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  store i32 %46, ptr %43, align 4, !tbaa !5
  %indvars.iv.next51 = or disjoint i64 %indvars.iv50, 1
  %47 = getelementptr inbounds [2000003 x i32], ptr @par, i64 0, i64 %indvars.iv.next51
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2000003 x i32], ptr @lnk, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = getelementptr inbounds [2000003 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv.next51
  store i32 %51, ptr %52, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx.1 = getelementptr inbounds i8, ptr %52, i64 4
  %53 = trunc nuw nsw i64 %indvars.iv.next51 to i32
  store i32 %53, ptr %.sroa.4.0..sroa_idx.1, align 4, !tbaa !5
  store i32 %53, ptr %50, align 4, !tbaa !5
  %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %12
  br i1 %niter.ncmp.1, label %._crit_edge37.loopexit.unr-lcssa, label %.lr.ph36, !llvm.loop !15

.lr.ph45:                                         ; preds = %._crit_edge37, %._crit_edge42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %55 = load i32, ptr %1, align 4, !tbaa !5
  %56 = add nsw i32 %55, -1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x ptr], ptr @sta, i64 0, i64 %57
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr i32, ptr %59, i64 %61
  %63 = getelementptr i8, ptr %62, i64 -4
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = sub nsw i32 %60, %65
  %67 = load i32, ptr @mx, align 4, !tbaa !5
  %68 = icmp sgt i32 %67, 0
  br i1 %68, label %.lr.ph41.preheader, label %._crit_edge42

.lr.ph41.preheader:                               ; preds = %.lr.ph45
  %69 = zext nneg i32 %67 to i64
  %xtraiter56 = and i64 %69, 1
  %lcmp.mod57.not = icmp eq i64 %xtraiter56, 0
  br i1 %lcmp.mod57.not, label %.lr.ph41.prol.loopexit, label %.lr.ph41.prol

.lr.ph41.prol:                                    ; preds = %.lr.ph41.preheader
  %indvars.iv.next54.prol = add nsw i64 %69, -1
  %70 = sext i32 %64 to i64
  %71 = getelementptr inbounds [21 x [2000003 x i32]], ptr @st, i64 0, i64 %indvars.iv.next54.prol, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %.not27.not.prol = icmp sgt i32 %75, %66
  %spec.select.prol = select i1 %.not27.not.prol, i32 %72, i32 %64
  br label %.lr.ph41.prol.loopexit

.lr.ph41.prol.loopexit:                           ; preds = %.lr.ph41.prol, %.lr.ph41.preheader
  %indvars.iv53.unr = phi i64 [ %69, %.lr.ph41.preheader ], [ %indvars.iv.next54.prol, %.lr.ph41.prol ]
  %.02238.unr = phi i32 [ %64, %.lr.ph41.preheader ], [ %spec.select.prol, %.lr.ph41.prol ]
  %spec.select.lcssa.unr = phi i32 [ poison, %.lr.ph41.preheader ], [ %spec.select.prol, %.lr.ph41.prol ]
  %76 = icmp eq i32 %67, 1
  br i1 %76, label %._crit_edge42, label %.lr.ph41

._crit_edge42:                                    ; preds = %.lr.ph41.prol.loopexit, %.lr.ph41, %.lr.ph45
  %.022.lcssa = phi i32 [ %64, %.lr.ph45 ], [ %spec.select.lcssa.unr, %.lr.ph41.prol.loopexit ], [ %spec.select.1, %.lr.ph41 ]
  %77 = sext i32 %.022.lcssa to i64
  %78 = getelementptr inbounds [2000003 x i32], ptr @f, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %79)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %81 = load i32, ptr @m, align 4, !tbaa !5
  %82 = add nsw i32 %81, -1
  store i32 %82, ptr @m, align 4, !tbaa !5
  %.not26 = icmp eq i32 %81, 0
  br i1 %.not26, label %._crit_edge46, label %.lr.ph45, !llvm.loop !16

.lr.ph41:                                         ; preds = %.lr.ph41.prol.loopexit, %.lr.ph41
  %indvars.iv53 = phi i64 [ %indvars.iv.next54.1, %.lr.ph41 ], [ %indvars.iv53.unr, %.lr.ph41.prol.loopexit ]
  %.02238 = phi i32 [ %spec.select.1, %.lr.ph41 ], [ %.02238.unr, %.lr.ph41.prol.loopexit ]
  %indvars.iv.next54 = add nsw i64 %indvars.iv53, -1
  %83 = sext i32 %.02238 to i64
  %84 = getelementptr inbounds [21 x [2000003 x i32]], ptr @st, i64 0, i64 %indvars.iv.next54, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %.not27.not = icmp sgt i32 %88, %66
  %spec.select = select i1 %.not27.not, i32 %85, i32 %.02238
  %indvars.iv.next54.1 = add nsw i64 %indvars.iv53, -2
  %89 = sext i32 %spec.select to i64
  %90 = getelementptr inbounds [21 x [2000003 x i32]], ptr @st, i64 0, i64 %indvars.iv.next54.1, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [2000003 x i32], ptr @dep, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %.not27.not.1 = icmp sgt i32 %94, %66
  %spec.select.1 = select i1 %.not27.not.1, i32 %91, i32 %spec.select
  %95 = icmp ugt i64 %indvars.iv.next54, 1
  br i1 %95, label %.lr.ph41, label %._crit_edge42, !llvm.loop !17

._crit_edge46:                                    ; preds = %._crit_edge42, %._crit_edge37
  ret i32 0
}

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

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

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 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 = { 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 #4 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


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