; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/CROC-MBTU 2012, Elimination Round (ACM-ICPC)/Problem H (H)

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

@l = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@dp = external dso_local global [5001 x [5001 x i32]], align 16
@q = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %19 = getelementptr i8, ptr %18, i64 -24
  %20 = load i64, ptr %19, align 8
  %21 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %20
  %22 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %21, ptr noundef null)
  %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)
  %24 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %25 = trunc i64 %24 to i32
  store i32 %25, ptr @l, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %26

26:                                               ; preds = %38, %0
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = load i32, ptr @l, align 4, !tbaa !8
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %41

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %33
  %35 = load i32, ptr %2, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [5001 x i32], ptr %34, i64 0, i64 %36
  store i32 1, ptr %37, align 4, !tbaa !8
  br label %38

38:                                               ; preds = %31
  %39 = load i32, ptr %2, align 4, !tbaa !8
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !8
  br label %26, !llvm.loop !11

41:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %42

42:                                               ; preds = %69, %41
  %43 = load i32, ptr %3, align 4, !tbaa !8
  %44 = load i32, ptr @l, align 4, !tbaa !8
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %72

47:                                               ; preds = %42
  %48 = load i32, ptr %3, align 4, !tbaa !8
  %49 = sext i32 %48 to i64
  %50 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %49)
  %51 = load i8, ptr %50, align 1, !tbaa !13
  %52 = sext i8 %51 to i32
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = sub nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %55)
  %57 = load i8, ptr %56, align 1, !tbaa !13
  %58 = sext i8 %57 to i32
  %59 = icmp eq i32 %52, %58
  br i1 %59, label %60, label %68

60:                                               ; preds = %47
  %61 = load i32, ptr %3, align 4, !tbaa !8
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %63
  %65 = load i32, ptr %3, align 4, !tbaa !8
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [5001 x i32], ptr %64, i64 0, i64 %66
  store i32 1, ptr %67, align 4, !tbaa !8
  br label %68

68:                                               ; preds = %60, %47
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %3, align 4, !tbaa !8
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %3, align 4, !tbaa !8
  br label %42, !llvm.loop !14

72:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 3, ptr %4, align 4, !tbaa !8
  br label %73

73:                                               ; preds = %127, %72
  %74 = load i32, ptr %4, align 4, !tbaa !8
  %75 = load i32, ptr @l, align 4, !tbaa !8
  %76 = icmp sle i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %130

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %79

79:                                               ; preds = %123, %78
  %80 = load i32, ptr %6, align 4, !tbaa !8
  %81 = load i32, ptr @l, align 4, !tbaa !8
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

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

84:                                               ; preds = %79
  %85 = load i32, ptr %6, align 4, !tbaa !8
  %86 = add nsw i32 %85, 1
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %87
  %89 = load i32, ptr %6, align 4, !tbaa !8
  %90 = load i32, ptr %4, align 4, !tbaa !8
  %91 = add nsw i32 %89, %90
  %92 = sub nsw i32 %91, 2
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [5001 x i32], ptr %88, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !8
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %122

97:                                               ; preds = %84
  %98 = load i32, ptr %6, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %99)
  %101 = load i8, ptr %100, align 1, !tbaa !13
  %102 = sext i8 %101 to i32
  %103 = load i32, ptr %6, align 4, !tbaa !8
  %104 = load i32, ptr %4, align 4, !tbaa !8
  %105 = add nsw i32 %103, %104
  %106 = sub nsw i32 %105, 1
  %107 = sext i32 %106 to i64
  %108 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %107)
  %109 = load i8, ptr %108, align 1, !tbaa !13
  %110 = sext i8 %109 to i32
  %111 = icmp eq i32 %102, %110
  br i1 %111, label %112, label %122

