#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 */
scalar_t__ EOF;
int /*<<< orphan*/ convert(int *, int, int *);
int /*<<< orphan*/ printTable(int *, int *);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, int *);
int main(void) {
  int input, len = 0;
  int *len_ptr = &len;
  int bin[10];
  printf("Please enter a number. Use Ctrl-D to exit.\n");
  while (scanf("%d", &input) != EOF) {
    convert(bin, input, len_ptr);
    printTable(bin, len_ptr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    0x2e67(%rip),%rcx
cmp    (%rcx),%rax
je     11ac <main+0x6c>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <convert@plt>
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <printTable@plt>
jmp    116a <main+0x2a>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
movl   $0x0,0xc(%rsp)
lea    0xea7(%rip),%rdi
call   1040 <puts@plt>
lea    0xe98(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x2e6f(%rip),%r13
cmp    0x0(%r13),%rax
je     11cb <main+0x8b>
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%rbx
lea    0xe70(%rip),%r15
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1030 <convert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <printTable@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
cmp    0x0(%r13),%rax
jne    11a0 <main+0x60>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Please enter a number. Use Ctrl-D to exit.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@EOF = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [10 x i32]
store i32 0, i32* %1
store i32 0, i32* %3
store i32* %3, i32** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %11, %0
%8 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i64, i64* @EOF
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%13 = load i32, i32* %2
%14 = load i32*, i32** %4
%15 = call i32 @convert(i32* %12, i32 %13, i32* %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%17 = load i32*, i32** %4
%18 = call i32 @printTable(i32* %16, i32* %17)
br label %7
19: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@EOF = global i64 0
@str = [43 x i8] c"Please enter a number. Use Ctrl-D to exit.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast [10 x i32]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%8 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i64, i64* @EOF
%10 = icmp eq i64 %8, %9
br i1 %10, label %20, label %11
11: ; preds = %0
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
br label %13
13: ; preds = %11, %13
%14 = load i32, i32* %1
%15 = call i32 @convert(i32* %12, i32 %14, i32* %2)
%16 = call i32 @printTable(i32* %12, i32* %2)
%17 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = load i64, i64* @EOF
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %13
20: ; preds = %13, %0
ret i32 0
}