; LLVM IR from eyangch/competitive-programming :: Codeforces/2 (b)

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

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

@N = external dso_local global i32, align 4
@p2 = external dso_local global [1000 x [1000 x i32]], align 16
@p5 = external dso_local global [1000 x [1000 x i32]], align 16
@dp2 = external dso_local global [1000 x [1000 x i32]], align 16
@dp5 = external dso_local global [1000 x [1000 x i32]], align 16
@zx = external dso_local global i32, align 4
@zy = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9backtrackB5cxx11RA1000_A1000_iS1_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 4 dereferenceable(4000000), ptr noundef nonnull align 4 dereferenceable(4000000)) #2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 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 i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, 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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %25

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

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

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

31:                                               ; preds = %139, %30
  %32 = load i32, ptr %4, align 4, !tbaa !8
  %33 = load i32, ptr @N, align 4, !tbaa !8
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

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

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %38 = load i32, ptr %5, align 4, !tbaa !8
  %39 = call noundef i32 @_Z2lgii(i32 noundef %38, i32 noundef 2)
  %40 = load i32, ptr %2, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p2, i64 0, i64 %41
  %43 = load i32, ptr %4, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000 x i32], ptr %42, i64 0, i64 %44
  store i32 %39, ptr %45, align 4, !tbaa !8
  %46 = load i32, ptr %5, align 4, !tbaa !8
  %47 = call noundef i32 @_Z2lgii(i32 noundef %46, i32 noundef 5)
  %48 = load i32, ptr %2, align 4, !tbaa !8
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p5, i64 0, i64 %49
  %51 = load i32, ptr %4, align 4, !tbaa !8
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000 x i32], ptr %50, i64 0, i64 %52
  store i32 %47, ptr %53, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1000000000, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1000000000, ptr %7, align 4, !tbaa !8
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %56, label %75

56:                                               ; preds = %36
  %57 = load i32, ptr %2, align 4, !tbaa !8
  %58 = sub nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %59
  %61 = load i32, ptr %4, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1000 x i32], ptr %60, i64 0, i64 %62
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %63)
  %65 = load i32, ptr %64, align 4, !tbaa !8
  store i32 %65, ptr %6, align 4, !tbaa !8
  %66 = load i32, ptr %2, align 4, !tbaa !8
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %68
  %70 = load i32, ptr %4, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1000 x i32], ptr %69, i64 0, i64 %71
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %72)
  %74 = load i32, ptr %73, align 4, !tbaa !8
  store i32 %74, ptr %7, align 4, !tbaa !8
  br label %75

75:                                               ; preds = %56, %36
  %76 = load i32, ptr %4, align 4, !tbaa !8
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %78, label %97

78:                                               ; preds = %75
  %79 = load i32, ptr %2, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %80
  %82 = load i32, ptr %4, align 4, !tbaa !8
  %83 = sub nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1000 x i32], ptr %81, i64 0, i64 %84
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %85)
  %87 = load i32, ptr %86, align 4, !tbaa !8
  store i32 %87, ptr %6, align 4, !tbaa !8
  %88 = load i32, ptr %2, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %89
  %91 = load i32, ptr %4, align 4, !tbaa !8
  %92 = sub nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1000 x i32], ptr %90, i64 0, i64 %93
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %94)
  %96 = load i32, ptr %95, align 4, !tbaa !8
  store i32 %96, ptr %7, align 4, !tbaa !8
  br label %97

97:                                               ; preds = %78, %75
  %98 = load i32, ptr %6, align 4, !tbaa !8
  %99 = sitofp i32 %98 to double
  %100 = fcmp oeq double %99, 1.000000e+09
  br i1 %100, label %101, label %102

101:                                              ; preds = %97
  store i32 0, ptr %6, align 4, !tbaa !8
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %102

