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

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

@nn = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@pre = external dso_local global [1000001 x i32], align 16
@suf = external dso_local global [1000001 x i32], align 16
@lnk = external dso_local global [1000001 x i32], align 16
@que = external dso_local global [1000001 x i32], align 16
@scc = external dso_local global [1000001 x i32], align 16
@e = external dso_local global [4000005 x %struct.Edge], align 16
@vis = external dso_local global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(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 uwtable
declare dso_local void @_Z4dfs2i(i32 noundef) #0

; 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: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4dfs3i(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.Edge, align 4
  %10 = alloca %struct.Edge, align 4
  %11 = alloca %struct.Edge, align 4
  %12 = alloca %struct.Edge, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %struct.Edge, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m, ptr noundef @nn)
  %25 = load i32, ptr @nn, align 4, !tbaa !5
  %26 = shl i32 %25, 1
  store i32 %26, ptr @n, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = mul i64 %28, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @pre, i64 1), i8 -1, i64 %29, i1 false)
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = mul i64 %31, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @suf, i64 1), i8 -1, i64 %32, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %150, %0
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8)
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %44

42:                                               ; preds = %38
  %43 = load i32, ptr %5, align 4, !tbaa !5
  br label %48

44:                                               ; preds = %38
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = load i32, ptr @nn, align 4, !tbaa !5
  %47 = add nsw i32 %45, %46
  br label %48

48:                                               ; preds = %44, %42
  %49 = phi i32 [ %43, %42 ], [ %47, %44 ]
  store i32 %49, ptr %3, align 4, !tbaa !5
  %50 = load i32, ptr %8, align 4, !tbaa !5
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %56

52:                                               ; preds = %48
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = load i32, ptr @nn, align 4, !tbaa !5
  %55 = add nsw i32 %53, %54
  br label %58

56:                                               ; preds = %48
  %57 = load i32, ptr %7, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %56, %52
  %59 = phi i32 [ %55, %52 ], [ %57, %56 ]
  store i32 %59, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %60 = getelementptr inbounds %struct.Edge, ptr %9, i32 0, i32 0
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  store i32 %64, ptr %60, align 4, !tbaa !9
  %65 = getelementptr inbounds %struct.Edge, ptr %9, i32 0, i32 1
  %66 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %66, ptr %65, align 4, !tbaa !11
  %67 = load i32, ptr %2, align 4, !tbaa !5
  %68 = shl i32 %67, 2
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %69
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %70, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = shl i32 %71, 2
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %74
  store i32 %72, ptr %75, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %76 = getelementptr inbounds %struct.Edge, ptr %10, i32 0, i32 0
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr %76, align 4, !tbaa !9
  %81 = getelementptr inbounds %struct.Edge, ptr %10, i32 0, i32 1
  %82 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %82, ptr %81, align 4, !tbaa !11
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = shl i32 %83, 2
  %85 = or i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %86
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %87, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %88 = load i32, ptr %2, align 4, !tbaa !5
  %89 = shl i32 %88, 2
  %90 = or i32 %89, 1
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %92
  store i32 %90, ptr %93, align 4, !tbaa !5
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %58
  %97 = load i32, ptr %7, align 4, !tbaa !5
  br label %102

98:                                               ; preds = %58
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = load i32, ptr @nn, align 4, !tbaa !5
  %101 = add nsw i32 %99, %100
  br label %102

102:                                              ; preds = %98, %96
  %103 = phi i32 [ %97, %96 ], [ %101, %98 ]
  store i32 %103, ptr %3, align 4, !tbaa !5
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %110

106:                                              ; preds = %102
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = load i32, ptr @nn, align 4, !tbaa !5
  %109 = add nsw i32 %107, %108
  br label %112

