#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 *, ...);
scalar_t__ scanf(char *, char *);
int main(void) {
  char start = 'A';
  char end = 'Z';
  char input;
  int dif;
  int i, j, k, l;
  printf("Please enter an uppercase letter: ");
  while ((scanf("%c", &input) == 0) || (input < start || input > end))
    printf("Please enter an upercase letter: ");
  dif = input - start;
  for (i = 0; i <= dif; i++) {
    for (j = i; j < dif; j++)
      printf(" ");
    for (k = 0; k <= i; k++)
      printf("%c", start + k);
    for (l = i; l > 0; l--)
      printf("%c", start + l - 1);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x41,-0x5(%rbp)
movb   $0x5a,-0x6(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x7(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1d(%rbp)
je     1192 <main+0x72>
movsbl -0x7(%rbp),%ecx
movsbl -0x5(%rbp),%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x1e(%rbp)
jl     118c <main+0x6c>
movsbl -0x7(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
setg   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    11a2 <main+0x82>
jmp    11b5 <main+0x95>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1145 <main+0x25>
movsbl -0x7(%rbp),%eax
movsbl -0x5(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     128b <main+0x16b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1203 <main+0xe3>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11db <main+0xbb>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1239 <main+0x119>
movsbl -0x5(%rbp),%esi
add    -0x18(%rbp),%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    120a <main+0xea>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    126f <main+0x14f>
movsbl -0x5(%rbp),%esi
add    -0x1c(%rbp),%esi
sub    $0x1,%esi
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    123f <main+0x11f>
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c9 <main+0xa9>
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>
lea    0xed3(%rip),%r14
lea    0x3(%rsp),%rbx
lea    0xeca(%rip),%r15
jmp    116a <main+0x3a>
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     1160 <main+0x30>
movzbl 0x3(%rsp),%r12d
lea    -0x5b(%r12),%eax
cmp    $0xe5,%al
jbe    1160 <main+0x30>
lea    -0x41(%r12),%r14d
add    $0xffffffc0,%r12d
xor    %r15d,%r15d
mov    $0xffffffff,%ebp
mov    $0x40,%r13d
mov    %r14d,0x4(%rsp)
jmp    11ce <main+0x9e>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
add    $0xffffffff,%r14d
add    $0xffffffff,%ebp
add    $0x1,%r13d
cmp    %r12d,%r15d
je     1249 <main+0x119>
mov    %r14d,%ebx
cmp    0x4(%rsp),%r15d
jge    11ef <main+0xbf>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11e0 <main+0xb0>
mov    $0x41,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1030 <putchar@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x41,%eax
jne    1200 <main+0xd0>
mov    %r13d,%ebx
test   %r15d,%r15d
je     11b0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <putchar@plt>
lea    -0x1(%rbx),%eax
add    $0xffffffc0,%ebx
cmp    $0x1,%ebx
mov    %eax,%ebx
jg     1230 <main+0x100>
jmp    11b0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Please enter an uppercase letter: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [34 x i8] c"Please enter an upercase letter: \00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i8 65, i8* %2
store i8 90, i8* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %30, %0
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = icmp eq i64 %12, 0
br i1 %13, label %28, label %14
14: ; preds = %11
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp slt i32 %16, %18
br i1 %19, label %26, label %20
20: ; preds = %14
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp sgt i32 %22, %24
br label %26
26: ; preds = %20, %14
%27 = phi i1 [ true, %14 ], [ %25, %20 ]
br label %28
28: ; preds = %26, %11
%29 = phi i1 [ true, %11 ], [ %27, %26 ]
br i1 %29, label %30, label %32
30: ; preds = %28
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %11
32: ; preds = %28
%33 = load i8, i8* %4
%34 = sext i8 %33 to i32
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = sub nsw i32 %34, %36
store i32 %37, i32* %5
store i32 0, i32* %6
br label %38
38: ; preds = %84, %32
%39 = load i32, i32* %6
%40 = load i32, i32* %5
%41 = icmp sle i32 %39, %40
br i1 %41, label %42, label %87
42: ; preds = %38
%43 = load i32, i32* %6
store i32 %43, i32* %7
br label %44
44: ; preds = %50, %42
%45 = load i32, i32* %7
%46 = load i32, i32* %5
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %44
53: ; preds = %44
store i32 0, i32* %8
br label %54
54: ; preds = %64, %53
%55 = load i32, i32* %8
%56 = load i32, i32* %6
%57 = icmp sle i32 %55, %56
br i1 %57, label %58, label %67
58: ; preds = %54
%59 = load i8, i8* %2
%60 = sext i8 %59 to i32
%61 = load i32, i32* %8
%62 = add nsw i32 %60, %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %58
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
store i32 %66, i32* %8
br label %54
67: ; preds = %54
%68 = load i32, i32* %6
store i32 %68, i32* %9
br label %69
69: ; preds = %79, %67
%70 = load i32, i32* %9
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %82
72: ; preds = %69
%73 = load i8, i8* %2
%74 = sext i8 %73 to i32
%75 = load i32, i32* %9
%76 = add nsw i32 %74, %75
%77 = sub nsw i32 %76, 1
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %72
%80 = load i32, i32* %9
%81 = add nsw i32 %80, -1
store i32 %81, i32* %9
br label %69
82: ; preds = %69
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %84
84: ; preds = %82
%85 = load i32, i32* %6
%86 = add nsw i32 %85, 1
store i32 %86, i32* %6
br label %38
87: ; preds = %38
ret i32 0
}

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