; LLVM IR from Izaron/ACM-ICPC :: Russian Olympiad in Informatics/Final Stage 2015 (submarine)

; 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::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" }
%"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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair.3" = type { i32, i32 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.std::reverse_iterator" = type { %"struct.std::_Rb_tree_const_iterator" }

@ms = external dso_local global [2005 x [2005 x i32]], align 16
@ukz = external dso_local global [26 x i32], align 16
@w = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@upSum = external dso_local global [2005 x [2005 x i32]], align 16
@downSum = external dso_local global [2005 x [2005 x i32]], align 16
@leftSum = external dso_local global [2005 x [2005 x i32]], align 16
@rightSum = external dso_local global [2005 x [2005 x i32]], align 16
@_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 personality ptr @__gxx_personality_v0 {
  %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 %"class.std::__cxx11::basic_string", align 8
  %7 = alloca ptr, align 8
  %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 i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %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 %"class.std::set", align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca %"struct.std::pair.3", align 4
  %29 = alloca %"struct.std::pair", align 8
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca %"struct.std::pair.3", align 4
  %33 = alloca %"struct.std::pair.3", align 4
  %34 = alloca %"class.std::reverse_iterator", align 8
  %35 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %47, %0
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [26 x i32], ptr @ukz, i64 0, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %45)
  br label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %37, !llvm.loop !9

50:                                               ; preds = %41
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %51, ptr noundef nonnull align 4 dereferenceable(4) @h)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %95, %50
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = load i32, ptr @w, align 4, !tbaa !5
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %99

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  %59 = invoke 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) %6)
          to label %60 unwind label %66

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

61:                                               ; preds = %87, %60
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = load i32, ptr @h, align 4, !tbaa !5
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %70, label %65

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

66:                                               ; preds = %58
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %7, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %8, align 4
  br label %98

70:                                               ; preds = %61
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %72)
          to label %74 unwind label %90

74:                                               ; preds = %70
  %75 = load i8, ptr %73, align 1, !tbaa !11
  %76 = sext i8 %75 to i32
  %77 = sub nsw i32 %76, 97
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [26 x i32], ptr @ukz, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %82
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [2005 x i32], ptr %83, i64 0, i64 %85
  store i32 %80, ptr %86, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %74
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %9, align 4, !tbaa !5
  br label %61, !llvm.loop !12

90:                                               ; preds = %70
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %7, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %98

94:                                               ; preds = %65
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #7
  br label %95

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

98:                                               ; preds = %90, %66
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %559

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

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

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

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

106:                                              ; preds = %159, %105
  %107 = load i32, ptr %11, align 4, !tbaa !5
  %108 = load i32, ptr @h, align 4, !tbaa !5
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %111, label %110

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

111:                                              ; preds = %106
  %112 = load i32, ptr %10, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %113
  %115 = load i32, ptr %11, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [2005 x i32], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %120
  %122 = load i32, ptr %11, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [2005 x i32], ptr %121, i64 0, i64 %123
  store i32 %118, ptr %124, align 4, !tbaa !5
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = icmp sgt i32 %125, 0
  br i1 %126, label %127, label %158

127:                                              ; preds = %111
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %129
  %131 = load i32, ptr %11, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [2005 x i32], ptr %130, i64 0, i64 %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %135
  %137 = load i32, ptr %11, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2005 x i32], ptr %136, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = sub nsw i32 %141, 1
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %143
  %145 = load i32, ptr %11, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [2005 x i32], ptr %144, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = add nsw i32 %140, %148
  store i32 %149, ptr %12, align 4, !tbaa !5
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %133, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = load i32, ptr %10, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %153
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [2005 x i32], ptr %154, i64 0, i64 %156
  store i32 %151, ptr %157, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %158

158:                                              ; preds = %127, %111
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %11, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %11, align 4, !tbaa !5
  br label %106, !llvm.loop !14

162:                                              ; preds = %110
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %10, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %10, align 4, !tbaa !5
  br label %100, !llvm.loop !15

166:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %167 = load i32, ptr @w, align 4, !tbaa !5
  %168 = sub nsw i32 %167, 1
  store i32 %168, ptr %13, align 4, !tbaa !5
  br label %169

169:                                              ; preds = %233, %166
  %170 = load i32, ptr %13, align 4, !tbaa !5
  %171 = icmp sge i32 %170, 0
  br i1 %171, label %173, label %172

172:                                              ; preds = %169
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %236

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

174:                                              ; preds = %229, %173
  %175 = load i32, ptr %14, align 4, !tbaa !5
  %176 = load i32, ptr @h, align 4, !tbaa !5
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %174
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %232

179:                                              ; preds = %174
  %180 = load i32, ptr %13, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %181
  %183 = load i32, ptr %14, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [2005 x i32], ptr %182, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = load i32, ptr %13, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %188
  %190 = load i32, ptr %14, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [2005 x i32], ptr %189, i64 0, i64 %191
  store i32 %186, ptr %192, align 4, !tbaa !5
  %193 = load i32, ptr %13, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  %195 = load i32, ptr @w, align 4, !tbaa !5
  %196 = icmp slt i32 %194, %195
  br i1 %196, label %197, label %228

197:                                              ; preds = %179
  %198 = load i32, ptr %13, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %199
  %201 = load i32, ptr %14, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [2005 x i32], ptr %200, i64 0, i64 %202
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %204 = load i32, ptr %13, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %205
  %207 = load i32, ptr %14, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [2005 x i32], ptr %206, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  %211 = load i32, ptr %13, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %213
  %215 = load i32, ptr %14, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [2005 x i32], ptr %214, i64 0, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !5
  %219 = add nsw i32 %210, %218
  store i32 %219, ptr %15, align 4, !tbaa !5
  %220 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %203, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = load i32, ptr %13, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %223
  %225 = load i32, ptr %14, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [2005 x i32], ptr %224, i64 0, i64 %226
  store i32 %221, ptr %227, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %228

228:                                              ; preds = %197, %179
  br label %229

229:                                              ; preds = %228
  %230 = load i32, ptr %14, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr %14, align 4, !tbaa !5
  br label %174, !llvm.loop !16

232:                                              ; preds = %178
  br label %233

233:                                              ; preds = %232
  %234 = load i32, ptr %13, align 4, !tbaa !5
  %235 = add nsw i32 %234, -1
  store i32 %235, ptr %13, align 4, !tbaa !5
  br label %169, !llvm.loop !17

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

237:                                              ; preds = %300, %236
  %238 = load i32, ptr %16, align 4, !tbaa !5
  %239 = load i32, ptr @w, align 4, !tbaa !5
  %240 = icmp slt i32 %238, %239
  br i1 %240, label %242, label %241

241:                                              ; preds = %237
  store i32 23, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %303

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

