#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 EOF;
scalar_t__ get_num(int *);
int /*<<< orphan*/ itoa(int, char *);
int /*<<< orphan*/ printf(char *, int, char *);
int main(void) {
  int num[2] = {0, ~EOF};
  char s[12];
  while (num[1] != EOF) {
    if (get_num(num)) {
      itoa(num[0], s);
      printf("itoa(%d) = %s\n", num[0], s);
    }
    num[0] = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
je     11a5 <main+0x75>
lea    -0xc(%rbp),%rdi
call   1030 <get_num@plt>
cmp    $0x0,%rax
je     1199 <main+0x69>
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1050 <itoa@plt>
mov    -0xc(%rbp),%esi
lea    -0x18(%rbp),%rdx
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1155 <main+0x25>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x4(%rsp)
mov    0x2e9e(%rip),%r12
mov    (%r12),%eax
not    %eax
mov    %eax,0x8(%rsp)
lea    0x4(%rsp),%r14
lea    0xc(%rsp),%rbx
lea    0xe9b(%rip),%r15
jmp    1182 <main+0x52>
nopw   0x0(%rax,%rax,1)
movl   $0x0,0x4(%rsp)
mov    0x8(%rsp),%eax
cmp    (%r12),%eax
je     11ac <main+0x7c>
mov    %r14,%rdi
call   1030 <get_num@plt>
test   %rax,%rax
je     1170 <main+0x40>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
call   1050 <itoa@plt>
mov    0x4(%rsp),%esi
mov    %r15,%rdi
mov    %rbx,%rdx
call   1040 <printf@plt>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [15 x i8] c"itoa(%d) = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [12 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 0, i32* %4
%5 = getelementptr inbounds i32, i32* %4, i64 1
%6 = load i32, i32* @EOF
%7 = xor i32 %6, -1
store i32 %7, i32* %5
br label %8
8: ; preds = %26, %0
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%10 = load i32, i32* %9
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %8
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%15 = call i64 @get_num(i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%19 = load i32, i32* %18
%20 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%21 = call i32 @itoa(i32 %19, i8* %20)
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%23 = load i32, i32* %22
%24 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %23, i8* %24)
br label %26
26: ; preds = %17, %13
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 0, i32* %27
br label %8
28: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [15 x i8] c"itoa(%d) = %s\0A\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [12 x i8]
%3 = bitcast [2 x i32]* %1 to i8*
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
store i32 0, i32* %4
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%6 = load i32, i32* @EOF
%7 = xor i32 %6, -1
store i32 %7, i32* %5
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
br label %9
9: ; preds = %0, %17
%10 = call i64 @get_num(i32* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = load i32, i32* %4
%14 = call i32 @itoa(i32 %13, i8* %8)
%15 = load i32, i32* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %8)
br label %17
17: ; preds = %12, %9
store i32 0, i32* %4
%18 = load i32, i32* %5
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %9
21: ; preds = %17
ret i32 0
}