; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/234 Division 2/Problem D (D)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@c = external dso_local global [511 x i32], align 16
@last = external dso_local global i32, align 4
@u = external dso_local global i32, align 4
@v = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@type = external dso_local global [100100 x i32], align 16
@g = external dso_local global [511 x [511 x i64]], align 16
@INF = external dso_local global i64, align 8
@adj = external dso_local global [100100 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsii(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %56, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @k, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %19
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %26
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %27)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %29 = load i32, ptr @last, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %4, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %46, %24
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = load i32, ptr @last, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = add nsw i32 %33, %37
  %39 = icmp sle i32 %32, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %31
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %44
  store i32 %42, ptr %45, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %41
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %4, align 4, !tbaa !5
  br label %31, !llvm.loop !9

49:                                               ; preds = %40
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr @last, align 4, !tbaa !5
  %55 = add nsw i32 %54, %53
  store i32 %55, ptr @last, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %49
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !11

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

60:                                               ; preds = %96, %59
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = load i32, ptr @k, align 4, !tbaa !5
  %63 = icmp sle i32 %61, %62
  br i1 %63, label %65, label %64

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

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

66:                                               ; preds = %79, %65
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = load i32, ptr @k, align 4, !tbaa !5
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

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

71:                                               ; preds = %66
  %72 = load i64, ptr @INF, align 8, !tbaa !12
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %74
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [511 x i64], ptr %75, i64 0, i64 %77
  store i64 %72, ptr %78, align 8, !tbaa !12
  br label %79

79:                                               ; preds = %71
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %6, align 4, !tbaa !5
  br label %66, !llvm.loop !14

82:                                               ; preds = %70
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp eq i32 %86, 1
  br i1 %87, label %88, label %95

88:                                               ; preds = %82
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %90
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [511 x i64], ptr %91, i64 0, i64 %93
  store i64 0, ptr %94, align 8, !tbaa !12
  br label %95

95:                                               ; preds = %88, %82
  br label %96

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

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

100:                                              ; preds = %159, %99
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = load i32, ptr @m, align 4, !tbaa !5
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

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

105:                                              ; preds = %100
  %106 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @u, ptr noundef @v, ptr noundef @x)
  %107 = load i32, ptr @x, align 4, !tbaa !5
  %108 = icmp eq i32 %107, 0
  br i1 %108, label %109, label %116

109:                                              ; preds = %105
  %110 = load i32, ptr @u, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @adj, i64 0, i64 %111
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %112, ptr noundef nonnull align 4 dereferenceable(4) @v)
  %113 = load i32, ptr @v, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @adj, i64 0, i64 %114
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %115, ptr noundef nonnull align 4 dereferenceable(4) @u)
  br label %116

116:                                              ; preds = %109, %105
  %117 = load i32, ptr @u, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  store i32 %120, ptr @u, align 4, !tbaa !5
  %121 = load i32, ptr @v, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  store i32 %124, ptr @v, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %125 = load i32, ptr @u, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %126
  %128 = load i32, ptr @v, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [511 x i64], ptr %127, i64 0, i64 %129
  %131 = load i64, ptr %130, align 8, !tbaa !12
  %132 = trunc i64 %131 to i32
  store i32 %132, ptr %8, align 4, !tbaa !5
  %133 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = load i32, ptr @u, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %137
  %139 = load i32, ptr @v, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [511 x i64], ptr %138, i64 0, i64 %140
  store i64 %135, ptr %141, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %142 = load i32, ptr @v, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %143
  %145 = load i32, ptr @u, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [511 x i64], ptr %144, i64 0, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !12
  %149 = trunc i64 %148 to i32
  store i32 %149, ptr %9, align 4, !tbaa !5
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = load i32, ptr @v, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %154
  %156 = load i32, ptr @u, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [511 x i64], ptr %155, i64 0, i64 %157
  store i64 %152, ptr %158, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %159

159:                                              ; preds = %116
  %160 = load i32, ptr %7, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %7, align 4, !tbaa !5
  br label %100, !llvm.loop !16

