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

; 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
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@pre = external dso_local global [5001 x i32], align 16
@suf = external dso_local global [5001 x i32], align 16
@fa = external dso_local global [5001 x i32], align 16
@ord = external dso_local global [5001 x i32], align 16
@rnk = external dso_local global [5001 x i32], align 16
@lnk = external dso_local global [5001 x i32], align 16
@dsu = external dso_local global [5001 x i32], align 16
@pos = external dso_local global [5001 x i32], align 16
@idom = external dso_local global [5001 x i32], align 16
@sdom = external dso_local global [5001 x i32], align 16
@e = external dso_local global [600003 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) #1

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

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

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

; 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 %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
  %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 %struct.Edge, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %50, %0
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [5001 x i32], ptr @rnk, i64 0, i64 %29
  store i32 -1, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %32
  store i32 -1, ptr %33, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [5001 x i32], ptr @suf, i64 0, i64 %35
  store i32 -1, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %38
  store i32 -1, ptr %39, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %42
  store i32 %40, ptr %43, align 4, !tbaa !5
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %45
  store i32 %40, ptr %46, align 4, !tbaa !5
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [5001 x i32], ptr @dsu, i64 0, i64 %48
  store i32 %40, ptr %49, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %27
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !9

53:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %97, %53
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = load i32, ptr @m, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %100

59:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %61 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 0
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = add nsw i32 %62, -1
  store i32 %63, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  store i32 %66, ptr %61, align 4, !tbaa !11
  %67 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 1
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = add nsw i32 %68, -1
  store i32 %69, ptr %5, align 4, !tbaa !5
  store i32 %69, ptr %67, align 4, !tbaa !13
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = shl i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %72
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %73, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = shl i32 %74, 1
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %77
  store i32 %75, ptr %78, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %79 = getelementptr inbounds %struct.Edge, ptr %7, i32 0, i32 0
  %80 = load i32, ptr %5, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [5001 x i32], ptr @suf, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  store i32 %83, ptr %79, align 4, !tbaa !11
  %84 = getelementptr inbounds %struct.Edge, ptr %7, i32 0, i32 1
  %85 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %85, ptr %84, align 4, !tbaa !13
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = shl i32 %86, 1
  %88 = or i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %89
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %90, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = shl i32 %91, 1
  %93 = or i32 %92, 1
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [5001 x i32], ptr @suf, i64 0, i64 %95
  store i32 %93, ptr %96, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %97

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