112:                                              ; preds = %97
  %113 = load i32, ptr %6, align 4, !tbaa !8
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %114
  %116 = load i32, ptr %6, align 4, !tbaa !8
  %117 = load i32, ptr %4, align 4, !tbaa !8
  %118 = add nsw i32 %116, %117
  %119 = sub nsw i32 %118, 1
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [5001 x i32], ptr %115, i64 0, i64 %120
  store i32 1, ptr %121, align 4, !tbaa !8
  br label %122

122:                                              ; preds = %112, %97, %84
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %6, align 4, !tbaa !8
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !8
  br label %79, !llvm.loop !15

126:                                              ; preds = %83
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %4, align 4, !tbaa !8
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %4, align 4, !tbaa !8
  br label %73, !llvm.loop !16

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

131:                                              ; preds = %163, %130
  %132 = load i32, ptr %7, align 4, !tbaa !8
  %133 = load i32, ptr @l, align 4, !tbaa !8
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %136, label %135

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

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

137:                                              ; preds = %159, %136
  %138 = load i32, ptr %8, align 4, !tbaa !8
  %139 = load i32, ptr @l, align 4, !tbaa !8
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %142, label %141

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

142:                                              ; preds = %137
  %143 = load i32, ptr %7, align 4, !tbaa !8
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %144
  %146 = load i32, ptr %8, align 4, !tbaa !8
  %147 = sub nsw i32 %146, 1
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [5001 x i32], ptr %145, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !8
  %151 = load i32, ptr %7, align 4, !tbaa !8
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %152
  %154 = load i32, ptr %8, align 4, !tbaa !8
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [5001 x i32], ptr %153, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !8
  %158 = add nsw i32 %157, %150
  store i32 %158, ptr %156, align 4, !tbaa !8
  br label %159

159:                                              ; preds = %142
  %160 = load i32, ptr %8, align 4, !tbaa !8
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %8, align 4, !tbaa !8
  br label %137, !llvm.loop !17

162:                                              ; preds = %141
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %7, align 4, !tbaa !8
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %7, align 4, !tbaa !8
  br label %131, !llvm.loop !18

166:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %167

167:                                              ; preds = %199, %166
  %168 = load i32, ptr %9, align 4, !tbaa !8
  %169 = load i32, ptr @l, align 4, !tbaa !8
  %170 = icmp slt i32 %168, %169
  br i1 %170, label %172, label %171

171:                                              ; preds = %167
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %202

172:                                              ; preds = %167
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !8
  br label %173

173:                                              ; preds = %195, %172
  %174 = load i32, ptr %10, align 4, !tbaa !8
  %175 = load i32, ptr @l, align 4, !tbaa !8
  %176 = icmp slt i32 %174, %175
  br i1 %176, label %178, label %177

177:                                              ; preds = %173
  store i32 23, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %198

178:                                              ; preds = %173
  %179 = load i32, ptr %10, align 4, !tbaa !8
  %180 = sub nsw i32 %179, 1
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %181
  %183 = load i32, ptr %9, align 4, !tbaa !8
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [5001 x i32], ptr %182, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !8
  %187 = load i32, ptr %10, align 4, !tbaa !8
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %188
  %190 = load i32, ptr %9, align 4, !tbaa !8
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [5001 x i32], ptr %189, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !8
  %194 = add nsw i32 %193, %186
  store i32 %194, ptr %192, align 4, !tbaa !8
  br label %195

195:                                              ; preds = %178
  %196 = load i32, ptr %10, align 4, !tbaa !8
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %10, align 4, !tbaa !8
  br label %173, !llvm.loop !19

198:                                              ; preds = %177
  br label %199

199:                                              ; preds = %198
  %200 = load i32, ptr %9, align 4, !tbaa !8
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %9, align 4, !tbaa !8
  br label %167, !llvm.loop !20

202:                                              ; preds = %171
  %203 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @q)
  br label %204

204:                                              ; preds = %256, %202
  %205 = load i32, ptr @q, align 4, !tbaa !8
  %206 = add nsw i32 %205, -1
  store i32 %206, ptr @q, align 4, !tbaa !8
  %207 = icmp ne i32 %205, 0
  br i1 %207, label %208, label %260

