; LLVM IR from tangjz/acm-icpc :: codeforces/complete (317C)

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

@n = external dso_local global i32, align 4
@lim = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [301 x i32], align 16
@b = external dso_local global [301 x i32], align 16
@g = external dso_local global [301 x i32], align 16
@tot = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@ans = external dso_local global [181202 x [3 x i32]], align 16
@vis = external dso_local global [301 x i8], align 16
@e = external dso_local global [100001 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 [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1

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

13:                                               ; preds = %23, %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %18, label %17

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

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

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

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

27:                                               ; preds = %37, %26
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp sle i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %40

32:                                               ; preds = %27
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i32, ptr @b, i64 %34
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %35)
  br label %37

37:                                               ; preds = %32
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %3, align 4, !tbaa !5
  br label %27, !llvm.loop !11

40:                                               ; preds = %31
  br label %41

41:                                               ; preds = %45, %40
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = add nsw i32 %42, -1
  store i32 %43, ptr @m, align 4, !tbaa !5
  %44 = icmp ne i32 %42, 0
  br i1 %44, label %45, label %77

45:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %47 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 0
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [301 x i32], ptr @g, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %47, align 4, !tbaa !12
  %52 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 1
  %53 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %53, ptr %52, align 4, !tbaa !14
  %54 = load i32, ptr @tot, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr @tot, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100001 x %struct.Edge], ptr @e, i64 0, i64 %56
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %57, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %58 = load i32, ptr @tot, align 4, !tbaa !5
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [301 x i32], ptr @g, i64 0, i64 %60
  store i32 %58, ptr %61, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %62 = getelementptr inbounds %struct.Edge, ptr %7, i32 0, i32 0
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [301 x i32], ptr @g, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  store i32 %66, ptr %62, align 4, !tbaa !12
  %67 = getelementptr inbounds %struct.Edge, ptr %7, i32 0, i32 1
  %68 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %68, ptr %67, align 4, !tbaa !14
  %69 = load i32, ptr @tot, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr @tot, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100001 x %struct.Edge], ptr @e, i64 0, i64 %71
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %72, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %73 = load i32, ptr @tot, align 4, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [301 x i32], ptr @g, i64 0, i64 %75
  store i32 %73, ptr %76, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %41, !llvm.loop !16

77:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %96, %77
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = icmp sle i32 %79, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %99

83:                                               ; preds = %78
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [301 x i32], ptr @a, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = icmp sgt i32 %87, %91
  br i1 %92, label %93, label %95

93:                                               ; preds = %83
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 301, i1 false)
  %94 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %94)
  br label %95

95:                                               ; preds = %93, %83
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %8, align 4, !tbaa !5
  br label %78, !llvm.loop !17

99:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %118, %99
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = load i32, ptr @n, align 4, !tbaa !5
  %103 = icmp sle i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 13, ptr %10, align 4
  br label %121

105:                                              ; preds = %100
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [301 x i32], ptr @a, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = icmp ne i32 %109, %113
  br i1 %114, label %115, label %117

115:                                              ; preds = %105
  %116 = call i32 @puts(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %121

117:                                              ; preds = %105
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %9, align 4, !tbaa !5
  br label %100, !llvm.loop !18

121:                                              ; preds = %115, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %122 = load i32, ptr %10, align 4
  switch i32 %122, label %154 [
    i32 13, label %123
    i32 1, label %152
  ]

123:                                              ; preds = %121
  %124 = load i32, ptr @cnt, align 4, !tbaa !5
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %124)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %148, %123
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = load i32, ptr @cnt, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 16, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %151

131:                                              ; preds = %126
  %132 = load i32, ptr %11, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [181202 x [3 x i32]], ptr @ans, i64 0, i64 %133
  %135 = getelementptr inbounds [3 x i32], ptr %134, i64 0, i64 0
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = load i32, ptr %11, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [181202 x [3 x i32]], ptr @ans, i64 0, i64 %138
  %140 = getelementptr inbounds [3 x i32], ptr %139, i64 0, i64 1
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = load i32, ptr %11, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [181202 x [3 x i32]], ptr @ans, i64 0, i64 %143
  %145 = getelementptr inbounds [3 x i32], ptr %144, i64 0, i64 2
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %136, i32 noundef %141, i32 noundef %146)
  br label %148

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

151:                                              ; preds = %130
  store i32 0, ptr %1, align 4
  br label %152

152:                                              ; preds = %151, %121
  %153 = load i32, ptr %1, align 4
  ret i32 %153

154:                                              ; preds = %121
  unreachable
}

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

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

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

declare i32 @puts(ptr noundef) #3

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

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

