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

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@grid = external dso_local global [1000 x [1000 x i32]], align 16
@s1 = external dso_local global [1000 x i32], align 16
@s2 = external dso_local global [1000 x i32], align 16
@dp = external dso_local global [1000 x [2 x i32]], align 16
@INF = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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
  store i32 0, ptr %1, align 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x, ptr noundef @y)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %48, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %44, %22
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %31)
  %33 = load i8, ptr %32, align 1, !tbaa !9
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 35
  br i1 %35, label %36, label %43

36:                                               ; preds = %29
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000 x i32], ptr %39, i64 0, i64 %41
  store i32 1, ptr %42, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %36, %29
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %4, align 4, !tbaa !5
  br label %24, !llvm.loop !10

47:                                               ; preds = %28
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !12

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

52:                                               ; preds = %89, %51
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = load i32, ptr @m, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

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

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

58:                                               ; preds = %85, %57
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %88

63:                                               ; preds = %58
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %65
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000 x i32], ptr %66, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %78

72:                                               ; preds = %63
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %75, align 4, !tbaa !5
  br label %84

78:                                               ; preds = %63
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %81, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %78, %72
  br label %85

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

88:                                               ; preds = %62
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %5, align 4, !tbaa !5
  br label %52, !llvm.loop !14

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

93:                                               ; preds = %119, %92
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = load i32, ptr @m, align 4, !tbaa !5
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %98, label %97

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

98:                                               ; preds = %93
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = add nsw i32 %107, %103
  store i32 %108, ptr %106, align 4, !tbaa !5
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sub nsw i32 %109, 1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = add nsw i32 %117, %113
  store i32 %118, ptr %116, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %98
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %7, align 4, !tbaa !5
  br label %93, !llvm.loop !15

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

123:                                              ; preds = %138, %122
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = load i32, ptr @m, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %141

128:                                              ; preds = %123
  %129 = load i32, ptr @INF, align 4, !tbaa !5
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %131
  %133 = getelementptr inbounds [2 x i32], ptr %132, i64 0, i64 1
  store i32 %129, ptr %133, align 4, !tbaa !5
  %134 = load i32, ptr %8, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %135
  %137 = getelementptr inbounds [2 x i32], ptr %136, i64 0, i64 0
  store i32 %129, ptr %137, align 8, !tbaa !5
  br label %138

138:                                              ; preds = %128
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %8, align 4, !tbaa !5
  br label %123, !llvm.loop !16

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

142:                                              ; preds = %157, %141
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = load i32, ptr @x, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %160

147:                                              ; preds = %142
  %148 = load i32, ptr @INF, align 4, !tbaa !5
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %150
  %152 = getelementptr inbounds [2 x i32], ptr %151, i64 0, i64 1
  store i32 %148, ptr %152, align 4, !tbaa !5
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %154
  %156 = getelementptr inbounds [2 x i32], ptr %155, i64 0, i64 0
  store i32 %148, ptr %156, align 8, !tbaa !5
  br label %157

157:                                              ; preds = %147
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %9, align 4, !tbaa !5
  br label %142, !llvm.loop !17

160:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %161 = load i32, ptr @x, align 4, !tbaa !5
  %162 = sub nsw i32 %161, 1
  store i32 %162, ptr %10, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %185, %160
  %164 = load i32, ptr %10, align 4, !tbaa !5
  %165 = load i32, ptr @y, align 4, !tbaa !5
  %166 = icmp slt i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %188

168:                                              ; preds = %163
  %169 = load i32, ptr %10, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = load i32, ptr %10, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %174
  %176 = getelementptr inbounds [2 x i32], ptr %175, i64 0, i64 0
  store i32 %172, ptr %176, align 8, !tbaa !5
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = load i32, ptr %10, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %182
  %184 = getelementptr inbounds [2 x i32], ptr %183, i64 0, i64 1
  store i32 %180, ptr %184, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %168
  %186 = load i32, ptr %10, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %10, align 4, !tbaa !5
  br label %163, !llvm.loop !18