110:                                              ; preds = %102
  %111 = load i32, ptr %5, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %110, %106
  %113 = phi i32 [ %109, %106 ], [ %111, %110 ]
  store i32 %113, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %114 = getelementptr inbounds %struct.Edge, ptr %11, i32 0, i32 0
  %115 = load i32, ptr %3, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  store i32 %118, ptr %114, align 4, !tbaa !9
  %119 = getelementptr inbounds %struct.Edge, ptr %11, i32 0, i32 1
  %120 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %120, ptr %119, align 4, !tbaa !11
  %121 = load i32, ptr %2, align 4, !tbaa !5
  %122 = shl i32 %121, 2
  %123 = or i32 %122, 2
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %124
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %125, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %126 = load i32, ptr %2, align 4, !tbaa !5
  %127 = shl i32 %126, 2
  %128 = or i32 %127, 2
  %129 = load i32, ptr %3, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %130
  store i32 %128, ptr %131, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %132 = getelementptr inbounds %struct.Edge, ptr %12, i32 0, i32 0
  %133 = load i32, ptr %4, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  store i32 %136, ptr %132, align 4, !tbaa !9
  %137 = getelementptr inbounds %struct.Edge, ptr %12, i32 0, i32 1
  %138 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %138, ptr %137, align 4, !tbaa !11
  %139 = load i32, ptr %2, align 4, !tbaa !5
  %140 = shl i32 %139, 2
  %141 = or i32 %140, 3
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %142
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %143, ptr align 4 %12, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %144 = load i32, ptr %2, align 4, !tbaa !5
  %145 = shl i32 %144, 2
  %146 = or i32 %145, 3
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %148
  store i32 %146, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %150

150:                                              ; preds = %112
  %151 = load i32, ptr %2, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %2, align 4, !tbaa !5
  br label %33, !llvm.loop !13

153:                                              ; preds = %37
  %154 = load i32, ptr @n, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = mul i64 %155, 1
  call void @llvm.memset.p0.i64(ptr align 1 getelementptr inbounds (i8, ptr @vis, i64 1), i8 0, i64 %156, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %157

157:                                              ; preds = %171, %153
  %158 = load i32, ptr %13, align 4, !tbaa !5
  %159 = load i32, ptr @n, align 4, !tbaa !5
  %160 = icmp sle i32 %158, %159
  br i1 %160, label %162, label %161

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

162:                                              ; preds = %157
  %163 = load i32, ptr %13, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %164
  %166 = load i8, ptr %165, align 1, !tbaa !15, !range !17, !noundef !18
  %167 = trunc i8 %166 to i1
  br i1 %167, label %170, label %168

168:                                              ; preds = %162
  %169 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z4dfs1i(i32 noundef %169)
  br label %170

170:                                              ; preds = %168, %162
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %13, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !5
  br label %157, !llvm.loop !19

174:                                              ; preds = %161
  store i32 0, ptr @tot, align 4, !tbaa !5
  %175 = load i32, ptr @m, align 4, !tbaa !5
  %176 = shl i32 %175, 2
  store i32 %176, ptr @m, align 4, !tbaa !5
  %177 = load i32, ptr @n, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = mul i64 %178, 1
  call void @llvm.memset.p0.i64(ptr align 1 getelementptr inbounds (i8, ptr @vis, i64 1), i8 0, i64 %179, i1 false)
  %180 = load i32, ptr @n, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = mul i64 %181, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @lnk, i64 1), i8 -1, i64 %182, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %183 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %183, ptr %14, align 4, !tbaa !5
  br label %184

184:                                              ; preds = %205, %174
  %185 = load i32, ptr %14, align 4, !tbaa !5
  %186 = icmp sge i32 %185, 1
  br i1 %186, label %188, label %187

187:                                              ; preds = %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %208

188:                                              ; preds = %184
  %189 = load i32, ptr %14, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %193
  %195 = load i8, ptr %194, align 1, !tbaa !15, !range !17, !noundef !18
  %196 = trunc i8 %195 to i1
  br i1 %196, label %204, label %197