@n = external dso_local global i32, align 4
@lim = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [301 x i32], align 16
@b = external dso_local global [301 x i32], align 16
@g = external dso_local local_unnamed_addr global [301 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global [181202 x [3 x i32]], align 16
@vis = external dso_local local_unnamed_addr global [301 x i8], align 16
@e = external dso_local local_unnamed_addr global [100001 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 [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(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 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 @n, ptr noundef nonnull @lim, ptr noundef nonnull @m)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %.not41 = icmp slt i32 %4, 1
  br i1 %.not41, label %.preheader39, label %.lr.ph

.preheader40:                                     ; preds = %.lr.ph
  %.not3043 = icmp slt i32 %7, 1
  br i1 %.not3043, label %.preheader39, label %.lr.ph45

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

.preheader39:                                     ; preds = %.lr.ph45, %0, %.preheader40
  %9 = phi i32 [ %7, %.preheader40 ], [ %4, %0 ], [ %14, %.lr.ph45 ]
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @m, align 4, !tbaa !5
  %.not3146 = icmp eq i32 %10, 0
  br i1 %.not3146, label %.preheader38, label %.lr.ph47

.lr.ph45:                                         ; preds = %.preheader40, %.lr.ph45
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph45 ], [ 1, %.preheader40 ]
  %12 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv59
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %12)
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %.not30.not = icmp slt i64 %indvars.iv59, %15
  br i1 %.not30.not, label %.lr.ph45, label %.preheader39, !llvm.loop !11

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

.preheader38:                                     ; preds = %.preheader38.loopexit, %.preheader39
  %16 = phi i32 [ %.pre, %.preheader38.loopexit ], [ %9, %.preheader39 ]
  %.not3248 = icmp slt i32 %16, 1
  br i1 %.not3248, label %._crit_edge, label %.lr.ph50

.lr.ph47:                                         ; preds = %.preheader39, %.lr.ph47
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [301 x i32], ptr @g, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @tot, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100001 x %struct.Edge], ptr @e, i64 0, i64 %25
  store i32 %21, ptr %26, align 8, !tbaa !5
  %.sroa.416.0..sroa_idx = getelementptr inbounds i8, ptr %26, i64 4
  store i32 %22, ptr %.sroa.416.0..sroa_idx, align 4, !tbaa !5
  store i32 %24, ptr %20, align 4, !tbaa !5
  %27 = sext i32 %22 to i64
  %28 = getelementptr inbounds [301 x i32], ptr @g, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i32 %23, 2
  store i32 %30, ptr @tot, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100001 x %struct.Edge], ptr @e, i64 0, i64 %31
  store i32 %29, ptr %32, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %32, i64 4
  store i32 %18, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  store i32 %30, ptr %28, align 4, !tbaa !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
  %33 = load i32, ptr @m, align 4, !tbaa !5
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr @m, align 4, !tbaa !5
  %.not31 = icmp eq i32 %33, 0
  br i1 %.not31, label %.preheader38.loopexit, label %.lr.ph47, !llvm.loop !12

.preheader:                                       ; preds = %44
  %.not3351 = icmp slt i32 %45, 1
  br i1 %.not3351, label %._crit_edge, label %.lr.ph53.preheader

.lr.ph53.preheader:                               ; preds = %.preheader
  %35 = add nuw i32 %45, 1
  %wide.trip.count = zext i32 %35 to i64
  br label %.lr.ph53

.lr.ph50:                                         ; preds = %.preheader38, %44
  %36 = phi i32 [ %45, %44 ], [ %16, %.preheader38 ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %44 ], [ 1, %.preheader38 ]
  %37 = getelementptr inbounds [301 x i32], ptr @a, i64 0, i64 %indvars.iv62
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %indvars.iv62
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = icmp sgt i32 %38, %40
  br i1 %41, label %42, label %44

42:                                               ; preds = %.lr.ph50
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(301) @vis, i8 0, i64 301, i1 false)
  %43 = trunc nuw nsw i64 %indvars.iv62 to i32
  call void @_Z3dfsi(i32 noundef %43)
  %.pre71 = load i32, ptr @n, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %.lr.ph50, %42
  %45 = phi i32 [ %36, %.lr.ph50 ], [ %.pre71, %42 ]
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %46 = sext i32 %45 to i64
  %.not32.not = icmp slt i64 %indvars.iv62, %46
  br i1 %.not32.not, label %.lr.ph50, label %.preheader, !llvm.loop !13

47:                                               ; preds = %.lr.ph53
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next66, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph53, !llvm.loop !14

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %47
  %indvars.iv65 = phi i64 [ 1, %.lr.ph53.preheader ], [ %indvars.iv.next66, %47 ]
  %48 = getelementptr inbounds [301 x i32], ptr @a, i64 0, i64 %indvars.iv65
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %indvars.iv65
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %.not34 = icmp eq i32 %49, %51
  br i1 %.not34, label %47, label %52

52:                                               ; preds = %.lr.ph53
  %53 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.loopexit

._crit_edge:                                      ; preds = %47, %.preheader38, %.preheader
  %54 = load i32, ptr @cnt, align 4, !tbaa !5
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %54)
  %56 = load i32, ptr @cnt, align 4, !tbaa !5
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %.lr.ph56, label %.loopexit

.lr.ph56:                                         ; preds = %._crit_edge, %.lr.ph56
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %.lr.ph56 ], [ 0, %._crit_edge ]
  %58 = getelementptr inbounds [181202 x [3 x i32]], ptr @ans, i64 0, i64 %indvars.iv68
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %58, i64 4
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %58, i64 8
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %59, i32 noundef %61, i32 noundef %63)
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %65 = load i32, ptr @cnt, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next69, %66
  br i1 %67, label %.lr.ph56, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %.lr.ph56, %._crit_edge, %52
  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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3

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

attributes #0 = { 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 #1 = { mustprogress 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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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