188:                                              ; preds = %167
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %189 = load i32, ptr @x, align 4, !tbaa !5
  store i32 %189, ptr %11, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %281, %188
  %191 = load i32, ptr %11, align 4, !tbaa !5
  %192 = load i32, ptr @m, align 4, !tbaa !5
  %193 = icmp slt i32 %191, %192
  br i1 %193, label %195, label %194

194:                                              ; preds = %190
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %284

195:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %196 = load i32, ptr @x, align 4, !tbaa !5
  %197 = sub nsw i32 %196, 1
  store i32 %197, ptr %12, align 4, !tbaa !5
  br label %198

198:                                              ; preds = %277, %195
  %199 = load i32, ptr %12, align 4, !tbaa !5
  %200 = load i32, ptr @y, align 4, !tbaa !5
  %201 = icmp slt i32 %199, %200
  br i1 %201, label %203, label %202

202:                                              ; preds = %198
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %280

203:                                              ; preds = %198
  %204 = load i32, ptr %11, align 4, !tbaa !5
  %205 = load i32, ptr %12, align 4, !tbaa !5
  %206 = add nsw i32 %204, %205
  %207 = load i32, ptr @m, align 4, !tbaa !5
  %208 = icmp slt i32 %206, %207
  br i1 %208, label %209, label %276

209:                                              ; preds = %203
  %210 = load i32, ptr %11, align 4, !tbaa !5
  %211 = load i32, ptr %12, align 4, !tbaa !5
  %212 = add nsw i32 %210, %211
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %213
  %215 = getelementptr inbounds [2 x i32], ptr %214, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %216 = load i32, ptr %11, align 4, !tbaa !5
  %217 = sub nsw i32 %216, 1
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %218
  %220 = getelementptr inbounds [2 x i32], ptr %219, i64 0, i64 1
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = load i32, ptr %11, align 4, !tbaa !5
  %223 = load i32, ptr %12, align 4, !tbaa !5
  %224 = add nsw i32 %222, %223
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = add nsw i32 %221, %227
  %229 = load i32, ptr %11, align 4, !tbaa !5
  %230 = sub nsw i32 %229, 1
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %231
  %233 = load i32, ptr %232, align 4, !tbaa !5
  %234 = sub nsw i32 %228, %233
  store i32 %234, ptr %13, align 4, !tbaa !5
  %235 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %215, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = load i32, ptr %11, align 4, !tbaa !5
  %238 = load i32, ptr %12, align 4, !tbaa !5
  %239 = add nsw i32 %237, %238
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %240
  %242 = getelementptr inbounds [2 x i32], ptr %241, i64 0, i64 0
  store i32 %236, ptr %242, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  %243 = load i32, ptr %11, align 4, !tbaa !5
  %244 = load i32, ptr %12, align 4, !tbaa !5
  %245 = add nsw i32 %243, %244
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %246
  %248 = getelementptr inbounds [2 x i32], ptr %247, i64 0, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %249 = load i32, ptr %11, align 4, !tbaa !5
  %250 = sub nsw i32 %249, 1
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %251
  %253 = getelementptr inbounds [2 x i32], ptr %252, i64 0, i64 0
  %254 = load i32, ptr %253, align 8, !tbaa !5
  %255 = load i32, ptr %11, align 4, !tbaa !5
  %256 = load i32, ptr %12, align 4, !tbaa !5
  %257 = add nsw i32 %255, %256
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %258
  %260 = load i32, ptr %259, align 4, !tbaa !5
  %261 = add nsw i32 %254, %260
  %262 = load i32, ptr %11, align 4, !tbaa !5
  %263 = sub nsw i32 %262, 1
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %264
  %266 = load i32, ptr %265, align 4, !tbaa !5
  %267 = sub nsw i32 %261, %266
  store i32 %267, ptr %14, align 4, !tbaa !5
  %268 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %248, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %269 = load i32, ptr %268, align 4, !tbaa !5
  %270 = load i32, ptr %11, align 4, !tbaa !5
  %271 = load i32, ptr %12, align 4, !tbaa !5
  %272 = add nsw i32 %270, %271
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %273
  %275 = getelementptr inbounds [2 x i32], ptr %274, i64 0, i64 1
  store i32 %269, ptr %275, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %276

