; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/Good Bye 2015/Problem D (D)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__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" }

@z = external dso_local global [5100 x [5100 x i32]], align 16
@n = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@MOD = external dso_local global i64, align 8
@dp = external dso_local global [5100 x [5100 x i64]], align 16
@sum = external dso_local global [5100 x [5100 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; 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_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

26:                                               ; preds = %40, %0
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = load i32, ptr @n, 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) #6
  br label %47

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = load i32, ptr @n, align 4, !tbaa !8
  %35 = load i32, ptr %2, align 4, !tbaa !8
  %36 = sub nsw i32 %34, %35
  %37 = sext i32 %36 to i64
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %3, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %33, i64 noundef %37)
  %38 = load i32, ptr %2, align 4, !tbaa !8
  invoke void @_Z7build_zNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef %3, i32 noundef %38)
          to label %39 unwind label %43

39:                                               ; preds = %31
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  br label %40

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

43:                                               ; preds = %31
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %4, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %379

47:                                               ; preds = %30
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 0)
  %49 = load i8, ptr %48, align 1, !tbaa !13
  %50 = sext i8 %49 to i32
  %51 = icmp ne i32 %50, 48
  br i1 %51, label %52, label %53

52:                                               ; preds = %47
  store i64 1, ptr getelementptr inbounds ([5100 x i64], ptr @dp, i64 0, i64 1), align 8, !tbaa !14
  br label %53

53:                                               ; preds = %52, %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !8
  br label %54

54:                                               ; preds = %348, %53
  %55 = load i32, ptr %6, align 4, !tbaa !8
  %56 = load i32, ptr @n, align 4, !tbaa !8
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

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

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

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

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

65:                                               ; preds = %60
  %66 = load i32, ptr %6, align 4, !tbaa !8
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %68
  %70 = load i32, ptr %8, align 4, !tbaa !8
  %71 = sub nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [5100 x i64], ptr %69, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !14
  %75 = load i32, ptr %6, align 4, !tbaa !8
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %77
  %79 = load i32, ptr %8, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [5100 x i64], ptr %78, i64 0, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !14
  %83 = add nsw i64 %74, %82
  %84 = load i32, ptr %6, align 4, !tbaa !8
  %85 = sub nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %86
  %88 = load i32, ptr %8, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [5100 x i64], ptr %87, i64 0, i64 %89
  store i64 %83, ptr %90, align 8, !tbaa !14
  %91 = load i32, ptr %6, align 4, !tbaa !8
  %92 = sub nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %93
  %95 = load i32, ptr %8, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [5100 x i64], ptr %94, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !14
  %99 = load i64, ptr @MOD, align 8, !tbaa !14
  %100 = icmp sge i64 %98, %99
  br i1 %100, label %101, label %112

101:                                              ; preds = %65
  %102 = load i64, ptr @MOD, align 8, !tbaa !14
  %103 = load i32, ptr %6, align 4, !tbaa !8
  %104 = sub nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %105
  %107 = load i32, ptr %8, align 4, !tbaa !8
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [5100 x i64], ptr %106, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !14
  %111 = sub nsw i64 %110, %102
  store i64 %111, ptr %109, align 8, !tbaa !14
  br label %112

112:                                              ; preds = %101, %65
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %8, align 4, !tbaa !8
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %8, align 4, !tbaa !8
  br label %60, !llvm.loop !16

116:                                              ; preds = %64
  %117 = load i32, ptr %6, align 4, !tbaa !8
  %118 = sext i32 %117 to i64
  %119 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %118)
  %120 = load i8, ptr %119, align 1, !tbaa !13
  %121 = sext i8 %120 to i32
  %122 = icmp ne i32 %121, 48
  br i1 %122, label %123, label %161

123:                                              ; preds = %116
  %124 = load i32, ptr %6, align 4, !tbaa !8
  %125 = sub nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %126)
  %128 = load i8, ptr %127, align 1, !tbaa !13
  %129 = sext i8 %128 to i32
  %130 = icmp ne i32 %129, 48
  br i1 %130, label %131, label %155