197:                                              ; preds = %188
  %198 = load i32, ptr @tot, align 4, !tbaa !5
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr @tot, align 4, !tbaa !5
  %200 = load i32, ptr %14, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %203)
  br label %204

204:                                              ; preds = %197, %188
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %14, align 4, !tbaa !5
  %207 = add nsw i32 %206, -1
  store i32 %207, ptr %14, align 4, !tbaa !5
  br label %184, !llvm.loop !20

208:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %209

209:                                              ; preds = %229, %208
  %210 = load i32, ptr %15, align 4, !tbaa !5
  %211 = load i32, ptr @nn, align 4, !tbaa !5
  %212 = icmp sle i32 %210, %211
  br i1 %212, label %214, label %213

213:                                              ; preds = %209
  store i32 11, ptr %16, align 4
  br label %232

214:                                              ; preds = %209
  %215 = load i32, ptr %15, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !5
  %219 = load i32, ptr %15, align 4, !tbaa !5
  %220 = load i32, ptr @nn, align 4, !tbaa !5
  %221 = add nsw i32 %219, %220
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  %225 = icmp eq i32 %218, %224
  br i1 %225, label %226, label %228

226:                                              ; preds = %214
  %227 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %16, align 4
  br label %232

228:                                              ; preds = %214
  br label %229

229:                                              ; preds = %228
  %230 = load i32, ptr %15, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr %15, align 4, !tbaa !5
  br label %209, !llvm.loop !21

232:                                              ; preds = %226, %213
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %233 = load i32, ptr %16, align 4
  switch i32 %233, label %348 [
    i32 11, label %234
    i32 1, label %346
  ]

234:                                              ; preds = %232
  %235 = load i32, ptr @n, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = mul i64 %236, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @pre, i64 1), i8 -1, i64 %237, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %238

238:                                              ; preds = %292, %234
  %239 = load i32, ptr %17, align 4, !tbaa !5
  %240 = load i32, ptr @n, align 4, !tbaa !5
  %241 = icmp sle i32 %239, %240
  br i1 %241, label %243, label %242

242:                                              ; preds = %238
  store i32 14, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %295

243:                                              ; preds = %238
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %244 = load i32, ptr %17, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %245
  %247 = load i32, ptr %246, align 4, !tbaa !5
  store i32 %247, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %248 = load i32, ptr %17, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %249
  %251 = load i32, ptr %250, align 4, !tbaa !5
  store i32 %251, ptr %19, align 4, !tbaa !5
  br label %252

252:                                              ; preds = %285, %243
  %253 = load i32, ptr %19, align 4, !tbaa !5
  %254 = icmp ne i32 %253, -1
  br i1 %254, label %256, label %255

255:                                              ; preds = %252
  store i32 17, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %291

256:                                              ; preds = %252
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %257 = load i32, ptr %19, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %258
  %260 = getelementptr inbounds %struct.Edge, ptr %259, i32 0, i32 1
  %261 = load i32, ptr %260, align 4, !tbaa !11
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  store i32 %264, ptr %20, align 4, !tbaa !5
  %265 = load i32, ptr %18, align 4, !tbaa !5
  %266 = load i32, ptr %20, align 4, !tbaa !5
  %267 = icmp ne i32 %265, %266
  br i1 %267, label %268, label %284

268:                                              ; preds = %256
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %269 = getelementptr inbounds %struct.Edge, ptr %21, i32 0, i32 0
  %270 = load i32, ptr %18, align 4, !tbaa !5
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %271
  %273 = load i32, ptr %272, align 4, !tbaa !5
  store i32 %273, ptr %269, align 4, !tbaa !9
  %274 = getelementptr inbounds %struct.Edge, ptr %21, i32 0, i32 1
  %275 = load i32, ptr %20, align 4, !tbaa !5
  store i32 %275, ptr %274, align 4, !tbaa !11
  %276 = load i32, ptr @m, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %277
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %278, ptr align 4 %21, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  %279 = load i32, ptr @m, align 4, !tbaa !5
  %280 = add nsw i32 %279, 1
  store i32 %280, ptr @m, align 4, !tbaa !5
  %281 = load i32, ptr %18, align 4, !tbaa !5
  %282 = sext i32 %281 to i64
  %283 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %282
  store i32 %279, ptr %283, align 4, !tbaa !5
  br label %284

