#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 */
size_t cubes(int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int i;
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int s[3];
  int x[500];
  register i;
  for (s[0] = 1; s[0] <= 6; s[0]++)
    for (s[1] = 1; s[1] <= 6; s[1]++)
      for (s[2] = 1; s[2] <= 6; s[2]++)
        x[cubes(s)]++;
  for (i = 0; i < 500; i++)
    if (x[i])
      printf("%d\t%d\n", i, x[i]);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x6,-0x10(%rbp)
jg     11c3 <main+0x93>
movl   $0x1,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jg     11b0 <main+0x80>
movl   $0x1,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     119d <main+0x6d>
lea    -0x10(%rbp),%rdi
call   1040 <cubes@plt>
mov    -0x7e0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x7e0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116b <main+0x3b>
jmp    11a2 <main+0x72>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <main+0x2a>
jmp    11b5 <main+0x85>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <main+0x19>
movl   $0x0,-0x7e4(%rbp)
cmpl   $0x1f4,-0x7e4(%rbp)
jge    122b <main+0xfb>
movslq -0x7e4(%rbp),%rax
cmpl   $0x0,-0x7e0(%rbp,%rax,4)
je     1212 <main+0xe2>
mov    -0x7e4(%rbp),%esi
movslq -0x7e4(%rbp),%rax
mov    -0x7e0(%rbp,%rax,4),%edx
lea    0xdf3(%rip),%rdi
call   1030 <printf@plt>
jmp    1217 <main+0xe7>
mov    -0x7e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e4(%rbp)
jmp    11cd <main+0x9d>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x7e8,%rsp
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
movl   $0x1,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
movl   $0x1,0xc(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <cubes@plt>
addl   $0x1,0x10(%rsp,%rax,4)
mov    0xc(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
cmp    $0x6,%eax
jl     1170 <main+0x40>
mov    0x8(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
cmp    $0x6,%eax
jl     1160 <main+0x30>
mov    0x4(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x6,%eax
jl     1150 <main+0x20>
xor    %ebx,%ebx
lea    0xe4a(%rip),%r14
jmp    11cd <main+0x9d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x1f4,%rbx
je     11e1 <main+0xb1>
mov    0x10(%rsp,%rbx,4),%edx
test   %edx,%edx
je     11c0 <main+0x90>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    11c0 <main+0x90>
xor    %edi,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d\09%d\0A\00"
@i = global i32 0
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [500 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast [500 x i32]* %2 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
store i32 1, i32* %5
br label %8
8: ; preds = %0, %22
store i32 1, i32* %6
br label %9
9: ; preds = %8, %18
store i32 1, i32* %7
br label %10
10: ; preds = %9, %10
%11 = call i64 @cubes(i32* %5)
%12 = getelementptr inbounds [500 x i32], [500 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
%17 = icmp slt i32 %15, 6
br i1 %17, label %10, label %18
18: ; preds = %10
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
%21 = icmp slt i32 %19, 6
br i1 %21, label %9, label %22
22: ; preds = %18
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
%25 = icmp slt i32 %23, 6
br i1 %25, label %8, label %26
26: ; preds = %22, %34
%27 = phi i64 [ %35, %34 ], [ 0, %22 ]
%28 = getelementptr inbounds [500 x i32], [500 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %26
%32 = trunc i64 %27 to i32
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %32, i32 %29)
br label %34
34: ; preds = %26, %31
%35 = add nuw nsw i64 %27, 1
%36 = icmp eq i64 %35, 500
br i1 %36, label %37, label %26
37: ; preds = %34
%38 = call i32 @exit(i32 0)
unreachable
}