243:                                              ; preds = %296, %242
  %244 = load i32, ptr %17, align 4, !tbaa !5
  %245 = load i32, ptr @h, align 4, !tbaa !5
  %246 = icmp slt i32 %244, %245
  br i1 %246, label %248, label %247

247:                                              ; preds = %243
  store i32 26, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %299

248:                                              ; preds = %243
  %249 = load i32, ptr %16, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %250
  %252 = load i32, ptr %17, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [2005 x i32], ptr %251, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !5
  %256 = load i32, ptr %16, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %257
  %259 = load i32, ptr %17, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [2005 x i32], ptr %258, i64 0, i64 %260
  store i32 %255, ptr %261, align 4, !tbaa !5
  %262 = load i32, ptr %17, align 4, !tbaa !5
  %263 = icmp sgt i32 %262, 0
  br i1 %263, label %264, label %295

264:                                              ; preds = %248
  %265 = load i32, ptr %16, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %266
  %268 = load i32, ptr %17, align 4, !tbaa !5
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [2005 x i32], ptr %267, i64 0, i64 %269
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %271 = load i32, ptr %16, align 4, !tbaa !5
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %272
  %274 = load i32, ptr %17, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [2005 x i32], ptr %273, i64 0, i64 %275
  %277 = load i32, ptr %276, align 4, !tbaa !5
  %278 = load i32, ptr %16, align 4, !tbaa !5
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %279
  %281 = load i32, ptr %17, align 4, !tbaa !5
  %282 = sub nsw i32 %281, 1
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [2005 x i32], ptr %280, i64 0, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !5
  %286 = add nsw i32 %277, %285
  store i32 %286, ptr %18, align 4, !tbaa !5
  %287 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %270, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %288 = load i32, ptr %287, align 4, !tbaa !5
  %289 = load i32, ptr %16, align 4, !tbaa !5
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %290
  %292 = load i32, ptr %17, align 4, !tbaa !5
  %293 = sext i32 %292 to i64
  %294 = getelementptr inbounds [2005 x i32], ptr %291, i64 0, i64 %293
  store i32 %288, ptr %294, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %295

295:                                              ; preds = %264, %248
  br label %296

296:                                              ; preds = %295
  %297 = load i32, ptr %17, align 4, !tbaa !5
  %298 = add nsw i32 %297, 1
  store i32 %298, ptr %17, align 4, !tbaa !5
  br label %243, !llvm.loop !18

299:                                              ; preds = %247
  br label %300

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

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

304:                                              ; preds = %370, %303
  %305 = load i32, ptr %19, align 4, !tbaa !5
  %306 = load i32, ptr @w, align 4, !tbaa !5
  %307 = icmp slt i32 %305, %306
  br i1 %307, label %309, label %308

308:                                              ; preds = %304
  store i32 29, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %373

309:                                              ; preds = %304
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %310 = load i32, ptr @h, align 4, !tbaa !5
  %311 = sub nsw i32 %310, 1
  store i32 %311, ptr %20, align 4, !tbaa !5
  br label %312

312:                                              ; preds = %366, %309
  %313 = load i32, ptr %20, align 4, !tbaa !5
  %314 = icmp sge i32 %313, 0
  br i1 %314, label %316, label %315

315:                                              ; preds = %312
  store i32 32, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %369

316:                                              ; preds = %312
  %317 = load i32, ptr %19, align 4, !tbaa !5
  %318 = sext i32 %317 to i64
  %319 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %318
  %320 = load i32, ptr %20, align 4, !tbaa !5
  %321 = sext i32 %320 to i64
  %322 = getelementptr inbounds [2005 x i32], ptr %319, i64 0, i64 %321
  %323 = load i32, ptr %322, align 4, !tbaa !5
  %324 = load i32, ptr %19, align 4, !tbaa !5
  %325 = sext i32 %324 to i64
  %326 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %325
  %327 = load i32, ptr %20, align 4, !tbaa !5
  %328 = sext i32 %327 to i64
  %329 = getelementptr inbounds [2005 x i32], ptr %326, i64 0, i64 %328
  store i32 %323, ptr %329, align 4, !tbaa !5
  %330 = load i32, ptr %20, align 4, !tbaa !5
  %331 = add nsw i32 %330, 1
  %332 = load i32, ptr @h, align 4, !tbaa !5
  %333 = icmp slt i32 %331, %332
  br i1 %333, label %334, label %365

334:                                              ; preds = %316
  %335 = load i32, ptr %19, align 4, !tbaa !5
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %336
  %338 = load i32, ptr %20, align 4, !tbaa !5
  %339 = sext i32 %338 to i64
  %340 = getelementptr inbounds [2005 x i32], ptr %337, i64 0, i64 %339
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %341 = load i32, ptr %19, align 4, !tbaa !5
  %342 = sext i32 %341 to i64
  %343 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %342
  %344 = load i32, ptr %20, align 4, !tbaa !5
  %345 = sext i32 %344 to i64
  %346 = getelementptr inbounds [2005 x i32], ptr %343, i64 0, i64 %345
  %347 = load i32, ptr %346, align 4, !tbaa !5
  %348 = load i32, ptr %19, align 4, !tbaa !5
  %349 = sext i32 %348 to i64
  %350 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %349
  %351 = load i32, ptr %20, align 4, !tbaa !5
  %352 = add nsw i32 %351, 1
  %353 = sext i32 %352 to i64
  %354 = getelementptr inbounds [2005 x i32], ptr %350, i64 0, i64 %353
  %355 = load i32, ptr %354, align 4, !tbaa !5
  %356 = add nsw i32 %347, %355
  store i32 %356, ptr %21, align 4, !tbaa !5
  %357 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %340, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %358 = load i32, ptr %357, align 4, !tbaa !5
  %359 = load i32, ptr %19, align 4, !tbaa !5
  %360 = sext i32 %359 to i64
  %361 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %360
  %362 = load i32, ptr %20, align 4, !tbaa !5
  %363 = sext i32 %362 to i64
  %364 = getelementptr inbounds [2005 x i32], ptr %361, i64 0, i64 %363
  store i32 %358, ptr %364, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %365

365:                                              ; preds = %334, %316
  br label %366

366:                                              ; preds = %365
  %367 = load i32, ptr %20, align 4, !tbaa !5
  %368 = add nsw i32 %367, -1
  store i32 %368, ptr %20, align 4, !tbaa !5
  br label %312, !llvm.loop !20

369:                                              ; preds = %315
  br label %370

370:                                              ; preds = %369
  %371 = load i32, ptr %19, align 4, !tbaa !5
  %372 = add nsw i32 %371, 1
  store i32 %372, ptr %19, align 4, !tbaa !5
  br label %304, !llvm.loop !21

