#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 main(void) {
  int x, res;
  res = getint(&x);
  if (res > 0)
    printf("getint() got int: %d\n", x);
  else if (res == EOF)
    printf("getint() got EOF\n");
  else if (res == 0)
    printf("getint() got no number\n");
  else
    printf("something`s wrong in getint()\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <getint@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    115b <main+0x3b>
mov    -0x8(%rbp),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0x95>
mov    -0xc(%rbp),%eax
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%eax
jne    1180 <main+0x60>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
cmpl   $0x0,-0xc(%rbp)
jne    119d <main+0x7d>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <main+0x8b>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
jmp    11b5 <main+0x95>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <getint@plt>
test   %eax,%eax
jle    1153 <main+0x23>
mov    0x4(%rsp),%esi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <main+0x50>
mov    0x2e8e(%rip),%rcx
cmp    (%rcx),%eax
jne    1167 <main+0x37>
lea    0xee6(%rip),%rdi
jmp    117b <main+0x4b>
test   %eax,%eax
je     1174 <main+0x44>
lea    0xea4(%rip),%rdi
jmp    117b <main+0x4b>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"getint() got int: %d\0A\00"
@EOF = global i32 0
@.str.1 = [18 x i8] c"getint() got EOF\0A\00"
@.str.2 = [24 x i8] c"getint() got no number\0A\00"
@.str.3 = [31 x i8] c"something`s wrong in getint()\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @getint(i32* %2)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %25
10: ; preds = %0
%11 = load i32, i32* %3
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %24
16: ; preds = %10
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %16
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
br label %24
24: ; preds = %23, %14
br label %25
25: ; preds = %24, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"getint() got int: %d\0A\00"
@EOF = global i32 0
@str = [30 x i8] c"something`s wrong in getint()\00"
@str.4 = [23 x i8] c"getint() got no number\00"
@str.5 = [17 x i8] c"getint() got EOF\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @getint(i32* %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %19
8: ; preds = %0
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %3, %9
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0))
br label %19
13: ; preds = %8
%14 = icmp eq i32 %3, 0
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.4, i64 0, i64 0))
br label %19
17: ; preds = %13
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %11, %17, %15, %5
ret i32 0
}