#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*/ printbinary(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printpile(int);
int printgame(int *p) {
  int nimber, c;
  nimber = 0;
  printf("\n%s%40s%s\t  %s\n", "Pile", "", "Size", "Binary");
  for (c = 0; c < 10; c++) {
    if (!p[c])
      continue;
    printf("%4d", c + 1);
    printpile(p[c]);
    nimber ^= p[c];
  }
  printf("\n%48s%d\t(", "nimber = ", nimber);
  printbinary(nimber);
  printf(" )\n");
  return nimber;
}


x86 assembly (clang, -O0):
<printgame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb6(%rip),%rdi
lea    0xebf(%rip),%rsi
lea    0xee4(%rip),%rdx
lea    0xeb6(%rip),%rcx
lea    0xeb4(%rip),%r8
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11d8 <printgame+0xa8>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1195 <printgame+0x65>
jmp    11ca <printgame+0x9a>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <printpile@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1174 <printgame+0x44>
mov    -0xc(%rbp),%edx
lea    0xe43(%rip),%rdi
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1050 <printbinary@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printgame>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb3(%rip),%rdi
lea    0xebc(%rip),%rsi
lea    0xeb4(%rip),%rdx
lea    0xeb3(%rip),%rcx
lea    0xeb1(%rip),%r8
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,(%rbx)
je     1193 <printgame+0x53>
lea    0xea3(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%edi
call   1050 <printpile@plt>
mov    (%rbx),%ebp
cmpl   $0x0,0x4(%rbx)
je     11b7 <printgame+0x77>
lea    0xe81(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rbx),%edi
call   1050 <printpile@plt>
xor    0x4(%rbx),%ebp
cmpl   $0x0,0x8(%rbx)
je     11db <printgame+0x9b>
lea    0xe5d(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%edi
call   1050 <printpile@plt>
xor    0x8(%rbx),%ebp
cmpl   $0x0,0xc(%rbx)
je     11ff <printgame+0xbf>
lea    0xe39(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx),%edi
call   1050 <printpile@plt>
xor    0xc(%rbx),%ebp
cmpl   $0x0,0x10(%rbx)
je     1223 <printgame+0xe3>
lea    0xe15(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%edi
call   1050 <printpile@plt>
xor    0x10(%rbx),%ebp
cmpl   $0x0,0x14(%rbx)
je     1247 <printgame+0x107>
lea    0xdf1(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rbx),%edi
call   1050 <printpile@plt>
xor    0x14(%rbx),%ebp
cmpl   $0x0,0x18(%rbx)
je     126b <printgame+0x12b>
lea    0xdcd(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rbx),%edi
call   1050 <printpile@plt>
xor    0x18(%rbx),%ebp
cmpl   $0x0,0x1c(%rbx)
je     128f <printgame+0x14f>
lea    0xda9(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rbx),%edi
call   1050 <printpile@plt>
xor    0x1c(%rbx),%ebp
cmpl   $0x0,0x20(%rbx)
je     12b3 <printgame+0x173>
lea    0xd85(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rbx),%edi
call   1050 <printpile@plt>
xor    0x20(%rbx),%ebp
cmpl   $0x0,0x24(%rbx)
je     12d7 <printgame+0x197>
lea    0xd61(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rbx),%edi
call   1050 <printpile@plt>
xor    0x24(%rbx),%ebp
lea    0xd47(%rip),%rdi
lea    0xd4a(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1060 <printbinary@plt>
lea    0xd3d(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0A%s%40s%s\09 %s\0A\00"
@.str.1 = [5 x i8] c"Pile\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c"Size\00"
@.str.4 = [7 x i8] c"Binary\00"
@.str.5 = [4 x i8] c"%4d\00"
@.str.6 = [10 x i8] c"\0A%48s%d\09(\00"
@.str.7 = [10 x i8] c"nimber = \00"
@.str.8 = [4 x i8] c" )\0A\00"
define i32 @printgame(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %4
br label %6
6: ; preds = %34, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %37
9: ; preds = %6
%10 = load i32*, i32** %2
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %9
br label %34
17: ; preds = %9
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %2
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = call i32 @printpile(i32 %25)
%27 = load i32*, i32** %2
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %3
%33 = xor i32 %32, %31
store i32 %33, i32* %3
br label %34
34: ; preds = %17, %16
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %6
37: ; preds = %6
%38 = load i32, i32* %3
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %3
%41 = call i32 @printbinary(i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0A%s%40s%s\09 %s\0A\00"
@.str.1 = [5 x i8] c"Pile\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c"Size\00"
@.str.4 = [7 x i8] c"Binary\00"
@.str.5 = [4 x i8] c"%4d\00"
@.str.6 = [10 x i8] c"\0A%48s%d\09(\00"
@.str.7 = [10 x i8] c"nimber = \00"
@str = [3 x i8] c" )\00"
define i32 @printgame(i32* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 1)
%7 = load i32, i32* %0
%8 = tail call i32 @printpile(i32 %7)
%9 = load i32, i32* %0
br label %10
10: ; preds = %1, %5
%11 = phi i32 [ %9, %5 ], [ 0, %1 ]
%12 = getelementptr inbounds i32, i32* %0, i64 1
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 2)
%17 = load i32, i32* %12
%18 = tail call i32 @printpile(i32 %17)
%19 = load i32, i32* %12
%20 = xor i32 %19, %11
br label %21
21: ; preds = %15, %10
%22 = phi i32 [ %20, %15 ], [ %11, %10 ]
%23 = getelementptr inbounds i32, i32* %0, i64 2
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %21
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%28 = load i32, i32* %23
%29 = tail call i32 @printpile(i32 %28)
%30 = load i32, i32* %23
%31 = xor i32 %30, %22
br label %32
32: ; preds = %26, %21
%33 = phi i32 [ %31, %26 ], [ %22, %21 ]
%34 = getelementptr inbounds i32, i32* %0, i64 3
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, 0
br i1 %36, label %43, label %37
37: ; preds = %32
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 4)
%39 = load i32, i32* %34
%40 = tail call i32 @printpile(i32 %39)
%41 = load i32, i32* %34
%42 = xor i32 %41, %33
br label %43
43: ; preds = %37, %32
%44 = phi i32 [ %42, %37 ], [ %33, %32 ]
%45 = getelementptr inbounds i32, i32* %0, i64 4
%46 = load i32, i32* %45
%47 = icmp eq i32 %46, 0
br i1 %47, label %54, label %48
48: ; preds = %43
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 5)
%50 = load i32, i32* %45
%51 = tail call i32 @printpile(i32 %50)
%52 = load i32, i32* %45
%53 = xor i32 %52, %44
br label %54
54: ; preds = %48, %43
%55 = phi i32 [ %53, %48 ], [ %44, %43 ]
%56 = getelementptr inbounds i32, i32* %0, i64 5
%57 = load i32, i32* %56
%58 = icmp eq i32 %57, 0
br i1 %58, label %65, label %59
59: ; preds = %54
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 6)
%61 = load i32, i32* %56
%62 = tail call i32 @printpile(i32 %61)
%63 = load i32, i32* %56
%64 = xor i32 %63, %55
br label %65
65: ; preds = %59, %54
%66 = phi i32 [ %64, %59 ], [ %55, %54 ]
%67 = getelementptr inbounds i32, i32* %0, i64 6
%68 = load i32, i32* %67
%69 = icmp eq i32 %68, 0
br i1 %69, label %76, label %70
70: ; preds = %65
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 7)
%72 = load i32, i32* %67
%73 = tail call i32 @printpile(i32 %72)
%74 = load i32, i32* %67
%75 = xor i32 %74, %66
br label %76
76: ; preds = %70, %65
%77 = phi i32 [ %75, %70 ], [ %66, %65 ]
%78 = getelementptr inbounds i32, i32* %0, i64 7
%79 = load i32, i32* %78
%80 = icmp eq i32 %79, 0
br i1 %80, label %87, label %81
81: ; preds = %76
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 8)
%83 = load i32, i32* %78
%84 = tail call i32 @printpile(i32 %83)
%85 = load i32, i32* %78
%86 = xor i32 %85, %77
br label %87
87: ; preds = %81, %76
%88 = phi i32 [ %86, %81 ], [ %77, %76 ]
%89 = getelementptr inbounds i32, i32* %0, i64 8
%90 = load i32, i32* %89
%91 = icmp eq i32 %90, 0
br i1 %91, label %98, label %92
92: ; preds = %87
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 9)
%94 = load i32, i32* %89
%95 = tail call i32 @printpile(i32 %94)
%96 = load i32, i32* %89
%97 = xor i32 %96, %88
br label %98
98: ; preds = %92, %87
%99 = phi i32 [ %97, %92 ], [ %88, %87 ]
%100 = getelementptr inbounds i32, i32* %0, i64 9
%101 = load i32, i32* %100
%102 = icmp eq i32 %101, 0
br i1 %102, label %109, label %103
103: ; preds = %98
%104 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 10)
%105 = load i32, i32* %100
%106 = tail call i32 @printpile(i32 %105)
%107 = load i32, i32* %100
%108 = xor i32 %107, %99
br label %109
109: ; preds = %103, %98
%110 = phi i32 [ %108, %103 ], [ %99, %98 ]
%111 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %110)
%112 = tail call i32 @printbinary(i32 %110)
%113 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 %110
}