#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 fgetc(unsigned int);
int /*<<< orphan*/ isdigit(char);
float fscan_float(unsigned f) {
  float value, significance, sign;
  char c;
  value = 0;
  significance = 0.1;
  c = fgetc(f);
  if (c == '-') {
    sign = -1;
  } else if (c == '+') {
    sign = 1;
  } else {
    sign = 1;
    value = c - '0';
  }
  while (1) {
    c = fgetc(f);
    if (!isdigit(c))
      break;
    value *= 10;
    value += c - '0';
  }
  if (c == '.') {
    while (1) {
      c = fgetc(f);
      if (!isdigit(c))
        break;
      value += significance * (c - '0');
      significance /= 10.0;
    }
  }
  return sign * value;
}


x86 assembly (clang, -O0):
<fscan_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec5(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x2d,%eax
jne    116a <fscan_float+0x4a>
movss  0xea8(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11ab <fscan_float+0x8b>
movsbl -0x11(%rbp),%eax
cmp    $0x2b,%eax
jne    1189 <fscan_float+0x69>
movss  0xe85(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11a6 <fscan_float+0x86>
movss  0xe73(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movsbl -0x11(%rbp),%eax
sub    $0x30,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ab <fscan_float+0x8b>
jmp    11b0 <fscan_float+0x90>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11d2 <fscan_float+0xb2>
jmp    11fe <fscan_float+0xde>
movss  0xe32(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movsbl -0x11(%rbp),%eax
sub    $0x30,%eax
cvtsi2ss %eax,%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11b0 <fscan_float+0x90>
movsbl -0x11(%rbp),%eax
cmp    $0x2e,%eax
jne    127c <fscan_float+0x15c>
jmp    1210 <fscan_float+0xf0>
mov    -0x4(%rbp),%edi
call   1040 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1232 <fscan_float+0x112>
jmp    1277 <fscan_float+0x157>
movss  -0xc(%rbp),%xmm0
movsbl -0x11(%rbp),%eax
sub    $0x30,%eax
cvtsi2ss %eax,%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdab(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1210 <fscan_float+0xf0>
jmp    127c <fscan_float+0x15c>
movss  -0x10(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fscan_float>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebp
call   1040 <fgetc@plt>
cmp    $0x2d,%al
je     113a <fscan_float+0x1a>
cmp    $0x2b,%al
jne    114d <fscan_float+0x2d>
xorps  %xmm0,%xmm0
jmp    1157 <fscan_float+0x37>
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0xeb5(%rip),%xmm0
jmp    1165 <fscan_float+0x45>
movsbl %al,%eax
add    $0xffffffd0,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0xe9f(%rip),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %ebp,%edi
call   1040 <fgetc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11d4 <fscan_float+0xb4>
movss  0xc(%rsp),%xmm1
cs nopw 0x0(%rax,%rax,1)
mulss  0xe70(%rip),%xmm1
movsbl %bl,%eax
add    $0xffffffd0,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
mov    %ebp,%edi
call   1040 <fgetc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1030 <isdigit@plt>
movss  0xc(%rsp),%xmm1
test   %eax,%eax
jne    1190 <fscan_float+0x70>
cmp    $0x2e,%bl
je     11e3 <fscan_float+0xc3>
jmp    1262 <fscan_float+0x142>
movss  0xc(%rsp),%xmm1
cmp    $0x2e,%bl
jne    1262 <fscan_float+0x142>
movss  %xmm1,0xc(%rsp)
mov    %ebp,%edi
call   1040 <fgetc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     125c <fscan_float+0x13c>
movss  0xe06(%rip),%xmm2
movss  0xc(%rsp),%xmm1
nopl   0x0(%rax)
movsbl %bl,%eax
add    $0xffffffd0,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
divss  0xdd5(%rip),%xmm2
movss  %xmm2,0x14(%rsp)
mov    %ebp,%edi
call   1040 <fgetc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1030 <isdigit@plt>
movss  0x14(%rsp),%xmm2
movss  0xc(%rsp),%xmm1
test   %eax,%eax
jne    1210 <fscan_float+0xf0>
jmp    1262 <fscan_float+0x142>
movss  0xc(%rsp),%xmm1
movss  0x10(%rsp),%xmm0
mulss  %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @fscan_float(i32 %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i8
store i32 %0, i32* %2
store float 0.000000e+00, float* %3
store float 0x3FB99999A0000000, float* %4
%7 = load i32, i32* %2
%8 = call signext i8 @fgetc(i32 %7)
store i8 %8, i8* %6
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 45
br i1 %11, label %12, label %13
12: ; preds = %1
store float -1.000000e+00, float* %5
br label %24
13: ; preds = %1
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 43
br i1 %16, label %17, label %18
17: ; preds = %13
store float 1.000000e+00, float* %5
br label %23
18: ; preds = %13
store float 1.000000e+00, float* %5
%19 = load i8, i8* %6
%20 = sext i8 %19 to i32
%21 = sub nsw i32 %20, 48
%22 = sitofp i32 %21 to float
store float %22, float* %3
br label %23
23: ; preds = %18, %17
br label %24
24: ; preds = %23, %12
br label %25
25: ; preds = %24, %32
%26 = load i32, i32* %2
%27 = call signext i8 @fgetc(i32 %26)
store i8 %27, i8* %6
%28 = load i8, i8* %6
%29 = call i32 @isdigit(i8 signext %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %25
br label %41
32: ; preds = %25
%33 = load float, float* %3
%34 = fmul float %33, 1.000000e+01
store float %34, float* %3
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = sub nsw i32 %36, 48
%38 = sitofp i32 %37 to float
%39 = load float, float* %3
%40 = fadd float %39, %38
store float %40, float* %3
br label %25
41: ; preds = %31
%42 = load i8, i8* %6
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 46
br i1 %44, label %45, label %66
45: ; preds = %41
br label %46
46: ; preds = %45, %53
%47 = load i32, i32* %2
%48 = call signext i8 @fgetc(i32 %47)
store i8 %48, i8* %6
%49 = load i8, i8* %6
%50 = call i32 @isdigit(i8 signext %49)
%51 = icmp ne i32 %50, 0
br i1 %51, label %53, label %52
52: ; preds = %46
br label %65
53: ; preds = %46
%54 = load float, float* %4
%55 = load i8, i8* %6
%56 = sext i8 %55 to i32
%57 = sub nsw i32 %56, 48
%58 = sitofp i32 %57 to float
%59 = load float, float* %3
%60 = call float @llvm.fmuladd.f32(float %54, float %58, float %59)
store float %60, float* %3
%61 = load float, float* %4
%62 = fpext float %61 to double
%63 = fdiv double %62, 1.000000e+01
%64 = fptrunc double %63 to float
store float %64, float* %4
br label %46
65: ; preds = %52
br label %66
66: ; preds = %65, %41
%67 = load float, float* %5
%68 = load float, float* %3
%69 = fmul float %67, %68
ret float %69
}

LLVM IR (-O2):
define float @fscan_float(i32 %0) {
%2 = tail call signext i8 @fgetc(i32 %0)
switch i8 %2, label %4 [
i8 45, label %8
i8 43, label %3
]
3: ; preds = %1
br label %8
4: ; preds = %1
%5 = sext i8 %2 to i32
%6 = add nsw i32 %5, -48
%7 = sitofp i32 %6 to float
br label %8
8: ; preds = %1, %3, %4
%9 = phi float [ 0.000000e+00, %3 ], [ %7, %4 ], [ 0.000000e+00, %1 ]
%10 = phi float [ 1.000000e+00, %3 ], [ 1.000000e+00, %4 ], [ -1.000000e+00, %1 ]
%11 = tail call signext i8 @fgetc(i32 %0)
%12 = tail call i32 @isdigit(i8 signext %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %25, label %14
14: ; preds = %8, %14
%15 = phi i8 [ %22, %14 ], [ %11, %8 ]
%16 = phi float [ %21, %14 ], [ %9, %8 ]
%17 = fmul float %16, 1.000000e+01
%18 = sext i8 %15 to i32
%19 = add nsw i32 %18, -48
%20 = sitofp i32 %19 to float
%21 = fadd float %17, %20
%22 = tail call signext i8 @fgetc(i32 %0)
%23 = tail call i32 @isdigit(i8 signext %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %14
25: ; preds = %14, %8
%26 = phi float [ %9, %8 ], [ %21, %14 ]
%27 = phi i8 [ %11, %8 ], [ %22, %14 ]
%28 = icmp eq i8 %27, 46
br i1 %28, label %29, label %45
29: ; preds = %25
%30 = tail call signext i8 @fgetc(i32 %0)
%31 = tail call i32 @isdigit(i8 signext %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %45, label %33
33: ; preds = %29, %33
%34 = phi i8 [ %42, %33 ], [ %30, %29 ]
%35 = phi float [ %41, %33 ], [ 0x3FB99999A0000000, %29 ]
%36 = phi float [ %40, %33 ], [ %26, %29 ]
%37 = sext i8 %34 to i32
%38 = add nsw i32 %37, -48
%39 = sitofp i32 %38 to float
%40 = tail call float @llvm.fmuladd.f32(float %35, float %39, float %36)
%41 = fdiv float %35, 1.000000e+01
%42 = tail call signext i8 @fgetc(i32 %0)
%43 = tail call i32 @isdigit(i8 signext %42)
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %33
45: ; preds = %33, %29, %25
%46 = phi float [ %26, %25 ], [ %26, %29 ], [ %40, %33 ]
%47 = fmul float %10, %46
ret float %47
}