208:                                              ; preds = %204
  %209 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %210 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %209, ptr noundef nonnull align 4 dereferenceable(4) @y)
  %211 = load i32, ptr @x, align 4, !tbaa !8
  %212 = add nsw i32 %211, -1
  store i32 %212, ptr @x, align 4, !tbaa !8
  %213 = load i32, ptr @y, align 4, !tbaa !8
  %214 = add nsw i32 %213, -1
  store i32 %214, ptr @y, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %215 = load i32, ptr @y, align 4, !tbaa !8
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %216
  %218 = load i32, ptr @y, align 4, !tbaa !8
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [5001 x i32], ptr %217, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !8
  store i32 %221, ptr %11, align 4, !tbaa !8
  %222 = load i32, ptr @x, align 4, !tbaa !8
  %223 = icmp sgt i32 %222, 0
  br i1 %223, label %224, label %256

224:                                              ; preds = %208
  %225 = load i32, ptr @y, align 4, !tbaa !8
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %226
  %228 = load i32, ptr @x, align 4, !tbaa !8
  %229 = sub nsw i32 %228, 1
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [5001 x i32], ptr %227, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !8
  %233 = load i32, ptr %11, align 4, !tbaa !8
  %234 = sub nsw i32 %233, %232
  store i32 %234, ptr %11, align 4, !tbaa !8
  %235 = load i32, ptr @x, align 4, !tbaa !8
  %236 = sub nsw i32 %235, 1
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %237
  %239 = load i32, ptr @y, align 4, !tbaa !8
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [5001 x i32], ptr %238, i64 0, i64 %240
  %242 = load i32, ptr %241, align 4, !tbaa !8
  %243 = load i32, ptr %11, align 4, !tbaa !8
  %244 = sub nsw i32 %243, %242
  store i32 %244, ptr %11, align 4, !tbaa !8
  %245 = load i32, ptr @x, align 4, !tbaa !8
  %246 = sub nsw i32 %245, 1
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %247
  %249 = load i32, ptr @x, align 4, !tbaa !8
  %250 = sub nsw i32 %249, 1
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [5001 x i32], ptr %248, i64 0, i64 %251
  %253 = load i32, ptr %252, align 4, !tbaa !8
  %254 = load i32, ptr %11, align 4, !tbaa !8
  %255 = add nsw i32 %254, %253
  store i32 %255, ptr %11, align 4, !tbaa !8
  br label %256

256:                                              ; preds = %224, %208
  %257 = load i32, ptr %11, align 4, !tbaa !8
  %258 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %257)
  %259 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %258, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %204, !llvm.loop !21

260:                                              ; preds = %204
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 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)) #1

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

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

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

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

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


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

@l = external dso_local local_unnamed_addr global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@dp = external dso_local local_unnamed_addr global [5001 x [5001 x i32]], align 16
@q = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = 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)
  %13 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #4
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr @l, align 4, !tbaa !8
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge77

.lr.ph.preheader:                                 ; preds = %0
  %wide.trip.count = and i64 %13, 2147483647
  %16 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %13, 3
  %17 = icmp ult i64 %16, 3
  br i1 %17, label %.preheader61.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
  br label %.lr.ph

.preheader61.unr-lcssa:                           ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader61, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader61.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %.preheader61.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %.preheader61.unr-lcssa ]
  %18 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv.epil
  store i32 1, ptr %18, align 4, !tbaa !8
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader61, label %.lr.ph.epil, !llvm.loop !11

