; LLVM IR from AdarshGaur/Competitive-Programming :: CSES/Dynamic Programming (Grid Paths)

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = call ptr @llvm.stacksave.p0()
  store ptr %17, ptr %3, align 8
  %18 = alloca %"class.std::__cxx11::basic_string", i64 %16, align 16
  store i64 %16, ptr %4, align 8
  %19 = icmp eq i64 %16, 0
  br i1 %19, label %26, label %20

20:                                               ; preds = %0
  %21 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 %16
  br label %22

22:                                               ; preds = %22, %20
  %23 = phi ptr [ %18, %20 ], [ %24, %22 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #8
  %24 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %23, i64 1
  %25 = icmp eq ptr %24, %21
  br i1 %25, label %26, label %22

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

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

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %45

32:                                               ; preds = %27
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 %34
  %36 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %35)
          to label %37 unwind label %41

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %5, align 4, !tbaa !5
  br label %27, !llvm.loop !9

41:                                               ; preds = %32
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %6, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %237

45:                                               ; preds = %31
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = zext i32 %46 to i64
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = zext i32 %48 to i64
  %50 = mul nuw i64 %47, %49
  %51 = alloca i32, i64 %50, align 16
  store i64 %47, ptr %8, align 8
  store i64 %49, ptr %9, align 8
  %52 = mul nuw i64 %47, %49
  %53 = mul nuw i64 4, %52
  call void @llvm.memset.p0.i64(ptr align 16 %51, i8 0, i64 %53, i1 false)
  %54 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 0
  %55 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %54, i64 noundef 0)
          to label %56 unwind label %64

56:                                               ; preds = %45
  %57 = load i8, ptr %55, align 1, !tbaa !11
  %58 = sext i8 %57 to i32
  %59 = icmp eq i32 %58, 46
  br i1 %59, label %60, label %68

60:                                               ; preds = %56
  %61 = mul nsw i64 0, %49
  %62 = getelementptr inbounds i32, ptr %51, i64 %61
  %63 = getelementptr inbounds i32, ptr %62, i64 0
  store i32 1, ptr %63, align 4, !tbaa !5
  br label %72

64:                                               ; preds = %225, %213, %45
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %6, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %7, align 4
  br label %237

68:                                               ; preds = %56
  %69 = mul nsw i64 0, %49
  %70 = getelementptr inbounds i32, ptr %51, i64 %69
  %71 = getelementptr inbounds i32, ptr %70, i64 0
  store i32 0, ptr %71, align 4, !tbaa !5
  br label %72

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

73:                                               ; preds = %139, %72
  %74 = load i32, ptr %10, align 4, !tbaa !5
  %75 = load i32, ptr %2, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %142

78:                                               ; preds = %73
  %79 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 0
  %80 = load i32, ptr %10, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %79, i64 noundef %81)
          to label %83 unwind label %93

83:                                               ; preds = %78
  %84 = load i8, ptr %82, align 1, !tbaa !11
  %85 = sext i8 %84 to i32
  %86 = icmp eq i32 %85, 42
  br i1 %86, label %87, label %97

87:                                               ; preds = %83
  %88 = mul nsw i64 0, %49
  %89 = getelementptr inbounds i32, ptr %51, i64 %88
  %90 = load i32, ptr %10, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %89, i64 %91
  store i32 0, ptr %92, align 4, !tbaa !5
  br label %110

93:                                               ; preds = %110, %78
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %6, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %237

97:                                               ; preds = %83
  %98 = mul nsw i64 0, %49
  %99 = getelementptr inbounds i32, ptr %51, i64 %98
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = sub nsw i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr %99, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = mul nsw i64 0, %49
  %106 = getelementptr inbounds i32, ptr %51, i64 %105
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %106, i64 %108
  store i32 %104, ptr %109, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %97, %87
  %111 = load i32, ptr %10, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 %112
  %114 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %113, i64 noundef 0)
          to label %115 unwind label %93

115:                                              ; preds = %110
  %116 = load i8, ptr %114, align 1, !tbaa !11
  %117 = sext i8 %116 to i32
  %118 = icmp eq i32 %117, 42
  br i1 %118, label %119, label %125

119:                                              ; preds = %115
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = mul nsw i64 %121, %49
  %123 = getelementptr inbounds i32, ptr %51, i64 %122
  %124 = getelementptr inbounds i32, ptr %123, i64 0
  store i32 0, ptr %124, align 4, !tbaa !5
  br label %138

