#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b, c, i, j, n;
  scanf("%d", &n);
  scanf("%d", &a);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n - i; j++)
      putchar(' ');
    for (j = 1; j <= 2 * i - 1; j++) {
      putchar('0' + (a + i + j - 2) % 10);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1203 <main+0xd3>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jg     11a2 <main+0x72>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1179 <main+0x49>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11e9 <main+0xb9>
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
sub    $0x2,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a9 <main+0x79>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <main+0x36>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    11fb <main+0xdb>
mov    $0x1,%r14d
xor    %r15d,%r15d
mov    $0x1,%r12d
nopl   0x0(%rax,%rax,1)
mov    %r15d,%ebp
mov    %r14d,%ebx
cmp    %r12d,%eax
jle    11a0 <main+0x80>
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
sub    %r12d,%eax
add    $0x1,%ebx
cmp    %eax,%ebx
jl     1180 <main+0x60>
mov    %r15d,%ebp
mov    %r14d,%ebx
xchg   %ax,%ax
mov    0xc(%rsp),%eax
add    %ebp,%eax
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
add    $0x30,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
jne    11a0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%ecx
mov    0x8(%rsp),%eax
add    $0x2,%r14d
add    $0x1,%r15d
cmp    %eax,%r12d
mov    %ecx,%r12d
jl     1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %5
br label %10
10: ; preds = %48, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %7
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %51
14: ; preds = %10
store i32 1, i32* %6
br label %15
15: ; preds = %23, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %5
%19 = sub nsw i32 %17, %18
%20 = icmp sle i32 %16, %19
br i1 %20, label %21, label %26
21: ; preds = %15
%22 = call i32 @putchar(i32 32)
br label %23
23: ; preds = %21
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %15
26: ; preds = %15
store i32 1, i32* %6
br label %27
27: ; preds = %43, %26
%28 = load i32, i32* %6
%29 = load i32, i32* %5
%30 = mul nsw i32 2, %29
%31 = sub nsw i32 %30, 1
%32 = icmp sle i32 %28, %31
br i1 %32, label %33, label %46
33: ; preds = %27
%34 = load i32, i32* %2
%35 = load i32, i32* %5
%36 = add nsw i32 %34, %35
%37 = load i32, i32* %6
%38 = add nsw i32 %36, %37
%39 = sub nsw i32 %38, 2
%40 = srem i32 %39, 10
%41 = add nsw i32 48, %40
%42 = call i32 @putchar(i32 %41)
br label %43
43: ; preds = %33
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %27
46: ; preds = %27
%47 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %48
48: ; preds = %46
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %10
51: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %39, label %9
9: ; preds = %0, %33
%10 = phi i32 [ %36, %33 ], [ %7, %0 ]
%11 = phi i32 [ %38, %33 ], [ 2, %0 ]
%12 = phi i32 [ %35, %33 ], [ 1, %0 ]
%13 = icmp sgt i32 %10, %12
br i1 %13, label %16, label %14
14: ; preds = %16, %9
%15 = add nsw i32 %12, -2
br label %23
16: ; preds = %9, %16
%17 = phi i32 [ %19, %16 ], [ 1, %9 ]
%18 = call i32 @putchar(i32 32)
%19 = add nuw nsw i32 %17, 1
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, %12
%22 = icmp slt i32 %17, %21
br i1 %22, label %16, label %14
23: ; preds = %14, %23
%24 = phi i32 [ 1, %14 ], [ %31, %23 ]
%25 = load i32, i32* %1
%26 = add i32 %15, %24
%27 = add i32 %26, %25
%28 = srem i32 %27, 10
%29 = add nsw i32 %28, 48
%30 = call i32 @putchar(i32 %29)
%31 = add nuw i32 %24, 1
%32 = icmp eq i32 %31, %11
br i1 %32, label %33, label %23
33: ; preds = %23
%34 = call i32 @putchar(i32 10)
%35 = add nuw nsw i32 %12, 1
%36 = load i32, i32* %2
%37 = icmp slt i32 %12, %36
%38 = add i32 %11, 2
br i1 %37, label %9, label %39
39: ; preds = %33, %0
ret i32 0
}