102:                                              ; preds = %101, %97
  %103 = load i32, ptr %2, align 4, !tbaa !8
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p2, i64 0, i64 %104
  %106 = load i32, ptr %4, align 4, !tbaa !8
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1000 x i32], ptr %105, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !8
  %110 = load i32, ptr %6, align 4, !tbaa !8
  %111 = add nsw i32 %109, %110
  %112 = load i32, ptr %2, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %113
  %115 = load i32, ptr %4, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1000 x i32], ptr %114, i64 0, i64 %116
  store i32 %111, ptr %117, align 4, !tbaa !8
  %118 = load i32, ptr %2, align 4, !tbaa !8
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p5, i64 0, i64 %119
  %121 = load i32, ptr %4, align 4, !tbaa !8
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1000 x i32], ptr %120, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !8
  %125 = load i32, ptr %7, align 4, !tbaa !8
  %126 = add nsw i32 %124, %125
  %127 = load i32, ptr %2, align 4, !tbaa !8
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %128
  %130 = load i32, ptr %4, align 4, !tbaa !8
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000 x i32], ptr %129, i64 0, i64 %131
  store i32 %126, ptr %132, align 4, !tbaa !8
  %133 = load i32, ptr %5, align 4, !tbaa !8
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %138, label %135

135:                                              ; preds = %102
  %136 = load i32, ptr %2, align 4, !tbaa !8
  store i32 %136, ptr @zx, align 4, !tbaa !8
  %137 = load i32, ptr %4, align 4, !tbaa !8
  store i32 %137, ptr @zy, align 4, !tbaa !8
  br label %138

138:                                              ; preds = %135, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %4, align 4, !tbaa !8
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %4, align 4, !tbaa !8
  br label %31, !llvm.loop !11

142:                                              ; preds = %35
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %2, align 4, !tbaa !8
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %2, align 4, !tbaa !8
  br label %25, !llvm.loop !13

146:                                              ; preds = %29
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !8
  %147 = load i32, ptr @N, align 4, !tbaa !8
  %148 = sub nsw i32 %147, 1
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %149
  %151 = load i32, ptr @N, align 4, !tbaa !8
  %152 = sub nsw i32 %151, 1
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1000 x i32], ptr %150, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !8
  %156 = load i32, ptr @N, align 4, !tbaa !8
  %157 = sub nsw i32 %156, 1
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %158
  %160 = load i32, ptr @N, align 4, !tbaa !8
  %161 = sub nsw i32 %160, 1
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [1000 x i32], ptr %159, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !8
  %165 = icmp slt i32 %155, %164
  br i1 %165, label %166, label %182

166:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #7
  invoke void @_Z9backtrackB5cxx11RA1000_A1000_iS1_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %10, ptr noundef nonnull align 4 dereferenceable(4000000) @p2, ptr noundef nonnull align 4 dereferenceable(4000000) @dp2)
          to label %167 unwind label %178

167:                                              ; preds = %166
  %168 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  %169 = load i32, ptr @N, align 4, !tbaa !8
  %170 = sub nsw i32 %169, 1
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %171
  %173 = load i32, ptr @N, align 4, !tbaa !8
  %174 = sub nsw i32 %173, 1
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1000 x i32], ptr %172, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !8
  store i32 %177, ptr %9, align 4, !tbaa !8
  br label %198

178:                                              ; preds = %166
  %179 = landingpad { ptr, i32 }
          cleanup
  %180 = extractvalue { ptr, i32 } %179, 0
  store ptr %180, ptr %11, align 8
  %181 = extractvalue { ptr, i32 } %179, 1
  store i32 %181, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  br label %290

182:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #7
  invoke void @_Z9backtrackB5cxx11RA1000_A1000_iS1_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %13, ptr noundef nonnull align 4 dereferenceable(4000000) @p5, ptr noundef nonnull align 4 dereferenceable(4000000) @dp5)
          to label %183 unwind label %194

183:                                              ; preds = %182
  %184 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #7
  %185 = load i32, ptr @N, align 4, !tbaa !8
  %186 = sub nsw i32 %185, 1
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %187
  %189 = load i32, ptr @N, align 4, !tbaa !8
  %190 = sub nsw i32 %189, 1
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [1000 x i32], ptr %188, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !8
  store i32 %193, ptr %9, align 4, !tbaa !8
  br label %198