162:                                              ; preds = %104
  store i32 0, ptr @last, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %190, %162
  %164 = load i32, ptr %10, align 4, !tbaa !5
  %165 = load i32, ptr @n, align 4, !tbaa !5
  %166 = icmp sle i32 %164, %165
  br i1 %166, label %168, label %167

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

168:                                              ; preds = %163
  %169 = load i32, ptr %10, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = load i32, ptr @last, align 4, !tbaa !5
  %174 = icmp ne i32 %172, %173
  br i1 %174, label %175, label %189

175:                                              ; preds = %168
  %176 = load i32, ptr @last, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr @last, align 4, !tbaa !5
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = load i32, ptr @last, align 4, !tbaa !5
  %180 = call noundef i32 @_Z3dfsii(i32 noundef %178, i32 noundef %179)
  %181 = load i32, ptr @last, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = icmp ne i32 %180, %184
  br i1 %185, label %186, label %188

186:                                              ; preds = %175
  %187 = call i32 @puts(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %193

188:                                              ; preds = %175
  br label %189

189:                                              ; preds = %188, %168
  br label %190

190:                                              ; preds = %189
  %191 = load i32, ptr %10, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %10, align 4, !tbaa !5
  br label %163, !llvm.loop !17

193:                                              ; preds = %186, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %194 = load i32, ptr %3, align 4
  switch i32 %194, label %324 [
    i32 17, label %195
    i32 1, label %322
  ]

195:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %196

196:                                              ; preds = %251, %195
  %197 = load i32, ptr %11, align 4, !tbaa !5
  %198 = load i32, ptr @k, align 4, !tbaa !5
  %199 = icmp sle i32 %197, %198
  br i1 %199, label %201, label %200

200:                                              ; preds = %196
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %254

201:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %202

202:                                              ; preds = %247, %201
  %203 = load i32, ptr %12, align 4, !tbaa !5
  %204 = load i32, ptr @k, align 4, !tbaa !5
  %205 = icmp sle i32 %203, %204
  br i1 %205, label %207, label %206

206:                                              ; preds = %202
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %250

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

208:                                              ; preds = %243, %207
  %209 = load i32, ptr %13, align 4, !tbaa !5
  %210 = load i32, ptr @k, align 4, !tbaa !5
  %211 = icmp sle i32 %209, %210
  br i1 %211, label %213, label %212

212:                                              ; preds = %208
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %246

213:                                              ; preds = %208
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %215
  %217 = load i32, ptr %13, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [511 x i64], ptr %216, i64 0, i64 %218
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %220 = load i32, ptr %12, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %221
  %223 = load i32, ptr %11, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [511 x i64], ptr %222, i64 0, i64 %224
  %226 = load i64, ptr %225, align 8, !tbaa !12
  %227 = load i32, ptr %11, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %228
  %230 = load i32, ptr %13, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [511 x i64], ptr %229, i64 0, i64 %231
  %233 = load i64, ptr %232, align 8, !tbaa !12
  %234 = add nsw i64 %226, %233
  store i64 %234, ptr %14, align 8, !tbaa !12
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %219, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %236 = load i64, ptr %235, align 8, !tbaa !12
  %237 = load i32, ptr %12, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %238
  %240 = load i32, ptr %13, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [511 x i64], ptr %239, i64 0, i64 %241
  store i64 %236, ptr %242, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %243

243:                                              ; preds = %213
  %244 = load i32, ptr %13, align 4, !tbaa !5
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %13, align 4, !tbaa !5
  br label %208, !llvm.loop !18

246:                                              ; preds = %212
  br label %247

247:                                              ; preds = %246
  %248 = load i32, ptr %12, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %12, align 4, !tbaa !5
  br label %202, !llvm.loop !19

250:                                              ; preds = %206
  br label %251

251:                                              ; preds = %250
  %252 = load i32, ptr %11, align 4, !tbaa !5
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %11, align 4, !tbaa !5
  br label %196, !llvm.loop !20

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

255:                                              ; preds = %272, %254
  %256 = load i32, ptr %15, align 4, !tbaa !5
  %257 = load i32, ptr @k, align 4, !tbaa !5
  %258 = icmp sle i32 %256, %257
  br i1 %258, label %260, label %259

259:                                              ; preds = %255
  store i32 29, ptr %3, align 4
  br label %275

260:                                              ; preds = %255
  %261 = load i32, ptr %15, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %262
  %264 = load i32, ptr %15, align 4, !tbaa !5
  %265 = sext i32 %264 to i64
  %266 = getelementptr inbounds [511 x i64], ptr %263, i64 0, i64 %265
  %267 = load i64, ptr %266, align 8, !tbaa !12
  %268 = icmp ne i64 %267, 0
  br i1 %268, label %269, label %271

269:                                              ; preds = %260
  %270 = call i32 @puts(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %275

271:                                              ; preds = %260
  br label %272

272:                                              ; preds = %271
  %273 = load i32, ptr %15, align 4, !tbaa !5
  %274 = add nsw i32 %273, 1
  store i32 %274, ptr %15, align 4, !tbaa !5
  br label %255, !llvm.loop !21

275:                                              ; preds = %269, %259
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %276 = load i32, ptr %3, align 4
  switch i32 %276, label %324 [
    i32 29, label %277
    i32 1, label %322
  ]

277:                                              ; preds = %275
  %278 = call i32 @puts(ptr noundef @.str.4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %279

279:                                              ; preds = %318, %277
  %280 = load i32, ptr %16, align 4, !tbaa !5
  %281 = load i32, ptr @k, align 4, !tbaa !5
  %282 = icmp sle i32 %280, %281
  br i1 %282, label %284, label %283

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

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

285:                                              ; preds = %313, %284
  %286 = load i32, ptr %17, align 4, !tbaa !5
  %287 = load i32, ptr @k, align 4, !tbaa !5
  %288 = icmp sle i32 %286, %287
  br i1 %288, label %290, label %289

289:                                              ; preds = %285
  store i32 35, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %316

290:                                              ; preds = %285
  %291 = load i32, ptr %16, align 4, !tbaa !5
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %292
  %294 = load i32, ptr %17, align 4, !tbaa !5
  %295 = sext i32 %294 to i64
  %296 = getelementptr inbounds [511 x i64], ptr %293, i64 0, i64 %295
  %297 = load i64, ptr %296, align 8, !tbaa !12
  %298 = load i64, ptr @INF, align 8, !tbaa !12
  %299 = icmp eq i64 %297, %298
  br i1 %299, label %300, label %301

300:                                              ; preds = %290
  br label %310

301:                                              ; preds = %290
  %302 = load i32, ptr %16, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %303
  %305 = load i32, ptr %17, align 4, !tbaa !5
  %306 = sext i32 %305 to i64
  %307 = getelementptr inbounds [511 x i64], ptr %304, i64 0, i64 %306
  %308 = load i64, ptr %307, align 8, !tbaa !12
  %309 = trunc i64 %308 to i32
  br label %310

310:                                              ; preds = %301, %300
  %311 = phi i32 [ -1, %300 ], [ %309, %301 ]
  %312 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %311)
  br label %313

313:                                              ; preds = %310
  %314 = load i32, ptr %17, align 4, !tbaa !5
  %315 = add nsw i32 %314, 1
  store i32 %315, ptr %17, align 4, !tbaa !5
  br label %285, !llvm.loop !22

316:                                              ; preds = %289
  %317 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %318

318:                                              ; preds = %316
  %319 = load i32, ptr %16, align 4, !tbaa !5
  %320 = add nsw i32 %319, 1
  store i32 %320, ptr %16, align 4, !tbaa !5
  br label %279, !llvm.loop !23

321:                                              ; preds = %283
  store i32 0, ptr %1, align 4
  br label %322

322:                                              ; preds = %321, %275, %193
  %323 = load i32, ptr %1, align 4
  ret i32 %323

324:                                              ; preds = %275, %193
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

declare i32 @puts(ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!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}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@c = external dso_local global [511 x i32], align 16
@last = external dso_local local_unnamed_addr global i32, align 4
@u = external dso_local global i32, align 4
@v = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@type = external dso_local local_unnamed_addr global [100100 x i32], align 16
@g = external dso_local global [511 x [511 x i64]], align 16
@INF = external dso_local local_unnamed_addr global i64, align 8
@adj = external dso_local global [100100 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %5 = load i32, ptr @k, align 4, !tbaa !5
  %.not103 = icmp slt i32 %5, 1
  br i1 %.not103, label %.preheader96, label %.lr.ph106

.preheader98:                                     ; preds = %._crit_edge
  %.not70111 = icmp slt i32 %23, 1
  br i1 %.not70111, label %.preheader96, label %.preheader97.lr.ph

.preheader97.lr.ph:                               ; preds = %.preheader98
  %6 = load i64, ptr @INF, align 8
  %7 = add nuw i32 %23, 1
  %wide.trip.count154 = zext i32 %7 to i64
  %8 = zext nneg i32 %23 to i64
  %min.iters.check196 = icmp ult i32 %23, 4
  %n.vec199 = and i64 %8, 2147483644
  %ind.end200 = or disjoint i64 %n.vec199, 1
  %broadcast.splatinsert205 = insertelement <2 x i64> poison, i64 %6, i64 0
  %broadcast.splat206 = shufflevector <2 x i64> %broadcast.splatinsert205, <2 x i64> poison, <2 x i32> zeroinitializer
  %cmp.n208 = icmp eq i64 %n.vec199, %8
  br label %.preheader97

.lr.ph106:                                        ; preds = %0, %._crit_edge
  %indvars.iv145 = phi i64 [ %indvars.iv.next146, %._crit_edge ], [ 1, %0 ]
  %9 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %indvars.iv145
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %9)
  %11 = load i32, ptr @last, align 4, !tbaa !5
  %12 = load i32, ptr %9, align 4, !tbaa !5
  %13 = add nsw i32 %12, %11
  %.not82.not101 = icmp sgt i32 %12, 0
  br i1 %.not82.not101, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph106
  %14 = sext i32 %11 to i64
  %15 = sext i32 %13 to i64
  %16 = trunc nuw nsw i64 %indvars.iv145 to i32
  %17 = add nsw i64 %14, 1
  %smax = tail call i64 @llvm.smax.i64(i64 %17, i64 %15)
  %18 = sub i64 %smax, %14
  %min.iters.check = icmp ult i64 %18, 8
  br i1 %min.iters.check, label %.lr.ph.preheader213, label %vector.ph

.lr.ph.preheader213:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ %14, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %18, -8
  %ind.end = add i64 %n.vec, %14
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %16, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %14
  %19 = add nsw i64 %offset.idx, 1
  %20 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %19
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  store <4 x i32> %broadcast.splat, ptr %20, align 4, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %21, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %22 = icmp eq i64 %index.next, %n.vec
  br i1 %22, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %18, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader213

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.lr.ph106
  store i32 %13, ptr @last, align 4, !tbaa !5
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %23 = load i32, ptr @k, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %.not.not = icmp slt i64 %indvars.iv145, %24
  br i1 %.not.not, label %.lr.ph106, label %.preheader98, !llvm.loop !13

.lr.ph:                                           ; preds = %.lr.ph.preheader213, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader213 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %25 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %indvars.iv.next
  store i32 %16, ptr %25, align 4, !tbaa !5
  %.not82.not = icmp slt i64 %indvars.iv.next, %15
  br i1 %.not82.not, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.preheader97:                                     ; preds = %.preheader97.lr.ph, %37
  %indvars.iv151 = phi i64 [ 1, %.preheader97.lr.ph ], [ %indvars.iv.next152, %37 ]
  br i1 %min.iters.check196, label %scalar.ph195.preheader, label %vector.body202

scalar.ph195.preheader:                           ; preds = %middle.block194, %.preheader97
  %indvars.iv148.ph = phi i64 [ 1, %.preheader97 ], [ %ind.end200, %middle.block194 ]
  br label %scalar.ph195

vector.body202:                                   ; preds = %.preheader97, %vector.body202
  %index203 = phi i64 [ %index.next207, %vector.body202 ], [ 0, %.preheader97 ]
  %offset.idx204 = or disjoint i64 %index203, 1
  %26 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv151, i64 %offset.idx204
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  store <2 x i64> %broadcast.splat206, ptr %26, align 8, !tbaa !15
  store <2 x i64> %broadcast.splat206, ptr %27, align 8, !tbaa !15
  %index.next207 = add nuw i64 %index203, 4
  %28 = icmp eq i64 %index.next207, %n.vec199
  br i1 %28, label %middle.block194, label %vector.body202, !llvm.loop !17

middle.block194:                                  ; preds = %vector.body202
  br i1 %cmp.n208, label %._crit_edge110, label %scalar.ph195.preheader

.preheader96:                                     ; preds = %37, %0, %.preheader98
  %29 = load i32, ptr @m, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph114, label %._crit_edge115

._crit_edge110:                                   ; preds = %scalar.ph195, %middle.block194
  %31 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %indvars.iv151
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %35, label %37

scalar.ph195:                                     ; preds = %scalar.ph195.preheader, %scalar.ph195
  %indvars.iv148 = phi i64 [ %indvars.iv.next149, %scalar.ph195 ], [ %indvars.iv148.ph, %scalar.ph195.preheader ]
  %34 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv151, i64 %indvars.iv148
  store i64 %6, ptr %34, align 8, !tbaa !15
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count154
  br i1 %exitcond.not, label %._crit_edge110, label %scalar.ph195, !llvm.loop !18

35:                                               ; preds = %._crit_edge110
  %36 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv151, i64 %indvars.iv151
  store i64 0, ptr %36, align 8, !tbaa !15
  br label %37

37:                                               ; preds = %._crit_edge110, %35
  %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
  %exitcond155.not = icmp eq i64 %indvars.iv.next152, %wide.trip.count154
  br i1 %exitcond155.not, label %.preheader96, label %.preheader97, !llvm.loop !19

._crit_edge115:                                   ; preds = %49, %.preheader96
  store i32 0, ptr @last, align 4, !tbaa !5
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %.not71116 = icmp slt i32 %38, 1
  br i1 %.not71116, label %.preheader95, label %.lr.ph119

.lr.ph114:                                        ; preds = %.preheader96, %49
  %.059113 = phi i32 [ %82, %49 ], [ 0, %.preheader96 ]
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @u, ptr noundef nonnull @v, ptr noundef nonnull @x)
  %40 = load i32, ptr @x, align 4, !tbaa !5
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %49

42:                                               ; preds = %.lr.ph114
  %43 = load i32, ptr @u, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @adj, i64 0, i64 %44
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %45, ptr noundef nonnull align 4 dereferenceable(4) @v)
  %46 = load i32, ptr @v, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @adj, i64 0, i64 %47
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %48, ptr noundef nonnull align 4 dereferenceable(4) @u)
  br label %49

