#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 *);
int /*<<< orphan*/ putchar(char);
int scanf(char *, float *);
float get_flt(void) {
  float input;
  char ch;
  while (scanf("%f", &input) != 1) {
    while ((ch = getchar()) != '\n')
      putchar(ch);
    printf(" is not a number.\nPlease enter a ");
    printf("number, such as 2.5, -1.78E8, or 3: ");
  }
  while (getchar() != '\n')
    continue;
  return input;
}


x86 assembly (clang, -O0):
<get_flt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
je     11a7 <get_flt+0x67>
jmp    1166 <get_flt+0x26>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     118a <get_flt+0x4a>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1166 <get_flt+0x26>
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
jmp    1148 <get_flt+0x8>
jmp    11ac <get_flt+0x6c>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11c4 <get_flt+0x84>
jmp    11ac <get_flt+0x6c>
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_flt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
je     11c0 <get_flt+0x80>
lea    0xe9e(%rip),%r14
lea    0xeb9(%rip),%r15
lea    0xe8d(%rip),%r12
lea    0x4(%rsp),%rbx
jmp    1188 <get_flt+0x48>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1180 <get_flt+0x40>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1188 <get_flt+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11c0 <get_flt+0x80>
movss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [34 x i8] c" is not a number.\0APlease enter a \00"
@.str.2 = [37 x i8] c"number, such as 2.5, -1.78E8, or 3: \00"
define float @get_flt() {
%1 = alloca float
%2 = alloca i8
br label %3
3: ; preds = %14, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %17
6: ; preds = %3
br label %7
7: ; preds = %11, %6
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8, i8* %2
%13 = call i32 @putchar(i8 signext %12)
br label %7
14: ; preds = %7
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %3
17: ; preds = %3
br label %18
18: ; preds = %22, %17
%19 = call signext i8 (...) @getchar()
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 10
br i1 %21, label %22, label %23
22: ; preds = %18
br label %18
23: ; preds = %18
%24 = load float, float* %1
ret float %24
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [34 x i8] c" is not a number.\0APlease enter a \00"
@.str.2 = [37 x i8] c"number, such as 2.5, -1.78E8, or 3: \00"
define float @get_flt() {
%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 = icmp eq i32 %3, 1
br i1 %4, label %18, label %5
5: ; preds = %0, %13
%6 = call signext i8 (...) @getchar()
%7 = icmp eq i8 %6, 10
br i1 %7, label %13, label %8
8: ; preds = %5, %8
%9 = phi i8 [ %11, %8 ], [ %6, %5 ]
%10 = call i32 @putchar(i8 signext %9)
%11 = call signext i8 (...) @getchar()
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %8
13: ; preds = %8, %5
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %5
18: ; preds = %13, %0
br label %19
19: ; preds = %18, %19
%20 = call signext i8 (...) @getchar()
%21 = icmp eq i8 %20, 10
br i1 %21, label %22, label %19
22: ; preds = %19
%23 = load float, float* %1
ret float %23
}