100:                                              ; preds = %58
  %101 = load i32, ptr @m, align 4, !tbaa !5
  %102 = shl i32 %101, 1
  store i32 %102, ptr @m, align 4, !tbaa !5
  store i32 -1, ptr @fa, align 16, !tbaa !5
  call void @_Z3dfsi(i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = sub nsw i32 %103, 1
  store i32 %104, ptr %8, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %270, %100
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = icmp sge i32 %106, 1
  br i1 %107, label %109, label %108

108:                                              ; preds = %105
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %273

109:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  store i32 %113, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [5001 x i32], ptr @suf, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  store i32 %117, ptr %11, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %161, %109
  %119 = load i32, ptr %11, align 4, !tbaa !5
  %120 = icmp ne i32 %119, -1
  br i1 %120, label %122, label %121

121:                                              ; preds = %118
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %167

122:                                              ; preds = %118
  %123 = load i32, ptr %11, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %124
  %126 = getelementptr inbounds %struct.Edge, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 4, !tbaa !13
  %128 = call noundef i32 @_Z8dsu_findi(i32 noundef %127)
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.Edge, ptr %131, i32 0, i32 1
  %133 = load i32, ptr %132, align 4, !tbaa !13
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = load i32, ptr %10, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = call noundef zeroext i1 @_Z3cmpii(i32 noundef %139, i32 noundef %143)
  br i1 %144, label %145, label %160

145:                                              ; preds = %122
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %147
  %149 = getelementptr inbounds %struct.Edge, ptr %148, i32 0, i32 1
  %150 = load i32, ptr %149, align 4, !tbaa !13
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = load i32, ptr %10, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %158
  store i32 %156, ptr %159, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %145, %122
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %163
  %165 = getelementptr inbounds %struct.Edge, ptr %164, i32 0, i32 0
  %166 = load i32, ptr %165, align 8, !tbaa !11
  store i32 %166, ptr %11, align 4, !tbaa !5
  br label %118, !llvm.loop !16

167:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %168 = getelementptr inbounds %struct.Edge, ptr %12, i32 0, i32 0
  %169 = load i32, ptr %10, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !5
  store i32 %175, ptr %168, align 4, !tbaa !11
  %176 = getelementptr inbounds %struct.Edge, ptr %12, i32 0, i32 1
  %177 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %177, ptr %176, align 4, !tbaa !13
  %178 = load i32, ptr @m, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %179
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %180, ptr align 4 %12, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %181 = load i32, ptr @m, align 4, !tbaa !5
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr @m, align 4, !tbaa !5
  %183 = load i32, ptr %10, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %187
  store i32 %181, ptr %188, align 4, !tbaa !5
  %189 = load i32, ptr %10, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [5001 x i32], ptr @fa, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !5
  %193 = load i32, ptr %10, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [5001 x i32], ptr @dsu, i64 0, i64 %194
  store i32 %192, ptr %195, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %196 = load i32, ptr %10, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [5001 x i32], ptr @fa, i64 0, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %200
  %202 = load i32, ptr %201, align 4, !tbaa !5
  store i32 %202, ptr %13, align 4, !tbaa !5
  br label %203

203:                                              ; preds = %257, %167
  %204 = load i32, ptr %13, align 4, !tbaa !5
  %205 = icmp ne i32 %204, -1
  br i1 %205, label %207, label %206

206:                                              ; preds = %203
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %263

207:                                              ; preds = %203
  %208 = load i32, ptr %13, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %209
  %211 = getelementptr inbounds %struct.Edge, ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 4, !tbaa !13
  %213 = call noundef i32 @_Z8dsu_findi(i32 noundef %212)
  %214 = load i32, ptr %13, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %215
  %217 = getelementptr inbounds %struct.Edge, ptr %216, i32 0, i32 1
  %218 = load i32, ptr %217, align 4, !tbaa !13
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  %225 = load i32, ptr %13, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %226
  %228 = getelementptr inbounds %struct.Edge, ptr %227, i32 0, i32 1
  %229 = load i32, ptr %228, align 4, !tbaa !13
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !5
  %233 = icmp eq i32 %224, %232
  br i1 %233, label %234, label %239

234:                                              ; preds = %207
  %235 = load i32, ptr %10, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [5001 x i32], ptr @fa, i64 0, i64 %236
  %238 = load i32, ptr %237, align 4, !tbaa !5
  br label %248

239:                                              ; preds = %207
  %240 = load i32, ptr %13, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %241
  %243 = getelementptr inbounds %struct.Edge, ptr %242, i32 0, i32 1
  %244 = load i32, ptr %243, align 4, !tbaa !13
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %245
  %247 = load i32, ptr %246, align 4, !tbaa !5
  br label %248

248:                                              ; preds = %239, %234
  %249 = phi i32 [ %238, %234 ], [ %247, %239 ]
  %250 = load i32, ptr %13, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %251
  %253 = getelementptr inbounds %struct.Edge, ptr %252, i32 0, i32 1
  %254 = load i32, ptr %253, align 4, !tbaa !13
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %255
  store i32 %249, ptr %256, align 4, !tbaa !5
  br label %257

257:                                              ; preds = %248
  %258 = load i32, ptr %13, align 4, !tbaa !5
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %259
  %261 = getelementptr inbounds %struct.Edge, ptr %260, i32 0, i32 0
  %262 = load i32, ptr %261, align 8, !tbaa !11
  store i32 %262, ptr %13, align 4, !tbaa !5
  br label %203, !llvm.loop !17

263:                                              ; preds = %206
  %264 = load i32, ptr %10, align 4, !tbaa !5
  %265 = sext i32 %264 to i64
  %266 = getelementptr inbounds [5001 x i32], ptr @fa, i64 0, i64 %265
  %267 = load i32, ptr %266, align 4, !tbaa !5
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %268
  store i32 -1, ptr %269, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %270

270:                                              ; preds = %263
  %271 = load i32, ptr %8, align 4, !tbaa !5
  %272 = add nsw i32 %271, -1
  store i32 %272, ptr %8, align 4, !tbaa !5
  br label %105, !llvm.loop !18

273:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %274

274:                                              ; preds = %311, %273
  %275 = load i32, ptr %14, align 4, !tbaa !5
  %276 = load i32, ptr @n, align 4, !tbaa !5
  %277 = icmp slt i32 %275, %276
  br i1 %277, label %279, label %278

278:                                              ; preds = %274
  store i32 17, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %314

279:                                              ; preds = %274
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %280 = load i32, ptr %14, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %281
  %283 = load i32, ptr %282, align 4, !tbaa !5
  store i32 %283, ptr %15, align 4, !tbaa !5
  %284 = load i32, ptr %15, align 4, !tbaa !5
  %285 = sext i32 %284 to i64
  %286 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %285
  %287 = load i32, ptr %286, align 4, !tbaa !5
  %288 = load i32, ptr %15, align 4, !tbaa !5
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %289
  %291 = load i32, ptr %290, align 4, !tbaa !5
  %292 = icmp eq i32 %287, %291
  br i1 %292, label %293, label %298

293:                                              ; preds = %279
  %294 = load i32, ptr %15, align 4, !tbaa !5
  %295 = sext i32 %294 to i64
  %296 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %295
  %297 = load i32, ptr %296, align 4, !tbaa !5
  br label %306

298:                                              ; preds = %279
  %299 = load i32, ptr %15, align 4, !tbaa !5
  %300 = sext i32 %299 to i64
  %301 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %300
  %302 = load i32, ptr %301, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %303
  %305 = load i32, ptr %304, align 4, !tbaa !5
  br label %306

306:                                              ; preds = %298, %293
  %307 = phi i32 [ %297, %293 ], [ %305, %298 ]
  %308 = load i32, ptr %15, align 4, !tbaa !5
  %309 = sext i32 %308 to i64
  %310 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %309
  store i32 %307, ptr %310, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %311

311:                                              ; preds = %306
  %312 = load i32, ptr %14, align 4, !tbaa !5
  %313 = add nsw i32 %312, 1
  store i32 %313, ptr %14, align 4, !tbaa !5
  br label %274, !llvm.loop !19

314:                                              ; preds = %278
  store i32 0, ptr @tot, align 4, !tbaa !5
  store i32 0, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %315

315:                                              ; preds = %368, %314
  %316 = load i32, ptr %16, align 4, !tbaa !5
  %317 = load i32, ptr @n, align 4, !tbaa !5
  %318 = icmp slt i32 %316, %317
  br i1 %318, label %320, label %319

319:                                              ; preds = %315
  store i32 20, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %371

320:                                              ; preds = %315
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %321 = load i32, ptr %16, align 4, !tbaa !5
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %322
  %324 = load i32, ptr %323, align 4, !tbaa !5
  store i32 %324, ptr %17, align 4, !tbaa !5
  %325 = load i32, ptr %17, align 4, !tbaa !5
  %326 = sext i32 %325 to i64
  %327 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %326
  store i32 -1, ptr %327, align 4, !tbaa !5
  %328 = load i32, ptr %17, align 4, !tbaa !5
  %329 = sext i32 %328 to i64
  %330 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %329
  %331 = load i32, ptr %330, align 4, !tbaa !5
  %332 = load i32, ptr %17, align 4, !tbaa !5
  %333 = call noundef zeroext i1 @_Z3cmpii(i32 noundef %331, i32 noundef %332)
  br i1 %333, label %334, label %367

334:                                              ; preds = %320
  %335 = load i32, ptr %17, align 4, !tbaa !5
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %336
  %338 = load i32, ptr %337, align 4, !tbaa !5
  %339 = sext i32 %338 to i64
  %340 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %339
  %341 = load i32, ptr %340, align 4, !tbaa !5
  %342 = icmp eq i32 %341, -1
  %343 = zext i1 %342 to i32
  %344 = load i32, ptr @tot, align 4, !tbaa !5
  %345 = add nsw i32 %344, %343
  store i32 %345, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %346 = getelementptr inbounds %struct.Edge, ptr %18, i32 0, i32 0
  %347 = load i32, ptr %17, align 4, !tbaa !5
  %348 = sext i32 %347 to i64
  %349 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %348
  %350 = load i32, ptr %349, align 4, !tbaa !5
  %351 = sext i32 %350 to i64
  %352 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %351
  %353 = load i32, ptr %352, align 4, !tbaa !5
  store i32 %353, ptr %346, align 4, !tbaa !11
  %354 = getelementptr inbounds %struct.Edge, ptr %18, i32 0, i32 1
  %355 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %355, ptr %354, align 4, !tbaa !13
  %356 = load i32, ptr @m, align 4, !tbaa !5
  %357 = sext i32 %356 to i64
  %358 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %357
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %358, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %359 = load i32, ptr @m, align 4, !tbaa !5
  %360 = add nsw i32 %359, 1
  store i32 %360, ptr @m, align 4, !tbaa !5
  %361 = load i32, ptr %17, align 4, !tbaa !5
  %362 = sext i32 %361 to i64
  %363 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %362
  %364 = load i32, ptr %363, align 4, !tbaa !5
  %365 = sext i32 %364 to i64
  %366 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %365
  store i32 %359, ptr %366, align 4, !tbaa !5
  br label %367

367:                                              ; preds = %334, %320
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %368

368:                                              ; preds = %367
  %369 = load i32, ptr %16, align 4, !tbaa !5
  %370 = add nsw i32 %369, 1
  store i32 %370, ptr %16, align 4, !tbaa !5
  br label %315, !llvm.loop !20

371:                                              ; preds = %319
  %372 = load i32, ptr @tot, align 4, !tbaa !5
  %373 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %372)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %374

