#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long double __scan_float_int(int /*<<< orphan*/ *, int);
long double __scan_float_uint(int /*<<< orphan*/ *, int);
long double ceill(int /*<<< orphan*/);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ log10l(long double);
long double powl(int, long double);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
long double __scan_float(FILE *stream, int flags) {
  long double i_part;
  long double f_part;
  long double e_part;
  char c;
  i_part = __scan_float_int(stream, flags);
  c = getc(stream);
  if (c == '.') {
    f_part = __scan_float_uint(stream, flags);
  } else {
    ungetc(c, stream);
    f_part = 0.0;
  }
  c = getc(stream);
  if (c == 'e' || c == 'E') {
    e_part = __scan_float_int(stream, flags);
  } else {
    ungetc(c, stream);
    e_part = 0.0;
  }
  return (i_part + f_part / powl(10, ceill(log10l(f_part)))) * powl(10, e_part);
}


x86 assembly (clang, -O0):
<__scan_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <__scan_float_int@plt>
fstpt  -0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
mov    %al,-0x41(%rbp)
movsbl -0x41(%rbp),%eax
cmp    $0x2e,%eax
jne    11be <__scan_float+0x4e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <__scan_float_uint@plt>
fstpt  -0x30(%rbp)
jmp    11d0 <__scan_float+0x60>
movsbl -0x41(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1060 <ungetc@plt>
fldz
fstpt  -0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
mov    %al,-0x41(%rbp)
movsbl -0x41(%rbp),%eax
cmp    $0x65,%eax
je     11f6 <__scan_float+0x86>
movsbl -0x41(%rbp),%eax
cmp    $0x45,%eax
jne    120a <__scan_float+0x9a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <__scan_float_int@plt>
fstpt  -0x40(%rbp)
jmp    121c <__scan_float+0xac>
movsbl -0x41(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1060 <ungetc@plt>
fldz
fstpt  -0x40(%rbp)
fldt   -0x20(%rbp)
fstpt  -0x58(%rbp)
fldt   -0x30(%rbp)
fld    %st(0)
fstpt  -0x68(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1080 <log10l@plt>
mov    %eax,%edi
call   1070 <ceill@plt>
mov    %rsp,%rax
fstpt  (%rax)
mov    $0xa,%edi
mov    %edi,-0x5c(%rbp)
call   1040 <powl@plt>
fldt   -0x68(%rbp)
mov    -0x5c(%rbp),%edi
fldt   -0x58(%rbp)
fxch   %st(1)
fdivp  %st,%st(2)
faddp  %st,%st(1)
fstpt  -0x4c(%rbp)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <powl@plt>
fldt   -0x4c(%rbp)
fmulp  %st,%st(1)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__scan_float>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <__scan_float_int@plt>
fstpt  0x2c(%rsp)
mov    %rbx,%rdi
call   1090 <getc@plt>
cmp    $0x2e,%al
jne    119c <__scan_float+0x2c>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <__scan_float_uint@plt>
jmp    11a9 <__scan_float+0x39>
movsbl %al,%edi
mov    %rbx,%rsi
call   1060 <ungetc@plt>
fldz
fstpt  0x14(%rsp)
mov    %rbx,%rdi
call   1090 <getc@plt>
mov    %eax,%ecx
and    $0xdf,%cl
cmp    $0x45,%cl
jne    11cb <__scan_float+0x5b>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <__scan_float_int@plt>
jmp    11d8 <__scan_float+0x68>
movsbl %al,%edi
mov    %rbx,%rsi
call   1060 <ungetc@plt>
fldz
fstpt  0x20(%rsp)
fldt   0x14(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fstpt  (%rsp)
call   1080 <log10l@plt>
mov    %eax,%edi
call   1070 <ceill@plt>
fstpt  (%rsp)
mov    $0xa,%edi
call   1040 <powl@plt>
fldt   0x14(%rsp)
fdivp  %st,%st(1)
fldt   0x2c(%rsp)
faddp  %st,%st(1)
fstpt  0x14(%rsp)
fldt   0x20(%rsp)
fstpt  (%rsp)
mov    $0xa,%edi
call   1040 <powl@plt>
fldt   0x14(%rsp)
fmulp  %st,%st(1)
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define x86_fp80 @__scan_float(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca i8
store i32* %0, i32** %3
store i32 %1, i32* %4
%9 = load i32*, i32** %3
%10 = load i32, i32* %4
%11 = call x86_fp80 @__scan_float_int(i32* %9, i32 %10)
store x86_fp80 %11, x86_fp80* %5
%12 = load i32*, i32** %3
%13 = call signext i8 @getc(i32* %12)
store i8 %13, i8* %8
%14 = load i8, i8* %8
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 46
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i32*, i32** %3
%19 = load i32, i32* %4
%20 = call x86_fp80 @__scan_float_uint(i32* %18, i32 %19)
store x86_fp80 %20, x86_fp80* %6
br label %25
21: ; preds = %2
%22 = load i8, i8* %8
%23 = load i32*, i32** %3
%24 = call i32 @ungetc(i8 signext %22, i32* %23)
store x86_fp80 0xK00000000000000000000, x86_fp80* %6
br label %25
25: ; preds = %21, %17
%26 = load i32*, i32** %3
%27 = call signext i8 @getc(i32* %26)
store i8 %27, i8* %8
%28 = load i8, i8* %8
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 101
br i1 %30, label %35, label %31
31: ; preds = %25
%32 = load i8, i8* %8
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 69
br i1 %34, label %35, label %39
35: ; preds = %31, %25
%36 = load i32*, i32** %3
%37 = load i32, i32* %4
%38 = call x86_fp80 @__scan_float_int(i32* %36, i32 %37)
store x86_fp80 %38, x86_fp80* %7
br label %43
39: ; preds = %31
%40 = load i8, i8* %8
%41 = load i32*, i32** %3
%42 = call i32 @ungetc(i8 signext %40, i32* %41)
store x86_fp80 0xK00000000000000000000, x86_fp80* %7
br label %43
43: ; preds = %39, %35
%44 = load x86_fp80, x86_fp80* %5
%45 = load x86_fp80, x86_fp80* %6
%46 = load x86_fp80, x86_fp80* %6
%47 = call i32 @log10l(x86_fp80 %46)
%48 = call x86_fp80 @ceill(i32 %47)
%49 = call x86_fp80 @powl(i32 10, x86_fp80 %48)
%50 = fdiv x86_fp80 %45, %49
%51 = fadd x86_fp80 %44, %50
%52 = load x86_fp80, x86_fp80* %7
%53 = call x86_fp80 @powl(i32 10, x86_fp80 %52)
%54 = fmul x86_fp80 %51, %53
ret x86_fp80 %54
}

LLVM IR (-O2):
define x86_fp80 @__scan_float(i32* %0, i32 %1) {
%3 = tail call x86_fp80 @__scan_float_int(i32* %0, i32 %1)
%4 = tail call signext i8 @getc(i32* %0)
%5 = icmp eq i8 %4, 46
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call x86_fp80 @__scan_float_uint(i32* %0, i32 %1)
br label %10
8: ; preds = %2
%9 = tail call i32 @ungetc(i8 signext %4, i32* %0)
br label %10
10: ; preds = %8, %6
%11 = phi x86_fp80 [ %7, %6 ], [ 0xK00000000000000000000, %8 ]
%12 = tail call signext i8 @getc(i32* %0)
%13 = and i8 %12, -33
%14 = icmp eq i8 %13, 69
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = tail call x86_fp80 @__scan_float_int(i32* %0, i32 %1)
br label %19
17: ; preds = %10
%18 = tail call i32 @ungetc(i8 signext %12, i32* %0)
br label %19
19: ; preds = %17, %15
%20 = phi x86_fp80 [ %16, %15 ], [ 0xK00000000000000000000, %17 ]
%21 = tail call i32 @log10l(x86_fp80 %11)
%22 = tail call x86_fp80 @ceill(i32 %21)
%23 = tail call x86_fp80 @powl(i32 10, x86_fp80 %22)
%24 = fdiv x86_fp80 %11, %23
%25 = fadd x86_fp80 %3, %24
%26 = tail call x86_fp80 @powl(i32 10, x86_fp80 %20)
%27 = fmul x86_fp80 %26, %25
ret x86_fp80 %27
}