49:                                               ; preds = %42, %.lr.ph114
  %50 = load i32, ptr @u, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  store i32 %53, ptr @u, align 4, !tbaa !5
  %54 = load i32, ptr @v, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  store i32 %57, ptr @v, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %58 = sext i32 %53 to i64
  %59 = sext i32 %57 to i64
  %60 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %58, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !15
  %62 = trunc i64 %61 to i32
  store i32 %62, ptr %1, align 4, !tbaa !5
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = load i32, ptr @u, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = load i32, ptr @v, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %67, i64 %69
  store i64 %65, ptr %70, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %71 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %69, i64 %67
  %72 = load i64, ptr %71, align 8, !tbaa !15
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %2, align 4, !tbaa !5
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = load i32, ptr @v, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = load i32, ptr @u, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %78, i64 %80
  store i64 %76, ptr %81, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %82 = add nuw nsw i32 %.059113, 1
  %83 = load i32, ptr @m, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %.lr.ph114, label %._crit_edge115, !llvm.loop !20

.preheader95:                                     ; preds = %98, %._crit_edge115
  %85 = load i32, ptr @k, align 4, !tbaa !5
  %.not74127 = icmp slt i32 %85, 1
  br i1 %.not74127, label %._crit_edge133, label %.preheader94

.lr.ph119:                                        ; preds = %._crit_edge115, %98
  %86 = phi i32 [ %99, %98 ], [ %38, %._crit_edge115 ]
  %87 = phi i32 [ %100, %98 ], [ 0, %._crit_edge115 ]
  %indvars.iv156 = phi i64 [ %indvars.iv.next157, %98 ], [ 1, %._crit_edge115 ]
  %88 = getelementptr inbounds [100100 x i32], ptr @type, i64 0, i64 %indvars.iv156
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %.not72 = icmp eq i32 %89, %87
  br i1 %.not72, label %98, label %90

