; LLVM IR from tangjz/acm-icpc :: hdu (5260)

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

@tt = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@ans = external dso_local global [500 x i8], align 16
@g = external dso_local global [4000 x i8], align 16
@vis = external dso_local global [4000 x i8], align 16
@nxt = external dso_local global [4000 x i8], align 16
@e = external dso_local global [4000 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 [10 x i8], align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.Edge, align 4
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @tt)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %280, %0
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @tt, align 4, !tbaa !5
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %283

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %27)
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @n, ptr noundef @m, ptr noundef @s, ptr noundef @t)
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %85, %26
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = load i32, ptr @m, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %88

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 10, ptr %7) #5
  %36 = getelementptr inbounds [10 x i8], ptr %7, i64 0, i64 0
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %5, ptr noundef %6, ptr noundef %36)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %81, %35
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [10 x i8], ptr %7, i64 0, i64 %40
  %42 = load i8, ptr %41, align 1, !tbaa !9
  %43 = icmp ne i8 %42, 0
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %46 = load i32, ptr %8, align 4, !tbaa !5
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %51

48:                                               ; preds = %45
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = sub nsw i32 %49, 1
  br label %53

51:                                               ; preds = %45
  %52 = load i32, ptr %5, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %51, %48
  %54 = phi i32 [ %50, %48 ], [ %52, %51 ]
  store i32 %54, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [10 x i8], ptr %7, i64 0, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !9
  %60 = icmp ne i8 %59, 0
  br i1 %60, label %61, label %64

61:                                               ; preds = %53
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr @n, align 4, !tbaa !5
  br label %66

64:                                               ; preds = %53
  %65 = load i32, ptr %6, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %64, %61
  %67 = phi i32 [ %62, %61 ], [ %65, %64 ]
  store i32 %67, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #5
  %68 = getelementptr inbounds %struct.Edge, ptr %11, i32 0, i32 0
  %69 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %69, ptr %68, align 4, !tbaa !10
  %70 = getelementptr inbounds %struct.Edge, ptr %11, i32 0, i32 1
  %71 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %71, ptr %70, align 4, !tbaa !12
  %72 = getelementptr inbounds %struct.Edge, ptr %11, i32 0, i32 2
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10 x i8], ptr %7, i64 0, i64 %74
  %76 = load i8, ptr %75, align 1, !tbaa !9
  store i8 %76, ptr %72, align 4, !tbaa !13
  %77 = load i32, ptr @tot, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr @tot, align 4, !tbaa !5
  %79 = sext i32 %77 to i64
  %80 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %79
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %80, ptr align 4 %11, i64 12, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %81

81:                                               ; preds = %66
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %8, align 4, !tbaa !5
  br label %38, !llvm.loop !15

84:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 10, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %4, align 4, !tbaa !5
  br label %30, !llvm.loop !17

88:                                               ; preds = %34
  call void @llvm.memset.p0.i64(ptr align 16 @g, i8 0, i64 4000, i1 false)
  %89 = load i32, ptr @t, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %90
  store i8 1, ptr %91, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %144, %88
  %93 = load i32, ptr %12, align 4, !tbaa !5
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = add nsw i32 %94, 10
  %96 = icmp slt i32 %93, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %92
  store i32 11, ptr %3, align 4
  br label %147

98:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #5
  store i8 0, ptr %13, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %133, %98
  %100 = load i32, ptr %14, align 4, !tbaa !5
  %101 = load i32, ptr @tot, align 4, !tbaa !5
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %99
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %136

104:                                              ; preds = %99
  %105 = load i32, ptr %14, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %106
  %108 = getelementptr inbounds %struct.Edge, ptr %107, i32 0, i32 0
  %109 = load i32, ptr %108, align 4, !tbaa !10
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !18, !range !20, !noundef !21
  %113 = trunc i8 %112 to i1
  br i1 %113, label %132, label %114

114:                                              ; preds = %104
  %115 = load i32, ptr %14, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %116
  %118 = getelementptr inbounds %struct.Edge, ptr %117, i32 0, i32 1
  %119 = load i32, ptr %118, align 4, !tbaa !12
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %120
  %122 = load i8, ptr %121, align 1, !tbaa !18, !range !20, !noundef !21
  %123 = trunc i8 %122 to i1
  br i1 %123, label %124, label %132