373:                                              ; preds = %308
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 -228000000, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %374

374:                                              ; preds = %551, %373
  %375 = load i32, ptr %23, align 4, !tbaa !5
  %376 = load i32, ptr @w, align 4, !tbaa !5
  %377 = icmp slt i32 %375, %376
  br i1 %377, label %379, label %378

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

379:                                              ; preds = %374
  call void @llvm.lifetime.start.p0(i64 48, ptr %24) #7
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %24) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 0, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %380

380:                                              ; preds = %437, %379
  %381 = load i32, ptr %26, align 4, !tbaa !5
  %382 = load i32, ptr @h, align 4, !tbaa !5
  %383 = icmp slt i32 %381, %382
  br i1 %383, label %385, label %384

384:                                              ; preds = %380
  store i32 38, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %444

385:                                              ; preds = %380
  %386 = load i32, ptr %23, align 4, !tbaa !5
  %387 = sext i32 %386 to i64
  %388 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %387
  %389 = load i32, ptr %26, align 4, !tbaa !5
  %390 = sext i32 %389 to i64
  %391 = getelementptr inbounds [2005 x i32], ptr %388, i64 0, i64 %390
  %392 = load i32, ptr %391, align 4, !tbaa !5
  %393 = load i32, ptr %25, align 4, !tbaa !5
  %394 = add nsw i32 %393, %392
  store i32 %394, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %395 = load i32, ptr %25, align 4, !tbaa !5
  %396 = load i32, ptr %23, align 4, !tbaa !5
  %397 = sext i32 %396 to i64
  %398 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %397
  %399 = load i32, ptr %26, align 4, !tbaa !5
  %400 = sext i32 %399 to i64
  %401 = getelementptr inbounds [2005 x i32], ptr %398, i64 0, i64 %400
  %402 = load i32, ptr %401, align 4, !tbaa !5
  %403 = add nsw i32 %395, %402
  %404 = load i32, ptr %23, align 4, !tbaa !5
  %405 = sext i32 %404 to i64
  %406 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %405
  %407 = load i32, ptr %26, align 4, !tbaa !5
  %408 = sext i32 %407 to i64
  %409 = getelementptr inbounds [2005 x i32], ptr %406, i64 0, i64 %408
  %410 = load i32, ptr %409, align 4, !tbaa !5
  %411 = add nsw i32 %403, %410
  %412 = load i32, ptr %23, align 4, !tbaa !5
  %413 = sext i32 %412 to i64
  %414 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %413
  %415 = load i32, ptr %26, align 4, !tbaa !5
  %416 = sext i32 %415 to i64
  %417 = getelementptr inbounds [2005 x i32], ptr %414, i64 0, i64 %416
  %418 = load i32, ptr %417, align 4, !tbaa !5
  %419 = add nsw i32 %411, %418
  %420 = load i32, ptr %23, align 4, !tbaa !5
  %421 = sext i32 %420 to i64
  %422 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %421
  %423 = load i32, ptr %26, align 4, !tbaa !5
  %424 = sext i32 %423 to i64
  %425 = getelementptr inbounds [2005 x i32], ptr %422, i64 0, i64 %424
  %426 = load i32, ptr %425, align 4, !tbaa !5
  %427 = mul nsw i32 3, %426
  %428 = sub nsw i32 %419, %427
  store i32 %428, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %429 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %27, ptr noundef nonnull align 4 dereferenceable(4) %26)
          to label %430 unwind label %440

430:                                              ; preds = %385
  store i64 %429, ptr %28, align 4
  %431 = invoke { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %24, ptr noundef nonnull align 4 dereferenceable(8) %28)
          to label %432 unwind label %440

432:                                              ; preds = %430
  %433 = getelementptr inbounds { ptr, i8 }, ptr %29, i32 0, i32 0
  %434 = extractvalue { ptr, i8 } %431, 0
  store ptr %434, ptr %433, align 8
  %435 = getelementptr inbounds { ptr, i8 }, ptr %29, i32 0, i32 1
  %436 = extractvalue { ptr, i8 } %431, 1
  store i8 %436, ptr %435, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  br label %437

437:                                              ; preds = %432
  %438 = load i32, ptr %26, align 4, !tbaa !5
  %439 = add nsw i32 %438, 1
  store i32 %439, ptr %26, align 4, !tbaa !5
  br label %380, !llvm.loop !22

440:                                              ; preds = %430, %385
  %441 = landingpad { ptr, i32 }
          cleanup
  %442 = extractvalue { ptr, i32 } %441, 0
  store ptr %442, ptr %7, align 8
  %443 = extractvalue { ptr, i32 } %441, 1
  store i32 %443, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %554

444:                                              ; preds = %384
  store i32 0, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #7
  store i32 0, ptr %30, align 4, !tbaa !5
  br label %445

445:                                              ; preds = %533, %444
  %446 = load i32, ptr %30, align 4, !tbaa !5
  %447 = load i32, ptr @h, align 4, !tbaa !5
  %448 = sub nsw i32 %447, 1
  %449 = icmp slt i32 %446, %448
  br i1 %449, label %451, label %450

450:                                              ; preds = %445
  store i32 41, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  br label %550

451:                                              ; preds = %445
  %452 = load i32, ptr %23, align 4, !tbaa !5
  %453 = sext i32 %452 to i64
  %454 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %453
  %455 = load i32, ptr %30, align 4, !tbaa !5
  %456 = sext i32 %455 to i64
  %457 = getelementptr inbounds [2005 x i32], ptr %454, i64 0, i64 %456
  %458 = load i32, ptr %457, align 4, !tbaa !5
  %459 = load i32, ptr %25, align 4, !tbaa !5
  %460 = add nsw i32 %459, %458
  store i32 %460, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #7
  %461 = load i32, ptr %25, align 4, !tbaa !5
  %462 = load i32, ptr %23, align 4, !tbaa !5
  %463 = sext i32 %462 to i64
  %464 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %463
  %465 = load i32, ptr %30, align 4, !tbaa !5
  %466 = sext i32 %465 to i64
  %467 = getelementptr inbounds [2005 x i32], ptr %464, i64 0, i64 %466
  %468 = load i32, ptr %467, align 4, !tbaa !5
  %469 = add nsw i32 %461, %468
  %470 = load i32, ptr %23, align 4, !tbaa !5
  %471 = sext i32 %470 to i64
  %472 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %471
  %473 = load i32, ptr %30, align 4, !tbaa !5
  %474 = sext i32 %473 to i64
  %475 = getelementptr inbounds [2005 x i32], ptr %472, i64 0, i64 %474
  %476 = load i32, ptr %475, align 4, !tbaa !5
  %477 = add nsw i32 %469, %476
  %478 = load i32, ptr %23, align 4, !tbaa !5
  %479 = sext i32 %478 to i64
  %480 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %479
  %481 = load i32, ptr %30, align 4, !tbaa !5
  %482 = sext i32 %481 to i64
  %483 = getelementptr inbounds [2005 x i32], ptr %480, i64 0, i64 %482
  %484 = load i32, ptr %483, align 4, !tbaa !5
  %485 = add nsw i32 %477, %484
  %486 = load i32, ptr %23, align 4, !tbaa !5
  %487 = sext i32 %486 to i64
  %488 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %487
  %489 = load i32, ptr %30, align 4, !tbaa !5
  %490 = sext i32 %489 to i64
  %491 = getelementptr inbounds [2005 x i32], ptr %488, i64 0, i64 %490
  %492 = load i32, ptr %491, align 4, !tbaa !5
  %493 = mul nsw i32 3, %492
  %494 = sub nsw i32 %485, %493
  store i32 %494, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #7
  %495 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %31, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %496 unwind label %536