374:                                              ; preds = %396, %371
  %375 = load i32, ptr %19, align 4, !tbaa !5
  %376 = load i32, ptr @n, align 4, !tbaa !5
  %377 = icmp slt i32 %375, %376
  br i1 %377, label %379, label %378

378:                                              ; preds = %374
  store i32 23, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %399

379:                                              ; preds = %374
  %380 = load i32, ptr %19, align 4, !tbaa !5
  %381 = sext i32 %380 to i64
  %382 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %381
  %383 = load i32, ptr %382, align 4, !tbaa !5
  %384 = icmp eq i32 %383, -1
  br i1 %384, label %385, label %386

385:                                              ; preds = %379
  br label %396

386:                                              ; preds = %379
  %387 = load i32, ptr %20, align 4, !tbaa !5
  %388 = icmp ne i32 %387, 0
  br i1 %388, label %389, label %391

389:                                              ; preds = %386
  %390 = call i32 @putchar(i32 noundef 32)
  br label %392

391:                                              ; preds = %386
  store i32 1, ptr %20, align 4, !tbaa !5
  br label %392

392:                                              ; preds = %391, %389
  %393 = load i32, ptr %19, align 4, !tbaa !5
  %394 = add nsw i32 %393, 1
  %395 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %394)
  br label %396

