#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 main() {
  char ch = 'A';
  int rows = 5, space = 0, lineNumber, colLeft, colRight;
  for (lineNumber = 0; lineNumber <= rows; lineNumber++) {
    for (space = rows - lineNumber; space; space--) {
      printf(" ");
    }
    for (colLeft = ch; colLeft <= 'A' + lineNumber; colLeft++) {
      printf("%c", ch);
      ch++;
    }
    ch -= 2;
    for (colRight = ch; colRight >= 'A' + 0; colRight--) {
      printf("%c", ch);
      ch--;
    }
    ch = 'A';
    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)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1216 <main+0x106>
mov    -0xc(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1173 <main+0x63>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    114d <main+0x3d>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x41,%ecx
cmp    %ecx,%eax
jg     11b3 <main+0xa3>
movsbl -0x5(%rbp),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117a <main+0x6a>
movsbl -0x5(%rbp),%eax
sub    $0x2,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x41,-0x1c(%rbp)
jl     11f6 <main+0xe6>
movsbl -0x5(%rbp),%esi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x5(%rbp),%al
add    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c4 <main+0xb4>
movb   $0x41,-0x5(%rbp)
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1138 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r15d,%r15d
mov    $0xfffffffb,%r14d
mov    $0xffffffff,%ebp
jmp    114b <main+0x3b>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
add    $0x1,%r14d
add    $0xffffffff,%ebp
cmp    $0x6,%r15d
je     11b6 <main+0xa6>
cmp    $0x5,%r15d
je     116e <main+0x5e>
mov    %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebx
jne    1160 <main+0x50>
mov    $0x3f,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x2(%rbx),%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
add    $0x1,%ebx
add    %ebp,%eax
add    $0x1,%eax
cmp    $0x3f,%eax
jne    1180 <main+0x70>
cmp    $0x41,%bl
jl     1130 <main+0x20>
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
lea    -0x1(%rbx),%eax
cmp    $0x41,%ebx
mov    %eax,%ebx
ja     11a0 <main+0x90>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %29
%2 = phi i32 [ 66, %0 ], [ %32, %29 ]
%3 = phi i32 [ 0, %0 ], [ %31, %29 ]
%4 = icmp eq i32 %3, 5
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = sub nuw nsw i32 5, %3
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %10, %7 ], [ %6, %5 ]
%9 = tail call i32 @putchar(i32 32)
%10 = add nsw i32 %8, -1
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %1
br label %13
13: ; preds = %12, %13
%14 = phi i32 [ %16, %13 ], [ 65, %12 ]
%15 = tail call i32 @putchar(i32 %14)
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, %2
br i1 %17, label %18, label %13
18: ; preds = %13
%19 = trunc i32 %14 to i8
%20 = add i8 %19, -1
%21 = icmp sgt i8 %20, 64
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = zext i8 %20 to i32
br label %24
24: ; preds = %22, %24
%25 = phi i32 [ %27, %24 ], [ %23, %22 ]
%26 = tail call i32 @putchar(i32 %25)
%27 = add nsw i32 %25, -1
%28 = icmp ugt i32 %25, 65
br i1 %28, label %24, label %29
29: ; preds = %24, %18
%30 = tail call i32 @putchar(i32 10)
%31 = add nuw nsw i32 %3, 1
%32 = add nuw nsw i32 %2, 1
%33 = icmp eq i32 %31, 6
br i1 %33, label %34, label %1
34: ; preds = %29
ret i32 0
}