496:                                              ; preds = %451
  store i64 %495, ptr %32, align 4
  %497 = invoke noundef i64 @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %24, ptr noundef nonnull align 4 dereferenceable(8) %32)
          to label %498 unwind label %536

498:                                              ; preds = %496
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  call void @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %34, ptr noundef nonnull align 8 dereferenceable(48) %24) #7
  %499 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorISt4pairIiiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %34)
          to label %500 unwind label %540

500:                                              ; preds = %498
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %499, i64 8, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #7
  %501 = getelementptr inbounds %"struct.std::pair.3", ptr %33, i32 0, i32 0
  %502 = load i32, ptr %501, align 4, !tbaa !23
  %503 = load i32, ptr %25, align 4, !tbaa !5
  %504 = sub nsw i32 %502, %503
  store i32 %504, ptr %35, align 4, !tbaa !5
  %505 = load i32, ptr %23, align 4, !tbaa !5
  %506 = sext i32 %505 to i64
  %507 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %506
  %508 = load i32, ptr %30, align 4, !tbaa !5
  %509 = sext i32 %508 to i64
  %510 = getelementptr inbounds [2005 x i32], ptr %507, i64 0, i64 %509
  %511 = load i32, ptr %510, align 4, !tbaa !5
  %512 = load i32, ptr %23, align 4, !tbaa !5
  %513 = sext i32 %512 to i64
  %514 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %513
  %515 = load i32, ptr %30, align 4, !tbaa !5
  %516 = sext i32 %515 to i64
  %517 = getelementptr inbounds [2005 x i32], ptr %514, i64 0, i64 %516
  %518 = load i32, ptr %517, align 4, !tbaa !5
  %519 = add nsw i32 %511, %518
  %520 = load i32, ptr %23, align 4, !tbaa !5
  %521 = sext i32 %520 to i64
  %522 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %521
  %523 = load i32, ptr %30, align 4, !tbaa !5
  %524 = sext i32 %523 to i64
  %525 = getelementptr inbounds [2005 x i32], ptr %522, i64 0, i64 %524
  %526 = load i32, ptr %525, align 4, !tbaa !5
  %527 = sub nsw i32 %519, %526
  %528 = load i32, ptr %35, align 4, !tbaa !5
  %529 = add nsw i32 %528, %527
  store i32 %529, ptr %35, align 4, !tbaa !5
  %530 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(4) %35)
          to label %531 unwind label %544

531:                                              ; preds = %500
  %532 = load i32, ptr %530, align 4, !tbaa !5
  store i32 %532, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #7
  br label %533

533:                                              ; preds = %531
  %534 = load i32, ptr %30, align 4, !tbaa !5
  %535 = add nsw i32 %534, 1
  store i32 %535, ptr %30, align 4, !tbaa !5
  br label %445, !llvm.loop !25

536:                                              ; preds = %496, %451
  %537 = landingpad { ptr, i32 }
          cleanup
  %538 = extractvalue { ptr, i32 } %537, 0
  store ptr %538, ptr %7, align 8
  %539 = extractvalue { ptr, i32 } %537, 1
  store i32 %539, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  br label %549

540:                                              ; preds = %498
  %541 = landingpad { ptr, i32 }
          cleanup
  %542 = extractvalue { ptr, i32 } %541, 0
  store ptr %542, ptr %7, align 8
  %543 = extractvalue { ptr, i32 } %541, 1
  store i32 %543, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  br label %548

544:                                              ; preds = %500
  %545 = landingpad { ptr, i32 }
          cleanup
  %546 = extractvalue { ptr, i32 } %545, 0
  store ptr %546, ptr %7, align 8
  %547 = extractvalue { ptr, i32 } %545, 1
  store i32 %547, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  br label %548

548:                                              ; preds = %544, %540
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  br label %549

549:                                              ; preds = %548, %536
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  br label %554

550:                                              ; preds = %450
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %24) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %24) #7
  br label %551

551:                                              ; preds = %550
  %552 = load i32, ptr %23, align 4, !tbaa !5
  %553 = add nsw i32 %552, 1
  store i32 %553, ptr %23, align 4, !tbaa !5
  br label %374, !llvm.loop !26

554:                                              ; preds = %549, %440
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %24) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %559

555:                                              ; preds = %378
  %556 = load i32, ptr %22, align 4, !tbaa !5
  %557 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %556)
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %558 = load i32, ptr %1, align 4
  ret i32 %558

559:                                              ; preds = %554, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %560

560:                                              ; preds = %559
  %561 = load ptr, ptr %7, align 8
  %562 = load i32, ptr %8, align 4
  %563 = insertvalue { ptr, i32 } poison, ptr %561, 0
  %564 = insertvalue { ptr, i32 } %563, i32 %562, 1
  resume { ptr, i32 } %564
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #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 void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 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)) #2

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!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}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = !{!24, !6, i64 0}
!24 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !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::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" }
%"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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair.3" = type { i32, i32 }
%"class.std::reverse_iterator" = type { %"struct.std::_Rb_tree_const_iterator" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@ms = external dso_local local_unnamed_addr global [2005 x [2005 x i32]], align 16
@ukz = external dso_local global [26 x i32], align 16
@w = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@upSum = external dso_local global [2005 x [2005 x i32]], align 16
@downSum = external dso_local global [2005 x [2005 x i32]], align 16
@leftSum = external dso_local global [2005 x [2005 x i32]], align 16
@rightSum = external dso_local global [2005 x [2005 x i32]], align 16
@_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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %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 %"class.std::set", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair.3", align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair.3", align 8
  %15 = alloca %"class.std::reverse_iterator", align 8
  %16 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @w)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) @h)
  %22 = load i32, ptr @w, align 4, !tbaa !5
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph142, label %._crit_edge164.thread274

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %24 = getelementptr inbounds [26 x i32], ptr @ukz, i64 0, i64 %indvars.iv
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader134:                                    ; preds = %._crit_edge139
  %29 = icmp sgt i32 %35, 0
  br i1 %29, label %.preheader133.lr.ph, label %._crit_edge164.thread274