124:                                              ; preds = %114
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %126
  %128 = getelementptr inbounds %struct.Edge, ptr %127, i32 0, i32 0
  %129 = load i32, ptr %128, align 4, !tbaa !10
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %130
  store i8 1, ptr %131, align 1, !tbaa !18
  store i8 1, ptr %13, align 1, !tbaa !18
  br label %132

132:                                              ; preds = %124, %114, %104
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %14, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %14, align 4, !tbaa !5
  br label %99, !llvm.loop !22

136:                                              ; preds = %103
  %137 = load i8, ptr %13, align 1, !tbaa !18, !range !20, !noundef !21
  %138 = trunc i8 %137 to i1
  br i1 %138, label %140, label %139

139:                                              ; preds = %136
  store i32 11, ptr %3, align 4
  br label %141

140:                                              ; preds = %136
  store i32 0, ptr %3, align 4
  br label %141

141:                                              ; preds = %140, %139
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #5
  %142 = load i32, ptr %3, align 4
  switch i32 %142, label %147 [
    i32 0, label %143
  ]

143:                                              ; preds = %141
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %12, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %12, align 4, !tbaa !5
  br label %92, !llvm.loop !23

147:                                              ; preds = %141, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr @s, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %150
  %152 = load i8, ptr %151, align 1, !tbaa !18, !range !20, !noundef !21
  %153 = trunc i8 %152 to i1
  br i1 %153, label %156, label %154

154:                                              ; preds = %148
  %155 = call i32 @puts(ptr noundef @.str.4)
  br label %280

156:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #5
  store i8 0, ptr %15, align 1, !tbaa !18
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 4000, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @ans, i8 0, i64 500, i1 false)
  %157 = load i32, ptr @s, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %158
  store i8 1, ptr %159, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %270, %156
  %161 = load i32, ptr %16, align 4, !tbaa !5
  %162 = icmp slt i32 %161, 500
  br i1 %162, label %164, label %163

163:                                              ; preds = %160
  store i32 17, ptr %3, align 4
  br label %273

164:                                              ; preds = %160
  %165 = load i32, ptr @t, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %166
  %168 = load i8, ptr %167, align 1, !tbaa !18, !range !20, !noundef !21
  %169 = trunc i8 %168 to i1
  br i1 %169, label %170, label %171

170:                                              ; preds = %164
  store i8 1, ptr %15, align 1, !tbaa !18
  store i32 17, ptr %3, align 4
  br label %273

