; LLVM IR from reyadussalahin/problem-solving :: graph/bfs/codeforces/F1296F (Solution)

; 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 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@adj = external dso_local global [5010 x %"class.std::vector"], align 16
@a = external dso_local global [5010 x [5010 x i32]], align 16
@b = external dso_local global [5010 x [5010 x i32]], align 16
@c = external dso_local global [5010 x i32], align 16
@cc = external dso_local global [5010 x i32], align 16
@q = external dso_local global [5010 x i32], align 16
@p = external dso_local global [5010 x i32], align 16
@seen = external dso_local global [5010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 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 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 i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %53, %0
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %3, ptr noundef %4)
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [5010 x %"class.std::vector"], ptr @adj, i64 0, i64 %35
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [5010 x %"class.std::vector"], ptr @adj, i64 0, i64 %38
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [5010 x [5010 x i32]], ptr @b, i64 0, i64 %42
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [5010 x i32], ptr %43, i64 0, i64 %45
  store i32 %40, ptr %46, align 4, !tbaa !5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [5010 x [5010 x i32]], ptr @b, i64 0, i64 %48
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [5010 x i32], ptr %49, i64 0, i64 %51
  store i32 %40, ptr %52, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %32
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %7, align 4, !tbaa !5
  br label %27, !llvm.loop !9

56:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %8)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %257, %56
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %260

63:                                               ; preds = %58
  %64 = load i32, ptr %9, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %65
  %67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %5, ptr noundef %6, ptr noundef %66)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = load i32, ptr %12, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %12, align 4, !tbaa !5
  %71 = sext i32 %69 to i64
  %72 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %71
  store i32 %68, ptr %72, align 4, !tbaa !5
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %74
  store i32 1, ptr %75, align 4, !tbaa !5
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %77
  store i32 0, ptr %78, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %141, %63
  %80 = load i32, ptr %11, align 4, !tbaa !5
  %81 = load i32, ptr %12, align 4, !tbaa !5
  %82 = icmp ne i32 %80, %81
  br i1 %82, label %83, label %142

83:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %84 = load i32, ptr %11, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %11, align 4, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  store i32 %88, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %89 = load i32, ptr %14, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [5010 x %"class.std::vector"], ptr @adj, i64 0, i64 %90
  store ptr %91, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %92 = load ptr, ptr %15, align 8, !tbaa !11
  %93 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %92) #6
  %94 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %93, ptr %94, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %95 = load ptr, ptr %15, align 8, !tbaa !11
  %96 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #6
  %97 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %96, ptr %97, align 8
  br label %98

98:                                               ; preds = %131, %83
  %99 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  br i1 %99, label %101, label %100

100:                                              ; preds = %98
  store i32 10, ptr %10, align 4
  br label %133

101:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  %103 = load i32, ptr %102, align 4, !tbaa !5
  store i32 %103, ptr %18, align 4, !tbaa !5
  %104 = load i32, ptr %18, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %110

109:                                              ; preds = %101
  store i32 11, ptr %10, align 4
  br label %128

110:                                              ; preds = %101
  %111 = load i32, ptr %18, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %112
  store i32 1, ptr %113, align 4, !tbaa !5
  %114 = load i32, ptr %14, align 4, !tbaa !5
  %115 = load i32, ptr %18, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %116
  store i32 %114, ptr %117, align 4, !tbaa !5
  %118 = load i32, ptr %18, align 4, !tbaa !5
  %119 = load i32, ptr %12, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %12, align 4, !tbaa !5
  %121 = sext i32 %119 to i64
  %122 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %121
  store i32 %118, ptr %122, align 4, !tbaa !5
  %123 = load i32, ptr %18, align 4, !tbaa !5
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = icmp eq i32 %123, %124
  br i1 %125, label %126, label %127

126:                                              ; preds = %110
  store i32 1, ptr %13, align 4, !tbaa !5
  store i32 10, ptr %10, align 4
  br label %128