276:                                              ; preds = %209, %203
  br label %277

277:                                              ; preds = %276
  %278 = load i32, ptr %12, align 4, !tbaa !5
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr %12, align 4, !tbaa !5
  br label %198, !llvm.loop !19

280:                                              ; preds = %202
  br label %281

281:                                              ; preds = %280
  %282 = load i32, ptr %11, align 4, !tbaa !5
  %283 = add nsw i32 %282, 1
  store i32 %283, ptr %11, align 4, !tbaa !5
  br label %190, !llvm.loop !20

284:                                              ; preds = %194
  %285 = load i32, ptr @m, align 4, !tbaa !5
  %286 = sub nsw i32 %285, 1
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %287
  %289 = getelementptr inbounds [2 x i32], ptr %288, i64 0, i64 0
  %290 = load i32, ptr @m, align 4, !tbaa !5
  %291 = sub nsw i32 %290, 1
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %292
  %294 = getelementptr inbounds [2 x i32], ptr %293, i64 0, i64 1
  %295 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %289, ptr noundef nonnull align 4 dereferenceable(4) %294)
  %296 = load i32, ptr %295, align 4, !tbaa !5
  %297 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %296)
  %298 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %297, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #3 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

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

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

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


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@grid = external dso_local local_unnamed_addr global [1000 x [1000 x i32]], align 16
@s1 = external dso_local local_unnamed_addr global [1000 x i32], align 16
@s2 = external dso_local local_unnamed_addr global [1000 x i32], align 16
@dp = external dso_local global [1000 x [2 x i32]], align 16
@INF = external dso_local local_unnamed_addr global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

..preheader74_crit_edge:                          ; preds = %0
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %.preheader74

.preheader74:                                     ; preds = %._crit_edge, %..preheader74_crit_edge
  %7 = phi i32 [ %.pre, %..preheader74_crit_edge ], [ %28, %._crit_edge ]
  %.lcssa77 = phi i32 [ %5, %..preheader74_crit_edge ], [ %29, %._crit_edge ]
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader73.lr.ph, label %.preheader70

.preheader73.lr.ph:                               ; preds = %.preheader74
  %9 = icmp sgt i32 %.lcssa77, 0
  br i1 %9, label %.preheader73.us.preheader, label %.preheader72

.preheader73.us.preheader:                        ; preds = %.preheader73.lr.ph
  %wide.trip.count120 = zext nneg i32 %7 to i64
  %wide.trip.count = zext nneg i32 %.lcssa77 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %10 = icmp eq i32 %.lcssa77, 1
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader73.us

.preheader73.us:                                  ; preds = %.preheader73.us.preheader, %._crit_edge84.us
  %indvars.iv117 = phi i64 [ 0, %.preheader73.us.preheader ], [ %indvars.iv.next118, %._crit_edge84.us ]
  %11 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %indvars.iv117
  %12 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %indvars.iv117
  br i1 %10, label %._crit_edge84.us.unr-lcssa, label %.preheader73.us.new

