#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 */
scalar_t__ errno;
scalar_t__ is_float_p(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rstdin_s(char *, int);
float strtod(char *, int /*<<< orphan*/ *);
float rstdin_f(void) {
  char d[256];
  float ret;
  rstdin_s(d, sizeof d);
  if (is_float_p(d)) {
    ret = strtod(d, NULL);
    if (errno) {
      printf("error encontrado intente de nuevo.\n");
      return rstdin_f();
    }
    return ret;
  } else {
    printf("%s no es un numero, intente de nuevo: ", d);
    return rstdin_f();
  }
}


x86 assembly (clang, -O0):
<rstdin_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1030 <rstdin_s@plt>
lea    -0x110(%rbp),%rdi
call   1050 <is_float_p@plt>
cmp    $0x0,%rax
je     11da <rstdin_f+0x8a>
lea    -0x110(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <strtod@plt>
movss  %xmm0,-0x114(%rbp)
ff
mov    0x2e3f(%rip),%rax
cmpq   $0x0,(%rax)
je     11c8 <rstdin_f+0x78>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
call   1070 <rstdin_f@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11f9 <rstdin_f+0xa9>
movss  -0x114(%rbp),%xmm0
ff
movss  %xmm0,-0x4(%rbp)
jmp    11f9 <rstdin_f+0xa9>
lea    -0x110(%rbp),%rsi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
call   1070 <rstdin_f@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rstdin_f>:
push   %rbx
sub    $0x100,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <rstdin_s@plt>
mov    %rbx,%rdi
call   1060 <is_float_p@plt>
test   %rax,%rax
je     11aa <rstdin_f+0x4a>
mov    %rsp,%rdi
xor    %esi,%esi
call   1050 <strtod@plt>
mov    0x2e4a(%rip),%rax
cmpq   $0x0,(%rax)
je     11c0 <rstdin_f+0x60>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
jmp    11bb <rstdin_f+0x5b>
lea    0xe4f(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
call   1080 <rstdin_f@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i64 0
@.str = [36 x i8] c"error encontrado intente de nuevo.\0A\00"
@.str.1 = [39 x i8] c"%s no es un numero, intente de nuevo: \00"
define float @rstdin_f() {
%1 = alloca float
%2 = alloca [256 x i8]
%3 = alloca float
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i32 @rstdin_s(i8* %4, i32 256)
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = call i64 @is_float_p(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%11 = call float @strtod(i8* %10, i32* null)
store float %11, float* %3
%12 = load i64, i64* @errno
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%16 = call float @rstdin_f()
store float %16, float* %1
br label %23
17: ; preds = %9
%18 = load float, float* %3
store float %18, float* %1
br label %23
19: ; preds = %0
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = call float @rstdin_f()
store float %22, float* %1
br label %23
23: ; preds = %19, %17, %14
%24 = load float, float* %1
ret float %24
}

LLVM IR (-O2):
@errno = global i64 0
@.str.1 = [39 x i8] c"%s no es un numero, intente de nuevo: \00"
@str = [35 x i8] c"error encontrado intente de nuevo.\00"
define float @rstdin_f() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @rstdin_s(i8* %2, i32 256)
%4 = call i64 @is_float_p(i8* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %0
%7 = call float @strtod(i8* nocapture %2, i32* null)
%8 = load i64, i64* @errno
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %6
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %14
14: ; preds = %10, %12
%15 = call float @rstdin_f()
br label %16
16: ; preds = %14, %6
%17 = phi float [ %7, %6 ], [ %15, %14 ]
ret float %17
}