396:                                              ; preds = %392, %385
  %397 = load i32, ptr %19, align 4, !tbaa !5
  %398 = add nsw i32 %397, 1
  store i32 %398, ptr %19, align 4, !tbaa !5
  br label %374, !llvm.loop !21

399:                                              ; preds = %378
  %400 = call i32 @putchar(i32 noundef 10)
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #6

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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync 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: readwrite) }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 4}
!14 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Edge = type { i32, i32 }

@n = external dso_local 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 [5001 x i32], align 16
@suf = external dso_local local_unnamed_addr global [5001 x i32], align 16
@fa = external dso_local local_unnamed_addr global [5001 x i32], align 16
@ord = external dso_local local_unnamed_addr global [5001 x i32], align 16
@rnk = external dso_local local_unnamed_addr global [5001 x i32], align 16
@lnk = external dso_local local_unnamed_addr global [5001 x i32], align 16
@dsu = external dso_local local_unnamed_addr global [5001 x i32], align 16
@pos = external dso_local local_unnamed_addr global [5001 x i32], align 16
@idom = external dso_local local_unnamed_addr global [5001 x i32], align 16
@sdom = external dso_local local_unnamed_addr global [5001 x i32], align 16
@e = external dso_local local_unnamed_addr global [600003 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) local_unnamed_addr #1

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

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

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

; 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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph.preheader, label %.preheader84