131:                                              ; preds = %123
  %132 = load i32, ptr %6, align 4, !tbaa !8
  %133 = sub nsw i32 %132, 1
  %134 = sext i32 %133 to i64
  %135 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %134)
  %136 = load i8, ptr %135, align 1, !tbaa !13
  %137 = sext i8 %136 to i32
  %138 = load i32, ptr %6, align 4, !tbaa !8
  %139 = sext i32 %138 to i64
  %140 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %139)
  %141 = load i8, ptr %140, align 1, !tbaa !13
  %142 = sext i8 %141 to i32
  %143 = icmp slt i32 %137, %142
  br i1 %143, label %144, label %155

144:                                              ; preds = %131
  %145 = load i32, ptr %6, align 4, !tbaa !8
  %146 = sub nsw i32 %145, 1
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %147
  %149 = getelementptr inbounds [5100 x i64], ptr %148, i64 0, i64 1
  %150 = load i64, ptr %149, align 8, !tbaa !14
  %151 = load i32, ptr %6, align 4, !tbaa !8
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %152
  %154 = getelementptr inbounds [5100 x i64], ptr %153, i64 0, i64 1
  store i64 %150, ptr %154, align 8, !tbaa !14
  br label %160

155:                                              ; preds = %131, %123
  %156 = load i32, ptr %6, align 4, !tbaa !8
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %157
  %159 = getelementptr inbounds [5100 x i64], ptr %158, i64 0, i64 1
  store i64 0, ptr %159, align 8, !tbaa !14
  br label %160

160:                                              ; preds = %155, %144
  br label %166

161:                                              ; preds = %116
  %162 = load i32, ptr %6, align 4, !tbaa !8
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %163
  %165 = getelementptr inbounds [5100 x i64], ptr %164, i64 0, i64 1
  store i64 0, ptr %165, align 8, !tbaa !14
  br label %166

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

167:                                              ; preds = %344, %166
  %168 = load i32, ptr %6, align 4, !tbaa !8
  %169 = load i32, ptr %9, align 4, !tbaa !8
  %170 = sub nsw i32 %168, %169
  %171 = add nsw i32 %170, 1
  %172 = icmp sge i32 %171, 0
  br i1 %172, label %174, label %173

173:                                              ; preds = %167
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %347

174:                                              ; preds = %167
  %175 = load i32, ptr %6, align 4, !tbaa !8
  %176 = load i32, ptr %9, align 4, !tbaa !8
  %177 = sub nsw i32 %175, %176
  %178 = add nsw i32 %177, 1
  %179 = sext i32 %178 to i64
  %180 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %179)
  %181 = load i8, ptr %180, align 1, !tbaa !13
  %182 = sext i8 %181 to i32
  %183 = icmp eq i32 %182, 48
  br i1 %183, label %184, label %191

184:                                              ; preds = %174
  %185 = load i32, ptr %6, align 4, !tbaa !8
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %186
  %188 = load i32, ptr %9, align 4, !tbaa !8
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [5100 x i64], ptr %187, i64 0, i64 %189
  store i64 0, ptr %190, align 8, !tbaa !14
  br label %344

191:                                              ; preds = %174
  %192 = load i32, ptr %6, align 4, !tbaa !8
  %193 = load i32, ptr %9, align 4, !tbaa !8
  %194 = sub nsw i32 %192, %193
  %195 = add nsw i32 %194, 1
  %196 = icmp eq i32 %195, 0
  br i1 %196, label %197, label %204

197:                                              ; preds = %191
  %198 = load i32, ptr %6, align 4, !tbaa !8
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %199
  %201 = load i32, ptr %9, align 4, !tbaa !8
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [5100 x i64], ptr %200, i64 0, i64 %202
  store i64 1, ptr %203, align 8, !tbaa !14
  br label %344

204:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %205 = load i32, ptr %6, align 4, !tbaa !8
  %206 = load i32, ptr %9, align 4, !tbaa !8
  %207 = sub nsw i32 %205, %206
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %208
  %210 = load i32, ptr %9, align 4, !tbaa !8
  %211 = sub nsw i32 %210, 1
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [5100 x i64], ptr %209, i64 0, i64 %212
  %214 = load i64, ptr %213, align 8, !tbaa !14
  store i64 %214, ptr %10, align 8, !tbaa !14
  %215 = load i32, ptr %6, align 4, !tbaa !8
  %216 = load i32, ptr %9, align 4, !tbaa !8
  %217 = sub nsw i32 %215, %216
  %218 = load i32, ptr %9, align 4, !tbaa !8
  %219 = sub nsw i32 %217, %218
  %220 = add nsw i32 %219, 1
  %221 = icmp slt i32 %220, 0
  br i1 %221, label %222, label %230

