#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 /*<<< orphan*/ __fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int scanf(char *, float *);
int /*<<< orphan*/ stdin;
float __readFloatToPointer() {
  float value;
  bool ret;
  do {
    ret = scanf("%f", &value);
    __fpurge(stdin);
    if (ret != true) {
      printf("ERRO: Value entered is NaN.\nTry again.\n");
    }
  } while (ret != true);
  return value;
}


x86 assembly (clang, -O0):
<__readFloatToPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
call   1030 <__fpurge@plt>
cmpl   $0x1,-0x8(%rbp)
je     116f <__readFloatToPointer+0x3f>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
jmp    1174 <__readFloatToPointer+0x44>
cmpl   $0x1,-0x8(%rbp)
jne    1138 <__readFloatToPointer+0x8>
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__readFloatToPointer>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    %eax,%ebx
mov    0x2e92(%rip),%r12
mov    (%r12),%edi
call   1040 <__fpurge@plt>
cmp    $0x1,%ebx
je     11a3 <__readFloatToPointer+0x73>
lea    0xe98(%rip),%r14
lea    0xe8e(%rip),%r15
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %eax,%ebp
mov    (%r12),%edi
call   1040 <__fpurge@plt>
cmp    $0x1,%ebp
jne    1180 <__readFloatToPointer+0x50>
movss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@stdin = global i32 0
@.str.1 = [40 x i8] c"ERRO: Value entered is NaN.\0ATry again.\0A\00"
define float @__readFloatToPointer() {
%1 = alloca float
%2 = alloca i32
br label %3
3: ; preds = %12, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
store i32 %4, i32* %2
%5 = load i32, i32* @stdin
%6 = call i32 @__fpurge(i32 %5)
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %3
br label %12
12: ; preds = %11
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 1
br i1 %14, label %3, label %15
15: ; preds = %12
%16 = load float, float* %1
ret float %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@stdin = global i32 0
@str = [39 x i8] c"ERRO: Value entered is NaN.\0ATry again.\00"
define float @__readFloatToPointer() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load i32, i32* @stdin
%5 = call i32 @__fpurge(i32 %4)
%6 = icmp eq i32 %3, 1
br i1 %6, label %13, label %7
7: ; preds = %0, %7
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%10 = load i32, i32* @stdin
%11 = call i32 @__fpurge(i32 %10)
%12 = icmp eq i32 %9, 1
br i1 %12, label %13, label %7
13: ; preds = %7, %0
%14 = load float, float* %1
ret float %14
}