90:                                               ; preds = %.lr.ph119
  %91 = add nsw i32 %87, 1
  store i32 %91, ptr @last, align 4, !tbaa !5
  %92 = trunc nuw nsw i64 %indvars.iv156 to i32
  %93 = call noundef i32 @_Z3dfsii(i32 noundef %92, i32 noundef %91)
  %94 = load i32, ptr @last, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [511 x i32], ptr @c, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %.not73 = icmp eq i32 %93, %97
  br i1 %.not73, label %._crit_edge179, label %.loopexit.sink.split

._crit_edge179:                                   ; preds = %90
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %._crit_edge179, %.lr.ph119
  %99 = phi i32 [ %86, %.lr.ph119 ], [ %.pre, %._crit_edge179 ]
  %100 = phi i32 [ %87, %.lr.ph119 ], [ %94, %._crit_edge179 ]
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %101 = sext i32 %99 to i64
  %.not71.not = icmp slt i64 %indvars.iv156, %101
  br i1 %.not71.not, label %.lr.ph119, label %.preheader95, !llvm.loop !21

.preheader94:                                     ; preds = %.preheader95, %._crit_edge126
  %102 = phi i32 [ %107, %._crit_edge126 ], [ %85, %.preheader95 ]
  %indvars.iv165 = phi i64 [ %indvars.iv.next166, %._crit_edge126 ], [ 1, %.preheader95 ]
  %.not79124 = icmp slt i32 %102, 1
  br i1 %.not79124, label %._crit_edge126, label %.preheader93