222:                                              ; preds = %204
  %223 = load i64, ptr %10, align 8, !tbaa !14
  %224 = load i32, ptr %6, align 4, !tbaa !8
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %225
  %227 = load i32, ptr %9, align 4, !tbaa !8
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [5100 x i64], ptr %226, i64 0, i64 %228
  store i64 %223, ptr %229, align 8, !tbaa !14
  store i32 13, ptr %7, align 4
  br label %341

230:                                              ; preds = %204
  %231 = load i32, ptr %6, align 4, !tbaa !8
  %232 = load i32, ptr %9, align 4, !tbaa !8
  %233 = sub nsw i32 %231, %232
  %234 = load i32, ptr %9, align 4, !tbaa !8
  %235 = sub nsw i32 %233, %234
  %236 = add nsw i32 %235, 1
  %237 = sext i32 %236 to i64
  %238 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %237)
  %239 = load i8, ptr %238, align 1, !tbaa !13
  %240 = sext i8 %239 to i32
  %241 = icmp eq i32 %240, 48
  br i1 %241, label %242, label %250

242:                                              ; preds = %230
  %243 = load i64, ptr %10, align 8, !tbaa !14
  %244 = load i32, ptr %6, align 4, !tbaa !8
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %245
  %247 = load i32, ptr %9, align 4, !tbaa !8
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [5100 x i64], ptr %246, i64 0, i64 %248
  store i64 %243, ptr %249, align 8, !tbaa !14
  store i32 13, ptr %7, align 4
  br label %341

250:                                              ; preds = %230
  %251 = load i32, ptr %6, align 4, !tbaa !8
  %252 = load i32, ptr %9, align 4, !tbaa !8
  %253 = sub nsw i32 %251, %252
  %254 = load i32, ptr %9, align 4, !tbaa !8
  %255 = sub nsw i32 %253, %254
  %256 = add nsw i32 %255, 1
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [5100 x [5100 x i32]], ptr @z, i64 0, i64 %257
  %259 = load i32, ptr %9, align 4, !tbaa !8
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [5100 x i32], ptr %258, i64 0, i64 %260
  %262 = load i32, ptr %261, align 4, !tbaa !8
  %263 = load i32, ptr %9, align 4, !tbaa !8
  %264 = icmp sge i32 %262, %263
  br i1 %264, label %265, label %273

265:                                              ; preds = %250
  %266 = load i64, ptr %10, align 8, !tbaa !14
  %267 = load i32, ptr %6, align 4, !tbaa !8
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %268
  %270 = load i32, ptr %9, align 4, !tbaa !8
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [5100 x i64], ptr %269, i64 0, i64 %271
  store i64 %266, ptr %272, align 8, !tbaa !14
  store i32 13, ptr %7, align 4
  br label %341