125:                                              ; preds = %115
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = sub nsw i32 %126, 1
  %128 = sext i32 %127 to i64
  %129 = mul nsw i64 %128, %49
  %130 = getelementptr inbounds i32, ptr %51, i64 %129
  %131 = getelementptr inbounds i32, ptr %130, i64 0
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = mul nsw i64 %134, %49
  %136 = getelementptr inbounds i32, ptr %51, i64 %135
  %137 = getelementptr inbounds i32, ptr %136, i64 0
  store i32 %132, ptr %137, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %125, %119
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %10, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %10, align 4, !tbaa !5
  br label %73, !llvm.loop !12

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

143:                                              ; preds = %210, %142
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = load i32, ptr %2, align 4, !tbaa !5
  %146 = icmp slt i32 %144, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %143
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %213

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

149:                                              ; preds = %206, %148
  %150 = load i32, ptr %13, align 4, !tbaa !5
  %151 = load i32, ptr %2, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %209

154:                                              ; preds = %149
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 %156
  %158 = load i32, ptr %13, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %157, i64 noundef %159)
          to label %161 unwind label %193

161:                                              ; preds = %154
  %162 = load i8, ptr %160, align 1, !tbaa !11
  %163 = sext i8 %162 to i32
  %164 = icmp ne i32 %163, 42
  br i1 %164, label %165, label %197

165:                                              ; preds = %161
  %166 = load i32, ptr %11, align 4, !tbaa !5
  %167 = sub nsw i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = mul nsw i64 %168, %49
  %170 = getelementptr inbounds i32, ptr %51, i64 %169
  %171 = load i32, ptr %13, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds i32, ptr %170, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = load i32, ptr %11, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = mul nsw i64 %176, %49
  %178 = getelementptr inbounds i32, ptr %51, i64 %177
  %179 = load i32, ptr %13, align 4, !tbaa !5
  %180 = sub nsw i32 %179, 1
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds i32, ptr %178, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = add nsw i32 %174, %183
  %185 = srem i32 %184, 1000000007
  %186 = load i32, ptr %11, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = mul nsw i64 %187, %49
  %189 = getelementptr inbounds i32, ptr %51, i64 %188
  %190 = load i32, ptr %13, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds i32, ptr %189, i64 %191
  store i32 %185, ptr %192, align 4, !tbaa !5
  br label %205

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

197:                                              ; preds = %161
  %198 = load i32, ptr %11, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = mul nsw i64 %199, %49
  %201 = getelementptr inbounds i32, ptr %51, i64 %200
  %202 = load i32, ptr %13, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds i32, ptr %201, i64 %203
  store i32 0, ptr %204, align 4, !tbaa !5
  br label %205

205:                                              ; preds = %197, %165
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr %13, align 4, !tbaa !5
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %13, align 4, !tbaa !5
  br label %149, !llvm.loop !13

209:                                              ; preds = %153
  br label %210

210:                                              ; preds = %209
  %211 = load i32, ptr %11, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %11, align 4, !tbaa !5
  br label %143, !llvm.loop !14

213:                                              ; preds = %147
  %214 = load i32, ptr %2, align 4, !tbaa !5
  %215 = sub nsw i32 %214, 1
  %216 = sext i32 %215 to i64
  %217 = mul nsw i64 %216, %49
  %218 = getelementptr inbounds i32, ptr %51, i64 %217
  %219 = load i32, ptr %2, align 4, !tbaa !5
  %220 = sub nsw i32 %219, 1
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds i32, ptr %218, i64 %221
  %223 = load i32, ptr %222, align 4, !tbaa !5
  %224 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %223)
          to label %225 unwind label %64

225:                                              ; preds = %213
  %226 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %224, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %227 unwind label %64

227:                                              ; preds = %225
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  %228 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 %16
  %229 = icmp eq ptr %18, %228
  br i1 %229, label %234, label %230

230:                                              ; preds = %230, %227
  %231 = phi ptr [ %228, %227 ], [ %232, %230 ]
  %232 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %231, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %232) #8
  %233 = icmp eq ptr %232, %18
  br i1 %233, label %234, label %230

234:                                              ; preds = %230, %227
  %235 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %235)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %236 = load i32, ptr %1, align 4
  ret i32 %236

237:                                              ; preds = %193, %93, %64, %41
  %238 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %18, i64 %16
  %239 = icmp eq ptr %18, %238
  br i1 %239, label %244, label %240

240:                                              ; preds = %240, %237
  %241 = phi ptr [ %238, %237 ], [ %242, %240 ]
  %242 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %241, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %242) #8
  %243 = icmp eq ptr %242, %18
  br i1 %243, label %244, label %240

244:                                              ; preds = %240, %237
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %245

245:                                              ; preds = %244
  %246 = load ptr, ptr %6, align 8
  %247 = load i32, ptr %7, align 4
  %248 = insertvalue { ptr, i32 } poison, ptr %246, 0
  %249 = insertvalue { ptr, i32 } %248, i32 %247, 1
  resume { ptr, i32 } %249
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %2 = 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)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = zext i32 %3 to i64
  %5 = call ptr @llvm.stacksave.p0()
  %6 = alloca %"class.std::__cxx11::basic_string", i64 %4, align 16
  %7 = icmp eq i32 %3, 0
  br i1 %7, label %.loopexit45, label %8

8:                                                ; preds = %0
  %9 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %6, i64 %4
  br label %10

10:                                               ; preds = %10, %8
  %11 = phi ptr [ %6, %8 ], [ %12, %10 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  %12 = getelementptr inbounds i8, ptr %11, i64 32
  %13 = icmp eq ptr %12, %9
  br i1 %13, label %.loopexit45, label %10

.loopexit45:                                      ; preds = %10, %0
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %27, %.loopexit45
  %.lcssa46 = phi i32 [ %14, %.loopexit45 ], [ %28, %27 ]
  %16 = zext i32 %.lcssa46 to i64
  %17 = mul nuw i64 %16, %16
  %18 = alloca i32, i64 %17, align 16
  %19 = shl nuw i64 %17, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %18, i8 0, i64 %19, i1 false)
  %20 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef 0)
  %21 = load i8, ptr %20, align 1, !tbaa !9
  %22 = icmp eq i8 %21, 46
  %. = zext i1 %22 to i32
  store i32 %., ptr %18, align 16, !tbaa !5
  %23 = load i32, ptr %1, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 1
  br i1 %24, label %.lr.ph51, label %._crit_edge56

.lr.ph:                                           ; preds = %.loopexit45, %27
  %indvars.iv = phi i64 [ %indvars.iv.next, %27 ], [ 0, %.loopexit45 ]
  %25 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %6, i64 %indvars.iv
  %26 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %25)
          to label %27 unwind label %31

27:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !10

31:                                               ; preds = %.lr.ph
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %100

33:                                               ; preds = %93, %._crit_edge56
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %100

.preheader44:                                     ; preds = %53
  %35 = icmp sgt i32 %56, 1
  br i1 %35, label %.preheader43, label %._crit_edge56

.lr.ph51:                                         ; preds = %._crit_edge, %53
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %53 ], [ 1, %._crit_edge ]
  %36 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %indvars.iv62)
  %37 = load i8, ptr %36, align 1, !tbaa !9
  %38 = icmp eq i8 %37, 42
  %39 = getelementptr i32, ptr %18, i64 %indvars.iv62
  br i1 %38, label %43, label %40

40:                                               ; preds = %.lr.ph51
  %41 = getelementptr i8, ptr %39, i64 -4
  %42 = load i32, ptr %41, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %.lr.ph51, %40
  %.sink = phi i32 [ %42, %40 ], [ 0, %.lr.ph51 ]
  store i32 %.sink, ptr %39, align 4, !tbaa !5
  %44 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %6, i64 %indvars.iv62
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %44, i64 noundef 0)
  %46 = load i8, ptr %45, align 1, !tbaa !9
  %47 = icmp eq i8 %46, 42
  br i1 %47, label %53, label %48

48:                                               ; preds = %43
  %49 = add nsw i64 %indvars.iv62, -1
  %50 = mul nuw nsw i64 %49, %16
  %51 = getelementptr inbounds i32, ptr %18, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %43, %48
  %.sink76 = phi i32 [ %52, %48 ], [ 0, %43 ]
  %54 = mul nuw nsw i64 %indvars.iv62, %16
  %55 = getelementptr inbounds i32, ptr %18, i64 %54
  store i32 %.sink76, ptr %55, align 4, !tbaa !5
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %56 = load i32, ptr %1, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = icmp slt i64 %indvars.iv.next63, %57
  br i1 %58, label %.lr.ph51, label %.preheader44, !llvm.loop !12

.preheader43:                                     ; preds = %.preheader44, %._crit_edge54
  %59 = phi i32 [ %74, %._crit_edge54 ], [ %56, %.preheader44 ]
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %._crit_edge54 ], [ 1, %.preheader44 ]
  %60 = icmp sgt i32 %59, 1
  br i1 %60, label %.lr.ph53, label %.preheader43.._crit_edge54_crit_edge

.preheader43.._crit_edge54_crit_edge:             ; preds = %.preheader43
  %.pre = sext i32 %59 to i64
  br label %._crit_edge54

.lr.ph53:                                         ; preds = %.preheader43
  %61 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %6, i64 %indvars.iv68
  %62 = add nsw i64 %indvars.iv68, -1
  %63 = mul nuw nsw i64 %62, %16
  %64 = getelementptr inbounds i32, ptr %18, i64 %63
  %65 = mul nuw nsw i64 %indvars.iv68, %16
  %66 = getelementptr inbounds i32, ptr %18, i64 %65
  br label %76

._crit_edge56:                                    ; preds = %._crit_edge54, %._crit_edge, %.preheader44
  %.lcssa = phi i32 [ %56, %.preheader44 ], [ %23, %._crit_edge ], [ %74, %._crit_edge54 ]
  %67 = add nsw i32 %.lcssa, -1
  %68 = sext i32 %67 to i64
  %69 = mul nsw i64 %68, %16
  %70 = getelementptr inbounds i32, ptr %18, i64 %69
  %71 = getelementptr inbounds i32, ptr %70, i64 %68
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %72)
          to label %93 unwind label %33

._crit_edge54:                                    ; preds = %89, %.preheader43.._crit_edge54_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader43.._crit_edge54_crit_edge ], [ %91, %89 ]
  %74 = phi i32 [ %59, %.preheader43.._crit_edge54_crit_edge ], [ %90, %89 ]
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %75 = icmp slt i64 %indvars.iv.next69, %.pre-phi
  br i1 %75, label %.preheader43, label %._crit_edge56, !llvm.loop !13

76:                                               ; preds = %.lr.ph53, %89
  %indvars.iv65 = phi i64 [ 1, %.lr.ph53 ], [ %indvars.iv.next66, %89 ]
  %77 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %61, i64 noundef %indvars.iv65)
  %78 = load i8, ptr %77, align 1, !tbaa !9
  %.not = icmp eq i8 %78, 42
  br i1 %.not, label %87, label %79

79:                                               ; preds = %76
  %80 = getelementptr inbounds i32, ptr %64, i64 %indvars.iv65
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = getelementptr i32, ptr %66, i64 %indvars.iv65
  %83 = getelementptr i8, ptr %82, i64 -4
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = add nsw i32 %84, %81
  %86 = srem i32 %85, 1000000007
  store i32 %86, ptr %82, align 4, !tbaa !5
  br label %89

87:                                               ; preds = %76
  %88 = getelementptr inbounds i32, ptr %66, i64 %indvars.iv65
  store i32 0, ptr %88, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %79, %87
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %90 = load i32, ptr %1, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next66, %91
  br i1 %92, label %76, label %._crit_edge54, !llvm.loop !15

93:                                               ; preds = %._crit_edge56
  %94 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %95 unwind label %33

95:                                               ; preds = %93
  br i1 %7, label %.loopexit42, label %.preheader41.preheader

.preheader41.preheader:                           ; preds = %95
  %96 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %6, i64 %4
  br label %.preheader41

.preheader41:                                     ; preds = %.preheader41.preheader, %.preheader41
  %97 = phi ptr [ %98, %.preheader41 ], [ %96, %.preheader41.preheader ]
  %98 = getelementptr inbounds i8, ptr %97, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %98) #8
  %99 = icmp eq ptr %98, %6
  br i1 %99, label %.loopexit42, label %.preheader41

.loopexit42:                                      ; preds = %.preheader41, %95
  call void @llvm.stackrestore.p0(ptr %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

100:                                              ; preds = %33, %31
  %.pn = phi { ptr, i32 } [ %32, %31 ], [ %34, %33 ]
  br i1 %7, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %100
  %101 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %6, i64 %4
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %102 = phi ptr [ %103, %.preheader ], [ %101, %.preheader.preheader ]
  %103 = getelementptr inbounds i8, ptr %102, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %103) #8
  %104 = icmp eq ptr %103, %6
  br i1 %104, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %.preheader, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #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 #6 align 2

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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

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

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


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