.preheader73.us.new:                              ; preds = %.preheader73.us, %.preheader73.us.new
  %indvars.iv114 = phi i64 [ %indvars.iv.next115.1, %.preheader73.us.new ], [ 0, %.preheader73.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader73.us.new ], [ 0, %.preheader73.us ]
  %13 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %indvars.iv114, i64 %indvars.iv117
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %.not.us = icmp eq i32 %14, 0
  %. = select i1 %.not.us, ptr %12, ptr %11
  %15 = load i32, ptr %., align 4, !tbaa !5
  %16 = add nsw i32 %15, 1
  store i32 %16, ptr %., align 4, !tbaa !5
  %indvars.iv.next115 = or disjoint i64 %indvars.iv114, 1
  %17 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %indvars.iv.next115, i64 %indvars.iv117
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %.not.us.1 = icmp eq i32 %18, 0
  %..1 = select i1 %.not.us.1, ptr %12, ptr %11
  %19 = load i32, ptr %..1, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %..1, align 4, !tbaa !5
  %indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge84.us.unr-lcssa, label %.preheader73.us.new, !llvm.loop !9

._crit_edge84.us.unr-lcssa:                       ; preds = %.preheader73.us.new, %.preheader73.us
  %indvars.iv114.unr = phi i64 [ 0, %.preheader73.us ], [ %indvars.iv.next115.1, %.preheader73.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge84.us, label %._crit_edge84.us.epilog-lcssa

._crit_edge84.us.epilog-lcssa:                    ; preds = %._crit_edge84.us.unr-lcssa
  %21 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %indvars.iv114.unr, i64 %indvars.iv117
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %.not.us.epil = icmp eq i32 %22, 0
  %..epil = select i1 %.not.us.epil, ptr %12, ptr %11
  %23 = load i32, ptr %..epil, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %..epil, align 4, !tbaa !5
  br label %._crit_edge84.us

._crit_edge84.us:                                 ; preds = %._crit_edge84.us.unr-lcssa, %._crit_edge84.us.epilog-lcssa
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120
  br i1 %exitcond121.not, label %.preheader72, label %.preheader73.us, !llvm.loop !11

.lr.ph81:                                         ; preds = %0, %._crit_edge
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %._crit_edge ], [ 0, %0 ]
  %25 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %37, %.lr.ph81
  %28 = phi i32 [ %26, %.lr.ph81 ], [ %38, %37 ]
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next112, %30
  br i1 %31, label %.lr.ph81, label %.preheader74, !llvm.loop !12

.lr.ph:                                           ; preds = %.lr.ph81, %37
  %indvars.iv = phi i64 [ %indvars.iv.next, %37 ], [ 0, %.lr.ph81 ]
  %32 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv)
  %33 = load i8, ptr %32, align 1, !tbaa !13
  %34 = icmp eq i8 %33, 35
  br i1 %34, label %35, label %37

35:                                               ; preds = %.lr.ph
  %36 = getelementptr inbounds [1000 x [1000 x i32]], ptr @grid, i64 0, i64 %indvars.iv111, i64 %indvars.iv
  store i32 1, ptr %36, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %.lr.ph, %35
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = icmp slt i64 %indvars.iv.next, %39
  br i1 %40, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.preheader72:                                     ; preds = %._crit_edge84.us, %.preheader73.lr.ph
  %.not164 = icmp eq i32 %7, 1
  br i1 %.not164, label %.preheader71, label %.lr.ph88.preheader

.lr.ph88.preheader:                               ; preds = %.preheader72
  %wide.trip.count125 = zext nneg i32 %7 to i64
  %.pre147 = load i32, ptr @s1, align 16, !tbaa !5
  %.pre148 = load i32, ptr @s2, align 16, !tbaa !5
  %41 = add nsw i64 %wide.trip.count125, -1
  %xtraiter210 = and i64 %41, 1
  %42 = icmp eq i32 %7, 2
  br i1 %42, label %.preheader71.loopexit.unr-lcssa, label %.lr.ph88.preheader.new

.lr.ph88.preheader.new:                           ; preds = %.lr.ph88.preheader
  %unroll_iter213 = and i64 %41, -2
  br label %.lr.ph88