.lr.ph.preheader:                                 ; preds = %0
  %6 = zext nneg i32 %4 to i64
  %7 = shl nuw nsw i64 %6, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @rnk, i8 -1, i64 %7, i1 false), !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @lnk, i8 -1, i64 %7, i1 false), !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @suf, i8 -1, i64 %7, i1 false), !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @pre, i8 -1, i64 %7, i1 false), !tbaa !5
  %min.iters.check = icmp ult i32 %4, 8
  br i1 %min.iters.check, label %.lr.ph.preheader144, label %vector.ph

.lr.ph.preheader144:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %6, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %8 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %index
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  store <4 x i32> %vec.ind, ptr %8, align 16, !tbaa !5
  store <4 x i32> %step.add, ptr %9, align 16, !tbaa !5
  %10 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %index
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  store <4 x i32> %vec.ind, ptr %10, align 16, !tbaa !5
  store <4 x i32> %step.add, ptr %11, align 16, !tbaa !5
  %12 = getelementptr inbounds [5001 x i32], ptr @dsu, i64 0, i64 %index
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  store <4 x i32> %vec.ind, ptr %12, align 16, !tbaa !5
  store <4 x i32> %step.add, ptr %13, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %14 = icmp eq i64 %index.next, %n.vec
  br i1 %14, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %6
  br i1 %cmp.n, label %.preheader84, label %.lr.ph.preheader144

.preheader84:                                     ; preds = %.lr.ph, %middle.block, %0
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph87, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph.preheader144, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader144 ]
  %17 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %indvars.iv
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %18, ptr %17, align 4, !tbaa !5
  %19 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %indvars.iv
  store i32 %18, ptr %19, align 4, !tbaa !5
  %20 = getelementptr inbounds [5001 x i32], ptr @dsu, i64 0, i64 %indvars.iv
  store i32 %18, ptr %20, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %6
  br i1 %exitcond.not, label %.preheader84, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph87, %.preheader84
  %.lcssa = phi i32 [ %15, %.preheader84 ], [ %44, %.lr.ph87 ]
  %21 = shl i32 %.lcssa, 1
  store i32 %21, ptr @m, align 4, !tbaa !5
  store i32 -1, ptr @fa, align 16, !tbaa !5
  call void @_Z3dfsi(i32 noundef 0)
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = icmp sgt i32 %22, 1
  br i1 %23, label %.lr.ph103.preheader, label %._crit_edge106

.lr.ph103.preheader:                              ; preds = %._crit_edge
  %24 = zext nneg i32 %22 to i64
  br label %.lr.ph103