.preheader133.lr.ph:                              ; preds = %.preheader134
  %30 = load i32, ptr @h, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.preheader133, label %._crit_edge164.thread

.lr.ph142:                                        ; preds = %._crit_edge, %._crit_edge139
  %indvars.iv190 = phi i64 [ %indvars.iv.next191, %._crit_edge139 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  %32 = invoke 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) %2)
          to label %.preheader135 unwind label %38

.preheader135:                                    ; preds = %.lr.ph142
  %33 = load i32, ptr @h, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph138, label %._crit_edge139

._crit_edge139:                                   ; preds = %.lr.ph138, %.preheader135
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #8
  %indvars.iv.next191 = add nuw nsw i64 %indvars.iv190, 1
  %35 = load i32, ptr @w, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next191, %36
  br i1 %37, label %.lr.ph142, label %.preheader134, !llvm.loop !11

38:                                               ; preds = %.lr.ph142
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #8
  br label %238

.lr.ph138:                                        ; preds = %.preheader135, %.lr.ph138
  %indvars.iv187 = phi i64 [ %indvars.iv.next188, %.lr.ph138 ], [ 0, %.preheader135 ]
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %2, i64 noundef %indvars.iv187)
  %41 = load i8, ptr %40, align 1, !tbaa !12
  %42 = sext i8 %41 to i64
  %43 = add nsw i64 %42, -97
  %44 = getelementptr inbounds [26 x i32], ptr @ukz, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv190, i64 %indvars.iv187
  store i32 %45, ptr %46, align 4, !tbaa !5
  %indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
  %47 = load i32, ptr @h, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next188, %48
  br i1 %49, label %.lr.ph138, label %._crit_edge139, !llvm.loop !13

.preheader133:                                    ; preds = %.preheader133.lr.ph, %._crit_edge145
  %50 = phi i32 [ %63, %._crit_edge145 ], [ %35, %.preheader133.lr.ph ]
  %51 = phi i32 [ %64, %._crit_edge145 ], [ %30, %.preheader133.lr.ph ]
  %52 = phi i32 [ %65, %._crit_edge145 ], [ %30, %.preheader133.lr.ph ]
  %indvar = phi i64 [ %indvar.next, %._crit_edge145 ], [ 0, %.preheader133.lr.ph ]
  %53 = mul nuw nsw i64 %indvar, 8020
  %scevgep = getelementptr i8, ptr @upSum, i64 %53
  %scevgep196 = getelementptr i8, ptr @ms, i64 %53
  %54 = icmp sgt i32 %52, 0
  br i1 %54, label %.lr.ph144, label %._crit_edge145

.lr.ph144:                                        ; preds = %.preheader133
  %.not125 = icmp eq i64 %indvar, 0
  %55 = add nsw i64 %indvar, -1
  br i1 %.not125, label %.lr.ph144.split.us, label %.lr.ph144.split

.lr.ph144.split.us:                               ; preds = %.lr.ph144
  %smax = call i32 @llvm.smax.i32(i32 %51, i32 1)
  %56 = zext nneg i32 %smax to i64
  %57 = shl nuw nsw i64 %56, 2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, ptr noundef nonnull align 4 dereferenceable(1) %scevgep196, i64 %57, i1 false), !tbaa !5
  br label %._crit_edge145

.preheader132:                                    ; preds = %._crit_edge145
  %58 = icmp sgt i32 %63, 0
  br i1 %58, label %.preheader131.lr.ph, label %._crit_edge164.thread274

.preheader131.lr.ph:                              ; preds = %.preheader132
  %.pr = load i32, ptr @h, align 4, !tbaa !5
  %59 = icmp sgt i32 %.pr, 0
  br i1 %59, label %.preheader131.preheader, label %._crit_edge164.thread

.preheader131.preheader:                          ; preds = %.preheader131.lr.ph
  %.0111149 = add nsw i32 %63, -1
  %60 = zext nneg i32 %.0111149 to i64
  %61 = mul nuw nsw i64 %60, 8020
  %62 = zext nneg i32 %63 to i64
  br label %.preheader131

._crit_edge145.loopexit183:                       ; preds = %.lr.ph144.split
  %.pre = load i32, ptr @w, align 4, !tbaa !5
  br label %._crit_edge145

._crit_edge145:                                   ; preds = %._crit_edge145.loopexit183, %.lr.ph144.split.us, %.preheader133
  %63 = phi i32 [ %.pre, %._crit_edge145.loopexit183 ], [ %50, %.lr.ph144.split.us ], [ %50, %.preheader133 ]
  %64 = phi i32 [ %76, %._crit_edge145.loopexit183 ], [ %51, %.lr.ph144.split.us ], [ %51, %.preheader133 ]
  %65 = phi i32 [ %76, %._crit_edge145.loopexit183 ], [ %51, %.lr.ph144.split.us ], [ %52, %.preheader133 ]
  %indvar.next = add nuw nsw i64 %indvar, 1
  %66 = sext i32 %63 to i64
  %67 = icmp slt i64 %indvar.next, %66
  br i1 %67, label %.preheader133, label %.preheader132, !llvm.loop !14

.lr.ph144.split:                                  ; preds = %.lr.ph144, %.lr.ph144.split
  %indvars.iv193 = phi i64 [ %indvars.iv.next194, %.lr.ph144.split ], [ 0, %.lr.ph144 ]
  %68 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvar, i64 %indvars.iv193
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %indvar, i64 %indvars.iv193
  store i32 %69, ptr %70, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %71 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %55, i64 %indvars.iv193
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %72, %69
  store i32 %73, ptr %3, align 4, !tbaa !5
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %70, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %75 = load i32, ptr %74, align 4, !tbaa !5
  store i32 %75, ptr %70, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %indvars.iv.next194 = add nuw nsw i64 %indvars.iv193, 1
  %76 = load i32, ptr @h, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = icmp slt i64 %indvars.iv.next194, %77
  br i1 %78, label %.lr.ph144.split, label %._crit_edge145.loopexit183, !llvm.loop !16