194:                                              ; preds = %182
  %195 = landingpad { ptr, i32 }
          cleanup
  %196 = extractvalue { ptr, i32 } %195, 0
  store ptr %196, ptr %11, align 8
  %197 = extractvalue { ptr, i32 } %195, 1
  store i32 %197, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #7
  br label %290

198:                                              ; preds = %183, %167
  %199 = load i32, ptr %9, align 4, !tbaa !8
  %200 = icmp sgt i32 %199, 1
  br i1 %200, label %201, label %279

201:                                              ; preds = %198
  %202 = load i32, ptr @zx, align 4, !tbaa !8
  %203 = icmp sge i32 %202, 0
  br i1 %203, label %204, label %279

204:                                              ; preds = %201
  store i32 1, ptr %9, align 4, !tbaa !8
  %205 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef @.str)
          to label %206 unwind label %212

206:                                              ; preds = %204
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %207

207:                                              ; preds = %219, %206
  %208 = load i32, ptr %14, align 4, !tbaa !8
  %209 = load i32, ptr @zx, align 4, !tbaa !8
  %210 = icmp slt i32 %208, %209
  br i1 %210, label %216, label %211

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

212:                                              ; preds = %286, %284, %282, %279, %204
  %213 = landingpad { ptr, i32 }
          cleanup
  %214 = extractvalue { ptr, i32 } %213, 0
  store ptr %214, ptr %11, align 8
  %215 = extractvalue { ptr, i32 } %213, 1
  store i32 %215, ptr %12, align 4
  br label %290

216:                                              ; preds = %207
  %217 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %8, i8 noundef signext 68)
          to label %218 unwind label %222

218:                                              ; preds = %216
  br label %219

219:                                              ; preds = %218
  %220 = load i32, ptr %14, align 4, !tbaa !8
  %221 = add nsw i32 %220, 1
  store i32 %221, ptr %14, align 4, !tbaa !8
  br label %207, !llvm.loop !14

222:                                              ; preds = %216
  %223 = landingpad { ptr, i32 }
          cleanup
  %224 = extractvalue { ptr, i32 } %223, 0
  store ptr %224, ptr %11, align 8
  %225 = extractvalue { ptr, i32 } %223, 1
  store i32 %225, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %290

226:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !8
  br label %227

227:                                              ; preds = %235, %226
  %228 = load i32, ptr %15, align 4, !tbaa !8
  %229 = load i32, ptr @zy, align 4, !tbaa !8
  %230 = icmp slt i32 %228, %229
  br i1 %230, label %232, label %231

231:                                              ; preds = %227
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %242

232:                                              ; preds = %227
  %233 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %8, i8 noundef signext 82)
          to label %234 unwind label %238

234:                                              ; preds = %232
  br label %235

235:                                              ; preds = %234
  %236 = load i32, ptr %15, align 4, !tbaa !8
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %15, align 4, !tbaa !8
  br label %227, !llvm.loop !15

238:                                              ; preds = %232
  %239 = landingpad { ptr, i32 }
          cleanup
  %240 = extractvalue { ptr, i32 } %239, 0
  store ptr %240, ptr %11, align 8
  %241 = extractvalue { ptr, i32 } %239, 1
  store i32 %241, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %290

242:                                              ; preds = %231
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %243 = load i32, ptr @zx, align 4, !tbaa !8
  %244 = add nsw i32 %243, 1
  store i32 %244, ptr %16, align 4, !tbaa !8
  br label %245

245:                                              ; preds = %253, %242
  %246 = load i32, ptr %16, align 4, !tbaa !8
  %247 = load i32, ptr @N, align 4, !tbaa !8
  %248 = icmp slt i32 %246, %247
  br i1 %248, label %250, label %249

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

250:                                              ; preds = %245
  %251 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %8, i8 noundef signext 68)
          to label %252 unwind label %256

252:                                              ; preds = %250
  br label %253

253:                                              ; preds = %252
  %254 = load i32, ptr %16, align 4, !tbaa !8
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %16, align 4, !tbaa !8
  br label %245, !llvm.loop !16