284:                                              ; preds = %268, %256
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %285

285:                                              ; preds = %284
  %286 = load i32, ptr %19, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %287
  %289 = getelementptr inbounds %struct.Edge, ptr %288, i32 0, i32 0
  %290 = load i32, ptr %289, align 8, !tbaa !9
  store i32 %290, ptr %19, align 4, !tbaa !5
  br label %252, !llvm.loop !22

291:                                              ; preds = %255
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %292

292:                                              ; preds = %291
  %293 = load i32, ptr %17, align 4, !tbaa !5
  %294 = add nsw i32 %293, 1
  store i32 %294, ptr %17, align 4, !tbaa !5
  br label %238, !llvm.loop !23

295:                                              ; preds = %242
  %296 = load i32, ptr @tot, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = mul i64 %297, 1
  call void @llvm.memset.p0.i64(ptr align 1 getelementptr inbounds (i8, ptr @vis, i64 1), i8 0, i64 %298, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %299

299:                                              ; preds = %316, %295
  %300 = load i32, ptr %22, align 4, !tbaa !5
  %301 = load i32, ptr @tot, align 4, !tbaa !5
  %302 = icmp sle i32 %300, %301
  br i1 %302, label %304, label %303

303:                                              ; preds = %299
  store i32 20, ptr %16, align 4
  br label %319

304:                                              ; preds = %299
  %305 = load i32, ptr %22, align 4, !tbaa !5
  %306 = sext i32 %305 to i64
  %307 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %306
  %308 = load i8, ptr %307, align 1, !tbaa !15, !range !17, !noundef !18
  %309 = trunc i8 %308 to i1
  br i1 %309, label %315, label %310

310:                                              ; preds = %304
  %311 = load i32, ptr %22, align 4, !tbaa !5
  %312 = call noundef zeroext i1 @_Z4dfs3i(i32 noundef %311)
  br i1 %312, label %315, label %313

313:                                              ; preds = %310
  %314 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %16, align 4
  br label %319

315:                                              ; preds = %310, %304
  br label %316

316:                                              ; preds = %315
  %317 = load i32, ptr %22, align 4, !tbaa !5
  %318 = add nsw i32 %317, 1
  store i32 %318, ptr %22, align 4, !tbaa !5
  br label %299, !llvm.loop !24

319:                                              ; preds = %313, %303
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  %320 = load i32, ptr %16, align 4
  switch i32 %320, label %348 [
    i32 20, label %321
    i32 1, label %346
  ]

321:                                              ; preds = %319
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 1, ptr %23, align 4, !tbaa !5
  br label %322

322:                                              ; preds = %342, %321
  %323 = load i32, ptr %23, align 4, !tbaa !5
  %324 = load i32, ptr @nn, align 4, !tbaa !5
  %325 = icmp sle i32 %323, %324
  br i1 %325, label %327, label %326

326:                                              ; preds = %322
  store i32 23, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %345

327:                                              ; preds = %322
  %328 = load i32, ptr %23, align 4, !tbaa !5
  %329 = sext i32 %328 to i64
  %330 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %329
  %331 = load i32, ptr %330, align 4, !tbaa !5
  %332 = sext i32 %331 to i64
  %333 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %332
  %334 = load i32, ptr %333, align 4, !tbaa !5
  %335 = icmp ne i32 %334, 0
  br i1 %335, label %336, label %337

336:                                              ; preds = %327
  br label %338

337:                                              ; preds = %327
  br label %338

338:                                              ; preds = %337, %336
  %339 = phi ptr [ @.str.3, %336 ], [ @.str.4, %337 ]
  %340 = getelementptr inbounds [2 x i8], ptr %339, i64 0, i64 0
  %341 = call i32 @puts(ptr noundef %340)
  br label %342

342:                                              ; preds = %338
  %343 = load i32, ptr %23, align 4, !tbaa !5
  %344 = add nsw i32 %343, 1
  store i32 %344, ptr %23, align 4, !tbaa !5
  br label %322, !llvm.loop !25

345:                                              ; preds = %326
  store i32 0, ptr %1, align 4
  br label %346

346:                                              ; preds = %345, %319, %232
  %347 = load i32, ptr %1, align 4
  ret i32 %347

348:                                              ; preds = %319, %232
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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) #4

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree 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 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}


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