.preheader92:                                     ; preds = %._crit_edge126
  %.not75130 = icmp slt i32 %107, 1
  br i1 %.not75130, label %._crit_edge133, label %.lr.ph132.preheader

.lr.ph132.preheader:                              ; preds = %.preheader92
  %103 = add nuw i32 %107, 1
  %wide.trip.count171 = zext i32 %103 to i64
  br label %.lr.ph132

.preheader93:                                     ; preds = %.preheader94, %._crit_edge123
  %104 = phi i32 [ %109, %._crit_edge123 ], [ %102, %.preheader94 ]
  %105 = phi i32 [ %110, %._crit_edge123 ], [ %102, %.preheader94 ]
  %indvars.iv162 = phi i64 [ %indvars.iv.next163, %._crit_edge123 ], [ 1, %.preheader94 ]
  %.not80120 = icmp slt i32 %105, 1
  br i1 %.not80120, label %.preheader93.._crit_edge123_crit_edge, label %.lr.ph122

.preheader93.._crit_edge123_crit_edge:            ; preds = %.preheader93
  %.pre180 = sext i32 %105 to i64
  br label %._crit_edge123

.lr.ph122:                                        ; preds = %.preheader93
  %106 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv162, i64 %indvars.iv165
  br label %111

._crit_edge126:                                   ; preds = %._crit_edge123, %.preheader94
  %107 = phi i32 [ %102, %.preheader94 ], [ %109, %._crit_edge123 ]
  %indvars.iv.next166 = add nuw nsw i64 %indvars.iv165, 1
  %108 = sext i32 %107 to i64
  %.not74.not = icmp slt i64 %indvars.iv165, %108
  br i1 %.not74.not, label %.preheader94, label %.preheader92, !llvm.loop !22