.lr.ph87:                                         ; preds = %.preheader84, %.lr.ph87
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %.lr.ph87 ], [ 0, %.preheader84 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = add nsw i32 %26, -1
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, -1
  %33 = shl nuw i64 %indvars.iv118, 1
  %34 = trunc nuw i64 %33 to i32
  %sext = shl i64 %indvars.iv118, 33
  %35 = ashr exact i64 %sext, 32
  %36 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %35
  store i32 %30, ptr %36, align 16, !tbaa !5
  %.sroa.454.0..sroa_idx = getelementptr inbounds i8, ptr %36, i64 4
  store i32 %32, ptr %.sroa.454.0..sroa_idx, align 4, !tbaa !5
  store i32 %34, ptr %29, align 4, !tbaa !5
  %37 = sext i32 %32 to i64
  %38 = getelementptr inbounds [5001 x i32], ptr @suf, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = trunc i64 %33 to i32
  %41 = or disjoint i32 %40, 1
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %42
  store i32 %39, ptr %43, align 8, !tbaa !5
  %.sroa.452.0..sroa_idx = getelementptr inbounds i8, ptr %43, i64 4
  store i32 %27, ptr %.sroa.452.0..sroa_idx, align 4, !tbaa !5
  store i32 %41, ptr %38, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = icmp slt i64 %indvars.iv.next119, %45
  br i1 %46, label %.lr.ph87, label %._crit_edge, !llvm.loop !14

.preheader:                                       ; preds = %._crit_edge99
  %.pre135 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp sgt i32 %.pre135, 1
  br i1 %47, label %.lr.ph105.preheader, label %._crit_edge106

.lr.ph105.preheader:                              ; preds = %.preheader
  %wide.trip.count127 = zext nneg i32 %.pre135 to i64
  %48 = add nsw i64 %wide.trip.count127, -1
  %xtraiter = and i64 %48, 1
  %49 = icmp eq i32 %.pre135, 2
  br i1 %49, label %._crit_edge106.loopexit.unr-lcssa, label %.lr.ph105.preheader.new

.lr.ph105.preheader.new:                          ; preds = %.lr.ph105.preheader
  %unroll_iter = and i64 %48, -2
  br label %.lr.ph105

.lr.ph103:                                        ; preds = %.lr.ph103.preheader, %._crit_edge99
  %indvars.iv121 = phi i64 [ %24, %.lr.ph103.preheader ], [ %indvars.iv.next122, %._crit_edge99 ]
  %indvars.iv.next122 = add nsw i64 %indvars.iv121, -1
  %50 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next122
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [5001 x i32], ptr @suf, i64 0, i64 %52
  %.07888 = load i32, ptr %53, align 4, !tbaa !5
  %.not8289 = icmp eq i32 %.07888, -1
  br i1 %.not8289, label %._crit_edge93, label %.lr.ph92

.lr.ph92:                                         ; preds = %.lr.ph103
  %54 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %52
  br label %69

._crit_edge93:                                    ; preds = %92, %.lr.ph103
  %55 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %52
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr @m, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %61
  store i32 %59, ptr %62, align 8, !tbaa !5
  %.sroa.431.0..sroa_idx = getelementptr inbounds i8, ptr %62, i64 4
  store i32 %51, ptr %.sroa.431.0..sroa_idx, align 4, !tbaa !5
  %63 = add nsw i32 %60, 1
  store i32 %63, ptr @m, align 4, !tbaa !5
  store i32 %60, ptr %58, align 4, !tbaa !5
  %64 = getelementptr inbounds [5001 x i32], ptr @fa, i64 0, i64 %52
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = getelementptr inbounds [5001 x i32], ptr @dsu, i64 0, i64 %52
  store i32 %65, ptr %66, align 4, !tbaa !5
  %67 = sext i32 %65 to i64
  %68 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %67
  %.07794 = load i32, ptr %68, align 4, !tbaa !5
  %.not8395 = icmp eq i32 %.07794, -1
  br i1 %.not8395, label %._crit_edge99, label %.lr.ph98

69:                                               ; preds = %.lr.ph92, %92
  %.07890 = phi i32 [ %.07888, %.lr.ph92 ], [ %.078, %92 ]
  %70 = sext i32 %.07890 to i64
  %71 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %70
  %72 = getelementptr inbounds i8, ptr %71, i64 4
  %73 = load i32, ptr %72, align 4, !tbaa !15
  %74 = call noundef i32 @_Z8dsu_findi(i32 noundef %73)
  %75 = load i32, ptr %72, align 4, !tbaa !15
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = load i32, ptr %54, align 4, !tbaa !5
  %83 = call noundef zeroext i1 @_Z3cmpii(i32 noundef %81, i32 noundef %82)
  br i1 %83, label %84, label %92

84:                                               ; preds = %69
  %85 = load i32, ptr %72, align 4, !tbaa !15
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  store i32 %91, ptr %54, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %69, %84
  %.078 = load i32, ptr %71, align 8, !tbaa !5
  %.not82 = icmp eq i32 %.078, -1
  br i1 %.not82, label %._crit_edge93, label %69, !llvm.loop !17

._crit_edge99.loopexit:                           ; preds = %112
  %.pre = load i32, ptr %64, align 4, !tbaa !5
  %.pre138 = sext i32 %.pre to i64
  br label %._crit_edge99

._crit_edge99:                                    ; preds = %._crit_edge99.loopexit, %._crit_edge93
  %.pre-phi = phi i64 [ %.pre138, %._crit_edge99.loopexit ], [ %67, %._crit_edge93 ]
  %93 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %.pre-phi
  store i32 -1, ptr %93, align 4, !tbaa !5
  %94 = icmp sgt i64 %indvars.iv121, 2
  br i1 %94, label %.lr.ph103, label %.preheader, !llvm.loop !18

.lr.ph98:                                         ; preds = %._crit_edge93, %112
  %.07796 = phi i32 [ %.077, %112 ], [ %.07794, %._crit_edge93 ]
  %95 = sext i32 %.07796 to i64
  %96 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %95
  %97 = getelementptr inbounds i8, ptr %96, i64 4
  %98 = load i32, ptr %97, align 4, !tbaa !15
  %99 = call noundef i32 @_Z8dsu_findi(i32 noundef %98)
  %100 = load i32, ptr %97, align 4, !tbaa !15
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [5001 x i32], ptr @pos, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %101
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = icmp eq i32 %106, %108
  br i1 %109, label %110, label %112

110:                                              ; preds = %.lr.ph98
  %111 = load i32, ptr %64, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %.lr.ph98, %110
  %113 = phi i32 [ %111, %110 ], [ %103, %.lr.ph98 ]
  %114 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %101
  store i32 %113, ptr %114, align 4, !tbaa !5
  %.077 = load i32, ptr %96, align 8, !tbaa !5
  %.not83 = icmp eq i32 %.077, -1
  br i1 %.not83, label %._crit_edge99.loopexit, label %.lr.ph98, !llvm.loop !19

._crit_edge106.loopexit.unr-lcssa:                ; preds = %155, %.lr.ph105.preheader
  %indvars.iv124.unr = phi i64 [ 1, %.lr.ph105.preheader ], [ %indvars.iv.next125.1, %155 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge106, label %.lr.ph105.epil

.lr.ph105.epil:                                   ; preds = %._crit_edge106.loopexit.unr-lcssa
  %115 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %indvars.iv124.unr
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %117
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = icmp eq i32 %119, %121
  br i1 %122, label %._crit_edge106.loopexit.epilog-lcssa, label %123

123:                                              ; preds = %.lr.ph105.epil
  %124 = sext i32 %119 to i64
  %125 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  br label %._crit_edge106.loopexit.epilog-lcssa

._crit_edge106.loopexit.epilog-lcssa:             ; preds = %123, %.lr.ph105.epil
  %127 = phi i32 [ %126, %123 ], [ %119, %.lr.ph105.epil ]
  store i32 %127, ptr %118, align 4, !tbaa !5
  br label %._crit_edge106

._crit_edge106:                                   ; preds = %._crit_edge106.loopexit.epilog-lcssa, %._crit_edge106.loopexit.unr-lcssa, %._crit_edge, %.preheader
  %128 = phi i32 [ %.pre135, %.preheader ], [ %22, %._crit_edge ], [ %.pre135, %._crit_edge106.loopexit.unr-lcssa ], [ %.pre135, %._crit_edge106.loopexit.epilog-lcssa ]
  store i32 0, ptr @tot, align 4, !tbaa !5
  store i32 0, ptr @m, align 4, !tbaa !5
  %129 = icmp sgt i32 %128, 0
  br i1 %129, label %.lr.ph109, label %._crit_edge110

.lr.ph105:                                        ; preds = %155, %.lr.ph105.preheader.new
  %indvars.iv124 = phi i64 [ 1, %.lr.ph105.preheader.new ], [ %indvars.iv.next125.1, %155 ]
  %niter = phi i64 [ 0, %.lr.ph105.preheader.new ], [ %niter.next.1, %155 ]
  %130 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %indvars.iv124
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %132
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = icmp eq i32 %134, %136
  br i1 %137, label %.lr.ph105.1, label %138

138:                                              ; preds = %.lr.ph105
  %139 = sext i32 %134 to i64
  %140 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  br label %.lr.ph105.1

.lr.ph105.1:                                      ; preds = %.lr.ph105, %138
  %142 = phi i32 [ %141, %138 ], [ %134, %.lr.ph105 ]
  store i32 %142, ptr %133, align 4, !tbaa !5
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %143 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next125
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = getelementptr inbounds [5001 x i32], ptr @sdom, i64 0, i64 %145
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = icmp eq i32 %147, %149
  br i1 %150, label %155, label %151

151:                                              ; preds = %.lr.ph105.1
  %152 = sext i32 %147 to i64
  %153 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %151, %.lr.ph105.1
  %156 = phi i32 [ %154, %151 ], [ %147, %.lr.ph105.1 ]
  store i32 %156, ptr %146, align 4, !tbaa !5
  %indvars.iv.next125.1 = add nuw nsw i64 %indvars.iv124, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge106.loopexit.unr-lcssa, label %.lr.ph105, !llvm.loop !20

._crit_edge110.loopexit:                          ; preds = %181
  %.pre136 = load i32, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge110

._crit_edge110:                                   ; preds = %._crit_edge110.loopexit, %._crit_edge106
  %157 = phi i32 [ %.pre136, %._crit_edge110.loopexit ], [ 0, %._crit_edge106 ]
  %158 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %157)
  %159 = load i32, ptr @n, align 4, !tbaa !5
  %160 = icmp sgt i32 %159, 0
  br i1 %160, label %.lr.ph114, label %._crit_edge115

.lr.ph109:                                        ; preds = %._crit_edge106, %181
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %181 ], [ 0, %._crit_edge106 ]
  %161 = getelementptr inbounds [5001 x i32], ptr @ord, i64 0, i64 %indvars.iv129
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %163
  store i32 -1, ptr %164, align 4, !tbaa !5
  %165 = getelementptr inbounds [5001 x i32], ptr @idom, i64 0, i64 %163
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = call noundef zeroext i1 @_Z3cmpii(i32 noundef %166, i32 noundef %162)
  br i1 %167, label %168, label %181