273:                                              ; preds = %250
  %274 = load i32, ptr %6, align 4, !tbaa !8
  %275 = load i32, ptr %9, align 4, !tbaa !8
  %276 = sub nsw i32 %274, %275
  %277 = load i32, ptr %9, align 4, !tbaa !8
  %278 = sub nsw i32 %276, %277
  %279 = add nsw i32 %278, 1
  %280 = load i32, ptr %6, align 4, !tbaa !8
  %281 = load i32, ptr %9, align 4, !tbaa !8
  %282 = sub nsw i32 %280, %281
  %283 = load i32, ptr %9, align 4, !tbaa !8
  %284 = sub nsw i32 %282, %283
  %285 = add nsw i32 %284, 1
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [5100 x [5100 x i32]], ptr @z, i64 0, i64 %286
  %288 = load i32, ptr %9, align 4, !tbaa !8
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds [5100 x i32], ptr %287, i64 0, i64 %289
  %291 = load i32, ptr %290, align 4, !tbaa !8
  %292 = add nsw i32 %279, %291
  %293 = sext i32 %292 to i64
  %294 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %293)
  %295 = load i8, ptr %294, align 1, !tbaa !13
  %296 = sext i8 %295 to i32
  %297 = load i32, ptr %6, align 4, !tbaa !8
  %298 = load i32, ptr %9, align 4, !tbaa !8
  %299 = sub nsw i32 %297, %298
  %300 = add nsw i32 %299, 1
  %301 = load i32, ptr %6, align 4, !tbaa !8
  %302 = load i32, ptr %9, align 4, !tbaa !8
  %303 = sub nsw i32 %301, %302
  %304 = load i32, ptr %9, align 4, !tbaa !8
  %305 = sub nsw i32 %303, %304
  %306 = add nsw i32 %305, 1
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds [5100 x [5100 x i32]], ptr @z, i64 0, i64 %307
  %309 = load i32, ptr %9, align 4, !tbaa !8
  %310 = sext i32 %309 to i64
  %311 = getelementptr inbounds [5100 x i32], ptr %308, i64 0, i64 %310
  %312 = load i32, ptr %311, align 4, !tbaa !8
  %313 = add nsw i32 %300, %312
  %314 = sext i32 %313 to i64
  %315 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %314)
  %316 = load i8, ptr %315, align 1, !tbaa !13
  %317 = sext i8 %316 to i32
  %318 = icmp slt i32 %296, %317
  br i1 %318, label %319, label %333

319:                                              ; preds = %273
  %320 = load i64, ptr %10, align 8, !tbaa !14
  %321 = load i32, ptr %6, align 4, !tbaa !8
  %322 = load i32, ptr %9, align 4, !tbaa !8
  %323 = sub nsw i32 %321, %322
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %324
  %326 = load i32, ptr %9, align 4, !tbaa !8
  %327 = sext i32 %326 to i64
  %328 = getelementptr inbounds [5100 x i64], ptr %325, i64 0, i64 %327
  %329 = load i64, ptr %328, align 8, !tbaa !14
  %330 = add nsw i64 %320, %329
  %331 = load i64, ptr @MOD, align 8, !tbaa !14
  %332 = srem i64 %330, %331
  store i64 %332, ptr %10, align 8, !tbaa !14
  br label %333

333:                                              ; preds = %319, %273
  %334 = load i64, ptr %10, align 8, !tbaa !14
  %335 = load i32, ptr %6, align 4, !tbaa !8
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %336
  %338 = load i32, ptr %9, align 4, !tbaa !8
  %339 = sext i32 %338 to i64
  %340 = getelementptr inbounds [5100 x i64], ptr %337, i64 0, i64 %339
  store i64 %334, ptr %340, align 8, !tbaa !14
  store i32 0, ptr %7, align 4
  br label %341

341:                                              ; preds = %333, %265, %242, %222
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %342 = load i32, ptr %7, align 4
  switch i32 %342, label %384 [
    i32 0, label %343
    i32 13, label %344
  ]

343:                                              ; preds = %341
  br label %344

344:                                              ; preds = %343, %341, %197, %184
  %345 = load i32, ptr %9, align 4, !tbaa !8
  %346 = add nsw i32 %345, 1
  store i32 %346, ptr %9, align 4, !tbaa !8
  br label %167, !llvm.loop !17

347:                                              ; preds = %173
  br label %348

348:                                              ; preds = %347
  %349 = load i32, ptr %6, align 4, !tbaa !8
  %350 = add nsw i32 %349, 1
  store i32 %350, ptr %6, align 4, !tbaa !8
  br label %54, !llvm.loop !18

351:                                              ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !8
  br label %352

352:                                              ; preds = %371, %351
  %353 = load i32, ptr %12, align 4, !tbaa !8
  %354 = load i32, ptr @n, align 4, !tbaa !8
  %355 = icmp sle i32 %353, %354
  br i1 %355, label %357, label %356

356:                                              ; preds = %352
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %374

