#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 scanf(char *, char *);
int main(void) {
  int i, row, j, sp;
  char ch;
  printf("Enter an Uppercase character:");
  while (scanf("%c", &ch) == 1) {
    for (row = 1; row <= (ch - 64); row++) {
      for (sp = (ch - 65); sp >= row; sp--)
        printf("%c", 32);
      {
        for (i = 65; i <= (sp + 65); i++)
          printf("%c", i);
        for (j = (64 + sp); j >= (65); j--)
          printf("%c", j);
        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
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x15(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1230 <main+0x110>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl -0x15(%rbp),%ecx
sub    $0x40,%ecx
cmp    %ecx,%eax
jg     122b <main+0x10b>
movsbl -0x15(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11a6 <main+0x86>
lea    0xe92(%rip),%rdi
mov    $0x20,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1179 <main+0x59>
movl   $0x41,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x41,%ecx
cmp    %ecx,%eax
jg     11dd <main+0xbd>
mov    -0x8(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ad <main+0x8d>
mov    -0x14(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x41,-0x10(%rbp)
jl     120f <main+0xef>
mov    -0x10(%rbp),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11e6 <main+0xc6>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x3d>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
nopl   0x0(%rax)
lea    0xec7(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1244 <main+0x114>
movzbl 0x7(%rsp),%ebx
cmp    $0x41,%bl
jl     1150 <main+0x20>
mov    $0x1,%r13d
xor    %r12d,%r12d
jmp    11a2 <main+0x72>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r13),%eax
movsbl 0x7(%rsp),%ebx
lea    -0x40(%rbx),%ecx
add    $0x1,%r12d
cmp    %ecx,%r13d
mov    %eax,%r13d
jge    1150 <main+0x20>
lea    -0x41(%rbx),%r14d
cmp    %r13d,%r14d
jge    11c0 <main+0x90>
cmp    $0x41,%ebx
jl     1180 <main+0x50>
jmp    11e5 <main+0xb5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffc0,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    %r13d,%ebx
jg     11d0 <main+0xa0>
mov    %r12d,%r14d
lea    0x41(%r14),%ebp
cmp    $0x42,%ebp
mov    $0x41,%ebx
mov    $0x41,%r15d
cmovge %ebp,%r15d
neg    %r15d
xchg   %ax,%ax
mov    %ebx,%edi
call   1030 <putchar@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1200 <main+0xd0>
test   %r14d,%r14d
jle    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x41,%ebp
ja     1230 <main+0x100>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [30 x i8] c"Enter an Uppercase character:\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %52
5: ; preds = %44, %8
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %52
8: ; preds = %0, %5
%9 = load i8, i8* %1
%10 = icmp slt i8 %9, 65
br i1 %10, label %5, label %11
11: ; preds = %8
%12 = zext i8 %9 to i32
br label %13
13: ; preds = %11, %44
%14 = phi i32 [ 0, %11 ], [ %51, %44 ]
%15 = phi i32 [ %12, %11 ], [ %48, %44 ]
%16 = phi i32 [ 1, %11 ], [ %46, %44 ]
%17 = add nsw i32 %15, -65
%18 = icmp slt i32 %17, %16
br i1 %18, label %19, label %25
19: ; preds = %13
%20 = icmp slt i32 %15, 65
br i1 %20, label %44, label %21
21: ; preds = %25, %19
%22 = phi i32 [ %17, %19 ], [ %14, %25 ]
%23 = add i32 %22, 65
%24 = call i32 @llvm.smax.i32(i32 %23, i32 65)
br label %30
25: ; preds = %13, %25
%26 = phi i32 [ %28, %25 ], [ %17, %13 ]
%27 = call i32 @putchar(i32 32)
%28 = add nsw i32 %26, -1
%29 = icmp sgt i32 %26, %16
br i1 %29, label %25, label %21
30: ; preds = %21, %30
%31 = phi i32 [ %33, %30 ], [ 65, %21 ]
%32 = call i32 @putchar(i32 %31)
%33 = add nuw nsw i32 %31, 1
%34 = icmp eq i32 %31, %24
br i1 %34, label %35, label %30
35: ; preds = %30
%36 = icmp sgt i32 %22, 0
br i1 %36, label %37, label %44
37: ; preds = %35
%38 = add nuw nsw i32 %22, 64
br label %39
39: ; preds = %37, %39
%40 = phi i32 [ %42, %39 ], [ %38, %37 ]
%41 = call i32 @putchar(i32 %40)
%42 = add nsw i32 %40, -1
%43 = icmp ugt i32 %40, 65
br i1 %43, label %39, label %44
44: ; preds = %39, %19, %35
%45 = call i32 @putchar(i32 10)
%46 = add nuw nsw i32 %16, 1
%47 = load i8, i8* %1
%48 = sext i8 %47 to i32
%49 = add nsw i32 %48, -64
%50 = icmp slt i32 %16, %49
%51 = add nuw nsw i32 %14, 1
br i1 %50, label %13, label %5
52: ; preds = %5, %0
ret i32 0
}