#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 */
double EOF;
double mygetfloat(double *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  double flt = 0.0;
  double res = 0.0;
  res = mygetfloat(&flt);
  if (res == EOF || res > 0) {
    printf("Float value is: %f\n", flt);
  } else {
    printf("Invalid float\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <mygetfloat@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    0x2e88(%rip),%rax
ucomisd (%rax),%xmm0
jne    1175 <main+0x55>
jp     1175 <main+0x55>
jmp    1187 <main+0x67>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    119f <main+0x7f>
movsd  -0x18(%rbp),%xmm0
lea    0xe6d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11ad <main+0x8d>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1050 <mygetfloat@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1168 <main+0x38>
mov    0x2e96(%rip),%rax
ucomisd (%rax),%xmm0
jne    115a <main+0x2a>
jnp    1168 <main+0x38>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
jmp    117b <main+0x4b>
movsd  (%rsp),%xmm0
lea    0xe8c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EOF = global double 0.000000e+00
@.str = [20 x i8] c"Float value is: %f\0A\00"
@.str.1 = [15 x i8] c"Invalid float\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
%8 = call double @mygetfloat(double* %6)
store double %8, double* %7
%9 = load double, double* %7
%10 = load double, double* @EOF
%11 = fcmp oeq double %9, %10
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load double, double* %7
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %12, %2
%16 = load double, double* %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %16)
br label %20
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@EOF = global double 0.000000e+00
@.str = [20 x i8] c"Float value is: %f\0A\00"
@str = [14 x i8] c"Invalid float\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%5 = call double @mygetfloat(double* %3)
%6 = load double, double* @EOF
%7 = fcmp oeq double %5, %6
%8 = fcmp ogt double %5, 0.000000e+00
%9 = or i1 %8, %7
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load double, double* %3
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %11)
br label %15
13: ; preds = %2
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
ret i32 0
}