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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <getfloat@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1161 <main+0x41>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11bb <main+0x9b>
mov    -0x8(%rbp),%eax
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%eax
jne    1186 <main+0x66>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b6 <main+0x96>
cmpl   $0x0,-0x8(%rbp)
jne    11a3 <main+0x83>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <main+0x91>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b6 <main+0x96>
jmp    11bb <main+0x9b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <getfloat@plt>
test   %eax,%eax
jle    1159 <main+0x29>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1186 <main+0x56>
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%eax
jne    116d <main+0x3d>
lea    0xee8(%rip),%rdi
jmp    1181 <main+0x51>
test   %eax,%eax
je     117a <main+0x4a>
lea    0xea2(%rip),%rdi
jmp    1181 <main+0x51>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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