256:                                              ; preds = %250
  %257 = landingpad { ptr, i32 }
          cleanup
  %258 = extractvalue { ptr, i32 } %257, 0
  store ptr %258, ptr %11, align 8
  %259 = extractvalue { ptr, i32 } %257, 1
  store i32 %259, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %290

260:                                              ; preds = %249
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %261 = load i32, ptr @zy, align 4, !tbaa !8
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr %17, align 4, !tbaa !8
  br label %263

263:                                              ; preds = %271, %260
  %264 = load i32, ptr %17, align 4, !tbaa !8
  %265 = load i32, ptr @N, align 4, !tbaa !8
  %266 = icmp slt i32 %264, %265
  br i1 %266, label %268, label %267

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

268:                                              ; preds = %263
  %269 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %8, i8 noundef signext 82)
          to label %270 unwind label %274

270:                                              ; preds = %268
  br label %271

271:                                              ; preds = %270
  %272 = load i32, ptr %17, align 4, !tbaa !8
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %17, align 4, !tbaa !8
  br label %263, !llvm.loop !17

274:                                              ; preds = %268
  %275 = landingpad { ptr, i32 }
          cleanup
  %276 = extractvalue { ptr, i32 } %275, 0
  store ptr %276, ptr %11, align 8
  %277 = extractvalue { ptr, i32 } %275, 1
  store i32 %277, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %290

278:                                              ; preds = %267
  br label %279

279:                                              ; preds = %278, %201, %198
  %280 = load i32, ptr %9, align 4, !tbaa !8
  %281 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %280)
          to label %282 unwind label %212

282:                                              ; preds = %279
  %283 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %281, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %284 unwind label %212

284:                                              ; preds = %282
  %285 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) %283, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %286 unwind label %212

286:                                              ; preds = %284
  %287 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %285, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %288 unwind label %212

288:                                              ; preds = %286
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #7
  %289 = load i32, ptr %1, align 4
  ret i32 %289

290:                                              ; preds = %274, %256, %238, %222, %212, %194, %178
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #7
  br label %291

291:                                              ; preds = %290
  %292 = load ptr, ptr %11, align 8
  %293 = load i32, ptr %12, align 4
  %294 = insertvalue { ptr, i32 } poison, ptr %292, 0
  %295 = insertvalue { ptr, i32 } %294, i32 %293, 1
  resume { ptr, i32 } %295
}

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

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

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

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@N = external dso_local global i32, align 4
@p2 = external dso_local global [1000 x [1000 x i32]], align 16
@p5 = external dso_local global [1000 x [1000 x i32]], align 16
@dp2 = external dso_local global [1000 x [1000 x i32]], align 16
@dp5 = external dso_local global [1000 x [1000 x i32]], align 16
@zx = external dso_local local_unnamed_addr global i32, align 4
@zy = external dso_local local_unnamed_addr global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z2lgii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

.preheader53:                                     ; preds = %0, %._crit_edge
  %16 = phi i32 [ %57, %._crit_edge ], [ %14, %0 ]
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %._crit_edge ], [ 0, %0 ]
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader53
  %.not = icmp eq i64 %indvars.iv65, 0
  %18 = add nsw i64 %indvars.iv65, -1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %20 = load i32, ptr %1, align 4, !tbaa !8
  %21 = call noundef i32 @_Z2lgii(i32 noundef %20, i32 noundef 2)
  %22 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p2, i64 0, i64 %indvars.iv65, i64 0
  store i32 %21, ptr %22, align 16, !tbaa !8
  %23 = load i32, ptr %1, align 4, !tbaa !8
  %24 = call noundef i32 @_Z2lgii(i32 noundef %23, i32 noundef 5)
  %25 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p5, i64 0, i64 %indvars.iv65, i64 0
  store i32 %24, ptr %25, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 1000000000, ptr %2, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 1000000000, ptr %3, align 4, !tbaa !8
  br i1 %.not, label %._crit_edge68.thread, label %._crit_edge68