.preheader71.loopexit.unr-lcssa:                  ; preds = %.lr.ph88, %.lr.ph88.preheader
  %.unr = phi i32 [ %.pre148, %.lr.ph88.preheader ], [ %68, %.lr.ph88 ]
  %.unr211 = phi i32 [ %.pre147, %.lr.ph88.preheader ], [ %65, %.lr.ph88 ]
  %indvars.iv122.unr = phi i64 [ 1, %.lr.ph88.preheader ], [ %indvars.iv.next123.1, %.lr.ph88 ]
  %lcmp.mod212.not = icmp eq i64 %xtraiter210, 0
  br i1 %lcmp.mod212.not, label %.preheader71, label %.lr.ph88.epil

.lr.ph88.epil:                                    ; preds = %.preheader71.loopexit.unr-lcssa
  %43 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %indvars.iv122.unr
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, %.unr211
  store i32 %45, ptr %43, align 4, !tbaa !5
  %46 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %indvars.iv122.unr
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, %.unr
  store i32 %48, ptr %46, align 4, !tbaa !5
  br label %.preheader71

.preheader71:                                     ; preds = %.lr.ph88.epil, %.preheader71.loopexit.unr-lcssa, %.preheader72
  br i1 %8, label %.lr.ph90, label %.preheader70

.lr.ph90:                                         ; preds = %.preheader71
  %49 = load i32, ptr @INF, align 4, !tbaa !5
  %wide.trip.count130 = zext nneg i32 %7 to i64
  %min.iters.check = icmp ult i32 %7, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph90
  %n.vec = and i64 %wide.trip.count130, 2147483644
  %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %49, i64 0
  %50 = shufflevector <2 x i32> %broadcast.splatinsert, <2 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 ]
  %51 = or disjoint i64 %index, 2
  %52 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %index
  %53 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %51
  store <4 x i32> %50, ptr %52, align 16, !tbaa !5
  store <4 x i32> %50, ptr %53, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %54 = icmp eq i64 %index.next, %n.vec
  br i1 %54, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count130
  br i1 %cmp.n, label %.preheader70, label %scalar.ph.preheader

.lr.ph88:                                         ; preds = %.lr.ph88, %.lr.ph88.preheader.new
  %55 = phi i32 [ %.pre148, %.lr.ph88.preheader.new ], [ %68, %.lr.ph88 ]
  %56 = phi i32 [ %.pre147, %.lr.ph88.preheader.new ], [ %65, %.lr.ph88 ]
  %indvars.iv122 = phi i64 [ 1, %.lr.ph88.preheader.new ], [ %indvars.iv.next123.1, %.lr.ph88 ]
  %niter214 = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %niter214.next.1, %.lr.ph88 ]
  %57 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %indvars.iv122
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add nsw i32 %58, %56
  store i32 %59, ptr %57, align 4, !tbaa !5
  %60 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %indvars.iv122
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, %55
  store i32 %62, ptr %60, align 4, !tbaa !5
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %63 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %indvars.iv.next123
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %64, %59
  store i32 %65, ptr %63, align 4, !tbaa !5
  %66 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %indvars.iv.next123
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, %62
  store i32 %68, ptr %66, align 4, !tbaa !5
  %indvars.iv.next123.1 = add nuw nsw i64 %indvars.iv122, 2
  %niter214.next.1 = add i64 %niter214, 2
  %niter214.ncmp.1 = icmp eq i64 %niter214.next.1, %unroll_iter213
  br i1 %niter214.ncmp.1, label %.preheader71.loopexit.unr-lcssa, label %.lr.ph88, !llvm.loop !18

.preheader70:                                     ; preds = %scalar.ph, %middle.block, %.preheader74, %.preheader71
  %69 = load i32, ptr @x, align 4, !tbaa !5
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.lr.ph92, label %._crit_edge93

.lr.ph92:                                         ; preds = %.preheader70
  %71 = load i32, ptr @INF, align 4, !tbaa !5
  %wide.trip.count135 = zext nneg i32 %69 to i64
  %min.iters.check174 = icmp ult i32 %69, 4
  br i1 %min.iters.check174, label %scalar.ph173.preheader, label %vector.ph175