.loopexit:                                        ; preds = %110, %.lr.ph148.split.us, %.preheader131
  %.pre236246 = phi i32 [ %.pre236, %.lr.ph148.split.us ], [ %.pre236, %.preheader131 ], [ %.pre236248, %110 ]
  %79 = phi i32 [ %84, %.lr.ph148.split.us ], [ %84, %.preheader131 ], [ %112, %110 ]
  %80 = phi i32 [ %84, %.lr.ph148.split.us ], [ %85, %.preheader131 ], [ %112, %110 ]
  %81 = phi i32 [ %86, %.lr.ph148.split.us ], [ %86, %.preheader131 ], [ %111, %110 ]
  %82 = phi i32 [ %87, %.lr.ph148.split.us ], [ %87, %.preheader131 ], [ %111, %110 ]
  %83 = phi i32 [ %87, %.lr.ph148.split.us ], [ %88, %.preheader131 ], [ %111, %110 ]
  %indvars.iv.next213 = add nsw i64 %indvars.iv212, -1
  %indvar.next202 = add nuw nsw i64 %indvar201, 1
  %indvars.iv.next215 = add nsw i64 %indvars.iv214, -1
  %exitcond.not = icmp eq i64 %indvar.next202, %62
  br i1 %exitcond.not, label %.preheader130, label %.preheader131, !llvm.loop !17

.preheader131:                                    ; preds = %.preheader131.preheader, %.loopexit
  %.pre236 = phi i32 [ %63, %.preheader131.preheader ], [ %.pre236246, %.loopexit ]
  %84 = phi i32 [ %63, %.preheader131.preheader ], [ %79, %.loopexit ]
  %85 = phi i32 [ %63, %.preheader131.preheader ], [ %80, %.loopexit ]
  %86 = phi i32 [ %.pr, %.preheader131.preheader ], [ %81, %.loopexit ]
  %87 = phi i32 [ %.pr, %.preheader131.preheader ], [ %82, %.loopexit ]
  %88 = phi i32 [ %.pr, %.preheader131.preheader ], [ %83, %.loopexit ]
  %indvars.iv214 = phi i64 [ %62, %.preheader131.preheader ], [ %indvars.iv.next215, %.loopexit ]
  %indvars.iv212 = phi i64 [ %60, %.preheader131.preheader ], [ %indvars.iv.next213, %.loopexit ]
  %indvar201 = phi i64 [ 0, %.preheader131.preheader ], [ %indvar.next202, %.loopexit ]
  %89 = mul nsw i64 %indvar201, -8020
  %90 = add nsw i64 %61, %89
  %scevgep203 = getelementptr i8, ptr @downSum, i64 %90
  %scevgep204 = getelementptr i8, ptr @ms, i64 %90
  %91 = icmp sgt i32 %88, 0
  br i1 %91, label %.lr.ph148, label %.loopexit

.lr.ph148:                                        ; preds = %.preheader131
  %92 = trunc nuw i64 %indvars.iv214 to i32
  %93 = icmp sgt i32 %84, %92
  br i1 %93, label %.lr.ph148.split, label %.lr.ph148.split.us

.lr.ph148.split.us:                               ; preds = %.lr.ph148
  %smax205 = call i32 @llvm.smax.i32(i32 %87, i32 1)
  %94 = zext nneg i32 %smax205 to i64
  %95 = shl nuw nsw i64 %94, 2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep203, ptr noundef nonnull align 4 dereferenceable(1) %scevgep204, i64 %95, i1 false), !tbaa !5
  br label %.loopexit

.preheader130:                                    ; preds = %.loopexit
  %96 = icmp sgt i32 %80, 0
  br i1 %96, label %.preheader129.lr.ph, label %._crit_edge164.thread274

.preheader129.lr.ph:                              ; preds = %.preheader130
  %.pr275 = load i32, ptr @h, align 4, !tbaa !5
  %97 = icmp sgt i32 %.pr275, 0
  br i1 %97, label %.preheader129, label %._crit_edge164.thread

.lr.ph148.split:                                  ; preds = %.lr.ph148, %110
  %.pre236247 = phi i32 [ %.pre236248, %110 ], [ %.pre236, %.lr.ph148 ]
  %98 = phi i32 [ %111, %110 ], [ %86, %.lr.ph148 ]
  %99 = phi i32 [ %112, %110 ], [ %.pre236, %.lr.ph148 ]
  %indvars.iv209 = phi i64 [ %indvars.iv.next210, %110 ], [ 0, %.lr.ph148 ]
  %100 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv212, i64 %indvars.iv209
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %indvars.iv212, i64 %indvars.iv209
  store i32 %101, ptr %102, align 4, !tbaa !5
  %103 = icmp sgt i32 %99, %92
  br i1 %103, label %104, label %110

104:                                              ; preds = %.lr.ph148.split
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %105 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %indvars.iv214, i64 %indvars.iv209
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = add nsw i32 %106, %101
  store i32 %107, ptr %4, align 4, !tbaa !5
  %108 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %102, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %109 = load i32, ptr %108, align 4, !tbaa !5
  store i32 %109, ptr %102, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %.pre235 = load i32, ptr @w, align 4, !tbaa !5
  %.pre237 = load i32, ptr @h, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %.lr.ph148.split, %104
  %.pre236248 = phi i32 [ %.pre236247, %.lr.ph148.split ], [ %.pre235, %104 ]
  %111 = phi i32 [ %98, %.lr.ph148.split ], [ %.pre237, %104 ]
  %112 = phi i32 [ %99, %.lr.ph148.split ], [ %.pre235, %104 ]
  %indvars.iv.next210 = add nuw nsw i64 %indvars.iv209, 1
  %113 = sext i32 %111 to i64
  %114 = icmp slt i64 %indvars.iv.next210, %113
  br i1 %114, label %.lr.ph148.split, label %.loopexit, !llvm.loop !18

.preheader129:                                    ; preds = %.preheader129.lr.ph, %._crit_edge154
  %.pre240249 = phi i32 [ %.pre240250, %._crit_edge154 ], [ %.pre236246, %.preheader129.lr.ph ]
  %115 = phi i32 [ %126, %._crit_edge154 ], [ %80, %.preheader129.lr.ph ]
  %116 = phi i32 [ %127, %._crit_edge154 ], [ %.pr275, %.preheader129.lr.ph ]
  %117 = phi i32 [ %128, %._crit_edge154 ], [ %.pr275, %.preheader129.lr.ph ]
  %indvars.iv223 = phi i64 [ %indvars.iv.next224, %._crit_edge154 ], [ 0, %.preheader129.lr.ph ]
  %118 = icmp sgt i32 %117, 0
  br i1 %118, label %119, label %._crit_edge154

119:                                              ; preds = %.preheader129
  %120 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv223, i64 0
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %indvars.iv223, i64 0
  store i32 %121, ptr %122, align 4, !tbaa !5
  %123 = icmp sgt i32 %116, 1
  br i1 %123, label %.peel.next, label %._crit_edge154

.preheader:                                       ; preds = %._crit_edge154
  %124 = icmp sgt i32 %126, 0
  br i1 %124, label %.lr.ph163, label %._crit_edge164.thread274