.preheader61:                                     ; preds = %.lr.ph.epil, %.preheader61.unr-lcssa
  %.not131 = icmp eq i32 %14, 1
  br i1 %.not131, label %.preheader58, label %.lr.ph64

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %19 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 %indvars.iv
  store i32 1, ptr %19, align 16, !tbaa !8
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %20 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next
  store i32 1, ptr %20, align 8, !tbaa !8
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %21 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv.next.1
  store i32 1, ptr %21, align 16, !tbaa !8
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %22 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv.next.2
  store i32 1, ptr %22, align 8, !tbaa !8
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader61.unr-lcssa, label %.lr.ph, !llvm.loop !13

.preheader60:                                     ; preds = %31
  %.not67 = icmp slt i32 %32, 3
  br i1 %.not67, label %.preheader58, label %.preheader59

.lr.ph64:                                         ; preds = %.preheader61, %31
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %31 ], [ 1, %.preheader61 ]
  %23 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv88)
  %24 = load i8, ptr %23, align 1, !tbaa !15
  %25 = add nsw i64 %indvars.iv88, -1
  %26 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %25)
  %27 = load i8, ptr %26, align 1, !tbaa !15
  %28 = icmp eq i8 %24, %27
  br i1 %28, label %29, label %31

29:                                               ; preds = %.lr.ph64
  %30 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %25, i64 %indvars.iv88
  store i32 1, ptr %30, align 4, !tbaa !8
  br label %31

31:                                               ; preds = %.lr.ph64, %29
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %32 = load i32, ptr @l, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next89, %33
  br i1 %34, label %.lr.ph64, label %.preheader60, !llvm.loop !16

.preheader59:                                     ; preds = %.preheader60, %._crit_edge
  %35 = phi i32 [ %58, %._crit_edge ], [ %32, %.preheader60 ]
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %._crit_edge ], [ 3, %.preheader60 ]
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph66, label %.preheader59.._crit_edge_crit_edge

.preheader59.._crit_edge_crit_edge:               ; preds = %.preheader59
  %.pre119 = sext i32 %35 to i64
  br label %._crit_edge

.preheader58:                                     ; preds = %._crit_edge, %.preheader61, %.preheader60
  %.lcssa = phi i32 [ %32, %.preheader60 ], [ %14, %.preheader61 ], [ %58, %._crit_edge ]
  %37 = icmp slt i32 %.lcssa, 1
  %or.cond = icmp slt i32 %.lcssa, 2
  br i1 %or.cond, label %._crit_edge77, label %.preheader57.us.preheader

.preheader57.us.preheader:                        ; preds = %.preheader58
  %wide.trip.count105 = zext nneg i32 %.lcssa to i64
  %38 = add nsw i64 %wide.trip.count105, -1
  %39 = add nsw i64 %wide.trip.count105, -2
  %xtraiter140 = and i64 %38, 3
  %40 = icmp ult i64 %39, 3
  %unroll_iter143 = and i64 %38, -4
  %lcmp.mod142.not = icmp eq i64 %xtraiter140, 0
  br label %.preheader57.us

.preheader57.us:                                  ; preds = %.preheader57.us.preheader, %._crit_edge71.us
  %indvars.iv102 = phi i64 [ 0, %.preheader57.us.preheader ], [ %indvars.iv.next103, %._crit_edge71.us ]
  %.phi.trans.insert = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv102, i64 0
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !8
  br i1 %40, label %._crit_edge71.us.unr-lcssa, label %.preheader57.us.new