@nn = external dso_local global i32, align 4
@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@pre = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@suf = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@lnk = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@que = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@scc = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@e = external dso_local local_unnamed_addr global [4000005 x %struct.Edge], align 16
@vis = external dso_local local_unnamed_addr global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(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 @_Z4dfs2i(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4dfs3i(i32 noundef) local_unnamed_addr #0

; 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 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @nn)
  %6 = load i32, ptr @nn, align 4, !tbaa !5
  %7 = shl i32 %6, 1
  store i32 %7, ptr @n, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = shl nsw i64 %8, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @pre, i64 4), i8 -1, i64 %9, i1 false)
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @suf, i64 4), i8 -1, i64 %9, i1 false)
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  %.pre162 = sext i32 %.pre to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %.pre-phi = phi i64 [ %.pre162, %._crit_edge.loopexit ], [ %8, %0 ]
  %12 = phi i32 [ %53, %._crit_edge.loopexit ], [ %10, %0 ]
  %13 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %7, %0 ]
  call void @llvm.memset.p0.i64(ptr nonnull align 1 getelementptr inbounds (i8, ptr @vis, i64 1), i8 0, i64 %.pre-phi, i1 false)
  %.not99 = icmp slt i32 %13, 1
  br i1 %.not99, label %._crit_edge103, label %.lr.ph102

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %.not84 = icmp eq i32 %15, 0
  %16 = load i32, ptr %1, align 4
  %17 = load i32, ptr @nn, align 4
  %18 = select i1 %.not84, i32 %17, i32 0
  %19 = add nsw i32 %18, %16
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %.not85 = icmp eq i32 %20, 0
  %21 = load i32, ptr %3, align 4
  %22 = select i1 %.not85, i32 0, i32 %17
  %23 = add nsw i32 %22, %21
  %24 = sext i32 %19 to i64
  %25 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = trunc nuw nsw i64 %indvars.iv to i32
  %28 = shl i32 %27, 2
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %29
  store i32 %26, ptr %30, align 16, !tbaa !5
  %.sroa.440.0..sroa_idx = getelementptr inbounds i8, ptr %30, i64 4
  store i32 %23, ptr %.sroa.440.0..sroa_idx, align 4, !tbaa !5
  store i32 %28, ptr %25, align 4, !tbaa !5
  %31 = sext i32 %23 to i64
  %32 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = or disjoint i32 %28, 1
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %35
  store i32 %33, ptr %36, align 8, !tbaa !5
  %.sroa.438.0..sroa_idx = getelementptr inbounds i8, ptr %36, i64 4
  store i32 %19, ptr %.sroa.438.0..sroa_idx, align 4, !tbaa !5
  store i32 %34, ptr %32, align 4, !tbaa !5
  %37 = select i1 %.not85, i32 %17, i32 0
  %38 = add nsw i32 %37, %21
  %39 = select i1 %.not84, i32 0, i32 %17
  %40 = add nsw i32 %39, %16
  %41 = sext i32 %38 to i64
  %42 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = or disjoint i32 %28, 2
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %45
  store i32 %43, ptr %46, align 16, !tbaa !5
  %.sroa.436.0..sroa_idx = getelementptr inbounds i8, ptr %46, i64 4
  store i32 %40, ptr %.sroa.436.0..sroa_idx, align 4, !tbaa !5
  store i32 %44, ptr %42, align 4, !tbaa !5
  %47 = sext i32 %40 to i64
  %48 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = or disjoint i32 %28, 3
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %51
  store i32 %49, ptr %52, align 8, !tbaa !5
  %.sroa.434.0..sroa_idx = getelementptr inbounds i8, ptr %52, i64 4
  store i32 %38, ptr %.sroa.434.0..sroa_idx, align 4, !tbaa !5
  store i32 %50, ptr %48, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  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
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %53 = load i32, ptr @m, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next, %54
  br i1 %55, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !9