scalar.ph173.preheader:                           ; preds = %middle.block172, %.lr.ph92
  %indvars.iv132.ph = phi i64 [ 0, %.lr.ph92 ], [ %n.vec177, %middle.block172 ]
  br label %scalar.ph173

vector.ph175:                                     ; preds = %.lr.ph92
  %n.vec177 = and i64 %wide.trip.count135, 2147483644
  %broadcast.splatinsert181 = insertelement <2 x i32> poison, i32 %71, i64 0
  %72 = shufflevector <2 x i32> %broadcast.splatinsert181, <2 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body179

vector.body179:                                   ; preds = %vector.body179, %vector.ph175
  %index180 = phi i64 [ 0, %vector.ph175 ], [ %index.next185, %vector.body179 ]
  %73 = or disjoint i64 %index180, 2
  %74 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %index180
  %75 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %73
  store <4 x i32> %72, ptr %74, align 16, !tbaa !5
  store <4 x i32> %72, ptr %75, align 16, !tbaa !5
  %index.next185 = add nuw i64 %index180, 4
  %76 = icmp eq i64 %index.next185, %n.vec177
  br i1 %76, label %middle.block172, label %vector.body179, !llvm.loop !19

middle.block172:                                  ; preds = %vector.body179
  %cmp.n186 = icmp eq i64 %n.vec177, %wide.trip.count135
  br i1 %cmp.n186, label %._crit_edge93, label %scalar.ph173.preheader

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv127 = phi i64 [ %indvars.iv.next128, %scalar.ph ], [ %indvars.iv127.ph, %scalar.ph.preheader ]
  %77 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv127
  %78 = getelementptr inbounds i8, ptr %77, i64 4
  store i32 %49, ptr %78, align 4, !tbaa !5
  store i32 %49, ptr %77, align 8, !tbaa !5
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %exitcond131.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count130
  br i1 %exitcond131.not, label %.preheader70, label %scalar.ph, !llvm.loop !20

._crit_edge93:                                    ; preds = %scalar.ph173, %middle.block172, %.preheader70
  %79 = load i32, ptr @y, align 4, !tbaa !5
  %.not = icmp sgt i32 %69, %79
  br i1 %.not, label %.preheader, label %.lr.ph97.preheader

.lr.ph97.preheader:                               ; preds = %._crit_edge93
  %80 = add i32 %69, -1
  %81 = sext i32 %80 to i64
  %82 = sub i32 %79, %69
  %83 = zext i32 %82 to i64
  %84 = add nuw nsw i64 %83, 1
  %min.iters.check189 = icmp ult i32 %82, 3
  br i1 %min.iters.check189, label %.lr.ph97.preheader206, label %vector.ph190

.lr.ph97.preheader206:                            ; preds = %middle.block187, %.lr.ph97.preheader
  %indvars.iv137.ph = phi i64 [ %81, %.lr.ph97.preheader ], [ %ind.end, %middle.block187 ]
  br label %.lr.ph97

vector.ph190:                                     ; preds = %.lr.ph97.preheader
  %n.vec192 = and i64 %84, 8589934588
  %ind.end = add nsw i64 %n.vec192, %81
  br label %vector.body194