._crit_edge68:                                    ; preds = %.lr.ph
  %26 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %18, i64 0
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %26)
  %28 = load i32, ptr %27, align 4, !tbaa !8
  store i32 %28, ptr %2, align 4, !tbaa !8
  %29 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %18, i64 0
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %29)
  %31 = load i32, ptr %30, align 4, !tbaa !8
  %.pre.pr = load i32, ptr %2, align 4, !tbaa !8
  %32 = icmp eq i32 %.pre.pr, 1000000000
  br i1 %32, label %._crit_edge68.thread, label %33

._crit_edge68.thread:                             ; preds = %.lr.ph, %._crit_edge68
  br label %33

33:                                               ; preds = %._crit_edge68.thread, %._crit_edge68
  %34 = phi i32 [ 0, %._crit_edge68.thread ], [ %31, %._crit_edge68 ]
  %35 = phi i32 [ 0, %._crit_edge68.thread ], [ %.pre.pr, %._crit_edge68 ]
  %36 = load i32, ptr %22, align 16, !tbaa !8
  %37 = add nsw i32 %35, %36
  %38 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %indvars.iv65, i64 0
  store i32 %37, ptr %38, align 16, !tbaa !8
  %39 = load i32, ptr %25, align 16, !tbaa !8
  %40 = add nsw i32 %34, %39
  %41 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %indvars.iv65, i64 0
  store i32 %40, ptr %41, align 16, !tbaa !8
  %42 = load i32, ptr %1, align 4, !tbaa !8
  %.not51.peel = icmp eq i32 %42, 0
  br i1 %.not51.peel, label %43, label %45

43:                                               ; preds = %33
  %44 = trunc nuw nsw i64 %indvars.iv65 to i32
  store i32 %44, ptr @zx, align 4, !tbaa !8
  store i32 0, ptr @zy, align 4, !tbaa !8
  br label %45

45:                                               ; preds = %43, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %46 = load i32, ptr @N, align 4, !tbaa !8
  %47 = icmp sgt i32 %46, 1
  br i1 %47, label %.peel.next, label %._crit_edge

.peel.next:                                       ; preds = %45
  %48 = trunc nuw nsw i64 %indvars.iv65 to i32
  br label %60

._crit_edge56:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  %49 = load i32, ptr @N, align 4, !tbaa !8
  %50 = add nsw i32 %49, -1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %51, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !8
  %54 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %51, i64 %51
  %55 = load i32, ptr %54, align 4, !tbaa !8
  %56 = icmp slt i32 %53, %55
  br i1 %56, label %98, label %103

._crit_edge:                                      ; preds = %94, %45, %.preheader53
  %57 = phi i32 [ %16, %.preheader53 ], [ %46, %45 ], [ %95, %94 ]
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next66, %58
  br i1 %59, label %.preheader53, label %._crit_edge56, !llvm.loop !11

60:                                               ; preds = %.peel.next, %94
  %indvars.iv = phi i64 [ 1, %.peel.next ], [ %indvars.iv.next, %94 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %62 = load i32, ptr %1, align 4, !tbaa !8
  %63 = call noundef i32 @_Z2lgii(i32 noundef %62, i32 noundef 2)
  %64 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p2, i64 0, i64 %indvars.iv65, i64 %indvars.iv
  store i32 %63, ptr %64, align 4, !tbaa !8
  %65 = load i32, ptr %1, align 4, !tbaa !8
  %66 = call noundef i32 @_Z2lgii(i32 noundef %65, i32 noundef 5)
  %67 = getelementptr inbounds [1000 x [1000 x i32]], ptr @p5, i64 0, i64 %indvars.iv65, i64 %indvars.iv
  store i32 %66, ptr %67, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 1000000000, ptr %2, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 1000000000, ptr %3, align 4, !tbaa !8
  br i1 %.not, label %75, label %68

68:                                               ; preds = %60
  %69 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %18, i64 %indvars.iv
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %69)
  %71 = load i32, ptr %70, align 4, !tbaa !8
  store i32 %71, ptr %2, align 4, !tbaa !8
  %72 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %18, i64 %indvars.iv
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %72)
  %74 = load i32, ptr %73, align 4, !tbaa !8
  store i32 %74, ptr %3, align 4, !tbaa !8
  br label %75