127:                                              ; preds = %110
  store i32 0, ptr %10, align 4
  br label %128

128:                                              ; preds = %127, %126, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  %129 = load i32, ptr %10, align 4
  switch i32 %129, label %133 [
    i32 0, label %130
    i32 11, label %131
  ]

130:                                              ; preds = %128
  br label %131

131:                                              ; preds = %130, %128
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  br label %98

133:                                              ; preds = %128, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %138

137:                                              ; preds = %134
  store i32 9, ptr %10, align 4
  br label %139

138:                                              ; preds = %134
  store i32 0, ptr %10, align 4
  br label %139

139:                                              ; preds = %138, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %140 = load i32, ptr %10, align 4
  switch i32 %140, label %349 [
    i32 0, label %141
    i32 9, label %142
  ]

141:                                              ; preds = %139
  br label %79, !llvm.loop !13

142:                                              ; preds = %139, %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %143 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %143, ptr %19, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %229, %142
  %145 = load i32, ptr %19, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %234

150:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %151 = load i32, ptr %19, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [5010 x [5010 x i32]], ptr @b, i64 0, i64 %152
  %154 = load i32, ptr %19, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [5010 x i32], ptr %153, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  store i32 %160, ptr %20, align 4, !tbaa !5
  %161 = load i32, ptr %20, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [5010 x i32], ptr @c, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %217

166:                                              ; preds = %150
  %167 = load i32, ptr %9, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = load i32, ptr %20, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %172
  %174 = getelementptr inbounds [5010 x i32], ptr %173, i64 0, i64 0
  %175 = load i32, ptr %174, align 8, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = icmp sgt i32 %170, %178
  br i1 %179, label %180, label %189

180:                                              ; preds = %166
  %181 = load i32, ptr %9, align 4, !tbaa !5
  %182 = load i32, ptr %20, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %183
  %185 = getelementptr inbounds [5010 x i32], ptr %184, i64 0, i64 0
  store i32 %181, ptr %185, align 8, !tbaa !5
  %186 = load i32, ptr %20, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [5010 x i32], ptr @c, i64 0, i64 %187
  store i32 1, ptr %188, align 4, !tbaa !5
  br label %216

189:                                              ; preds = %166
  %190 = load i32, ptr %9, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = load i32, ptr %20, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %195
  %197 = getelementptr inbounds [5010 x i32], ptr %196, i64 0, i64 0
  %198 = load i32, ptr %197, align 8, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = icmp eq i32 %193, %201
  br i1 %202, label %203, label %215

203:                                              ; preds = %189
  %204 = load i32, ptr %9, align 4, !tbaa !5
  %205 = load i32, ptr %20, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %206
  %208 = load i32, ptr %20, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [5010 x i32], ptr @c, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %210, align 4, !tbaa !5
  %213 = sext i32 %211 to i64
  %214 = getelementptr inbounds [5010 x i32], ptr %207, i64 0, i64 %213
  store i32 %204, ptr %214, align 4, !tbaa !5
  br label %215

215:                                              ; preds = %203, %189
  br label %216

216:                                              ; preds = %215, %180
  br label %229

217:                                              ; preds = %150
  %218 = load i32, ptr %9, align 4, !tbaa !5
  %219 = load i32, ptr %20, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %220
  %222 = load i32, ptr %20, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [5010 x i32], ptr @c, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = add nsw i32 %225, 1
  store i32 %226, ptr %224, align 4, !tbaa !5
  %227 = sext i32 %225 to i64
  %228 = getelementptr inbounds [5010 x i32], ptr %221, i64 0, i64 %227
  store i32 %218, ptr %228, align 4, !tbaa !5
  br label %229

229:                                              ; preds = %217, %216
  %230 = load i32, ptr %19, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %231
  %233 = load i32, ptr %232, align 4, !tbaa !5
  store i32 %233, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %144, !llvm.loop !14

234:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %235

235:                                              ; preds = %253, %234
  %236 = load i32, ptr %21, align 4, !tbaa !5
  %237 = load i32, ptr %12, align 4, !tbaa !5
  %238 = icmp slt i32 %236, %237
  br i1 %238, label %240, label %239

239:                                              ; preds = %235
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %256

240:                                              ; preds = %235
  %241 = load i32, ptr %21, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %242
  %244 = load i32, ptr %243, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %245
  store i32 0, ptr %246, align 4, !tbaa !5
  %247 = load i32, ptr %21, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %248
  %250 = load i32, ptr %249, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %251
  store i32 0, ptr %252, align 4, !tbaa !5
  br label %253

253:                                              ; preds = %240
  %254 = load i32, ptr %21, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %21, align 4, !tbaa !5
  br label %235, !llvm.loop !15

256:                                              ; preds = %239
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %257

257:                                              ; preds = %256
  %258 = load i32, ptr %9, align 4, !tbaa !5
  %259 = add nsw i32 %258, 1
  store i32 %259, ptr %9, align 4, !tbaa !5
  br label %58, !llvm.loop !16

260:                                              ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 1, ptr %23, align 4, !tbaa !5
  br label %261

261:                                              ; preds = %304, %260
  %262 = load i32, ptr %23, align 4, !tbaa !5
  %263 = load i32, ptr %2, align 4, !tbaa !5
  %264 = icmp slt i32 %262, %263
  br i1 %264, label %266, label %265

265:                                              ; preds = %261
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %307

266:                                              ; preds = %261
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %267

267:                                              ; preds = %300, %266
  %268 = load i32, ptr %24, align 4, !tbaa !5
  %269 = load i32, ptr %23, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [5010 x i32], ptr @c, i64 0, i64 %270
  %272 = load i32, ptr %271, align 4, !tbaa !5
  %273 = icmp slt i32 %268, %272
  br i1 %273, label %275, label %274

274:                                              ; preds = %267
  store i32 20, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %303

275:                                              ; preds = %267
  %276 = load i32, ptr %23, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %277
  %279 = load i32, ptr %24, align 4, !tbaa !5
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [5010 x i32], ptr %278, i64 0, i64 %280
  %282 = load i32, ptr %281, align 4, !tbaa !5
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !5
  %286 = icmp ne i32 %285, 0
  br i1 %286, label %299, label %287

287:                                              ; preds = %275
  %288 = load i32, ptr %22, align 4, !tbaa !5
  %289 = add nsw i32 %288, 1
  store i32 %289, ptr %22, align 4, !tbaa !5
  %290 = load i32, ptr %23, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %291
  %293 = load i32, ptr %24, align 4, !tbaa !5
  %294 = sext i32 %293 to i64
  %295 = getelementptr inbounds [5010 x i32], ptr %292, i64 0, i64 %294
  %296 = load i32, ptr %295, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %297
  store i32 1, ptr %298, align 4, !tbaa !5
  br label %299

299:                                              ; preds = %287, %275
  br label %300

300:                                              ; preds = %299
  %301 = load i32, ptr %24, align 4, !tbaa !5
  %302 = add nsw i32 %301, 1
  store i32 %302, ptr %24, align 4, !tbaa !5
  br label %267, !llvm.loop !17

303:                                              ; preds = %274
  br label %304

304:                                              ; preds = %303
  %305 = load i32, ptr %23, align 4, !tbaa !5
  %306 = add nsw i32 %305, 1
  store i32 %306, ptr %23, align 4, !tbaa !5
  br label %261, !llvm.loop !18

307:                                              ; preds = %265
  %308 = load i32, ptr %22, align 4, !tbaa !5
  %309 = load i32, ptr %8, align 4, !tbaa !5
  %310 = icmp eq i32 %308, %309
  br i1 %310, label %311, label %345

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