168:                                              ; preds = %.lr.ph109
  %169 = load i32, ptr %165, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = icmp eq i32 %172, -1
  %174 = zext i1 %173 to i32
  %175 = load i32, ptr @tot, align 4, !tbaa !5
  %176 = add nsw i32 %175, %174
  store i32 %176, ptr @tot, align 4, !tbaa !5
  %177 = load i32, ptr @m, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [600003 x %struct.Edge], ptr @e, i64 0, i64 %178
  store i32 %172, ptr %179, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %179, i64 4
  store i32 %162, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %180 = add nsw i32 %177, 1
  store i32 %180, ptr @m, align 4, !tbaa !5
  store i32 %177, ptr %171, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %168, %.lr.ph109
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %182 = load i32, ptr @n, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = icmp slt i64 %indvars.iv.next130, %183
  br i1 %184, label %.lr.ph109, label %._crit_edge110.loopexit, !llvm.loop !21

._crit_edge115:                                   ; preds = %197, %._crit_edge110
  %185 = call i32 @putchar(i32 noundef 10)
  ret i32 0

.lr.ph114:                                        ; preds = %._crit_edge110, %197
  %186 = phi i32 [ %198, %197 ], [ %159, %._crit_edge110 ]
  %indvars.iv132 = phi i64 [ %indvars.iv.next133.pre-phi, %197 ], [ 0, %._crit_edge110 ]
  %.0112 = phi i32 [ %.2, %197 ], [ 0, %._crit_edge110 ]
  %187 = getelementptr inbounds [5001 x i32], ptr @lnk, i64 0, i64 %indvars.iv132
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = icmp eq i32 %188, -1
  br i1 %189, label %.lr.ph114._crit_edge, label %190

