#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*/ putchar(char);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, j, a;
  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);
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f4 <main+0xd4>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     1192 <main+0x72>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1169 <main+0x49>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11dc <main+0xbc>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x2,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1199 <main+0x79>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <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    11fc <main+0xdc>
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
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
movsbl %al,%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"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 1, i32* %3
br label %8
8: ; preds = %47, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %50
12: ; preds = %8
store i32 1, i32* %4
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = sub nsw i32 %15, %16
%18 = icmp sle i32 %14, %17
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = call i32 @putchar(i8 signext 32)
br label %21
21: ; preds = %19
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %13
24: ; preds = %13
store i32 1, i32* %4
br label %25
25: ; preds = %42, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %3
%28 = mul nsw i32 2, %27
%29 = sub nsw i32 %28, 1
%30 = icmp sle i32 %26, %29
br i1 %30, label %31, label %45
31: ; preds = %25
%32 = load i32, i32* %5
%33 = load i32, i32* %3
%34 = add nsw i32 %32, %33
%35 = load i32, i32* %4
%36 = add nsw i32 %34, %35
%37 = sub nsw i32 %36, 2
%38 = srem i32 %37, 10
%39 = add nsw i32 48, %38
%40 = trunc i32 %39 to i8
%41 = call i32 @putchar(i8 signext %40)
br label %42
42: ; preds = %31
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %25
45: ; preds = %25
%46 = call i32 @putchar(i8 signext 10)
br label %47
47: ; preds = %45
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %8
50: ; preds = %8
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* %1)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %40, label %9
9: ; preds = %0, %34
%10 = phi i32 [ %37, %34 ], [ %7, %0 ]
%11 = phi i32 [ %39, %34 ], [ 2, %0 ]
%12 = phi i32 [ %36, %34 ], [ 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(i8 signext 32)
%19 = add nuw nsw i32 %17, 1
%20 = load i32, i32* %1
%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 ], [ %32, %23 ]
%25 = load i32, i32* %2
%26 = add i32 %15, %24
%27 = add i32 %26, %25
%28 = srem i32 %27, 10
%29 = trunc i32 %28 to i8
%30 = add nsw i8 %29, 48
%31 = call i32 @putchar(i8 signext %30)
%32 = add nuw i32 %24, 1
%33 = icmp eq i32 %32, %11
br i1 %33, label %34, label %23
34: ; preds = %23
%35 = call i32 @putchar(i8 signext 10)
%36 = add nuw nsw i32 %12, 1
%37 = load i32, i32* %1
%38 = icmp slt i32 %12, %37
%39 = add i32 %11, 2
br i1 %38, label %9, label %40
40: ; preds = %34, %0
ret i32 0
}