#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 word[] = {'p', 'r', 'o', 'g', 'r', 'a', 'm'};
  int i = 0, j = 0;
  for (i = 0; i < 7; i++) {
    for (j = 0; j < 7; j++) {
      if (i == j)
        printf("%c", word[i]);
      else if (i + j == 6)
        printf("%c", word[6 - i]);
      else
        printf(" ");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jge    1207 <main+0xf7>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    11eb <main+0xdb>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1194 <main+0x84>
movslq -0x10(%rbp),%rax
movsbl -0xb(%rbp,%rax,1),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d8 <main+0xc8>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    $0x6,%eax
jne    11c5 <main+0xb5>
mov    $0x6,%eax
sub    -0x10(%rbp),%eax
cltq
movsbl -0xb(%rbp,%rax,1),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <main+0xc3>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d8 <main+0xc8>
jmp    11dd <main+0xcd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x52>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1151 <main+0x41>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xee7(%rip),%r15
xor    %r14d,%r14d
lea    0xed7(%rip),%r12
jmp    1167 <main+0x57>
movsbl (%r14,%r12,1),%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0xffffffffffffffff,%r15
lea    (%r12,%r14,1),%rbx
test   %r14,%r14
je     1179 <main+0x69>
cmp    $0x6,%r14
jne    11d0 <main+0xc0>
mov    %r15,%rbx
movsbl (%rbx),%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x4,%r14
jne    11b0 <main+0xa0>
movsbl (%r15),%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1240 <main+0x130>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x3,%r14
je     112b <main+0x1b>
jmp    11fb <main+0xeb>
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x1,%r14
je     11e9 <main+0xd9>
cmp    $0x5,%r14
jne    124a <main+0x13a>
mov    %r15,%rbx
movsbl (%rbx),%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x4,%r14
je     1240 <main+0x130>
cmp    $0x2,%r14
je     1272 <main+0x162>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x1,%r14
je     127b <main+0x16b>
cmp    $0x5,%r14
jne    1284 <main+0x174>
movsbl (%r14,%r12,1),%edi
jmp    1144 <main+0x34>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%r12,1),%edi
jmp    113a <main+0x2a>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    $0x2,%r14
jne    118b <main+0x7b>
movsbl (%r14,%r12,1),%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movsbl (%r15),%edi
jmp    113a <main+0x2a>
movsbl (%r15),%edi
jmp    1144 <main+0x34>
mov    $0x20,%ebx
mov    $0x20,%edi
call   1030 <putchar@plt>
test   %r14,%r14
je     12a4 <main+0x194>
cmp    $0x6,%r14
jne    114e <main+0x3e>
jmp    12ad <main+0x19d>
movsbl (%r15),%ebx
jmp    114e <main+0x3e>
movsbl (%r14,%r12,1),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.word = [7 x i8] c"program"
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [7 x i8]* %2 to i8*
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %3
br label %6
6: ; preds = %46, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 7
br i1 %8, label %9, label %49
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %41, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 7
br i1 %12, label %13, label %44
13: ; preds = %10
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %40
24: ; preds = %13
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = add nsw i32 %25, %26
%28 = icmp eq i32 %27, 6
br i1 %28, label %29, label %37
29: ; preds = %24
%30 = load i32, i32* %3
%31 = sub nsw i32 6, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %35)
br label %39
37: ; preds = %24
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %39
39: ; preds = %37, %29
br label %40
40: ; preds = %39, %17
br label %41
41: ; preds = %40
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %10
44: ; preds = %10
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %6
49: ; preds = %6
%50 = load i32, i32* %1
ret i32 %50
}

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