.lr.ph114._crit_edge:                             ; preds = %.lr.ph114
  %.pre139 = add nuw nsw i64 %indvars.iv132, 1
  br label %197

190:                                              ; preds = %.lr.ph114
  %.not = icmp eq i32 %.0112, 0
  br i1 %.not, label %193, label %191

191:                                              ; preds = %190
  %192 = call i32 @putchar(i32 noundef 32)
  br label %193

193:                                              ; preds = %190, %191
  %194 = add nuw nsw i64 %indvars.iv132, 1
  %195 = trunc nuw nsw i64 %194 to i32
  %196 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %195)
  %.pre137 = load i32, ptr @n, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %.lr.ph114._crit_edge, %193
  %indvars.iv.next133.pre-phi = phi i64 [ %.pre139, %.lr.ph114._crit_edge ], [ %194, %193 ]
  %198 = phi i32 [ %186, %.lr.ph114._crit_edge ], [ %.pre137, %193 ]
  %.2 = phi i32 [ %.0112, %.lr.ph114._crit_edge ], [ 1, %193 ]
  %199 = sext i32 %198 to i64
  %200 = icmp slt i64 %indvars.iv.next133.pre-phi, %199
  br i1 %200, label %.lr.ph114, label %._crit_edge115, !llvm.loop !22
}

; 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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5

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

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


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