.lr.ph163:                                        ; preds = %.preheader
  %.pr272 = load i32, ptr @h, align 4, !tbaa !5
  %125 = icmp sgt i32 %.pr272, 0
  br i1 %125, label %.lr.ph163.split, label %._crit_edge164.thread

._crit_edge154.loopexit.loopexit:                 ; preds = %.peel.next
  %.pre240.pre = load i32, ptr @w, align 4, !tbaa !5
  br label %._crit_edge154

._crit_edge154:                                   ; preds = %119, %._crit_edge154.loopexit.loopexit, %.preheader129
  %.pre240250 = phi i32 [ %.pre240249, %.preheader129 ], [ %.pre240.pre, %._crit_edge154.loopexit.loopexit ], [ %.pre240249, %119 ]
  %126 = phi i32 [ %115, %.preheader129 ], [ %.pre240.pre, %._crit_edge154.loopexit.loopexit ], [ %.pre240249, %119 ]
  %127 = phi i32 [ %116, %.preheader129 ], [ %.pre239, %._crit_edge154.loopexit.loopexit ], [ %116, %119 ]
  %128 = phi i32 [ %117, %.preheader129 ], [ %.pre239, %._crit_edge154.loopexit.loopexit ], [ %116, %119 ]
  %indvars.iv.next224 = add nuw nsw i64 %indvars.iv223, 1
  %129 = sext i32 %126 to i64
  %130 = icmp slt i64 %indvars.iv.next224, %129
  br i1 %130, label %.preheader129, label %.preheader, !llvm.loop !19

.peel.next:                                       ; preds = %119, %.peel.next
  %131 = phi i32 [ %137, %.peel.next ], [ %121, %119 ]
  %indvars.iv219 = phi i64 [ %indvars.iv.next220, %.peel.next ], [ 1, %119 ]
  %132 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv223, i64 %indvars.iv219
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %indvars.iv223, i64 %indvars.iv219
  store i32 %133, ptr %134, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %135 = add nsw i32 %131, %133
  store i32 %135, ptr %5, align 4, !tbaa !5
  %136 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %134, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %137 = load i32, ptr %136, align 4, !tbaa !5
  store i32 %137, ptr %134, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %.pre239 = load i32, ptr @h, align 4, !tbaa !5
  %indvars.iv.next220 = add nuw nsw i64 %indvars.iv219, 1
  %138 = sext i32 %.pre239 to i64
  %139 = icmp slt i64 %indvars.iv.next220, %138
  br i1 %139, label %.peel.next, label %._crit_edge154.loopexit.loopexit, !llvm.loop !20

._crit_edge164.thread:                            ; preds = %.preheader131.lr.ph, %.preheader133.lr.ph, %.lr.ph163, %.preheader129.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  store i32 -228000000, ptr %7, align 4, !tbaa !5
  br label %.lr.ph177.preheader

._crit_edge164.thread274:                         ; preds = %.preheader, %.preheader130, %.preheader132, %.preheader134, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  store i32 -228000000, ptr %7, align 4, !tbaa !5
  br label %._crit_edge178

._crit_edge164:                                   ; preds = %._crit_edge161
  %140 = icmp sgt i32 %146, 0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  store i32 -228000000, ptr %7, align 4, !tbaa !5
  br i1 %140, label %.lr.ph177.preheader, label %._crit_edge178

.lr.ph177.preheader:                              ; preds = %._crit_edge164.thread, %._crit_edge164
  br label %.lr.ph177

.lr.ph163.split:                                  ; preds = %.lr.ph163, %._crit_edge161
  %.pre242 = phi i32 [ %.pre242254, %._crit_edge161 ], [ %.pr272, %.lr.ph163 ]
  %141 = phi i32 [ %145, %._crit_edge161 ], [ %.pr272, %.lr.ph163 ]
  %142 = phi i32 [ %146, %._crit_edge161 ], [ %126, %.lr.ph163 ]
  %indvars.iv229 = phi i64 [ %indvars.iv.next230, %._crit_edge161 ], [ 0, %.lr.ph163 ]
  %143 = icmp sgt i32 %141, 0
  br i1 %143, label %.lr.ph160, label %._crit_edge161

.lr.ph160:                                        ; preds = %.lr.ph163.split
  %144 = zext nneg i32 %141 to i64
  br label %149

._crit_edge161.loopexit:                          ; preds = %162
  %.pre243 = load i32, ptr @w, align 4, !tbaa !5
  br label %._crit_edge161

._crit_edge161:                                   ; preds = %._crit_edge161.loopexit, %.lr.ph163.split
  %.pre242254 = phi i32 [ %.pre242256, %._crit_edge161.loopexit ], [ %.pre242, %.lr.ph163.split ]
  %145 = phi i32 [ %163, %._crit_edge161.loopexit ], [ %141, %.lr.ph163.split ]
  %146 = phi i32 [ %.pre243, %._crit_edge161.loopexit ], [ %142, %.lr.ph163.split ]
  %indvars.iv.next230 = add nuw nsw i64 %indvars.iv229, 1
  %147 = sext i32 %146 to i64
  %148 = icmp slt i64 %indvars.iv.next230, %147
  br i1 %148, label %.lr.ph163.split, label %._crit_edge164, !llvm.loop !22

149:                                              ; preds = %.lr.ph160, %162
  %.pre242255 = phi i32 [ %.pre242, %.lr.ph160 ], [ %.pre242256, %162 ]
  %150 = phi i32 [ %.pre242, %.lr.ph160 ], [ %163, %162 ]
  %indvars.iv226 = phi i64 [ %144, %.lr.ph160 ], [ %indvars.iv.next227, %162 ]
  %indvars.iv.next227 = add nsw i64 %indvars.iv226, -1
  %151 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv229, i64 %indvars.iv.next227
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %indvars.iv229, i64 %indvars.iv.next227
  store i32 %152, ptr %153, align 4, !tbaa !5
  %154 = sext i32 %150 to i64
  %155 = icmp slt i64 %indvars.iv226, %154
  br i1 %155, label %156, label %162

156:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %157 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %indvars.iv229, i64 %indvars.iv226
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = add nsw i32 %158, %152
  store i32 %159, ptr %6, align 4, !tbaa !5
  %160 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %153, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %161 = load i32, ptr %160, align 4, !tbaa !5
  store i32 %161, ptr %153, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  %.pre241 = load i32, ptr @h, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %149, %156
  %.pre242256 = phi i32 [ %.pre242255, %149 ], [ %.pre241, %156 ]
  %163 = phi i32 [ %150, %149 ], [ %.pre241, %156 ]
  %164 = icmp ugt i64 %indvars.iv226, 1
  br i1 %164, label %149, label %._crit_edge161.loopexit, !llvm.loop !23

