#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 */
char getchar();
int /*<<< orphan*/ isupper(char);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ system(char *);
void main() {
  char a, b, x;
  int i;
  while (!isupper(x = getchar()))
    ;
  for (a = 'A'; a <= x; a++) {
    for (b = 'A'; b < 'A' + x - a; b++)
      putchar(' ');
    for (i = 1; i <= 2 * (a - 'A') + 1; i++)
      putchar(a);
    putchar('\n');
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x3(%rbp)
movsbl %al,%edi
call   1060 <isupper@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    116f <main+0x2f>
jmp    1174 <main+0x34>
jmp    1148 <main+0x8>
movb   $0x41,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x3(%rbp),%ecx
cmp    %ecx,%eax
jg     1209 <main+0xc9>
movb   $0x41,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
movsbl -0x3(%rbp),%ecx
add    $0x41,%ecx
movsbl -0x1(%rbp),%edx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    11bc <main+0x7c>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
jmp    118c <main+0x4c>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl -0x1(%rbp),%ecx
sub    $0x41,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     11f2 <main+0xb2>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c3 <main+0x83>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    1178 <main+0x38>
lea    0xdf0(%rip),%rdi
call   1040 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r12d
movsbl %al,%edi
call   1060 <isupper@plt>
test   %eax,%eax
je     1150 <main+0x10>
cmp    $0x41,%r12b
jge    1186 <main+0x46>
lea    0xe8d(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <system@plt>
movzbl %r12b,%r15d
add    $0x41,%r15d
mov    $0x41,%r13d
jmp    11b7 <main+0x77>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r13),%eax
movsbl %al,%r13d
cmp    %r12b,%r13b
jg     116c <main+0x2c>
lea    0x0(%r13,%r13,1),%ebx
cmp    $0x83,%ebx
mov    $0x82,%eax
cmovl  %eax,%ebx
mov    %r15d,%ebp
sub    %r13d,%ebp
cmp    $0x42,%ebp
jl     11f6 <main+0xb6>
mov    $0x42,%r14b
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
movsbl %r14b,%eax
lea    0x1(%rax),%r14d
cmp    %eax,%ebp
jg     11e0 <main+0xa0>
cmp    $0x41,%r13d
jl     11a0 <main+0x60>
add    $0xffffff7f,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %r13b,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1210 <main+0xd0>
jmp    11a0 <main+0x60>

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

LLVM IR (-O2):
@.str = [6 x i8] c"pause\00"
define void @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = tail call i32 @isupper(i8 signext %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = icmp slt i8 %2, 65
br i1 %6, label %36, label %7
7: ; preds = %5
%8 = zext i8 %2 to i32
%9 = add nuw nsw i32 %8, 65
br label %10
10: ; preds = %7, %31
%11 = phi i32 [ 65, %7 ], [ %34, %31 ]
%12 = trunc i32 %11 to i8
%13 = shl nsw i32 %11, 1
%14 = call i32 @llvm.smax.i32(i32 %13, i32 130)
%15 = add nsw i32 %14, -128
%16 = sub nsw i32 %9, %11
%17 = icmp sgt i32 %16, 65
br i1 %17, label %20, label %18
18: ; preds = %20, %10
%19 = icmp slt i32 %11, 65
br i1 %19, label %31, label %26
20: ; preds = %10, %20
%21 = phi i8 [ %23, %20 ], [ 65, %10 ]
%22 = tail call i32 @putchar(i8 signext 32)
%23 = add i8 %21, 1
%24 = sext i8 %23 to i32
%25 = icmp sgt i32 %16, %24
br i1 %25, label %20, label %18
26: ; preds = %18, %26
%27 = phi i32 [ %29, %26 ], [ 1, %18 ]
%28 = tail call i32 @putchar(i8 signext %12)
%29 = add nuw nsw i32 %27, 1
%30 = icmp eq i32 %29, %15
br i1 %30, label %31, label %26
31: ; preds = %26, %18
%32 = tail call i32 @putchar(i8 signext 10)
%33 = add i8 %12, 1
%34 = sext i8 %33 to i32
%35 = icmp sgt i8 %33, %2
br i1 %35, label %36, label %10
36: ; preds = %31, %5
%37 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}