vector.body194:                                   ; preds = %vector.body194, %vector.ph190
  %index195 = phi i64 [ 0, %vector.ph190 ], [ %index.next201, %vector.body194 ]
  %offset.idx = add i64 %index195, %81
  %85 = add i64 %offset.idx, 2
  %86 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %offset.idx
  %87 = getelementptr inbounds i8, ptr %86, i64 8
  %wide.load = load <2 x i32>, ptr %86, align 4, !tbaa !5
  %wide.load196 = load <2 x i32>, ptr %87, align 4, !tbaa !5
  %88 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %offset.idx
  %89 = getelementptr inbounds i8, ptr %88, i64 8
  %wide.load197 = load <2 x i32>, ptr %88, align 4, !tbaa !5
  %wide.load198 = load <2 x i32>, ptr %89, align 4, !tbaa !5
  %90 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %offset.idx
  %91 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %85
  %interleaved.vec199 = shufflevector <2 x i32> %wide.load, <2 x i32> %wide.load197, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x i32> %interleaved.vec199, ptr %90, align 8, !tbaa !5
  %interleaved.vec200 = shufflevector <2 x i32> %wide.load196, <2 x i32> %wide.load198, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x i32> %interleaved.vec200, ptr %91, align 8, !tbaa !5
  %index.next201 = add nuw i64 %index195, 4
  %92 = icmp eq i64 %index.next201, %n.vec192
  br i1 %92, label %middle.block187, label %vector.body194, !llvm.loop !21

middle.block187:                                  ; preds = %vector.body194
  %cmp.n202 = icmp eq i64 %84, %n.vec192
  br i1 %cmp.n202, label %.preheader, label %.lr.ph97.preheader206

scalar.ph173:                                     ; preds = %scalar.ph173.preheader, %scalar.ph173
  %indvars.iv132 = phi i64 [ %indvars.iv.next133, %scalar.ph173 ], [ %indvars.iv132.ph, %scalar.ph173.preheader ]
  %93 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv132
  %94 = getelementptr inbounds i8, ptr %93, i64 4
  store i32 %71, ptr %94, align 4, !tbaa !5
  store i32 %71, ptr %93, align 8, !tbaa !5
  %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
  %exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135
  br i1 %exitcond136.not, label %._crit_edge93, label %scalar.ph173, !llvm.loop !22

.preheader:                                       ; preds = %.lr.ph97, %middle.block187, %._crit_edge93
  %95 = icmp slt i32 %69, %7
  br i1 %95, label %.lr.ph103.preheader, label %._crit_edge104

.lr.ph103.preheader:                              ; preds = %.preheader
  %96 = sext i32 %69 to i64
  br label %.lr.ph103

.lr.ph97:                                         ; preds = %.lr.ph97.preheader206, %.lr.ph97
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %.lr.ph97 ], [ %indvars.iv137.ph, %.lr.ph97.preheader206 ]
  %97 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %indvars.iv137
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv137
  store i32 %98, ptr %99, align 8, !tbaa !5
  %100 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %indvars.iv137
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = getelementptr inbounds i8, ptr %99, i64 4
  store i32 %101, ptr %102, align 4, !tbaa !5
  %indvars.iv.next138 = add nsw i64 %indvars.iv137, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next138 to i32
  %exitcond140.not = icmp eq i32 %79, %lftr.wideiv
  br i1 %exitcond140.not, label %.preheader, label %.lr.ph97, !llvm.loop !23

._crit_edge104:                                   ; preds = %._crit_edge101, %.preheader
  %.lcssa = phi i32 [ %7, %.preheader ], [ %122, %._crit_edge101 ]
  %103 = add nsw i32 %.lcssa, -1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %104
  %106 = getelementptr inbounds i8, ptr %105, i64 4
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %105, ptr noundef nonnull align 4 dereferenceable(4) %106)
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %108)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph103:                                        ; preds = %.lr.ph103.preheader, %._crit_edge101
  %.pre150 = phi i32 [ %7, %.lr.ph103.preheader ], [ %.pre150153, %._crit_edge101 ]
  %111 = phi i32 [ %7, %.lr.ph103.preheader ], [ %122, %._crit_edge101 ]
  %112 = phi i32 [ %79, %.lr.ph103.preheader ], [ %123, %._crit_edge101 ]
  %113 = phi i32 [ %79, %.lr.ph103.preheader ], [ %124, %._crit_edge101 ]
  %indvars.iv144 = phi i64 [ %96, %.lr.ph103.preheader ], [ %indvars.iv.next145, %._crit_edge101 ]
  %114 = load i32, ptr @x, align 4, !tbaa !5
  %.not106 = icmp sgt i32 %114, %113
  br i1 %.not106, label %._crit_edge101, label %.lr.ph100

