#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() {
  char ch;
  int a, i, j, k;
  printf("input the word:");
  scanf("%c", &ch);
  if ('A' <= ch && ch < 'a')
    a = ch + 32 - 96;
  else
    a = ch - 96;
  for (i = 1; i <= a; i++) {
    for (j = a - i; j >= 0; j--) {
      printf(" ");
    }
    for (k = 1; k <= i; k++) {
      ch = 'A' + k - 1;
      printf("%c", ch);
    }
    for (k = i; k >= 2; k--) {
      ch = 'A' + k - 2;
      printf("%c", ch);
    }
    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    0xecc(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     117d <main+0x5d>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jge    117d <main+0x5d>
movsbl -0x5(%rbp),%eax
add    $0x20,%eax
sub    $0x60,%eax
mov    %eax,-0xc(%rbp)
jmp    1187 <main+0x67>
movsbl -0x5(%rbp),%eax
sub    $0x60,%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1260 <main+0x140>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11c9 <main+0xa9>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11a3 <main+0x83>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1208 <main+0xe8>
mov    -0x18(%rbp),%eax
add    $0x41,%eax
sub    $0x1,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jl     1244 <main+0x124>
mov    -0x18(%rbp),%eax
add    $0x41,%eax
sub    $0x2,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    120e <main+0xee>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118e <main+0x6e>
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    0xec0(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%eax
lea    -0x41(%rax),%ecx
xor    %edx,%edx
cmp    $0x20,%cl
setb   %dl
shl    $0x5,%edx
lea    (%rdx,%rax,1),%r15d
add    $0xffffffa0,%r15d
test   %r15d,%r15d
jle    122c <main+0xfc>
lea    0x1(%r15),%r14d
mov    $0x1,%ebp
mov    $0x2,%r12d
mov    %r15d,%r13d
jmp    11be <main+0x8e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
lea    0x1(%r12),%eax
add    $0xffffffff,%r13d
cmp    %r14d,%r12d
mov    %eax,%r12d
je     122c <main+0xfc>
cmp    %ebp,%r15d
mov    %r13d,%ebx
js     11df <main+0xaf>
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0xa0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x41(%rbx),%eax
mov    %al,0x7(%rsp)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    11f0 <main+0xc0>
mov    %r12d,%ebx
cmp    $0x2,%ebp
jb     11a0 <main+0x70>
xchg   %ax,%ax
lea    0x3e(%rbx),%eax
mov    %al,0x7(%rsp)
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
jg     1210 <main+0xe0>
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"input the word:\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 ([16 x i8], [16 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 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = add i8 %4, -65
%7 = icmp ult i8 %6, 32
%8 = select i1 %7, i32 -64, i32 -96
%9 = add nsw i32 %8, %5
%10 = icmp slt i32 %9, 1
br i1 %10, label %47, label %11
11: ; preds = %0
%12 = add nsw i32 %9, 1
br label %13
13: ; preds = %11, %42
%14 = phi i32 [ 2, %11 ], [ %45, %42 ]
%15 = phi i32 [ 1, %11 ], [ %44, %42 ]
%16 = sub nsw i32 %9, %15
%17 = icmp sgt i32 %16, -1
br i1 %17, label %19, label %18
18: ; preds = %19, %13
br label %26
19: ; preds = %13, %19
%20 = phi i32 [ %22, %19 ], [ %16, %13 ]
%21 = call i32 @putchar(i32 32)
%22 = add nsw i32 %20, -1
%23 = icmp eq i32 %20, 0
br i1 %23, label %18, label %19
24: ; preds = %26
%25 = icmp ugt i32 %15, 1
br i1 %25, label %34, label %42
26: ; preds = %18, %26
%27 = phi i32 [ %32, %26 ], [ 1, %18 ]
%28 = trunc i32 %27 to i8
%29 = add i8 %28, 64
store i8 %29, i8* %1
%30 = sext i8 %29 to i32
%31 = call i32 @putchar(i32 %30)
%32 = add nuw nsw i32 %27, 1
%33 = icmp eq i32 %32, %14
br i1 %33, label %24, label %26
34: ; preds = %24, %34
%35 = phi i32 [ %40, %34 ], [ %15, %24 ]
%36 = trunc i32 %35 to i8
%37 = add i8 %36, 63
store i8 %37, i8* %1
%38 = sext i8 %37 to i32
%39 = call i32 @putchar(i32 %38)
%40 = add nsw i32 %35, -1
%41 = icmp sgt i32 %35, 2
br i1 %41, label %34, label %42
42: ; preds = %34, %24
%43 = call i32 @putchar(i32 10)
%44 = add nuw nsw i32 %15, 1
%45 = add nuw nsw i32 %14, 1
%46 = icmp eq i32 %14, %12
br i1 %46, label %47, label %13
47: ; preds = %42, %0
ret i32 0
}