._crit_edge103.loopexit:                          ; preds = %67
  %.pre158 = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge103

._crit_edge103:                                   ; preds = %._crit_edge103.loopexit, %._crit_edge
  %.pre-phi163 = phi i64 [ %69, %._crit_edge103.loopexit ], [ %.pre-phi, %._crit_edge ]
  %56 = phi i32 [ %.pre158, %._crit_edge103.loopexit ], [ %12, %._crit_edge ]
  %.lcssa = phi i32 [ %68, %._crit_edge103.loopexit ], [ %13, %._crit_edge ]
  store i32 0, ptr @tot, align 4, !tbaa !5
  %57 = shl i32 %56, 2
  store i32 %57, ptr @m, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr nonnull align 1 getelementptr inbounds (i8, ptr @vis, i64 1), i8 0, i64 %.pre-phi163, i1 false)
  %58 = shl nsw i64 %.pre-phi163, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @lnk, i64 4), i8 -1, i64 %58, i1 false)
  %59 = icmp sgt i32 %.lcssa, 0
  br i1 %59, label %.lr.ph106.preheader, label %.preheader97

.lr.ph106.preheader:                              ; preds = %._crit_edge103
  %60 = zext nneg i32 %.lcssa to i64
  br label %.lr.ph106

.lr.ph102:                                        ; preds = %._crit_edge, %67
  %61 = phi i32 [ %68, %67 ], [ %13, %._crit_edge ]
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %67 ], [ 1, %._crit_edge ]
  %62 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %indvars.iv137
  %63 = load i8, ptr %62, align 1, !tbaa !11, !range !13, !noundef !14
  %64 = trunc nuw i8 %63 to i1
  br i1 %64, label %67, label %65

65:                                               ; preds = %.lr.ph102
  %66 = trunc nuw nsw i64 %indvars.iv137 to i32
  call void @_Z4dfs1i(i32 noundef %66)
  %.pre157 = load i32, ptr @n, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %.lr.ph102, %65
  %68 = phi i32 [ %61, %.lr.ph102 ], [ %.pre157, %65 ]
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %69 = sext i32 %68 to i64
  %.not.not = icmp slt i64 %indvars.iv137, %69
  br i1 %.not.not, label %.lr.ph102, label %._crit_edge103.loopexit, !llvm.loop !15

.preheader97:                                     ; preds = %82, %._crit_edge103
  %70 = load i32, ptr @nn, align 4, !tbaa !5
  %.not77107 = icmp slt i32 %70, 1
  br i1 %.not77107, label %._crit_edge110, label %.lr.ph109.preheader

.lr.ph109.preheader:                              ; preds = %.preheader97
  %71 = zext nneg i32 %70 to i64
  %72 = add nuw i32 %70, 1
  %wide.trip.count = zext i32 %72 to i64
  br label %.lr.ph109