.lr.ph100:                                        ; preds = %.lr.ph103
  %115 = add i32 %114, -1
  %116 = add nsw i64 %indvars.iv144, -1
  %117 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %116
  %118 = getelementptr inbounds i8, ptr %117, i64 4
  %119 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %116
  %120 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %116
  %121 = sext i32 %115 to i64
  br label %127

._crit_edge101:                                   ; preds = %152, %.lr.ph103
  %.pre150153 = phi i32 [ %.pre150, %.lr.ph103 ], [ %.pre150155, %152 ]
  %122 = phi i32 [ %111, %.lr.ph103 ], [ %154, %152 ]
  %123 = phi i32 [ %112, %.lr.ph103 ], [ %153, %152 ]
  %124 = phi i32 [ %113, %.lr.ph103 ], [ %153, %152 ]
  %indvars.iv.next145 = add nsw i64 %indvars.iv144, 1
  %125 = sext i32 %122 to i64
  %126 = icmp slt i64 %indvars.iv.next145, %125
  br i1 %126, label %.lr.ph103, label %._crit_edge104, !llvm.loop !24

127:                                              ; preds = %.lr.ph100, %152
  %.pre150154 = phi i32 [ %.pre150, %.lr.ph100 ], [ %.pre150155, %152 ]
  %128 = phi i32 [ %112, %.lr.ph100 ], [ %153, %152 ]
  %129 = phi i32 [ %.pre150, %.lr.ph100 ], [ %154, %152 ]
  %indvars.iv141 = phi i64 [ %121, %.lr.ph100 ], [ %indvars.iv.next142, %152 ]
  %130 = add nsw i64 %indvars.iv141, %indvars.iv144
  %131 = sext i32 %129 to i64
  %132 = icmp slt i64 %130, %131
  br i1 %132, label %133, label %152

133:                                              ; preds = %127
  %134 = getelementptr inbounds [1000 x [2 x i32]], ptr @dp, i64 0, i64 %130
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %135 = load i32, ptr %118, align 4, !tbaa !5
  %136 = getelementptr inbounds [1000 x i32], ptr @s1, i64 0, i64 %130
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = add nsw i32 %137, %135
  %139 = load i32, ptr %119, align 4, !tbaa !5
  %140 = sub i32 %138, %139
  store i32 %140, ptr %1, align 4, !tbaa !5
  %141 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %134, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %142 = load i32, ptr %141, align 4, !tbaa !5
  store i32 %142, ptr %134, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %143 = getelementptr inbounds i8, ptr %134, i64 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %144 = load i32, ptr %117, align 8, !tbaa !5
  %145 = getelementptr inbounds [1000 x i32], ptr @s2, i64 0, i64 %130
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = add nsw i32 %146, %144
  %148 = load i32, ptr %120, align 4, !tbaa !5
  %149 = sub i32 %147, %148
  store i32 %149, ptr %2, align 4, !tbaa !5
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %143, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %151 = load i32, ptr %150, align 4, !tbaa !5
  store i32 %151, ptr %143, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %.pre149 = load i32, ptr @m, align 4, !tbaa !5
  %.pre151 = load i32, ptr @y, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %127, %133
  %.pre150155 = phi i32 [ %.pre150154, %127 ], [ %.pre149, %133 ]
  %153 = phi i32 [ %128, %127 ], [ %.pre151, %133 ]
  %154 = phi i32 [ %129, %127 ], [ %.pre149, %133 ]
  %indvars.iv.next142 = add nsw i64 %indvars.iv141, 1
  %155 = sext i32 %153 to i64
  %156 = icmp slt i64 %indvars.iv.next142, %155
  br i1 %156, label %127, label %._crit_edge101, !llvm.loop !25
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: 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 #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

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


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