._crit_edge123:                                   ; preds = %111, %.preheader93.._crit_edge123_crit_edge
  %.pre-phi = phi i64 [ %.pre180, %.preheader93.._crit_edge123_crit_edge ], [ %120, %111 ]
  %109 = phi i32 [ %104, %.preheader93.._crit_edge123_crit_edge ], [ %119, %111 ]
  %110 = phi i32 [ %105, %.preheader93.._crit_edge123_crit_edge ], [ %119, %111 ]
  %indvars.iv.next163 = add nuw nsw i64 %indvars.iv162, 1
  %.not79.not = icmp slt i64 %indvars.iv162, %.pre-phi
  br i1 %.not79.not, label %.preheader93, label %._crit_edge126, !llvm.loop !24

111:                                              ; preds = %.lr.ph122, %111
  %indvars.iv159 = phi i64 [ 1, %.lr.ph122 ], [ %indvars.iv.next160, %111 ]
  %112 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv162, i64 %indvars.iv159
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %113 = load i64, ptr %106, align 8, !tbaa !15
  %114 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv165, i64 %indvars.iv159
  %115 = load i64, ptr %114, align 8, !tbaa !15
  %116 = add nsw i64 %115, %113
  store i64 %116, ptr %3, align 8, !tbaa !15
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %112, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %118 = load i64, ptr %117, align 8, !tbaa !15
  store i64 %118, ptr %112, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
  %119 = load i32, ptr @k, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %.not80.not = icmp slt i64 %indvars.iv159, %120
  br i1 %.not80.not, label %111, label %._crit_edge123, !llvm.loop !25