75:                                               ; preds = %68, %60
  %76 = add nsw i64 %indvars.iv, -1
  %77 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %indvars.iv65, i64 %76
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %77)
  %79 = load i32, ptr %78, align 4, !tbaa !8
  store i32 %79, ptr %2, align 4, !tbaa !8
  %80 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %indvars.iv65, i64 %76
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %80)
  %82 = load i32, ptr %81, align 4, !tbaa !8
  %83 = load i32, ptr %2, align 4, !tbaa !8
  %84 = icmp eq i32 %83, 1000000000
  %spec.select = select i1 %84, i32 0, i32 %82
  %spec.select73 = select i1 %84, i32 0, i32 %83
  %85 = load i32, ptr %64, align 4, !tbaa !8
  %86 = add nsw i32 %spec.select73, %85
  %87 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp2, i64 0, i64 %indvars.iv65, i64 %indvars.iv
  store i32 %86, ptr %87, align 4, !tbaa !8
  %88 = load i32, ptr %67, align 4, !tbaa !8
  %89 = add nsw i32 %spec.select, %88
  %90 = getelementptr inbounds [1000 x [1000 x i32]], ptr @dp5, i64 0, i64 %indvars.iv65, i64 %indvars.iv
  store i32 %89, ptr %90, align 4, !tbaa !8
  %91 = load i32, ptr %1, align 4, !tbaa !8
  %.not51 = icmp eq i32 %91, 0
  br i1 %.not51, label %92, label %94

92:                                               ; preds = %75
  store i32 %48, ptr @zx, align 4, !tbaa !8
  %93 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %93, ptr @zy, align 4, !tbaa !8
  br label %94

94:                                               ; preds = %92, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %95 = load i32, ptr @N, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = icmp slt i64 %indvars.iv.next, %96
  br i1 %97, label %60, label %._crit_edge, !llvm.loop !14

98:                                               ; preds = %._crit_edge56
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #7
  invoke void @_Z9backtrackB5cxx11RA1000_A1000_iS1_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull align 4 dereferenceable(4000000) @p2, ptr noundef nonnull align 4 dereferenceable(4000000) @dp2)
          to label %99 unwind label %101

99:                                               ; preds = %98
  %100 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %108

101:                                              ; preds = %98
  %102 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %162

103:                                              ; preds = %._crit_edge56
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  invoke void @_Z9backtrackB5cxx11RA1000_A1000_iS1_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %6, ptr noundef nonnull align 4 dereferenceable(4000000) @p5, ptr noundef nonnull align 4 dereferenceable(4000000) @dp5)
          to label %104 unwind label %106

104:                                              ; preds = %103
  %105 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  br label %108

106:                                              ; preds = %103
  %107 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  br label %162

108:                                              ; preds = %104, %99
  %dp5.sink = phi ptr [ @dp5, %104 ], [ @dp2, %99 ]
  %109 = load i32, ptr @N, align 4, !tbaa !8
  %110 = add nsw i32 %109, -1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1000 x [1000 x i32]], ptr %dp5.sink, i64 0, i64 %111, i64 %111
  %.046 = load i32, ptr %112, align 4, !tbaa !8
  %113 = icmp sgt i32 %.046, 1
  %114 = load i32, ptr @zx, align 4
  %115 = icmp sgt i32 %114, -1
  %or.cond = select i1 %113, i1 %115, i1 false
  br i1 %or.cond, label %116, label %.loopexit

116:                                              ; preds = %108
  %117 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @.str)
          to label %.preheader52 unwind label %123

.preheader52:                                     ; preds = %116
  %118 = load i32, ptr @zx, align 4, !tbaa !8
  %119 = icmp sgt i32 %118, 0
  br i1 %119, label %.lr.ph58, label %.preheader

.preheader:                                       ; preds = %126, %.preheader52
  %120 = phi i32 [ %118, %.preheader52 ], [ %128, %126 ]
  %121 = load i32, ptr @zy, align 4, !tbaa !8
  %122 = icmp sgt i32 %121, 0
  br i1 %122, label %.lr.ph60, label %._crit_edge61.preheader