.lr.ph106:                                        ; preds = %.lr.ph106.preheader, %82
  %indvars.iv140 = phi i64 [ %60, %.lr.ph106.preheader ], [ %indvars.iv.next141, %82 ]
  %73 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %indvars.iv140
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %75
  %77 = load i8, ptr %76, align 1, !tbaa !11, !range !13, !noundef !14
  %78 = trunc nuw i8 %77 to i1
  br i1 %78, label %82, label %79

79:                                               ; preds = %.lr.ph106
  %80 = load i32, ptr @tot, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr @tot, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %74)
  br label %82

82:                                               ; preds = %.lr.ph106, %79
  %indvars.iv.next141 = add nsw i64 %indvars.iv140, -1
  %83 = icmp sgt i64 %indvars.iv140, 1
  br i1 %83, label %.lr.ph106, label %.preheader97, !llvm.loop !16

84:                                               ; preds = %.lr.ph109
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge110, label %.lr.ph109, !llvm.loop !17

.lr.ph109:                                        ; preds = %.lr.ph109.preheader, %84
  %indvars.iv143 = phi i64 [ 1, %.lr.ph109.preheader ], [ %indvars.iv.next144, %84 ]
  %85 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %indvars.iv143
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = add nuw nsw i64 %indvars.iv143, %71
  %88 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp eq i32 %86, %89
  br i1 %90, label %.loopexit.sink.split, label %84

._crit_edge110:                                   ; preds = %84, %.preheader97
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = shl nsw i64 %92, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @pre, i64 4), i8 -1, i64 %93, i1 false)
  %.not78122 = icmp slt i32 %91, 1
  br i1 %.not78122, label %._crit_edge127, label %.lr.ph126.preheader

.lr.ph126.preheader:                              ; preds = %._crit_edge110
  %m.promoted117 = load i32, ptr @m, align 4, !tbaa !5
  %94 = add nuw i32 %91, 1
  %wide.trip.count149 = zext i32 %94 to i64
  br label %.lr.ph126

._crit_edge127:                                   ; preds = %._crit_edge116, %._crit_edge110
  %95 = load i32, ptr @tot, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 1 getelementptr inbounds (i8, ptr @vis, i64 1), i8 0, i64 %96, i1 false)
  %.not79128 = icmp slt i32 %95, 1
  br i1 %.not79128, label %.preheader, label %.lr.ph131

.lr.ph126:                                        ; preds = %.lr.ph126.preheader, %._crit_edge116
  %indvars.iv146 = phi i64 [ 1, %.lr.ph126.preheader ], [ %indvars.iv.next147, %._crit_edge116 ]
  %m.promoted121123 = phi i32 [ %m.promoted117, %.lr.ph126.preheader ], [ %m.promoted120, %._crit_edge116 ]
  %97 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %indvars.iv146
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = getelementptr inbounds [1000001 x i32], ptr @suf, i64 0, i64 %indvars.iv146
  %.068111 = load i32, ptr %99, align 4, !tbaa !5
  %.not82112 = icmp eq i32 %.068111, -1
  br i1 %.not82112, label %._crit_edge116, label %.lr.ph115

.lr.ph115:                                        ; preds = %.lr.ph126
  %100 = sext i32 %98 to i64
  %101 = getelementptr inbounds [1000001 x i32], ptr @pre, i64 0, i64 %100
  br label %102

._crit_edge116:                                   ; preds = %116, %.lr.ph126
  %m.promoted120 = phi i32 [ %m.promoted121123, %.lr.ph126 ], [ %m.promoted118, %116 ]
  %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
  %exitcond150.not = icmp eq i64 %indvars.iv.next147, %wide.trip.count149
  br i1 %exitcond150.not, label %._crit_edge127, label %.lr.ph126, !llvm.loop !18