357:                                              ; preds = %352
  %358 = load i32, ptr @n, align 4, !tbaa !8
  %359 = sub nsw i32 %358, 1
  %360 = sext i32 %359 to i64
  %361 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %360
  %362 = load i32, ptr %12, align 4, !tbaa !8
  %363 = sext i32 %362 to i64
  %364 = getelementptr inbounds [5100 x i64], ptr %361, i64 0, i64 %363
  %365 = load i64, ptr %364, align 8, !tbaa !14
  %366 = load i64, ptr %11, align 8, !tbaa !14
  %367 = add nsw i64 %366, %365
  store i64 %367, ptr %11, align 8, !tbaa !14
  %368 = load i64, ptr @MOD, align 8, !tbaa !14
  %369 = load i64, ptr %11, align 8, !tbaa !14
  %370 = srem i64 %369, %368
  store i64 %370, ptr %11, align 8, !tbaa !14
  br label %371

371:                                              ; preds = %357
  %372 = load i32, ptr %12, align 4, !tbaa !8
  %373 = add nsw i32 %372, 1
  store i32 %373, ptr %12, align 4, !tbaa !8
  br label %352, !llvm.loop !19

374:                                              ; preds = %356
  %375 = load i64, ptr %11, align 8, !tbaa !14
  %376 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %375)
  %377 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %376, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %378 = load i32, ptr %1, align 4
  ret i32 %378

379:                                              ; preds = %43
  %380 = load ptr, ptr %4, align 8
  %381 = load i32, ptr %5, align 4
  %382 = insertvalue { ptr, i32 } poison, ptr %380, 0
  %383 = insertvalue { ptr, i32 } %382, i32 %381, 1
  resume { ptr, i32 } %383

384:                                              ; preds = %341
  unreachable
}

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

; 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 @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

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)) #4

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!15, !15, i64 0}
!15 = !{!"long long", !10, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !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" }

@z = external dso_local local_unnamed_addr global [5100 x [5100 x i32]], align 16
@n = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@MOD = external dso_local local_unnamed_addr global i64, align 8
@dp = external dso_local local_unnamed_addr global [5100 x [5100 x i64]], align 16
@sum = external dso_local local_unnamed_addr global [5100 x [5100 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = 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) @n)
  %14 = 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)
  %15 = load i32, ptr @n, align 4, !tbaa !8
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %23, %0
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 0)
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %.not = icmp eq i8 %18, 48
  br i1 %.not, label %30, label %29

.lr.ph:                                           ; preds = %0, %23
  %indvars.iv = phi i64 [ %indvars.iv.next, %23 ], [ 0, %0 ]
  %19 = phi i32 [ %24, %23 ], [ %15, %0 ]
  %20 = trunc nuw nsw i64 %indvars.iv to i32
  %21 = sub nsw i32 %19, %20
  %22 = sext i32 %21 to i64
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %1, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv, i64 noundef %22)
  invoke void @_Z7build_zNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull %1, i32 noundef %20)
          to label %23 unwind label %27

23:                                               ; preds = %.lr.ph
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @n, align 4, !tbaa !8
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next, %25
  br i1 %26, label %.lr.ph, label %._crit_edge, !llvm.loop !12

27:                                               ; preds = %.lr.ph
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  resume { ptr, i32 } %28

29:                                               ; preds = %._crit_edge
  store i64 1, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !14
  br label %30

30:                                               ; preds = %29, %._crit_edge
  %31 = load i32, ptr @n, align 4, !tbaa !8
  %32 = icmp sgt i32 %31, 1
  br i1 %32, label %.preheader108, label %.preheader

.preheader108:                                    ; preds = %30, %._crit_edge117
  %indvars.iv140 = phi i64 [ %indvars.iv.next141, %._crit_edge117 ], [ 1, %30 ]
  %indvars.iv138 = phi i64 [ %indvars.iv.next139, %._crit_edge117 ], [ 3, %30 ]
  %33 = phi i32 [ %82, %._crit_edge117 ], [ %31, %30 ]
  %.not103110 = icmp slt i32 %33, 1
  br i1 %.not103110, label %._crit_edge113, label %.lr.ph112

.lr.ph112:                                        ; preds = %.preheader108
  %34 = add nsw i64 %indvars.iv140, -1
  %35 = load i64, ptr @MOD, align 8, !tbaa !14
  %.phi.trans.insert = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %34, i64 0
  %.pre = load i64, ptr %.phi.trans.insert, align 16, !tbaa !14
  %36 = zext nneg i32 %33 to i64
  %xtraiter = and i64 %36, 1
  %37 = icmp eq i32 %33, 1
  br i1 %37, label %._crit_edge113.loopexit.unr-lcssa, label %.lr.ph112.new

.lr.ph112.new:                                    ; preds = %.lr.ph112
  %unroll_iter = and i64 %36, 2147483646
  br label %50

.preheader:                                       ; preds = %._crit_edge117, %30
  %.lcssa = phi i32 [ %31, %30 ], [ %82, %._crit_edge117 ]
  %.not102119 = icmp slt i32 %.lcssa, 1
  br i1 %.not102119, label %._crit_edge123, label %.lr.ph122

.lr.ph122:                                        ; preds = %.preheader
  %38 = add nsw i32 %.lcssa, -1
  %39 = zext nneg i32 %38 to i64
  %40 = load i64, ptr @MOD, align 8, !tbaa !14
  %41 = zext nneg i32 %.lcssa to i64
  %xtraiter159 = and i64 %41, 1
  %42 = icmp eq i32 %.lcssa, 1
  br i1 %42, label %._crit_edge123.loopexit.unr-lcssa, label %.lr.ph122.new

.lr.ph122.new:                                    ; preds = %.lr.ph122
  %unroll_iter162 = and i64 %41, 2147483646
  br label %137

._crit_edge113.loopexit.unr-lcssa:                ; preds = %50, %.lr.ph112
  %.unr = phi i64 [ %.pre, %.lr.ph112 ], [ %spec.select.1, %50 ]
  %indvars.iv128.unr = phi i64 [ 1, %.lr.ph112 ], [ %indvars.iv.next129.1, %50 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge113, label %._crit_edge113.loopexit.epilog-lcssa

._crit_edge113.loopexit.epilog-lcssa:             ; preds = %._crit_edge113.loopexit.unr-lcssa
  %43 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %34, i64 %indvars.iv128.unr
  %44 = load i64, ptr %43, align 8, !tbaa !14
  %45 = add nsw i64 %44, %.unr
  %46 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %34, i64 %indvars.iv128.unr
  %.not107.epil = icmp slt i64 %45, %35
  %47 = select i1 %.not107.epil, i64 0, i64 %35
  %spec.select.epil = sub nsw i64 %45, %47
  store i64 %spec.select.epil, ptr %46, align 8, !tbaa !14
  br label %._crit_edge113

._crit_edge113:                                   ; preds = %._crit_edge113.loopexit.epilog-lcssa, %._crit_edge113.loopexit.unr-lcssa, %.preheader108
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv140)
  %49 = load i8, ptr %48, align 1, !tbaa !11
  %.not104 = icmp eq i8 %49, 48
  br i1 %.not104, label %78, label %62

50:                                               ; preds = %50, %.lr.ph112.new
  %51 = phi i64 [ %.pre, %.lr.ph112.new ], [ %spec.select.1, %50 ]
  %indvars.iv128 = phi i64 [ 1, %.lr.ph112.new ], [ %indvars.iv.next129.1, %50 ]
  %niter = phi i64 [ 0, %.lr.ph112.new ], [ %niter.next.1, %50 ]
  %52 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %34, i64 %indvars.iv128
  %53 = load i64, ptr %52, align 8, !tbaa !14
  %54 = add nsw i64 %53, %51
  %55 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %34, i64 %indvars.iv128
  %.not107 = icmp slt i64 %54, %35
  %56 = select i1 %.not107, i64 0, i64 %35
  %spec.select = sub nsw i64 %54, %56
  store i64 %spec.select, ptr %55, align 8, !tbaa !14
  %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
  %57 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %34, i64 %indvars.iv.next129
  %58 = load i64, ptr %57, align 8, !tbaa !14
  %59 = add nsw i64 %58, %spec.select
  %60 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %34, i64 %indvars.iv.next129
  %.not107.1 = icmp slt i64 %59, %35
  %61 = select i1 %.not107.1, i64 0, i64 %35
  %spec.select.1 = sub nsw i64 %59, %61
  store i64 %spec.select.1, ptr %60, align 8, !tbaa !14
  %indvars.iv.next129.1 = add nuw nsw i64 %indvars.iv128, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge113.loopexit.unr-lcssa, label %50, !llvm.loop !16

62:                                               ; preds = %._crit_edge113
  %63 = add nsw i64 %indvars.iv140, -1
  %64 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %63)
  %65 = load i8, ptr %64, align 1, !tbaa !11
  %.not105 = icmp eq i8 %65, 48
  br i1 %.not105, label %76, label %66

66:                                               ; preds = %62
  %67 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %63)
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv140)
  %70 = load i8, ptr %69, align 1, !tbaa !11
  %71 = icmp slt i8 %68, %70
  br i1 %71, label %72, label %76

72:                                               ; preds = %66
  %73 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %63, i64 1
  %74 = load i64, ptr %73, align 8, !tbaa !14
  %75 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %indvars.iv140, i64 1
  store i64 %74, ptr %75, align 8, !tbaa !14
  br label %.lr.ph116.preheader

76:                                               ; preds = %66, %62
  %77 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %indvars.iv140, i64 1
  store i64 0, ptr %77, align 8, !tbaa !14
  br label %.lr.ph116.preheader

78:                                               ; preds = %._crit_edge113
  %79 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %indvars.iv140, i64 1
  store i64 0, ptr %79, align 8, !tbaa !14
  %.pre150 = add nsw i64 %indvars.iv140, -1
  br label %.lr.ph116.preheader

.lr.ph116.preheader:                              ; preds = %78, %76, %72
  %.pre-phi = phi i64 [ %63, %72 ], [ %63, %76 ], [ %.pre150, %78 ]
  %80 = trunc i64 %indvars.iv140 to i32
  %81 = add i32 %80, -2
  br label %.lr.ph116

._crit_edge117:                                   ; preds = %126
  %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
  %82 = load i32, ptr @n, align 4, !tbaa !8
  %83 = sext i32 %82 to i64
  %84 = icmp slt i64 %indvars.iv.next141, %83
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  br i1 %84, label %.preheader108, label %.preheader, !llvm.loop !17

.lr.ph116:                                        ; preds = %.lr.ph116.preheader, %126
  %indvars.iv131 = phi i64 [ 2, %.lr.ph116.preheader ], [ %indvars.iv.next132, %126 ]
  %.in = phi i64 [ %.pre-phi, %.lr.ph116.preheader ], [ %129, %126 ]
  %85 = phi i32 [ %81, %.lr.ph116.preheader ], [ %130, %126 ]
  %86 = trunc i64 %.in to i32
  %87 = and i64 %.in, 4294967295
  %88 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %87)
  %89 = load i8, ptr %88, align 1, !tbaa !11
  %90 = icmp eq i8 %89, 48
  br i1 %90, label %126, label %91

91:                                               ; preds = %.lr.ph116
  %92 = icmp eq i32 %86, 0
  br i1 %92, label %126, label %93

93:                                               ; preds = %91
  %94 = zext nneg i32 %85 to i64
  %95 = add nsw i64 %indvars.iv131, -1
  %96 = getelementptr inbounds [5100 x [5100 x i64]], ptr @sum, i64 0, i64 %94, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !14
  %98 = sext i32 %85 to i64
  %99 = sub nsw i64 %98, %indvars.iv131
  %100 = add nsw i64 %99, 1
  %101 = icmp slt i64 %99, -1
  br i1 %101, label %126, label %102

102:                                              ; preds = %93
  %103 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %100)
  %104 = load i8, ptr %103, align 1, !tbaa !11
  %105 = icmp eq i8 %104, 48
  br i1 %105, label %126, label %106

106:                                              ; preds = %102
  %107 = getelementptr inbounds [5100 x [5100 x i32]], ptr @z, i64 0, i64 %100, i64 %indvars.iv131
  %108 = load i32, ptr %107, align 4, !tbaa !8
  %109 = sext i32 %108 to i64
  %.not106 = icmp sgt i64 %indvars.iv131, %109
  br i1 %.not106, label %110, label %126

110:                                              ; preds = %106
  %111 = add nsw i64 %100, %109
  %112 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %111)
  %113 = load i8, ptr %112, align 1, !tbaa !11
  %114 = load i32, ptr %107, align 4, !tbaa !8
  %115 = add nsw i32 %114, %86
  %116 = sext i32 %115 to i64
  %117 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %116)
  %118 = load i8, ptr %117, align 1, !tbaa !11
  %119 = icmp slt i8 %113, %118
  br i1 %119, label %120, label %126

120:                                              ; preds = %110
  %121 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %94, i64 %indvars.iv131
  %122 = load i64, ptr %121, align 8, !tbaa !14
  %123 = add nsw i64 %122, %97
  %124 = load i64, ptr @MOD, align 8, !tbaa !14
  %125 = srem i64 %123, %124
  br label %126

126:                                              ; preds = %110, %120, %106, %102, %93, %91, %.lr.ph116
  %.sink = phi i64 [ 0, %.lr.ph116 ], [ 1, %91 ], [ %97, %93 ], [ %97, %102 ], [ %97, %106 ], [ %125, %120 ], [ %97, %110 ]
  %127 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %indvars.iv140, i64 %indvars.iv131
  store i64 %.sink, ptr %127, align 8, !tbaa !14
  %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
  %128 = sub nsw i64 %indvars.iv140, %indvars.iv.next132
  %129 = add nsw i64 %128, 1
  %130 = trunc nsw i64 %128 to i32
  %exitcond137.not = icmp eq i64 %indvars.iv.next132, %indvars.iv138
  br i1 %exitcond137.not, label %._crit_edge117, label %.lr.ph116, !llvm.loop !18

._crit_edge123.loopexit.unr-lcssa:                ; preds = %137, %.lr.ph122
  %.lcssa156.ph = phi i64 [ poison, %.lr.ph122 ], [ %145, %137 ]
  %indvars.iv145.unr = phi i64 [ 1, %.lr.ph122 ], [ %indvars.iv.next146.1, %137 ]
  %.089120.unr = phi i64 [ 0, %.lr.ph122 ], [ %145, %137 ]
  %lcmp.mod160.not = icmp eq i64 %xtraiter159, 0
  br i1 %lcmp.mod160.not, label %._crit_edge123, label %._crit_edge123.loopexit.epilog-lcssa

._crit_edge123.loopexit.epilog-lcssa:             ; preds = %._crit_edge123.loopexit.unr-lcssa
  %131 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv145.unr
  %132 = load i64, ptr %131, align 8, !tbaa !14
  %133 = add nsw i64 %132, %.089120.unr
  %134 = srem i64 %133, %40
  br label %._crit_edge123

._crit_edge123:                                   ; preds = %._crit_edge123.loopexit.epilog-lcssa, %._crit_edge123.loopexit.unr-lcssa, %.preheader
  %.089.lcssa = phi i64 [ 0, %.preheader ], [ %.lcssa156.ph, %._crit_edge123.loopexit.unr-lcssa ], [ %134, %._crit_edge123.loopexit.epilog-lcssa ]
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.089.lcssa)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %135, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

137:                                              ; preds = %137, %.lr.ph122.new
  %indvars.iv145 = phi i64 [ 1, %.lr.ph122.new ], [ %indvars.iv.next146.1, %137 ]
  %.089120 = phi i64 [ 0, %.lr.ph122.new ], [ %145, %137 ]
  %niter163 = phi i64 [ 0, %.lr.ph122.new ], [ %niter163.next.1, %137 ]
  %138 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv145
  %139 = load i64, ptr %138, align 8, !tbaa !14
  %140 = add nsw i64 %139, %.089120
  %141 = srem i64 %140, %40
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %142 = getelementptr inbounds [5100 x [5100 x i64]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv.next146
  %143 = load i64, ptr %142, align 8, !tbaa !14
  %144 = add nsw i64 %143, %141
  %145 = srem i64 %144, %40
  %indvars.iv.next146.1 = add nuw nsw i64 %indvars.iv145, 2
  %niter163.next.1 = add i64 %niter163, 2
  %niter163.ncmp.1 = icmp eq i64 %niter163.next.1, %unroll_iter162
  br i1 %niter163.ncmp.1, label %._crit_edge123.loopexit.unr-lcssa, label %137, !llvm.loop !19
}

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

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

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

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress 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 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !10, i64 0}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}


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