312:                                              ; preds = %340, %311
  %313 = load i32, ptr %25, align 4, !tbaa !5
  %314 = load i32, ptr %2, align 4, !tbaa !5
  %315 = icmp slt i32 %313, %314
  br i1 %315, label %317, label %316

316:                                              ; preds = %312
  store i32 23, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %343

317:                                              ; preds = %312
  %318 = load i32, ptr %25, align 4, !tbaa !5
  %319 = sext i32 %318 to i64
  %320 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %319
  %321 = getelementptr inbounds [5010 x i32], ptr %320, i64 0, i64 0
  %322 = load i32, ptr %321, align 8, !tbaa !5
  %323 = sext i32 %322 to i64
  %324 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %323
  %325 = load i32, ptr %324, align 4, !tbaa !5
  %326 = icmp ne i32 %325, 0
  br i1 %326, label %327, label %336

327:                                              ; preds = %317
  %328 = load i32, ptr %25, align 4, !tbaa !5
  %329 = sext i32 %328 to i64
  %330 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %329
  %331 = getelementptr inbounds [5010 x i32], ptr %330, i64 0, i64 0
  %332 = load i32, ptr %331, align 8, !tbaa !5
  %333 = sext i32 %332 to i64
  %334 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %333
  %335 = load i32, ptr %334, align 4, !tbaa !5
  br label %337

336:                                              ; preds = %317
  br label %337

337:                                              ; preds = %336, %327
  %338 = phi i32 [ %335, %327 ], [ 1000000, %336 ]
  %339 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %338)
  br label %340

340:                                              ; preds = %337
  %341 = load i32, ptr %25, align 4, !tbaa !5
  %342 = add nsw i32 %341, 1
  store i32 %342, ptr %25, align 4, !tbaa !5
  br label %312, !llvm.loop !19

343:                                              ; preds = %316
  %344 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  br label %347

345:                                              ; preds = %307
  %346 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %347

347:                                              ; preds = %345, %343
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %348 = load i32, ptr %1, align 4
  ret i32 %348

349:                                              ; preds = %139
  unreachable
}

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 #4 = { 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 = { 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 #6 = { nounwind }

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

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


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

%"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 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@adj = external dso_local global [5010 x %"class.std::vector"], align 16
@a = external dso_local local_unnamed_addr global [5010 x [5010 x i32]], align 16
@b = external dso_local local_unnamed_addr global [5010 x [5010 x i32]], align 16
@c = external dso_local local_unnamed_addr global [5010 x i32], align 16
@cc = external dso_local global [5010 x i32], align 16
@q = external dso_local local_unnamed_addr global [5010 x i32], align 16
@p = external dso_local local_unnamed_addr global [5010 x i32], align 16
@seen = external dso_local local_unnamed_addr global [5010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #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 %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  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 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 1
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %6)
  %13 = load i32, ptr %6, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph118, label %.preheader97

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.066100 = phi i32 [ %28, %.lr.ph ], [ 1, %0 ]
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [5010 x %"class.std::vector"], ptr @adj, i64 0, i64 %17
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [5010 x %"class.std::vector"], ptr @adj, i64 0, i64 %20
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [5010 x [5010 x i32]], ptr @b, i64 0, i64 %23, i64 %25
  store i32 %.066100, ptr %26, align 4, !tbaa !5
  %27 = getelementptr inbounds [5010 x [5010 x i32]], ptr @b, i64 0, i64 %25, i64 %23
  store i32 %.066100, ptr %27, align 4, !tbaa !5
  %28 = add nuw nsw i32 %.066100, 1
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader97:                                     ; preds = %._crit_edge115, %._crit_edge
  %.lcssa99 = phi i32 [ %13, %._crit_edge ], [ %103, %._crit_edge115 ]
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 1
  br i1 %32, label %.preheader96.preheader, label %._crit_edge127.thread

.preheader96.preheader:                           ; preds = %.preheader97
  %wide.trip.count148 = zext nneg i32 %31 to i64
  br label %.preheader96