._crit_edge178.loopexit:                          ; preds = %._crit_edge174
  %.pre244 = load i32, ptr %7, align 4, !tbaa !5
  br label %._crit_edge178

._crit_edge178:                                   ; preds = %._crit_edge164.thread274, %._crit_edge178.loopexit, %._crit_edge164
  %165 = phi i32 [ %.pre244, %._crit_edge178.loopexit ], [ -228000000, %._crit_edge164 ], [ -228000000, %._crit_edge164.thread274 ]
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %165)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

.lr.ph177:                                        ; preds = %.lr.ph177.preheader, %._crit_edge174
  %indvars.iv232 = phi i64 [ %indvars.iv.next233, %._crit_edge174 ], [ 0, %.lr.ph177.preheader ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %8) #8
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  store i32 0, ptr %9, align 4, !tbaa !5
  %167 = load i32, ptr @h, align 4, !tbaa !5
  %168 = icmp sgt i32 %167, 0
  br i1 %168, label %.lr.ph168, label %._crit_edge169.thread

._crit_edge169.thread:                            ; preds = %.lr.ph177
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #8
  br label %._crit_edge174

._crit_edge169:                                   ; preds = %187
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  %169 = icmp sgt i32 %190, 1
  br i1 %169, label %.lr.ph173, label %._crit_edge174

.lr.ph168:                                        ; preds = %.lr.ph177, %187
  %.0103166 = phi i32 [ %173, %187 ], [ 0, %.lr.ph177 ]
  %storemerge165 = phi i32 [ %189, %187 ], [ 0, %.lr.ph177 ]
  %170 = sext i32 %storemerge165 to i64
  %171 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv232, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = add nsw i32 %172, %.0103166
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #8
  %174 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %indvars.iv232, i64 %170
  %175 = load i32, ptr %174, align 4, !tbaa !5
  %176 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %indvars.iv232, i64 %170
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %indvars.iv232, i64 %170
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %.neg123 = mul i32 %172, -3
  %180 = add i32 %.neg123, %173
  %181 = add i32 %180, %175
  %182 = add i32 %181, %177
  %183 = add i32 %182, %179
  store i32 %183, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #8
  %184 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %185 unwind label %192

185:                                              ; preds = %.lr.ph168
  store i64 %184, ptr %11, align 8
  %186 = invoke { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 4 dereferenceable(8) %11)
          to label %187 unwind label %192

187:                                              ; preds = %185
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #8
  %188 = load i32, ptr %9, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %9, align 4, !tbaa !5
  %190 = load i32, ptr @h, align 4, !tbaa !5
  %191 = icmp slt i32 %189, %190
  br i1 %191, label %.lr.ph168, label %._crit_edge169, !llvm.loop !24

192:                                              ; preds = %185, %.lr.ph168
  %193 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  br label %237

._crit_edge174:                                   ; preds = %214, %._crit_edge169.thread, %._crit_edge169
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #8
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #8
  %indvars.iv.next233 = add nuw nsw i64 %indvars.iv232, 1
  %194 = load i32, ptr @w, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = icmp slt i64 %indvars.iv.next233, %195
  br i1 %196, label %.lr.ph177, label %._crit_edge178.loopexit, !llvm.loop !25

.lr.ph173:                                        ; preds = %._crit_edge169, %214
  %.1104171 = phi i32 [ %200, %214 ], [ 0, %._crit_edge169 ]
  %storemerge122170 = phi i32 [ %231, %214 ], [ 0, %._crit_edge169 ]
  %197 = sext i32 %storemerge122170 to i64
  %198 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv232, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !5
  %200 = add nsw i32 %199, %.1104171
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #8
  %201 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %indvars.iv232, i64 %197
  %202 = load i32, ptr %201, align 4, !tbaa !5
  %203 = getelementptr inbounds [2005 x [2005 x i32]], ptr @downSum, i64 0, i64 %indvars.iv232, i64 %197
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = getelementptr inbounds [2005 x [2005 x i32]], ptr @rightSum, i64 0, i64 %indvars.iv232, i64 %197
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %.neg = mul i32 %199, -3
  %207 = add i32 %.neg, %200
  %208 = add i32 %207, %202
  %209 = add i32 %208, %204
  %210 = add i32 %209, %206
  store i32 %210, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #8
  %211 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %212 unwind label %235

212:                                              ; preds = %.lr.ph173
  store i64 %211, ptr %14, align 8
  %213 = invoke noundef i64 @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 4 dereferenceable(8) %14)
          to label %214 unwind label %235

214:                                              ; preds = %212
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #8
  call void @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %15, ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  %215 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt16reverse_iteratorISt23_Rb_tree_const_iteratorISt4pairIiiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
  %.sroa.0.0.copyload = load i32, ptr %215, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #8
  %216 = sub nsw i32 %.sroa.0.0.copyload, %200
  %217 = load i32, ptr %12, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [2005 x [2005 x i32]], ptr @upSum, i64 0, i64 %indvars.iv232, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = getelementptr inbounds [2005 x [2005 x i32]], ptr @leftSum, i64 0, i64 %indvars.iv232, i64 %218
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = getelementptr inbounds [2005 x [2005 x i32]], ptr @ms, i64 0, i64 %indvars.iv232, i64 %218
  %224 = load i32, ptr %223, align 4, !tbaa !5
  %225 = add i32 %220, %216
  %226 = add i32 %225, %222
  %227 = sub i32 %226, %224
  store i32 %227, ptr %16, align 4, !tbaa !5
  %228 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %229 = load i32, ptr %228, align 4, !tbaa !5
  store i32 %229, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  %230 = load i32, ptr %12, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr %12, align 4, !tbaa !5
  %232 = load i32, ptr @h, align 4, !tbaa !5
  %233 = add nsw i32 %232, -1
  %234 = icmp slt i32 %231, %233
  br i1 %234, label %.lr.ph173, label %._crit_edge174, !llvm.loop !26

235:                                              ; preds = %212, %.lr.ph173
  %236 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #8
  br label %237

237:                                              ; preds = %235, %192
  %.pn = phi { ptr, i32 } [ %193, %192 ], [ %236, %235 ]
  call void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  br label %238

238:                                              ; preds = %237, %38
  %.pn126 = phi { ptr, i32 } [ %39, %38 ], [ %.pn, %237 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn126
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #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 void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 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 #2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { mustprogress 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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !15}
!18 = distinct !{!18, !10, !15}
!19 = distinct !{!19, !10, !15}
!20 = distinct !{!20, !10, !21}
!21 = !{!"llvm.loop.peeled.count", i32 1}
!22 = distinct !{!22, !10, !15}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass