#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*/ scanf(char *, char *);
int main(void) {
  char end;
  scanf("%c", &end);
  for (int i = 'A'; i <= end; i++) {
    for (int j = 0; j < end - i; j++)
      printf(" ");
    int k;
    for (k = 'A'; k < i; k++)
      printf("%c", k);
    for (; k >= 'A'; k--)
      printf("%c", k);
    printf("\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    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x41,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jg     1206 <main+0xe6>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movsbl -0x5(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    118a <main+0x6a>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115c <main+0x3c>
movl   $0x41,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bc <main+0x9c>
mov    -0x14(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1191 <main+0x71>
jmp    11c1 <main+0xa1>
cmpl   $0x41,-0x14(%rbp)
jl     11ea <main+0xca>
mov    -0x14(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11c1 <main+0xa1>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x7(%rsp),%al
cmp    $0x41,%al
jge    114d <main+0x2d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x41,%ebp
xor    %r14d,%r14d
mov    $0x42,%r15d
jmp    1180 <main+0x60>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%ecx
movsbl 0x7(%rsp),%eax
add    $0xffffffff,%r14d
add    $0x1,%r15d
cmp    %eax,%ebp
mov    %ecx,%ebp
jge    1140 <main+0x20>
movsbl %al,%eax
cmp    %eax,%ebp
jge    11a8 <main+0x88>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
movsbl 0x7(%rsp),%eax
sub    %ebp,%eax
cmp    %eax,%ebx
jl     1190 <main+0x70>
mov    %r15d,%ebx
cmp    $0x42,%ebp
jb     11f0 <main+0xd0>
mov    $0x41,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <putchar@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x41,%eax
jne    11c0 <main+0xa0>
mov    %r15d,%ebx
cmp    $0x41,%ebp
jb     1160 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
cmp    $0x41,%ebx
ja     11f0 <main+0xd0>
jmp    1160 <main+0x40>

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

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