.preheader57.us.new:                              ; preds = %.preheader57.us, %.preheader57.us.new
  %41 = phi i32 [ %53, %.preheader57.us.new ], [ %.pre, %.preheader57.us ]
  %indvars.iv97 = phi i64 [ %indvars.iv.next98.3, %.preheader57.us.new ], [ 1, %.preheader57.us ]
  %niter144 = phi i64 [ %niter144.next.3, %.preheader57.us.new ], [ 0, %.preheader57.us ]
  %42 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv102, i64 %indvars.iv97
  %43 = load i32, ptr %42, align 4, !tbaa !8
  %44 = add nsw i32 %43, %41
  store i32 %44, ptr %42, align 4, !tbaa !8
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %45 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv102, i64 %indvars.iv.next98
  %46 = load i32, ptr %45, align 4, !tbaa !8
  %47 = add nsw i32 %46, %44
  store i32 %47, ptr %45, align 4, !tbaa !8
  %indvars.iv.next98.1 = add nuw nsw i64 %indvars.iv97, 2
  %48 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv102, i64 %indvars.iv.next98.1
  %49 = load i32, ptr %48, align 4, !tbaa !8
  %50 = add nsw i32 %49, %47
  store i32 %50, ptr %48, align 4, !tbaa !8
  %indvars.iv.next98.2 = add nuw nsw i64 %indvars.iv97, 3
  %51 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv102, i64 %indvars.iv.next98.2
  %52 = load i32, ptr %51, align 4, !tbaa !8
  %53 = add nsw i32 %52, %50
  store i32 %53, ptr %51, align 4, !tbaa !8
  %indvars.iv.next98.3 = add nuw nsw i64 %indvars.iv97, 4
  %niter144.next.3 = add i64 %niter144, 4
  %niter144.ncmp.3 = icmp eq i64 %niter144.next.3, %unroll_iter143
  br i1 %niter144.ncmp.3, label %._crit_edge71.us.unr-lcssa, label %.preheader57.us.new, !llvm.loop !17

._crit_edge71.us.unr-lcssa:                       ; preds = %.preheader57.us.new, %.preheader57.us
  %.unr = phi i32 [ %.pre, %.preheader57.us ], [ %53, %.preheader57.us.new ]
  %indvars.iv97.unr = phi i64 [ 1, %.preheader57.us ], [ %indvars.iv.next98.3, %.preheader57.us.new ]
  br i1 %lcmp.mod142.not, label %._crit_edge71.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge71.us.unr-lcssa, %.epil.preheader
  %54 = phi i32 [ %57, %.epil.preheader ], [ %.unr, %._crit_edge71.us.unr-lcssa ]
  %indvars.iv97.epil = phi i64 [ %indvars.iv.next98.epil, %.epil.preheader ], [ %indvars.iv97.unr, %._crit_edge71.us.unr-lcssa ]
  %epil.iter141 = phi i64 [ %epil.iter141.next, %.epil.preheader ], [ 0, %._crit_edge71.us.unr-lcssa ]
  %55 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv102, i64 %indvars.iv97.epil
  %56 = load i32, ptr %55, align 4, !tbaa !8
  %57 = add nsw i32 %56, %54
  store i32 %57, ptr %55, align 4, !tbaa !8
  %indvars.iv.next98.epil = add nuw nsw i64 %indvars.iv97.epil, 1
  %epil.iter141.next = add i64 %epil.iter141, 1
  %epil.iter141.cmp.not = icmp eq i64 %epil.iter141.next, %xtraiter140
  br i1 %epil.iter141.cmp.not, label %._crit_edge71.us, label %.epil.preheader, !llvm.loop !18

._crit_edge71.us:                                 ; preds = %.epil.preheader, %._crit_edge71.us.unr-lcssa
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %exitcond106.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count105
  br i1 %exitcond106.not, label %.preheader56, label %.preheader57.us, !llvm.loop !19

._crit_edge:                                      ; preds = %72, %.preheader59.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre119, %.preheader59.._crit_edge_crit_edge ], [ %74, %72 ]
  %58 = phi i32 [ %35, %.preheader59.._crit_edge_crit_edge ], [ %73, %72 ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %.not.not = icmp slt i64 %indvars.iv94, %.pre-phi
  br i1 %.not.not, label %.preheader59, label %.preheader58, !llvm.loop !20

.lr.ph66:                                         ; preds = %.preheader59, %72
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %72 ], [ 0, %.preheader59 ]
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %59 = add nuw nsw i64 %indvars.iv91, %indvars.iv94
  %60 = add nsw i64 %59, -2
  %61 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next92, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %.not53 = icmp eq i32 %62, 0
  br i1 %.not53, label %72, label %63