._crit_edge61.preheader:                          ; preds = %._crit_edge61.loopexit, %.preheader
  %.041.in.ph = phi i32 [ %120, %.preheader ], [ %.pre70, %._crit_edge61.loopexit ]
  br label %._crit_edge61

123:                                              ; preds = %159, %157, %155, %.loopexit, %116
  %124 = landingpad { ptr, i32 }
          cleanup
  br label %162

.lr.ph58:                                         ; preds = %.preheader52, %126
  %.04357 = phi i32 [ %127, %126 ], [ 0, %.preheader52 ]
  %125 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext 68)
          to label %126 unwind label %130

126:                                              ; preds = %.lr.ph58
  %127 = add nuw nsw i32 %.04357, 1
  %128 = load i32, ptr @zx, align 4, !tbaa !8
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %.lr.ph58, label %.preheader, !llvm.loop !16

130:                                              ; preds = %.lr.ph58
  %131 = landingpad { ptr, i32 }
          cleanup
  br label %162

._crit_edge61.loopexit:                           ; preds = %133
  %.pre70 = load i32, ptr @zx, align 4, !tbaa !8
  br label %._crit_edge61.preheader

.lr.ph60:                                         ; preds = %.preheader, %133
  %.04259 = phi i32 [ %134, %133 ], [ 0, %.preheader ]
  %132 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext 82)
          to label %133 unwind label %137

133:                                              ; preds = %.lr.ph60
  %134 = add nuw nsw i32 %.04259, 1
  %135 = load i32, ptr @zy, align 4, !tbaa !8
  %136 = icmp slt i32 %134, %135
  br i1 %136, label %.lr.ph60, label %._crit_edge61.loopexit, !llvm.loop !17

137:                                              ; preds = %.lr.ph60
  %138 = landingpad { ptr, i32 }
          cleanup
  br label %162

._crit_edge61:                                    ; preds = %._crit_edge61.preheader, %143
  %.041.in = phi i32 [ %.041, %143 ], [ %.041.in.ph, %._crit_edge61.preheader ]
  %.041 = add nsw i32 %.041.in, 1
  %139 = load i32, ptr @N, align 4, !tbaa !8
  %140 = icmp slt i32 %.041, %139
  br i1 %140, label %143, label %141

141:                                              ; preds = %._crit_edge61
  %142 = load i32, ptr @zy, align 4, !tbaa !8
  br label %147

143:                                              ; preds = %._crit_edge61
  %144 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext 68)
          to label %._crit_edge61 unwind label %145, !llvm.loop !18

145:                                              ; preds = %143
  %146 = landingpad { ptr, i32 }
          cleanup
  br label %162

147:                                              ; preds = %150, %141
  %.0.in = phi i32 [ %142, %141 ], [ %.0, %150 ]
  %.0 = add nsw i32 %.0.in, 1
  %148 = load i32, ptr @N, align 4, !tbaa !8
  %149 = icmp slt i32 %.0, %148
  br i1 %149, label %150, label %.loopexit

150:                                              ; preds = %147
  %151 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext 82)
          to label %147 unwind label %152, !llvm.loop !19

152:                                              ; preds = %150
  %153 = landingpad { ptr, i32 }
          cleanup
  br label %162

.loopexit:                                        ; preds = %147, %108
  %.1 = phi i32 [ %.046, %108 ], [ 1, %147 ]
  %154 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.1)
          to label %155 unwind label %123

155:                                              ; preds = %.loopexit
  %156 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %154, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %157 unwind label %123

157:                                              ; preds = %155
  %158 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) %156, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %159 unwind label %123

159:                                              ; preds = %157
  %160 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %158, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %161 unwind label %123

161:                                              ; preds = %159
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  ret i32 0

162:                                              ; preds = %152, %145, %137, %130, %123, %106, %101
  %.pn = phi { ptr, i32 } [ %131, %130 ], [ %138, %137 ], [ %146, %145 ], [ %153, %152 ], [ %124, %123 ], [ %102, %101 ], [ %107, %106 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn
}

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

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

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

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

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

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

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

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

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

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

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

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


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