.lr.ph118:                                        ; preds = %._crit_edge, %._crit_edge115
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %._crit_edge115 ], [ 0, %._crit_edge ]
  %33 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %indvars.iv137
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %33)
  %35 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %35, ptr @q, align 16, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %36
  store i32 1, ptr %37, align 4, !tbaa !5
  %38 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %36
  store i32 0, ptr %38, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %.lr.ph118, %._crit_edge104
  %.073161 = phi i32 [ 1, %.lr.ph118 ], [ %.376, %._crit_edge104 ]
  %indvars.iv160 = phi i64 [ 0, %.lr.ph118 ], [ %indvars.iv.next, %._crit_edge104 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv160, 1
  %40 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %indvars.iv160
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [5010 x %"class.std::vector"], ptr @adj, i64 0, i64 %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %44 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #6
  store ptr %44, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %45 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #6
  store ptr %45, ptr %8, align 8
  %46 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br i1 %46, label %.lr.ph103, label %._crit_edge104

.lr.ph103:                                        ; preds = %39, %59
  %.174101 = phi i32 [ %.275.ph, %59 ], [ %.073161, %39 ]
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %.not86 = icmp eq i32 %51, 0
  br i1 %.not86, label %52, label %59

52:                                               ; preds = %.lr.ph103
  store i32 1, ptr %50, align 4, !tbaa !5
  %53 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %49
  store i32 %41, ptr %53, align 4, !tbaa !5
  %54 = add nsw i32 %.174101, 1
  %55 = sext i32 %.174101 to i64
  %56 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %55
  store i32 %48, ptr %56, align 4, !tbaa !5
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = icmp eq i32 %48, %57
  br i1 %58, label %._crit_edge104.thread, label %59

._crit_edge104.thread:                            ; preds = %52
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %.loopexit

59:                                               ; preds = %.lr.ph103, %52
  %.275.ph = phi i32 [ %54, %52 ], [ %.174101, %.lr.ph103 ]
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %61 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br i1 %61, label %.lr.ph103, label %._crit_edge104

._crit_edge104:                                   ; preds = %59, %39
  %.376 = phi i32 [ %.073161, %39 ], [ %.275.ph, %59 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %62 = zext i32 %.376 to i64
  %.not85 = icmp eq i64 %indvars.iv.next, %62
  br i1 %.not85, label %.loopexit, label %39

.loopexit:                                        ; preds = %._crit_edge104, %._crit_edge104.thread
  %.4 = phi i32 [ %54, %._crit_edge104.thread ], [ %.376, %._crit_edge104 ]
  %.065109 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %.065109 to i64
  %64 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %.not88110 = icmp eq i32 %65, 0
  br i1 %.not88110, label %.preheader98, label %.lr.ph112.preheader

.lr.ph112.preheader:                              ; preds = %.loopexit
  %66 = trunc nuw nsw i64 %indvars.iv137 to i32
  %67 = trunc nuw nsw i64 %indvars.iv137 to i32
  %68 = trunc nuw nsw i64 %indvars.iv137 to i32
  br label %.lr.ph112

.preheader98:                                     ; preds = %95, %.loopexit
  %69 = icmp sgt i32 %.4, 0
  br i1 %69, label %.lr.ph114.preheader, label %._crit_edge115

.lr.ph114.preheader:                              ; preds = %.preheader98
  %wide.trip.count = zext nneg i32 %.4 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %70 = icmp ult i32 %.4, 4
  br i1 %70, label %._crit_edge115.loopexit.unr-lcssa, label %.lr.ph114.preheader.new

.lr.ph114.preheader.new:                          ; preds = %.lr.ph114.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph114

.lr.ph112:                                        ; preds = %.lr.ph112.preheader, %95
  %.065 = phi i32 [ %97, %95 ], [ %65, %.lr.ph112.preheader ]
  %71 = phi i64 [ %72, %95 ], [ %63, %.lr.ph112.preheader ]
  %72 = sext i32 %.065 to i64
  %73 = getelementptr inbounds [5010 x [5010 x i32]], ptr @b, i64 0, i64 %71, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [5010 x i32], ptr @c, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %.not89 = icmp eq i32 %77, 0
  br i1 %.not89, label %93, label %78

78:                                               ; preds = %.lr.ph112
  %79 = load i32, ptr %33, align 4, !tbaa !5
  %80 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %75
  %81 = load i32, ptr %80, align 8, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = icmp sgt i32 %79, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %78
  store i32 %67, ptr %80, align 8, !tbaa !5
  store i32 1, ptr %76, align 4, !tbaa !5
  br label %95

87:                                               ; preds = %78
  %88 = icmp eq i32 %79, %84
  br i1 %88, label %89, label %95

89:                                               ; preds = %87
  %90 = add nsw i32 %77, 1
  store i32 %90, ptr %76, align 4, !tbaa !5
  %91 = sext i32 %77 to i64
  %92 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %75, i64 %91
  store i32 %66, ptr %92, align 4, !tbaa !5
  br label %95

93:                                               ; preds = %.lr.ph112
  %94 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %75
  store i32 1, ptr %76, align 4, !tbaa !5
  store i32 %68, ptr %94, align 8, !tbaa !5
  br label %95

95:                                               ; preds = %86, %89, %87, %93
  %96 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %72
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %.not88 = icmp eq i32 %97, 0
  br i1 %.not88, label %.preheader98, label %.lr.ph112, !llvm.loop !11

._crit_edge115.loopexit.unr-lcssa:                ; preds = %.lr.ph114, %.lr.ph114.preheader
  %indvars.iv134.unr = phi i64 [ 0, %.lr.ph114.preheader ], [ %indvars.iv.next135.3, %.lr.ph114 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge115, label %.lr.ph114.epil

.lr.ph114.epil:                                   ; preds = %._crit_edge115.loopexit.unr-lcssa, %.lr.ph114.epil
  %indvars.iv134.epil = phi i64 [ %indvars.iv.next135.epil, %.lr.ph114.epil ], [ %indvars.iv134.unr, %._crit_edge115.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph114.epil ], [ 0, %._crit_edge115.loopexit.unr-lcssa ]
  %98 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %indvars.iv134.epil
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %100
  store i32 0, ptr %101, align 4, !tbaa !5
  %102 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %100
  store i32 0, ptr %102, align 4, !tbaa !5
  %indvars.iv.next135.epil = add nuw nsw i64 %indvars.iv134.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge115, label %.lr.ph114.epil, !llvm.loop !12

._crit_edge115:                                   ; preds = %._crit_edge115.loopexit.unr-lcssa, %.lr.ph114.epil, %.preheader98
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = icmp slt i64 %indvars.iv.next138, %104
  br i1 %105, label %.lr.ph118, label %.preheader97, !llvm.loop !14

.lr.ph114:                                        ; preds = %.lr.ph114, %.lr.ph114.preheader.new
  %indvars.iv134 = phi i64 [ 0, %.lr.ph114.preheader.new ], [ %indvars.iv.next135.3, %.lr.ph114 ]
  %niter = phi i64 [ 0, %.lr.ph114.preheader.new ], [ %niter.next.3, %.lr.ph114 ]
  %106 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %indvars.iv134
  %107 = load i32, ptr %106, align 16, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %108
  store i32 0, ptr %109, align 4, !tbaa !5
  %110 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %108
  store i32 0, ptr %110, align 4, !tbaa !5
  %indvars.iv.next135 = or disjoint i64 %indvars.iv134, 1
  %111 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %indvars.iv.next135
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %113
  store i32 0, ptr %114, align 4, !tbaa !5
  %115 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %113
  store i32 0, ptr %115, align 4, !tbaa !5
  %indvars.iv.next135.1 = or disjoint i64 %indvars.iv134, 2
  %116 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %indvars.iv.next135.1
  %117 = load i32, ptr %116, align 8, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %118
  store i32 0, ptr %119, align 4, !tbaa !5
  %120 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %118
  store i32 0, ptr %120, align 4, !tbaa !5
  %indvars.iv.next135.2 = or disjoint i64 %indvars.iv134, 3
  %121 = getelementptr inbounds [5010 x i32], ptr @q, i64 0, i64 %indvars.iv.next135.2
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %123
  store i32 0, ptr %124, align 4, !tbaa !5
  %125 = getelementptr inbounds [5010 x i32], ptr @p, i64 0, i64 %123
  store i32 0, ptr %125, align 4, !tbaa !5
  %indvars.iv.next135.3 = add nuw nsw i64 %indvars.iv134, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge115.loopexit.unr-lcssa, label %.lr.ph114, !llvm.loop !15

.preheader96:                                     ; preds = %.preheader96.preheader, %._crit_edge123
  %indvars.iv145 = phi i64 [ 1, %.preheader96.preheader ], [ %indvars.iv.next146, %._crit_edge123 ]
  %.063125 = phi i32 [ 0, %.preheader96.preheader ], [ %.1.lcssa, %._crit_edge123 ]
  %126 = getelementptr inbounds [5010 x i32], ptr @c, i64 0, i64 %indvars.iv145
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = icmp sgt i32 %127, 0
  br i1 %128, label %.lr.ph122.preheader, label %._crit_edge123

.lr.ph122.preheader:                              ; preds = %.preheader96
  %wide.trip.count143 = zext nneg i32 %127 to i64
  %xtraiter163 = and i64 %wide.trip.count143, 1
  %129 = icmp eq i32 %127, 1
  br i1 %129, label %._crit_edge123.loopexit.unr-lcssa, label %.lr.ph122.preheader.new

.lr.ph122.preheader.new:                          ; preds = %.lr.ph122.preheader
  %unroll_iter167 = and i64 %wide.trip.count143, 2147483646
  br label %.lr.ph122

._crit_edge127:                                   ; preds = %._crit_edge123
  %130 = icmp eq i32 %.1.lcssa, %.lcssa99
  br i1 %130, label %.preheader, label %163

._crit_edge127.thread:                            ; preds = %.preheader97
  %131 = icmp eq i32 %.lcssa99, 0
  br i1 %131, label %._crit_edge131, label %163

.preheader:                                       ; preds = %._crit_edge127
  br i1 %32, label %.lr.ph130, label %._crit_edge131

._crit_edge123.loopexit.unr-lcssa:                ; preds = %153, %.lr.ph122.preheader
  %.2.lcssa.ph = phi i32 [ poison, %.lr.ph122.preheader ], [ %.2.1, %153 ]
  %indvars.iv140.unr = phi i64 [ 0, %.lr.ph122.preheader ], [ %indvars.iv.next141.1, %153 ]
  %.1120.unr = phi i32 [ %.063125, %.lr.ph122.preheader ], [ %.2.1, %153 ]
  %lcmp.mod165.not = icmp eq i64 %xtraiter163, 0
  br i1 %lcmp.mod165.not, label %._crit_edge123, label %.lr.ph122.epil

.lr.ph122.epil:                                   ; preds = %._crit_edge123.loopexit.unr-lcssa
  %132 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %indvars.iv145, i64 %indvars.iv140.unr
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %.not84.epil = icmp eq i32 %136, 0
  br i1 %.not84.epil, label %137, label %._crit_edge123

137:                                              ; preds = %.lr.ph122.epil
  %138 = add nsw i32 %.1120.unr, 1
  store i32 1, ptr %135, align 4, !tbaa !5
  br label %._crit_edge123

._crit_edge123:                                   ; preds = %._crit_edge123.loopexit.unr-lcssa, %137, %.lr.ph122.epil, %.preheader96
  %.1.lcssa = phi i32 [ %.063125, %.preheader96 ], [ %.2.lcssa.ph, %._crit_edge123.loopexit.unr-lcssa ], [ %.1120.unr, %.lr.ph122.epil ], [ %138, %137 ]
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %exitcond149.not = icmp eq i64 %indvars.iv.next146, %wide.trip.count148
  br i1 %exitcond149.not, label %._crit_edge127, label %.preheader96, !llvm.loop !16

.lr.ph122:                                        ; preds = %153, %.lr.ph122.preheader.new
  %indvars.iv140 = phi i64 [ 0, %.lr.ph122.preheader.new ], [ %indvars.iv.next141.1, %153 ]
  %.1120 = phi i32 [ %.063125, %.lr.ph122.preheader.new ], [ %.2.1, %153 ]
  %niter168 = phi i64 [ 0, %.lr.ph122.preheader.new ], [ %niter168.next.1, %153 ]
  %139 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %indvars.iv145, i64 %indvars.iv140
  %140 = load i32, ptr %139, align 8, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %.not84 = icmp eq i32 %143, 0
  br i1 %.not84, label %144, label %.lr.ph122.1

144:                                              ; preds = %.lr.ph122
  %145 = add nsw i32 %.1120, 1
  store i32 1, ptr %142, align 4, !tbaa !5
  br label %.lr.ph122.1

.lr.ph122.1:                                      ; preds = %.lr.ph122, %144
  %.2 = phi i32 [ %.1120, %.lr.ph122 ], [ %145, %144 ]
  %indvars.iv.next141 = or disjoint i64 %indvars.iv140, 1
  %146 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %indvars.iv145, i64 %indvars.iv.next141
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [5010 x i32], ptr @seen, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %.not84.1 = icmp eq i32 %150, 0
  br i1 %.not84.1, label %151, label %153

151:                                              ; preds = %.lr.ph122.1
  %152 = add nsw i32 %.2, 1
  store i32 1, ptr %149, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %151, %.lr.ph122.1
  %.2.1 = phi i32 [ %.2, %.lr.ph122.1 ], [ %152, %151 ]
  %indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 2
  %niter168.next.1 = add i64 %niter168, 2
  %niter168.ncmp.1 = icmp eq i64 %niter168.next.1, %unroll_iter167
  br i1 %niter168.ncmp.1, label %._crit_edge123.loopexit.unr-lcssa, label %.lr.ph122, !llvm.loop !17

.lr.ph130:                                        ; preds = %.preheader, %.lr.ph130
  %indvars.iv150 = phi i64 [ %indvars.iv.next151, %.lr.ph130 ], [ 1, %.preheader ]
  %154 = getelementptr inbounds [5010 x [5010 x i32]], ptr @a, i64 0, i64 %indvars.iv150
  %155 = load i32, ptr %154, align 8, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [5010 x i32], ptr @cc, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %.not = icmp eq i32 %158, 0
  %spec.select = select i1 %.not, i32 1000000, i32 %158
  %159 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %spec.select)
  %indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
  %160 = load i32, ptr %1, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = icmp slt i64 %indvars.iv.next151, %161
  br i1 %162, label %.lr.ph130, label %._crit_edge131, !llvm.loop !18

163:                                              ; preds = %._crit_edge127.thread, %._crit_edge127
  br label %._crit_edge131

._crit_edge131:                                   ; preds = %.lr.ph130, %.preheader, %._crit_edge127.thread, %163
  %.str.6.sink = phi ptr [ @.str.6, %163 ], [ @.str.5, %._crit_edge127.thread ], [ @.str.5, %.preheader ], [ @.str.5, %.lr.ph130 ]
  %164 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.6.sink)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, 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
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; 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 #3 align 2

; 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 nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 = { 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 #6 = { nounwind }

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

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


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