#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*/ printf(char *, char *);
int scanf(char *, ...);
float inputControllatoFloat(void) {
  int esitoScanf;
  float numeroVirgolaMobile;
  do {
    esitoScanf = scanf("%f", &numeroVirgolaMobile);
    if (esitoScanf == 0) {
      printf("%s", "Attenzione non e' stato inserito un input valido, "
                   "reinserire il valore!\n");
      scanf("%*[^\n]");
    }
  } while (esitoScanf != 1);
  return numeroVirgolaMobile;
}


x86 assembly (clang, -O0):
<inputControllatoFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1168 <inputControllatoFloat+0x48>
lea    0xeb5(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    116d <inputControllatoFloat+0x4d>
cmpl   $0x1,-0x4(%rbp)
jne    1128 <inputControllatoFloat+0x8>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputControllatoFloat>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%r14
lea    0xc(%rsp),%rbx
lea    0xec3(%rip),%r15
lea    0xebf(%rip),%r12
lea    0xf01(%rip),%r13
jmp    1165 <inputControllatoFloat+0x45>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
test   %eax,%eax
je     1150 <inputControllatoFloat+0x30>
cmp    $0x1,%eax
jne    1165 <inputControllatoFloat+0x45>
movss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [73 x i8] c"Attenzione non e' stato inserito un input valido, reinserire il valore!\0A\00"
@.str.3 = [7 x i8] c"%*[^\0A]\00"
define float @inputControllatoFloat() {
%1 = alloca i32
%2 = alloca float
br label %3
3: ; preds = %11, %0
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %10
10: ; preds = %7, %3
br label %11
11: ; preds = %10
%12 = load i32, i32* %1
%13 = icmp ne i32 %12, 1
br i1 %13, label %3, label %14
14: ; preds = %11
%15 = load float, float* %2
ret float %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [73 x i8] c"Attenzione non e' stato inserito un input valido, reinserire il valore!\0A\00"
@.str.3 = [7 x i8] c"%*[^\0A]\00"
define float @inputControllatoFloat() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
br label %3
3: ; preds = %5, %0
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
switch i32 %4, label %5 [
i32 0, label %6
i32 1, label %9
]
5: ; preds = %3, %6
br label %3
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %5
9: ; preds = %3
%10 = load float, float* %1
ret float %10
}