#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;
int getint(int *);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int n;
  int rc;
  int w1 = 8;
  while ((rc = getint(&n)) != EOF && rc != 0) {
    printf("getint returned: %*i  and retrieved: %i\n", w1, rc, n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <getint@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2e9b(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x11(%rbp)
je     1162 <main+0x42>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1172 <main+0x52>
jmp    118c <main+0x6c>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1040 <getint@plt>
test   %eax,%eax
je     1174 <main+0x54>
mov    0x2eaa(%rip),%r15
cmp    (%r15),%eax
je     1174 <main+0x54>
lea    0xeb6(%rip),%r14
lea    0xc(%rsp),%rbx
nop
mov    0xc(%rsp),%ecx
mov    %r14,%rdi
mov    $0x8,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <getint@plt>
test   %eax,%eax
je     1174 <main+0x54>
cmp    (%r15),%eax
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [41 x i8] c"getint returned: %*i and retrieved: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %4
br label %5
5: ; preds = %14, %0
%6 = call i32 @getint(i32* %2)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br label %12
12: ; preds = %9, %5
%13 = phi i1 [ false, %5 ], [ %11, %9 ]
br i1 %13, label %14, label %19
14: ; preds = %12
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
br label %5
19: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [41 x i8] c"getint returned: %*i and retrieved: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @getint(i32* %1)
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 0
%7 = and i1 %6, %5
br i1 %7, label %8, label %17
8: ; preds = %0, %8
%9 = phi i32 [ %12, %8 ], [ %3, %0 ]
%10 = load i32, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 8, i32 %9, i32 %10)
%12 = call i32 @getint(i32* %1)
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
%15 = icmp ne i32 %12, 0
%16 = and i1 %15, %14
br i1 %16, label %8, label %17
17: ; preds = %8, %0
ret i32 0
}