#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 input_check(const char *label) {
  float input;
  while (1) {
    printf("%s", label);
    if ((scanf("%f", &input)) < 1) {
      printf("Insira apenas numeros");
      __fpurge(stdin);
    } else
      return input;
  }
}


x86 assembly (clang, -O0):
<input_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jge    1188 <input_check+0x58>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1030 <__fpurge@plt>
jmp    1193 <input_check+0x63>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret
jmp    113c <input_check+0xc>

x86 assembly (clang, -O2):
<input_check>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xebb(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
test   %eax,%eax
jg     11be <input_check+0x8e>
lea    0xe9b(%rip),%r14
mov    0x2e76(%rip),%rbp
lea    0xe87(%rip),%r15
lea    0xe83(%rip),%r12
lea    0x4(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%edi
call   1030 <__fpurge@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
test   %eax,%eax
jle    1190 <input_check+0x60>
movss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"Insira apenas numeros\00"
@stdin = global i32 0
define float @input_check(i8* %0) {
%2 = alloca i8*
%3 = alloca float
store i8* %0, i8** %2
br label %4
4: ; preds = %1, %15
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @__fpurge(i32 %11)
br label %15
13: ; preds = %4
%14 = load float, float* %3
ret float %14
15: ; preds = %9
br label %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"Insira apenas numeros\00"
@stdin = global i32 0
define float @input_check(i8* %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %14
7: ; preds = %1, %7
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @stdin
%10 = call i32 @__fpurge(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%13 = icmp slt i32 %12, 1
br i1 %13, label %7, label %14
14: ; preds = %7, %1
%15 = load float, float* %2
ret float %15
}