#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 *, ...);
main() {
  int i, j;
  int i3, j3;
  printf("\n        ");
  for (j = 1; j < 10; j++) {
    printf("%1d       ", j);
  }
  printf("\n\n");
  for (i = 1; i <= 10; i++) {
    i3 = i * i * i;
    printf("%2d| %5d %2d", i, i3, i3 % 7);
    for (j = 2; j < i; j++) {
      j3 = j * j * j;
      printf(" %4d %2d", i3 - j3 + 1, (i3 - j3 + 1) % 7);
    }
    printf("\n  |\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    115d <main+0x4d>
mov    -0xc(%rbp),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <main+0x24>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     1224 <main+0x114>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x18(%rbp),%edx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1208 <main+0xf8>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
sub    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b8 <main+0xa8>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1172 <main+0x62>
mov    -0x4(%rbp),%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    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rbx
mov    $0x1,%r12d
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
lea    0xe42(%rip),%r13
lea    0xe46(%rip),%r15
xor    %ebx,%ebx
jmp    1209 <main+0xe9>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x1,%r12d
add    $0xffffffff,%ebx
cmp    $0xb,%r12d
je     12c4 <main+0x1a4>
mov    %r12d,%ebp
imul   %r12d,%ebp
imul   %r12d,%ebp
movzwl %bp,%eax
imul   $0x2493,%eax,%eax
shr    $0x10,%eax
mov    %ebp,%ecx
sub    %eax,%ecx
movzwl %cx,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x2,%ecx
lea    0x0(,%rcx,8),%eax
sub    %eax,%ecx
add    %ebp,%ecx
movzwl %cx,%ecx
lea    0xdd2(%rip),%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x3,%r12d
jb     11f0 <main+0xd0>
mov    $0x2,%r14d
nopl   0x0(%rax,%rax,1)
mov    %r14d,%eax
imul   %r14d,%eax
imul   %r14d,%eax
mov    %ebp,%ecx
sub    %eax,%ecx
mov    %ecx,%eax
add    $0x1,%eax
movslq %eax,%rsi
imul   $0xffffffff92492493,%rsi,%rax
shr    $0x20,%rax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x2,%eax
add    %edx,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
lea    (%rcx,%rax,1),%edx
add    $0x1,%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%r14,1),%eax
add    $0x1,%eax
mov    %r14d,%ecx
add    $0x1,%ecx
mov    %ecx,%r14d
cmp    $0x1,%eax
jne    1260 <main+0x140>
jmp    11f0 <main+0xd0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"\0A \00"
@.str.1 = [11 x i8] c"%1d \00"
@.str.3 = [13 x i8] c"%2d| %5d %2d\00"
@.str.4 = [9 x i8] c" %4d %2d\00"
@str = [2 x i8] c"\0A\00"
@str.6 = [5 x i8] c"\0A |\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 6)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 8)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 9)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %0, %31
%13 = phi i32 [ 1, %0 ], [ %33, %31 ]
%14 = mul nuw nsw i32 %13, %13
%15 = mul nuw nsw i32 %14, %13
%16 = trunc i32 %15 to i16
%17 = urem i16 %16, 7
%18 = zext i16 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %13, i32 %15, i32 %18)
%20 = icmp ugt i32 %13, 2
br i1 %20, label %21, label %31
21: ; preds = %12, %21
%22 = phi i32 [ %29, %21 ], [ 2, %12 ]
%23 = mul nsw i32 %22, %22
%24 = mul nsw i32 %23, %22
%25 = sub nsw i32 %15, %24
%26 = add nsw i32 %25, 1
%27 = srem i32 %26, 7
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %26, i32 %27)
%29 = add nuw nsw i32 %22, 1
%30 = icmp eq i32 %29, %13
br i1 %30, label %31, label %21
31: ; preds = %21, %12
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%33 = add nuw nsw i32 %13, 1
%34 = icmp eq i32 %33, 11
br i1 %34, label %35, label %12
35: ; preds = %31
ret i32 0
}