102:                                              ; preds = %.lr.ph115, %116
  %m.promoted119 = phi i32 [ %m.promoted121123, %.lr.ph115 ], [ %m.promoted118, %116 ]
  %.068113 = phi i32 [ %.068111, %.lr.ph115 ], [ %.068, %116 ]
  %103 = phi i32 [ %m.promoted121123, %.lr.ph115 ], [ %117, %116 ]
  %104 = sext i32 %.068113 to i64
  %105 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %104
  %106 = getelementptr inbounds i8, ptr %105, i64 4
  %107 = load i32, ptr %106, align 4, !tbaa !19
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %.not83 = icmp eq i32 %98, %110
  br i1 %.not83, label %116, label %111

111:                                              ; preds = %102
  %112 = load i32, ptr %101, align 4, !tbaa !5
  %113 = sext i32 %103 to i64
  %114 = getelementptr inbounds [4000005 x %struct.Edge], ptr @e, i64 0, i64 %113
  store i32 %112, ptr %114, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %114, i64 4
  store i32 %110, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %115 = add nsw i32 %103, 1
  store i32 %115, ptr @m, align 4, !tbaa !5
  store i32 %103, ptr %101, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %111, %102
  %m.promoted118 = phi i32 [ %115, %111 ], [ %m.promoted119, %102 ]
  %117 = phi i32 [ %115, %111 ], [ %103, %102 ]
  %.068 = load i32, ptr %105, align 8, !tbaa !5
  %.not82 = icmp eq i32 %.068, -1
  br i1 %.not82, label %._crit_edge116, label %102, !llvm.loop !21

.preheader.loopexit:                              ; preds = %126
  %.pre161 = load i32, ptr @nn, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %._crit_edge127
  %118 = phi i32 [ %.pre161, %.preheader.loopexit ], [ %70, %._crit_edge127 ]
  %.not80132 = icmp slt i32 %118, 1
  br i1 %.not80132, label %.loopexit, label %.lr.ph134

.lr.ph131:                                        ; preds = %._crit_edge127, %126
  %119 = phi i32 [ %127, %126 ], [ %95, %._crit_edge127 ]
  %indvars.iv151 = phi i64 [ %indvars.iv.next152, %126 ], [ 1, %._crit_edge127 ]
  %120 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %indvars.iv151
  %121 = load i8, ptr %120, align 1, !tbaa !11, !range !13, !noundef !14
  %122 = trunc nuw i8 %121 to i1
  br i1 %122, label %126, label %123

123:                                              ; preds = %.lr.ph131
  %124 = trunc nuw nsw i64 %indvars.iv151 to i32
  %125 = call noundef zeroext i1 @_Z4dfs3i(i32 noundef %124)
  br i1 %125, label %._crit_edge159, label %.loopexit.sink.split

._crit_edge159:                                   ; preds = %123
  %.pre160 = load i32, ptr @tot, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %._crit_edge159, %.lr.ph131
  %127 = phi i32 [ %.pre160, %._crit_edge159 ], [ %119, %.lr.ph131 ]
  %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
  %128 = sext i32 %127 to i64
  %.not79.not = icmp slt i64 %indvars.iv151, %128
  br i1 %.not79.not, label %.lr.ph131, label %.preheader.loopexit, !llvm.loop !22

.lr.ph134:                                        ; preds = %.preheader, %.lr.ph134
  %indvars.iv154 = phi i64 [ %indvars.iv.next155, %.lr.ph134 ], [ 1, %.preheader ]
  %129 = getelementptr inbounds [1000001 x i32], ptr @scc, i64 0, i64 %indvars.iv154
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %.not81 = icmp eq i32 %133, 0
  %.str.3..str.4 = select i1 %.not81, ptr @.str.4, ptr @.str.3
  %134 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3..str.4)
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  %135 = load i32, ptr @nn, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %.not80.not = icmp slt i64 %indvars.iv154, %136
  br i1 %.not80.not, label %.lr.ph134, label %.loopexit, !llvm.loop !23

.loopexit.sink.split:                             ; preds = %.lr.ph109, %123
  %137 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph134, %.loopexit.sink.split, %.preheader
  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

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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = !{!20, !6, i64 4}
!20 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}


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