#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 */
char getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, float *);
float askQuestionFloat(float *value, char *q) {
  printf("%s : ", q);
  scanf("%f", value);
  if (*value == -1) {
    return -1;
  }
  while (getchar() != '\n')
    ;
  return 0;
}


x86 assembly (clang, -O0):
<askQuestionFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  0xe90(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1191 <askQuestionFloat+0x61>
jp     1191 <askQuestionFloat+0x61>
movss  0xe79(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b6 <askQuestionFloat+0x86>
jmp    1196 <askQuestionFloat+0x66>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11ae <askQuestionFloat+0x7e>
jmp    1196 <askQuestionFloat+0x66>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<askQuestionFloat>:
push   %rbx
mov    %rdi,%rbx
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movss  (%rbx),%xmm1
movss  0xea5(%rip),%xmm0
ucomiss %xmm0,%xmm1
jne    1170 <askQuestionFloat+0x40>
jp     1170 <askQuestionFloat+0x40>
pop    %rbx
ret
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1170 <askQuestionFloat+0x40>
xorps  %xmm0,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s : \00"
@.str.1 = [3 x i8] c"%f\00"
define float @askQuestionFloat(float* %0, i8* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca i8*
store float* %0, float** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load float*, float** %4
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%10 = load float*, float** %4
%11 = load float, float* %10
%12 = fcmp oeq float %11, -1.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %2
store float -1.000000e+00, float* %3
br label %21
14: ; preds = %2
br label %15
15: ; preds = %19, %14
%16 = call signext i8 (...) @getchar()
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 10
br i1 %18, label %19, label %20
19: ; preds = %15
br label %15
20: ; preds = %15
store float 0.000000e+00, float* %3
br label %21
21: ; preds = %20, %13
%22 = load float, float* %3
ret float %22
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s : \00"
@.str.1 = [3 x i8] c"%f\00"
define float @askQuestionFloat(float* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %0)
%5 = load float, float* %0
%6 = fcmp oeq float %5, -1.000000e+00
br i1 %6, label %10, label %7
7: ; preds = %2, %7
%8 = tail call signext i8 (...) @getchar()
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %7
10: ; preds = %7, %2
%11 = phi float [ -1.000000e+00, %2 ], [ 0.000000e+00, %7 ]
ret float %11
}