#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*/ putchar(char);
void printpile(int num) {
  int c;
  for (c = 0; c < 20 - num; c++)
    putchar(' ');
  for (c = 0; c < num; c++)
    printf("o ");
  for (c = 0; c < 20 - num; c++)
    putchar(' ');
  printf(": %d \t ", num);
  printbinary(num);
  putchar('\n');
}


x86 assembly (clang, -O0):
<printpile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jge    116d <printpile+0x3d>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <printpile+0x12>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119c <printpile+0x6c>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <printpile+0x44>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x14,%ecx
sub    -0x4(%rbp),%ecx
cmp    %ecx,%eax
jge    11ce <printpile+0x9e>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <printpile+0x73>
mov    -0x4(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <printbinary@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printpile>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0x14,%r14d
sub    %edi,%r14d
mov    %edi,%ebx
cmp    $0x13,%edi
jg     1180 <printpile+0x50>
cmp    $0x2,%r14d
mov    $0x1,%ebx
cmovge %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1160 <printpile+0x30>
mov    %ebp,%ebx
test   %ebp,%ebp
jle    1193 <printpile+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    1180 <printpile+0x50>
cmp    $0x13,%ebp
jg     11bf <printpile+0x8f>
cmp    $0x2,%r14d
mov    $0x1,%ebx
cmovge %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <printpile+0x80>
lea    0xe3d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1050 <printbinary@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"o \00"
@.str.1 = [8 x i8] c": %d \09 \00"
define void @printpile(i32 %0) {
%2 = sub i32 20, %0
%3 = icmp slt i32 %0, 20
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = call i32 @llvm.smax.i32(i32 %2, i32 1)
br label %9
6: ; preds = %9
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %14
8: ; preds = %1, %6
br label %17
9: ; preds = %4, %9
%10 = phi i32 [ %12, %9 ], [ 0, %4 ]
%11 = tail call i32 @putchar(i8 signext 32)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %5
br i1 %13, label %6, label %9
14: ; preds = %17, %6
br i1 %3, label %15, label %27
15: ; preds = %14
%16 = call i32 @llvm.smax.i32(i32 %2, i32 1)
br label %22
17: ; preds = %8, %17
%18 = phi i32 [ %20, %17 ], [ 0, %8 ]
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, %0
br i1 %21, label %14, label %17
22: ; preds = %15, %22
%23 = phi i32 [ %25, %22 ], [ 0, %15 ]
%24 = tail call i32 @putchar(i8 signext 32)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, %16
br i1 %26, label %27, label %22
27: ; preds = %22, %14
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%29 = tail call i32 @printbinary(i32 %0)
%30 = tail call i32 @putchar(i8 signext 10)
ret void
}