63:                                               ; preds = %.lr.ph66
  %64 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv91)
  %65 = load i8, ptr %64, align 1, !tbaa !15
  %66 = add nsw i64 %59, -1
  %67 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %66)
  %68 = load i8, ptr %67, align 1, !tbaa !15
  %69 = icmp eq i8 %65, %68
  br i1 %69, label %70, label %72

70:                                               ; preds = %63
  %71 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv91, i64 %66
  store i32 1, ptr %71, align 4, !tbaa !8
  br label %72

72:                                               ; preds = %.lr.ph66, %63, %70
  %73 = load i32, ptr @l, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next92, %74
  br i1 %75, label %.lr.ph66, label %._crit_edge, !llvm.loop !22

.preheader56:                                     ; preds = %._crit_edge71.us
  br i1 %37, label %._crit_edge77, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.preheader56
  %wide.trip.count115 = zext nneg i32 %.lcssa to i64
  %xtraiter146 = and i64 %38, 3
  %76 = icmp ult i64 %39, 3
  %unroll_iter150 = and i64 %38, -4
  %lcmp.mod149.not = icmp eq i64 %xtraiter146, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge75.us
  %indvars.iv112 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next113, %._crit_edge75.us ]
  %.phi.trans.insert117 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 0, i64 %indvars.iv112
  %.pre118 = load i32, ptr %.phi.trans.insert117, align 4, !tbaa !8
  br i1 %76, label %._crit_edge75.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %77 = phi i32 [ %89, %.preheader.us.new ], [ %.pre118, %.preheader.us ]
  %indvars.iv107 = phi i64 [ %indvars.iv.next108.3, %.preheader.us.new ], [ 1, %.preheader.us ]
  %niter151 = phi i64 [ %niter151.next.3, %.preheader.us.new ], [ 0, %.preheader.us ]
  %78 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv107, i64 %indvars.iv112
  %79 = load i32, ptr %78, align 4, !tbaa !8
  %80 = add nsw i32 %79, %77
  store i32 %80, ptr %78, align 4, !tbaa !8
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %81 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next108, i64 %indvars.iv112
  %82 = load i32, ptr %81, align 4, !tbaa !8
  %83 = add nsw i32 %82, %80
  store i32 %83, ptr %81, align 4, !tbaa !8
  %indvars.iv.next108.1 = add nuw nsw i64 %indvars.iv107, 2
  %84 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next108.1, i64 %indvars.iv112
  %85 = load i32, ptr %84, align 4, !tbaa !8
  %86 = add nsw i32 %85, %83
  store i32 %86, ptr %84, align 4, !tbaa !8
  %indvars.iv.next108.2 = add nuw nsw i64 %indvars.iv107, 3
  %87 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next108.2, i64 %indvars.iv112
  %88 = load i32, ptr %87, align 4, !tbaa !8
  %89 = add nsw i32 %88, %86
  store i32 %89, ptr %87, align 4, !tbaa !8
  %indvars.iv.next108.3 = add nuw nsw i64 %indvars.iv107, 4
  %niter151.next.3 = add i64 %niter151, 4
  %niter151.ncmp.3 = icmp eq i64 %niter151.next.3, %unroll_iter150
  br i1 %niter151.ncmp.3, label %._crit_edge75.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !23

._crit_edge75.us.unr-lcssa:                       ; preds = %.preheader.us.new, %.preheader.us
  %.unr148 = phi i32 [ %.pre118, %.preheader.us ], [ %89, %.preheader.us.new ]
  %indvars.iv107.unr = phi i64 [ 1, %.preheader.us ], [ %indvars.iv.next108.3, %.preheader.us.new ]
  br i1 %lcmp.mod149.not, label %._crit_edge75.us, label %.epil.preheader145