121:                                              ; preds = %.lr.ph132
  %indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
  %exitcond172.not = icmp eq i64 %indvars.iv.next169, %wide.trip.count171
  br i1 %exitcond172.not, label %._crit_edge133, label %.lr.ph132, !llvm.loop !26

.lr.ph132:                                        ; preds = %.lr.ph132.preheader, %121
  %indvars.iv168 = phi i64 [ 1, %.lr.ph132.preheader ], [ %indvars.iv.next169, %121 ]
  %122 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv168, i64 %indvars.iv168
  %123 = load i64, ptr %122, align 8, !tbaa !15
  %.not76 = icmp eq i64 %123, 0
  br i1 %.not76, label %121, label %.loopexit.sink.split

._crit_edge133:                                   ; preds = %121, %.preheader95, %.preheader92
  %124 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  %125 = load i32, ptr @k, align 4, !tbaa !5
  %.not77138 = icmp slt i32 %125, 1
  br i1 %.not77138, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %._crit_edge133, %._crit_edge137
  %126 = phi i32 [ %128, %._crit_edge137 ], [ %125, %._crit_edge133 ]
  %indvars.iv176 = phi i64 [ %indvars.iv.next177, %._crit_edge137 ], [ 1, %._crit_edge133 ]
  %.not78134 = icmp slt i32 %126, 1
  br i1 %.not78134, label %._crit_edge137, label %.lr.ph136

._crit_edge137:                                   ; preds = %.lr.ph136, %.preheader
  %127 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
  %128 = load i32, ptr @k, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %.not77.not = icmp slt i64 %indvars.iv176, %129
  br i1 %.not77.not, label %.preheader, label %.loopexit, !llvm.loop !27

.lr.ph136:                                        ; preds = %.preheader, %.lr.ph136
  %indvars.iv173 = phi i64 [ %indvars.iv.next174, %.lr.ph136 ], [ 1, %.preheader ]
  %130 = getelementptr inbounds [511 x [511 x i64]], ptr @g, i64 0, i64 %indvars.iv176, i64 %indvars.iv173
  %131 = load i64, ptr %130, align 8, !tbaa !15
  %132 = load i64, ptr @INF, align 8, !tbaa !15
  %133 = icmp eq i64 %131, %132
  %134 = trunc i64 %131 to i32
  %spec.select = select i1 %133, i32 -1, i32 %134
  %135 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %spec.select)
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  %136 = load i32, ptr @k, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %.not78.not = icmp slt i64 %indvars.iv173, %137
  br i1 %.not78.not, label %.lr.ph136, label %._crit_edge137, !llvm.loop !28

.loopexit.sink.split:                             ; preds = %90, %.lr.ph132
  %138 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge137, %.loopexit.sink.split, %._crit_edge133
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint 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 #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 = 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}
!14 = distinct !{!14, !10, !12, !11}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !23}
!23 = !{!"llvm.loop.unswitch.partial.disable"}
!24 = distinct !{!24, !10, !23}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass