; LLVM IR from kazunetakahashi/atcoder :: 2017/1106_ABC063 (C)

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

@N = external dso_local global i32, align 4
@s = external dso_local global [120 x i32], align 16
@memo = external dso_local global [120 x [10 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call noundef 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) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %23, %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr @N, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [120 x i32], ptr @s, i64 0, i64 %20
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %21)
  br label %23

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %2, align 4, !tbaa !5
  br label %13, !llvm.loop !9

26:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @memo, ptr noundef getelementptr inbounds (i32, ptr @memo, i64 1200), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %27

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

31:                                               ; preds = %27
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %98

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

33:                                               ; preds = %52, %32
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = icmp slt i32 %34, 10
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %55

37:                                               ; preds = %33
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %39
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [10 x i32], ptr %40, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %47
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [10 x i32], ptr %48, i64 0, i64 %50
  store i32 %44, ptr %51, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %37
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %6, align 4, !tbaa !5
  br label %33, !llvm.loop !11

55:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %91, %55
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = icmp slt i32 %57, 10
  br i1 %58, label %60, label %59

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

60:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %62
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [10 x i32], ptr %63, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [120 x i32], ptr @s, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %67, %71
  store i32 %72, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = srem i32 %73, 10
  store i32 %74, ptr %9, align 4, !tbaa !5
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %77
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [10 x i32], ptr %78, i64 0, i64 %80
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %81, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %86
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [10 x i32], ptr %87, i64 0, i64 %89
  store i32 %83, ptr %90, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %91

91:                                               ; preds = %60
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !5
  br label %56, !llvm.loop !12

94:                                               ; preds = %59
  br label %95

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

98:                                               ; preds = %31
  %99 = load i32, ptr @N, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %100
  %102 = getelementptr inbounds [10 x i32], ptr %101, i64 0, i64 0
  store i32 0, ptr %102, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %116, %98
  %104 = load i32, ptr %11, align 4, !tbaa !5
  %105 = icmp slt i32 %104, 10
  br i1 %105, label %107, label %106

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

107:                                              ; preds = %103
  %108 = load i32, ptr @N, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %109
  %111 = load i32, ptr %11, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [10 x i32], ptr %110, i64 0, i64 %112
  %114 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %113)
  %115 = load i32, ptr %114, align 4, !tbaa !5
  store i32 %115, ptr %10, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %107
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %11, align 4, !tbaa !5
  br label %103, !llvm.loop !14

119:                                              ; preds = %106
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %120)
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %121, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %123 = load i32, ptr %1, align 4
  ret i32 %123
}

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

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

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

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

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

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

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

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

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

@N = external dso_local global i32, align 4
@s = external dso_local global [120 x i32], align 16
@memo = external dso_local global [120 x [10 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = 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)
  %5 = load i32, ptr @N, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @memo, ptr noundef nonnull getelementptr inbounds (i8, ptr @memo, i64 4800), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader29, label %._crit_edge.._crit_edge34_crit_edge

._crit_edge.._crit_edge34_crit_edge:              ; preds = %._crit_edge
  %.pre = sext i32 %7 to i64
  br label %._crit_edge34

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %9 = getelementptr inbounds [120 x i32], ptr @s, i64 0, i64 %indvars.iv
  %10 = 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) %9)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @N, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = icmp slt i64 %indvars.iv.next, %12
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader29:                                     ; preds = %._crit_edge, %.preheader29
  %indvars.iv45 = phi i64 [ %indvars.iv.next46, %.preheader29 ], [ 0, %._crit_edge ]
  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
  %14 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 0
  %15 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 0
  %16 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 1
  %17 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 2
  %18 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 3
  %19 = load <4 x i32>, ptr %14, align 8, !tbaa !5
  store <4 x i32> %19, ptr %15, align 8, !tbaa !5
  %20 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 4
  %21 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 4
  %22 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 5
  %23 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 6
  %24 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 7
  %25 = load <4 x i32>, ptr %20, align 8, !tbaa !5
  store <4 x i32> %25, ptr %21, align 8, !tbaa !5
  %26 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 8
  %27 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 8
  %28 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv45, i64 9
  %29 = load <2 x i32>, ptr %26, align 8, !tbaa !5
  store <2 x i32> %29, ptr %27, align 8, !tbaa !5
  %30 = getelementptr inbounds [120 x i32], ptr @s, i64 0, i64 %indvars.iv45
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = extractelement <4 x i32> %19, i64 0
  %33 = add nsw i32 %31, %32
  store i32 %33, ptr %2, align 4, !tbaa !5
  %34 = srem i32 %33, 10
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %35
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %36, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %38 = load i32, ptr %37, align 4, !tbaa !5
  store i32 %38, ptr %36, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %39 = load i32, ptr %16, align 4, !tbaa !5
  %40 = load i32, ptr %30, align 4, !tbaa !5
  %41 = add nsw i32 %40, %39
  store i32 %41, ptr %2, align 4, !tbaa !5
  %42 = srem i32 %41, 10
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %43
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %44, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %46 = load i32, ptr %45, align 4, !tbaa !5
  store i32 %46, ptr %44, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %47 = load i32, ptr %17, align 8, !tbaa !5
  %48 = load i32, ptr %30, align 4, !tbaa !5
  %49 = add nsw i32 %48, %47
  store i32 %49, ptr %2, align 4, !tbaa !5
  %50 = srem i32 %49, 10
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %51
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %52, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %54 = load i32, ptr %53, align 4, !tbaa !5
  store i32 %54, ptr %52, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %55 = load i32, ptr %18, align 4, !tbaa !5
  %56 = load i32, ptr %30, align 4, !tbaa !5
  %57 = add nsw i32 %56, %55
  store i32 %57, ptr %2, align 4, !tbaa !5
  %58 = srem i32 %57, 10
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %59
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %60, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %62 = load i32, ptr %61, align 4, !tbaa !5
  store i32 %62, ptr %60, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %63 = load i32, ptr %20, align 8, !tbaa !5
  %64 = load i32, ptr %30, align 4, !tbaa !5
  %65 = add nsw i32 %64, %63
  store i32 %65, ptr %2, align 4, !tbaa !5
  %66 = srem i32 %65, 10
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %67
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %68, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %70 = load i32, ptr %69, align 4, !tbaa !5
  store i32 %70, ptr %68, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %71 = load i32, ptr %22, align 4, !tbaa !5
  %72 = load i32, ptr %30, align 4, !tbaa !5
  %73 = add nsw i32 %72, %71
  store i32 %73, ptr %2, align 4, !tbaa !5
  %74 = srem i32 %73, 10
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %75
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %76, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %78 = load i32, ptr %77, align 4, !tbaa !5
  store i32 %78, ptr %76, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %79 = load i32, ptr %23, align 8, !tbaa !5
  %80 = load i32, ptr %30, align 4, !tbaa !5
  %81 = add nsw i32 %80, %79
  store i32 %81, ptr %2, align 4, !tbaa !5
  %82 = srem i32 %81, 10
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %83
  %85 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %84, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %86 = load i32, ptr %85, align 4, !tbaa !5
  store i32 %86, ptr %84, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %87 = load i32, ptr %24, align 4, !tbaa !5
  %88 = load i32, ptr %30, align 4, !tbaa !5
  %89 = add nsw i32 %88, %87
  store i32 %89, ptr %2, align 4, !tbaa !5
  %90 = srem i32 %89, 10
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %91
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %92, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %94 = load i32, ptr %93, align 4, !tbaa !5
  store i32 %94, ptr %92, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %95 = load i32, ptr %26, align 8, !tbaa !5
  %96 = load i32, ptr %30, align 4, !tbaa !5
  %97 = add nsw i32 %96, %95
  store i32 %97, ptr %2, align 4, !tbaa !5
  %98 = srem i32 %97, 10
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %99
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %100, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %102 = load i32, ptr %101, align 4, !tbaa !5
  store i32 %102, ptr %100, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %103 = load i32, ptr %28, align 4, !tbaa !5
  %104 = load i32, ptr %30, align 4, !tbaa !5
  %105 = add nsw i32 %104, %103
  store i32 %105, ptr %2, align 4, !tbaa !5
  %106 = srem i32 %105, 10
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %indvars.iv.next46, i64 %107
  %109 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %108, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %110 = load i32, ptr %109, align 4, !tbaa !5
  store i32 %110, ptr %108, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %111 = load i32, ptr @N, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next46, %112
  br i1 %113, label %.preheader29, label %._crit_edge34, !llvm.loop !11

._crit_edge34:                                    ; preds = %.preheader29, %._crit_edge.._crit_edge34_crit_edge
  %.pre-phi = phi i64 [ %.pre, %._crit_edge.._crit_edge34_crit_edge ], [ %112, %.preheader29 ]
  %114 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %.pre-phi
  store i32 0, ptr %114, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  %115 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %114)
  %116 = load i32, ptr %115, align 4, !tbaa !5
  store i32 %116, ptr %3, align 4, !tbaa !5
  %117 = load i32, ptr @N, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %118, i64 1
  %120 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %119)
  %121 = load i32, ptr %120, align 4, !tbaa !5
  store i32 %121, ptr %3, align 4, !tbaa !5
  %122 = load i32, ptr @N, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %123, i64 2
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %124)
  %126 = load i32, ptr %125, align 4, !tbaa !5
  store i32 %126, ptr %3, align 4, !tbaa !5
  %127 = load i32, ptr @N, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %128, i64 3
  %130 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %129)
  %131 = load i32, ptr %130, align 4, !tbaa !5
  store i32 %131, ptr %3, align 4, !tbaa !5
  %132 = load i32, ptr @N, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %133, i64 4
  %135 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %134)
  %136 = load i32, ptr %135, align 4, !tbaa !5
  store i32 %136, ptr %3, align 4, !tbaa !5
  %137 = load i32, ptr @N, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %138, i64 5
  %140 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %139)
  %141 = load i32, ptr %140, align 4, !tbaa !5
  store i32 %141, ptr %3, align 4, !tbaa !5
  %142 = load i32, ptr @N, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %143, i64 6
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %144)
  %146 = load i32, ptr %145, align 4, !tbaa !5
  store i32 %146, ptr %3, align 4, !tbaa !5
  %147 = load i32, ptr @N, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %148, i64 7
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %149)
  %151 = load i32, ptr %150, align 4, !tbaa !5
  store i32 %151, ptr %3, align 4, !tbaa !5
  %152 = load i32, ptr @N, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %153, i64 8
  %155 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %154)
  %156 = load i32, ptr %155, align 4, !tbaa !5
  store i32 %156, ptr %3, align 4, !tbaa !5
  %157 = load i32, ptr @N, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [120 x [10 x i32]], ptr @memo, i64 0, i64 %158, i64 9
  %160 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %159)
  %161 = load i32, ptr %160, align 4, !tbaa !5
  store i32 %161, ptr %3, align 4, !tbaa !5
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %161)
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %162, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret i32 0
}

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

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

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

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

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

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

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

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

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


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