.epil.preheader145:                               ; preds = %._crit_edge75.us.unr-lcssa, %.epil.preheader145
  %90 = phi i32 [ %93, %.epil.preheader145 ], [ %.unr148, %._crit_edge75.us.unr-lcssa ]
  %indvars.iv107.epil = phi i64 [ %indvars.iv.next108.epil, %.epil.preheader145 ], [ %indvars.iv107.unr, %._crit_edge75.us.unr-lcssa ]
  %epil.iter147 = phi i64 [ %epil.iter147.next, %.epil.preheader145 ], [ 0, %._crit_edge75.us.unr-lcssa ]
  %91 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %indvars.iv107.epil, i64 %indvars.iv112
  %92 = load i32, ptr %91, align 4, !tbaa !8
  %93 = add nsw i32 %92, %90
  store i32 %93, ptr %91, align 4, !tbaa !8
  %indvars.iv.next108.epil = add nuw nsw i64 %indvars.iv107.epil, 1
  %epil.iter147.next = add i64 %epil.iter147, 1
  %epil.iter147.cmp.not = icmp eq i64 %epil.iter147.next, %xtraiter146
  br i1 %epil.iter147.cmp.not, label %._crit_edge75.us, label %.epil.preheader145, !llvm.loop !24

._crit_edge75.us:                                 ; preds = %.epil.preheader145, %._crit_edge75.us.unr-lcssa
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %exitcond116.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count115
  br i1 %exitcond116.not, label %._crit_edge77, label %.preheader.us, !llvm.loop !25

._crit_edge77:                                    ; preds = %._crit_edge75.us, %0, %.preheader58, %.preheader56
  %94 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @q)
  %95 = load i32, ptr @q, align 4, !tbaa !8
  %96 = add nsw i32 %95, -1
  store i32 %96, ptr @q, align 4, !tbaa !8
  %.not5278 = icmp eq i32 %95, 0
  br i1 %.not5278, label %._crit_edge81, label %.lr.ph80

.lr.ph80:                                         ; preds = %._crit_edge77, %119
  %97 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %98 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %97, ptr noundef nonnull align 4 dereferenceable(4) @y)
  %99 = load i32, ptr @x, align 4, !tbaa !8
  %100 = add nsw i32 %99, -1
  store i32 %100, ptr @x, align 4, !tbaa !8
  %101 = load i32, ptr @y, align 4, !tbaa !8
  %102 = add nsw i32 %101, -1
  store i32 %102, ptr @y, align 4, !tbaa !8
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %103, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !8
  %106 = icmp sgt i32 %99, 1
  br i1 %106, label %107, label %119

107:                                              ; preds = %.lr.ph80
  %108 = add nsw i32 %99, -2
  %109 = zext nneg i32 %108 to i64
  %110 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %103, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !8
  %112 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %109, i64 %103
  %113 = load i32, ptr %112, align 4, !tbaa !8
  %114 = getelementptr inbounds [5001 x [5001 x i32]], ptr @dp, i64 0, i64 %109, i64 %109
  %115 = load i32, ptr %114, align 4, !tbaa !8
  %116 = add i32 %111, %113
  %117 = sub i32 %105, %116
  %118 = add nsw i32 %117, %115
  br label %119

119:                                              ; preds = %107, %.lr.ph80
  %.0 = phi i32 [ %118, %107 ], [ %105, %.lr.ph80 ]
  %120 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.0)
  %121 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %120, ptr noundef nonnull @.str)
  %122 = load i32, ptr @q, align 4, !tbaa !8
  %123 = add nsw i32 %122, -1
  store i32 %123, ptr @q, align 4, !tbaa !8
  %.not52 = icmp eq i32 %122, 0
  br i1 %.not52, label %._crit_edge81, label %.lr.ph80, !llvm.loop !26

._crit_edge81:                                    ; preds = %119, %._crit_edge77
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #2 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 #1

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #4 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14, !21}
!21 = !{!"llvm.loop.unswitch.partial.disable"}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}


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