171:                                              ; preds = %164
  call void @llvm.memset.p0.i64(ptr align 16 @nxt, i8 0, i64 4000, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #5
  store i8 123, ptr %17, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %172

172:                                              ; preds = %214, %171
  %173 = load i32, ptr %18, align 4, !tbaa !5
  %174 = load i32, ptr @tot, align 4, !tbaa !5
  %175 = icmp slt i32 %173, %174
  br i1 %175, label %177, label %176

176:                                              ; preds = %172
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %217

177:                                              ; preds = %172
  %178 = load i32, ptr %18, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %179
  %181 = getelementptr inbounds %struct.Edge, ptr %180, i32 0, i32 0
  %182 = load i32, ptr %181, align 4, !tbaa !10
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %183
  %185 = load i8, ptr %184, align 1, !tbaa !18, !range !20, !noundef !21
  %186 = trunc i8 %185 to i1
  br i1 %186, label %187, label %213

187:                                              ; preds = %177
  %188 = load i32, ptr %18, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %189
  %191 = getelementptr inbounds %struct.Edge, ptr %190, i32 0, i32 1
  %192 = load i32, ptr %191, align 4, !tbaa !12
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %193
  %195 = load i8, ptr %194, align 1, !tbaa !18, !range !20, !noundef !21
  %196 = trunc i8 %195 to i1
  br i1 %196, label %197, label %213

197:                                              ; preds = %187
  %198 = load i32, ptr %18, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %199
  %201 = getelementptr inbounds %struct.Edge, ptr %200, i32 0, i32 2
  %202 = load i8, ptr %201, align 4, !tbaa !13
  %203 = sext i8 %202 to i32
  %204 = load i8, ptr %17, align 1, !tbaa !9
  %205 = sext i8 %204 to i32
  %206 = icmp sle i32 %203, %205
  br i1 %206, label %207, label %213

207:                                              ; preds = %197
  %208 = load i32, ptr %18, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %209
  %211 = getelementptr inbounds %struct.Edge, ptr %210, i32 0, i32 2
  %212 = load i8, ptr %211, align 4, !tbaa !13
  store i8 %212, ptr %17, align 1, !tbaa !9
  br label %213

213:                                              ; preds = %207, %197, %187, %177
  br label %214

214:                                              ; preds = %213
  %215 = load i32, ptr %18, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %18, align 4, !tbaa !5
  br label %172, !llvm.loop !24

217:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %218

218:                                              ; preds = %262, %217
  %219 = load i32, ptr %19, align 4, !tbaa !5
  %220 = load i32, ptr @tot, align 4, !tbaa !5
  %221 = icmp slt i32 %219, %220
  br i1 %221, label %223, label %222

222:                                              ; preds = %218
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %265

223:                                              ; preds = %218
  %224 = load i32, ptr %19, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %225
  %227 = getelementptr inbounds %struct.Edge, ptr %226, i32 0, i32 0
  %228 = load i32, ptr %227, align 4, !tbaa !10
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %229
  %231 = load i8, ptr %230, align 1, !tbaa !18, !range !20, !noundef !21
  %232 = trunc i8 %231 to i1
  br i1 %232, label %233, label %261

233:                                              ; preds = %223
  %234 = load i32, ptr %19, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %235
  %237 = getelementptr inbounds %struct.Edge, ptr %236, i32 0, i32 1
  %238 = load i32, ptr %237, align 4, !tbaa !12
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %239
  %241 = load i8, ptr %240, align 1, !tbaa !18, !range !20, !noundef !21
  %242 = trunc i8 %241 to i1
  br i1 %242, label %243, label %261

243:                                              ; preds = %233
  %244 = load i32, ptr %19, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %245
  %247 = getelementptr inbounds %struct.Edge, ptr %246, i32 0, i32 2
  %248 = load i8, ptr %247, align 4, !tbaa !13
  %249 = sext i8 %248 to i32
  %250 = load i8, ptr %17, align 1, !tbaa !9
  %251 = sext i8 %250 to i32
  %252 = icmp eq i32 %249, %251
  br i1 %252, label %253, label %261

253:                                              ; preds = %243
  %254 = load i32, ptr %19, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %255
  %257 = getelementptr inbounds %struct.Edge, ptr %256, i32 0, i32 1
  %258 = load i32, ptr %257, align 4, !tbaa !12
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [4000 x i8], ptr @nxt, i64 0, i64 %259
  store i8 1, ptr %260, align 1, !tbaa !18
  br label %261

261:                                              ; preds = %253, %243, %233, %223
  br label %262

262:                                              ; preds = %261
  %263 = load i32, ptr %19, align 4, !tbaa !5
  %264 = add nsw i32 %263, 1
  store i32 %264, ptr %19, align 4, !tbaa !5
  br label %218, !llvm.loop !25

265:                                              ; preds = %222
  %266 = load i8, ptr %17, align 1, !tbaa !9
  %267 = load i32, ptr %16, align 4, !tbaa !5
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [500 x i8], ptr @ans, i64 0, i64 %268
  store i8 %266, ptr %269, align 1, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @vis, ptr align 16 @nxt, i64 4000, i1 false)
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #5
  br label %270

270:                                              ; preds = %265
  %271 = load i32, ptr %16, align 4, !tbaa !5
  %272 = add nsw i32 %271, 1
  store i32 %272, ptr %16, align 4, !tbaa !5
  br label %160, !llvm.loop !26

273:                                              ; preds = %170, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %274

274:                                              ; preds = %273
  %275 = load i8, ptr %15, align 1, !tbaa !18, !range !20, !noundef !21
  %276 = trunc i8 %275 to i1
  %277 = zext i1 %276 to i64
  %278 = select i1 %276, ptr @ans, ptr @.str.4
  %279 = call i32 @puts(ptr noundef %278)
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #5
  br label %280

280:                                              ; preds = %274, %154
  %281 = load i32, ptr %2, align 4, !tbaa !5
  %282 = add nsw i32 %281, 1
  store i32 %282, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !27

283:                                              ; preds = %25
  ret i32 0
}

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

declare i32 @puts(ptr noundef) #1

attributes #0 = { 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 #1 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

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

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


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

@tt = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local global [500 x i8], align 16
@g = external dso_local local_unnamed_addr global [4000 x i8], align 16
@vis = external dso_local local_unnamed_addr global [4000 x i8], align 16
@nxt = external dso_local local_unnamed_addr global [4000 x i8], align 16
@e = external dso_local local_unnamed_addr global [4000 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [10 x i8], align 1
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tt)
  %5 = load i32, ptr @tt, align 4, !tbaa !5
  %.not80 = icmp slt i32 %5, 1
  br i1 %.not80, label %._crit_edge84, label %.lr.ph83.preheader

.lr.ph83.preheader:                               ; preds = %0
  %6 = getelementptr inbounds i8, ptr %3, i64 1
  br label %.lr.ph83

._crit_edge84:                                    ; preds = %.loopexit, %0
  ret i32 0

.lr.ph83:                                         ; preds = %.lr.ph83.preheader, %.loopexit
  %.04881 = phi i32 [ %180, %.loopexit ], [ 1, %.lr.ph83.preheader ]
  %7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.04881)
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @s, ptr noundef nonnull @t)
  store i32 0, ptr @tot, align 4, !tbaa !5
  %9 = load i32, ptr @m, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph62, label %._crit_edge63

._crit_edge63:                                    ; preds = %79, %.lr.ph83
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) @g, i8 0, i64 4000, i1 false)
  %11 = load i32, ptr @t, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %12
  store i8 1, ptr %13, align 1, !tbaa !9
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, -10
  br i1 %15, label %.preheader56.lr.ph, label %._crit_edge69

.preheader56.lr.ph:                               ; preds = %._crit_edge63
  %16 = load i32, ptr @tot, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.preheader56.us.preheader, label %._crit_edge69

.preheader56.us.preheader:                        ; preds = %.preheader56.lr.ph
  %wide.trip.count = zext nneg i32 %16 to i64
  %18 = add nsw i32 %14, 9
  %xtraiter = and i64 %wide.trip.count, 1
  %19 = icmp eq i32 %16, 1
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader56.us

.preheader56.us:                                  ; preds = %.preheader56.us.preheader, %._crit_edge67.us
  %.04768.us = phi i32 [ %64, %._crit_edge67.us ], [ 0, %.preheader56.us.preheader ]
  br i1 %19, label %._crit_edge67.us.unr-lcssa, label %.preheader56.us.new

.preheader56.us.new:                              ; preds = %.preheader56.us, %49
  %indvars.iv88 = phi i64 [ %indvars.iv.next89.1, %49 ], [ 0, %.preheader56.us ]
  %.04564.us = phi i1 [ %.146.us.1, %49 ], [ false, %.preheader56.us ]
  %niter = phi i64 [ %niter.next.1, %49 ], [ 0, %.preheader56.us ]
  %20 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv88
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %22
  %24 = load i8, ptr %23, align 1, !tbaa !9, !range !13, !noundef !14
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %34, label %26

26:                                               ; preds = %.preheader56.us.new
  %27 = getelementptr inbounds i8, ptr %20, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !15
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !9, !range !13, !noundef !14
  %32 = trunc nuw i8 %31 to i1
  br i1 %32, label %33, label %34

33:                                               ; preds = %26
  store i8 1, ptr %23, align 1, !tbaa !9
  br label %34

34:                                               ; preds = %33, %26, %.preheader56.us.new
  %.146.us = phi i1 [ %.04564.us, %.preheader56.us.new ], [ true, %33 ], [ %.04564.us, %26 ]
  %indvars.iv.next89 = or disjoint i64 %indvars.iv88, 1
  %35 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv.next89
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %37
  %39 = load i8, ptr %38, align 1, !tbaa !9, !range !13, !noundef !14
  %40 = trunc nuw i8 %39 to i1
  br i1 %40, label %49, label %41

41:                                               ; preds = %34
  %42 = getelementptr inbounds i8, ptr %35, i64 4
  %43 = load i32, ptr %42, align 8, !tbaa !15
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !9, !range !13, !noundef !14
  %47 = trunc nuw i8 %46 to i1
  br i1 %47, label %48, label %49

48:                                               ; preds = %41
  store i8 1, ptr %38, align 1, !tbaa !9
  br label %49

49:                                               ; preds = %48, %41, %34
  %.146.us.1 = phi i1 [ %.146.us, %34 ], [ true, %48 ], [ %.146.us, %41 ]
  %indvars.iv.next89.1 = add nuw nsw i64 %indvars.iv88, 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_edge67.us.unr-lcssa, label %.preheader56.us.new, !llvm.loop !16

._crit_edge67.us.unr-lcssa:                       ; preds = %49, %.preheader56.us
  %.146.us.lcssa.ph = phi i1 [ poison, %.preheader56.us ], [ %.146.us.1, %49 ]
  %indvars.iv88.unr = phi i64 [ 0, %.preheader56.us ], [ %indvars.iv.next89.1, %49 ]
  %.04564.us.unr = phi i1 [ false, %.preheader56.us ], [ %.146.us.1, %49 ]
  br i1 %lcmp.mod.not, label %._crit_edge67.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge67.us.unr-lcssa
  %50 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv88.unr
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !9, !range !13, !noundef !14
  %55 = trunc nuw i8 %54 to i1
  br i1 %55, label %._crit_edge67.us, label %56

56:                                               ; preds = %.epil.preheader
  %57 = getelementptr inbounds i8, ptr %50, i64 4
  %58 = load i32, ptr %57, align 4, !tbaa !15
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !9, !range !13, !noundef !14
  %62 = trunc nuw i8 %61 to i1
  br i1 %62, label %63, label %._crit_edge67.us

63:                                               ; preds = %56
  store i8 1, ptr %53, align 1, !tbaa !9
  br label %._crit_edge67.us

._crit_edge67.us:                                 ; preds = %.epil.preheader, %56, %63, %._crit_edge67.us.unr-lcssa
  %.146.us.lcssa = phi i1 [ %.146.us.lcssa.ph, %._crit_edge67.us.unr-lcssa ], [ %.04564.us.unr, %.epil.preheader ], [ true, %63 ], [ %.04564.us.unr, %56 ]
  %64 = add nuw nsw i32 %.04768.us, 1
  %65 = icmp slt i32 %.04768.us, %18
  %or.cond = select i1 %.146.us.lcssa, i1 %65, i1 false
  br i1 %or.cond, label %.preheader56.us, label %._crit_edge69, !llvm.loop !18

.lr.ph62:                                         ; preds = %.lr.ph83, %79
  %.05060 = phi i32 [ %80, %79 ], [ 0, %.lr.ph83 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %3) #6
  %66 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %67 = load i8, ptr %3, align 1, !tbaa !19
  %.not5357 = icmp eq i8 %67, 0
  br i1 %.not5357, label %79, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph62
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  %n.promoted = load i32, ptr @n, align 4
  %68 = load i32, ptr %1, align 4
  %69 = load i32, ptr %2, align 4
  %70 = sext i32 %tot.promoted to i64
  %71 = load i8, ptr %6, align 1, !tbaa !19
  %.not55.peel = icmp eq i8 %71, 0
  br i1 %.not55.peel, label %74, label %72

72:                                               ; preds = %.lr.ph
  %73 = add nsw i32 %n.promoted, 1
  store i32 %73, ptr @n, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %72, %.lr.ph
  %75 = phi i32 [ %73, %72 ], [ %n.promoted, %.lr.ph ]
  %76 = phi i32 [ %n.promoted, %72 ], [ %69, %.lr.ph ]
  %indvars.iv.next86.peel = add nsw i64 %70, 1
  %77 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %70
  store i32 %68, ptr %77, align 4, !tbaa !5
  %.sroa.4.0..sroa_idx.peel = getelementptr inbounds i8, ptr %77, i64 4
  store i32 %76, ptr %.sroa.4.0..sroa_idx.peel, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx.peel = getelementptr inbounds i8, ptr %77, i64 8
  store i8 %67, ptr %.sroa.5.0..sroa_idx.peel, align 4, !tbaa !19
  br i1 %.not55.peel, label %._crit_edge, label %.peel.next

._crit_edge:                                      ; preds = %90, %74
  %.lcssa.wide = phi i64 [ %indvars.iv.next86.peel, %74 ], [ %indvars.iv.next86, %90 ]
  %78 = trunc nsw i64 %.lcssa.wide to i32
  store i32 %78, ptr @tot, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %._crit_edge, %.lr.ph62
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %80 = add nuw nsw i32 %.05060, 1
  %81 = load i32, ptr @m, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %.lr.ph62, label %._crit_edge63, !llvm.loop !20

.peel.next:                                       ; preds = %74, %90
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %90 ], [ %indvars.iv.next86.peel, %74 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %90 ], [ 1, %74 ]
  %83 = phi i8 [ %87, %90 ], [ %71, %74 ]
  %84 = phi i32 [ %91, %90 ], [ %75, %74 ]
  %85 = add nsw i32 %84, -1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %86 = getelementptr inbounds [10 x i8], ptr %3, i64 0, i64 %indvars.iv.next
  %87 = load i8, ptr %86, align 1, !tbaa !19
  %.not55 = icmp eq i8 %87, 0
  br i1 %.not55, label %90, label %88

88:                                               ; preds = %.peel.next
  %89 = add nsw i32 %84, 1
  store i32 %89, ptr @n, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %.peel.next, %88
  %91 = phi i32 [ %89, %88 ], [ %84, %.peel.next ]
  %92 = phi i32 [ %84, %88 ], [ %69, %.peel.next ]
  %indvars.iv.next86 = add nsw i64 %indvars.iv85, 1
  %93 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv85
  store i32 %85, ptr %93, align 4, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %93, i64 4
  store i32 %92, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %93, i64 8
  store i8 %83, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !19
  br i1 %.not55, label %._crit_edge, label %.peel.next, !llvm.loop !21

._crit_edge69:                                    ; preds = %._crit_edge67.us, %.preheader56.lr.ph, %._crit_edge63
  %94 = load i32, ptr @s, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %95
  %97 = load i8, ptr %96, align 1, !tbaa !9, !range !13, !noundef !14
  %98 = trunc nuw i8 %97 to i1
  br i1 %98, label %99, label %.loopexit

99:                                               ; preds = %._crit_edge69
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) @vis, i8 0, i64 4000, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(500) @ans, i8 0, i64 500, i1 false)
  %100 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %95
  store i8 1, ptr %100, align 1, !tbaa !9
  %101 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %12
  %102 = load i32, ptr @tot, align 4
  %103 = icmp sgt i32 %102, 0
  %wide.trip.count92 = zext i32 %102 to i64
  %wide.trip.count97 = zext nneg i32 %102 to i64
  %xtraiter106 = and i64 %wide.trip.count92, 1
  %104 = icmp eq i32 %102, 1
  %unroll_iter109 = and i64 %wide.trip.count92, 2147483646
  %lcmp.mod107.not = icmp eq i64 %xtraiter106, 0
  br label %105

105:                                              ; preds = %99, %._crit_edge78
  %indvars.iv99 = phi i64 [ 0, %99 ], [ %indvars.iv.next100, %._crit_edge78 ]
  %106 = load i8, ptr %101, align 1, !tbaa !9, !range !13, !noundef !14
  %107 = trunc nuw i8 %106 to i1
  br i1 %107, label %.loopexit, label %108

108:                                              ; preds = %105
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) @nxt, i8 0, i64 4000, i1 false)
  br i1 %103, label %.lr.ph74.preheader, label %._crit_edge78

.lr.ph74.preheader:                               ; preds = %108
  br i1 %104, label %.preheader.unr-lcssa, label %.lr.ph74

.preheader.unr-lcssa:                             ; preds = %157, %.lr.ph74.preheader
  %.1.lcssa.ph = phi i8 [ poison, %.lr.ph74.preheader ], [ %.1.1, %157 ]
  %indvars.iv90.unr = phi i64 [ 0, %.lr.ph74.preheader ], [ %indvars.iv.next91.1, %157 ]
  %.04171.unr = phi i8 [ 123, %.lr.ph74.preheader ], [ %.1.1, %157 ]
  br i1 %lcmp.mod107.not, label %.preheader, label %.lr.ph74.epil

.lr.ph74.epil:                                    ; preds = %.preheader.unr-lcssa
  %109 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv90.unr
  %110 = load i32, ptr %109, align 4, !tbaa !11
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !9, !range !13, !noundef !14
  %114 = trunc nuw i8 %113 to i1
  br i1 %114, label %115, label %.preheader

115:                                              ; preds = %.lr.ph74.epil
  %116 = getelementptr inbounds i8, ptr %109, i64 4
  %117 = load i32, ptr %116, align 4, !tbaa !15
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !9, !range !13, !noundef !14
  %121 = trunc nuw i8 %120 to i1
  br i1 %121, label %122, label %.preheader

122:                                              ; preds = %115
  %123 = getelementptr inbounds i8, ptr %109, i64 8
  %124 = load i8, ptr %123, align 4, !tbaa !23
  %spec.select.epil = call i8 @llvm.smin.i8(i8 %124, i8 %.04171.unr)
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph74.epil, %115, %122, %.preheader.unr-lcssa
  %.1.lcssa = phi i8 [ %.1.lcssa.ph, %.preheader.unr-lcssa ], [ %.04171.unr, %115 ], [ %.04171.unr, %.lr.ph74.epil ], [ %spec.select.epil, %122 ]
  br i1 %103, label %.lr.ph77, label %._crit_edge78

.lr.ph74:                                         ; preds = %.lr.ph74.preheader, %157
  %indvars.iv90 = phi i64 [ %indvars.iv.next91.1, %157 ], [ 0, %.lr.ph74.preheader ]
  %.04171 = phi i8 [ %.1.1, %157 ], [ 123, %.lr.ph74.preheader ]
  %niter110 = phi i64 [ %niter110.next.1, %157 ], [ 0, %.lr.ph74.preheader ]
  %125 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv90
  %126 = load i32, ptr %125, align 8, !tbaa !11
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %127
  %129 = load i8, ptr %128, align 1, !tbaa !9, !range !13, !noundef !14
  %130 = trunc nuw i8 %129 to i1
  br i1 %130, label %131, label %.lr.ph74.1

131:                                              ; preds = %.lr.ph74
  %132 = getelementptr inbounds i8, ptr %125, i64 4
  %133 = load i32, ptr %132, align 4, !tbaa !15
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %134
  %136 = load i8, ptr %135, align 1, !tbaa !9, !range !13, !noundef !14
  %137 = trunc nuw i8 %136 to i1
  br i1 %137, label %138, label %.lr.ph74.1

138:                                              ; preds = %131
  %139 = getelementptr inbounds i8, ptr %125, i64 8
  %140 = load i8, ptr %139, align 8, !tbaa !23
  %spec.select = call i8 @llvm.smin.i8(i8 %140, i8 %.04171)
  br label %.lr.ph74.1

.lr.ph74.1:                                       ; preds = %138, %.lr.ph74, %131
  %.1 = phi i8 [ %.04171, %131 ], [ %.04171, %.lr.ph74 ], [ %spec.select, %138 ]
  %indvars.iv.next91 = or disjoint i64 %indvars.iv90, 1
  %141 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv.next91
  %142 = load i32, ptr %141, align 4, !tbaa !11
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !9, !range !13, !noundef !14
  %146 = trunc nuw i8 %145 to i1
  br i1 %146, label %147, label %157

147:                                              ; preds = %.lr.ph74.1
  %148 = getelementptr inbounds i8, ptr %141, i64 4
  %149 = load i32, ptr %148, align 8, !tbaa !15
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %150
  %152 = load i8, ptr %151, align 1, !tbaa !9, !range !13, !noundef !14
  %153 = trunc nuw i8 %152 to i1
  br i1 %153, label %154, label %157

154:                                              ; preds = %147
  %155 = getelementptr inbounds i8, ptr %141, i64 8
  %156 = load i8, ptr %155, align 4, !tbaa !23
  %spec.select.1 = call i8 @llvm.smin.i8(i8 %156, i8 %.1)
  br label %157

157:                                              ; preds = %154, %147, %.lr.ph74.1
  %.1.1 = phi i8 [ %.1, %147 ], [ %.1, %.lr.ph74.1 ], [ %spec.select.1, %154 ]
  %indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 2
  %niter110.next.1 = add i64 %niter110, 2
  %niter110.ncmp.1 = icmp eq i64 %niter110.next.1, %unroll_iter109
  br i1 %niter110.ncmp.1, label %.preheader.unr-lcssa, label %.lr.ph74, !llvm.loop !24

._crit_edge78:                                    ; preds = %178, %108, %.preheader
  %.041.lcssa104 = phi i8 [ %.1.lcssa, %.preheader ], [ 123, %108 ], [ %.1.lcssa, %178 ]
  %158 = getelementptr inbounds [500 x i8], ptr @ans, i64 0, i64 %indvars.iv99
  store i8 %.041.lcssa104, ptr %158, align 1, !tbaa !19
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) @vis, ptr noundef nonnull align 16 dereferenceable(4000) @nxt, i64 4000, i1 false)
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %exitcond102.not = icmp eq i64 %indvars.iv.next100, 500
  br i1 %exitcond102.not, label %.loopexit, label %105, !llvm.loop !25

.lr.ph77:                                         ; preds = %.preheader, %178
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %178 ], [ 0, %.preheader ]
  %159 = getelementptr inbounds [4000 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv94
  %160 = load i32, ptr %159, align 4, !tbaa !11
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [4000 x i8], ptr @vis, i64 0, i64 %161
  %163 = load i8, ptr %162, align 1, !tbaa !9, !range !13, !noundef !14
  %164 = trunc nuw i8 %163 to i1
  br i1 %164, label %165, label %178

165:                                              ; preds = %.lr.ph77
  %166 = getelementptr inbounds i8, ptr %159, i64 4
  %167 = load i32, ptr %166, align 4, !tbaa !15
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [4000 x i8], ptr @g, i64 0, i64 %168
  %170 = load i8, ptr %169, align 1, !tbaa !9, !range !13, !noundef !14
  %171 = trunc nuw i8 %170 to i1
  br i1 %171, label %172, label %178

172:                                              ; preds = %165
  %173 = getelementptr inbounds i8, ptr %159, i64 8
  %174 = load i8, ptr %173, align 4, !tbaa !23
  %175 = icmp eq i8 %174, %.1.lcssa
  br i1 %175, label %176, label %178

176:                                              ; preds = %172
  %177 = getelementptr inbounds [4000 x i8], ptr @nxt, i64 0, i64 %168
  store i8 1, ptr %177, align 1, !tbaa !9
  br label %178

178:                                              ; preds = %.lr.ph77, %165, %172, %176
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %exitcond98.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count97
  br i1 %exitcond98.not, label %._crit_edge78, label %.lr.ph77, !llvm.loop !26

.loopexit:                                        ; preds = %._crit_edge78, %105, %._crit_edge69
  %.sink = phi ptr [ @.str.4, %._crit_edge69 ], [ @.str.4, %._crit_edge78 ], [ @ans, %105 ]
  %179 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.sink)
  %180 = add nuw nsw i32 %.04881, 1
  %181 = load i32, ptr @tt, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.04881, %181
  br i1 %.not.not, label %.lr.ph83, label %._crit_edge84, !llvm.loop !27
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: mustprogress 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) #3

; 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 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 #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.smin.i8(i8, i8) #5

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

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

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


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