#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 */
long double __scan_float_int(char const **, int);
long double __scan_float_uint(char const **, int);
long double ceill(int /*<<< orphan*/);
int /*<<< orphan*/ log10l(long double);
long double powl(int, long double);
long double __scan_float(const char **_str, int flags) {
  long double i_part;
  long double f_part;
  long double e_part;
  long double f_exp;
  i_part = __scan_float_int(_str, flags);
  if (**_str == '.') {
    (*_str)++;
    f_part = __scan_float_uint(_str, flags);
  } else {
    f_part = 0.0;
  }
  if (**_str == 'e' || **_str == 'E') {
    (*_str)++;
    e_part = __scan_float_int(_str, flags);
  } else {
    e_part = 0.0;
  }
  f_exp = ceill(log10l(f_part));
  if (f_exp < 1)
    f_exp = 1.0;
  return (i_part + f_part / powl(10, f_exp)) * powl(10, e_part);
}


x86 assembly (clang, -O0):
<__scan_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11a6 <__scan_float+0x56>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <__scan_float_uint@plt>
fstpt  -0x30(%rbp)
jmp    11ab <__scan_float+0x5b>
fldz
fstpt  -0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x65,%eax
je     11d1 <__scan_float+0x81>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x45,%eax
jne    11f3 <__scan_float+0xa3>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <__scan_float_int@plt>
fstpt  -0x40(%rbp)
jmp    11f8 <__scan_float+0xa8>
fldz
fstpt  -0x40(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1070 <log10l@plt>
mov    %eax,%edi
call   1060 <ceill@plt>
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
fld1
fucomip %st(1),%st
fstp   %st(0)
jbe    1228 <__scan_float+0xd8>
jmp    1223 <__scan_float+0xd3>
fld1
fstpt  -0x50(%rbp)
fldt   -0x20(%rbp)
fstpt  -0x68(%rbp)
fldt   -0x30(%rbp)
fstpt  -0x78(%rbp)
fldt   -0x50(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
mov    $0xa,%edi
mov    %edi,-0x6c(%rbp)
call   1040 <powl@plt>
fldt   -0x78(%rbp)
mov    -0x6c(%rbp),%edi
fldt   -0x68(%rbp)
fxch   %st(1)
fdivp  %st,%st(2)
faddp  %st,%st(1)
fstpt  -0x5c(%rbp)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <powl@plt>
fldt   -0x5c(%rbp)
fmulp  %st,%st(1)
add    $0x90,%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),%rax
mov    (%rax),%cl
fldz
cmp    $0x2e,%cl
jne    1194 <__scan_float+0x44>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
mov    %ebp,%esi
fstpt  0x20(%rsp)
call   1050 <__scan_float_uint@plt>
fstpt  0x14(%rsp)
fldt   0x20(%rsp)
mov    (%rbx),%rax
mov    (%rax),%cl
jmp    119a <__scan_float+0x4a>
fld    %st(0)
fstpt  0x14(%rsp)
or     $0x20,%cl
cmp    $0x65,%cl
jne    11b5 <__scan_float+0x65>
fstp   %st(0)
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <__scan_float_int@plt>
fstpt  0x20(%rsp)
fldt   0x14(%rsp)
fld    %st(0)
fstpt  0x14(%rsp)
fstpt  (%rsp)
call   1070 <log10l@plt>
mov    %eax,%edi
call   1060 <ceill@plt>
fld1
fucomi %st(1),%st
fxch   %st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
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(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca x86_fp80
store i8** %0, i8*** %3
store i32 %1, i32* %4
%9 = load i8**, i8*** %3
%10 = load i32, i32* %4
%11 = call x86_fp80 @__scan_float_int(i8** %9, i32 %10)
store x86_fp80 %11, x86_fp80* %5
%12 = load i8**, i8*** %3
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 46
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i8**, i8*** %3
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %18
%21 = load i8**, i8*** %3
%22 = load i32, i32* %4
%23 = call x86_fp80 @__scan_float_uint(i8** %21, i32 %22)
store x86_fp80 %23, x86_fp80* %6
br label %25
24: ; preds = %2
store x86_fp80 0xK00000000000000000000, x86_fp80* %6
br label %25
25: ; preds = %24, %17
%26 = load i8**, i8*** %3
%27 = load i8*, i8** %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 101
br i1 %30, label %37, label %31
31: ; preds = %25
%32 = load i8**, i8*** %3
%33 = load i8*, i8** %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 69
br i1 %36, label %37, label %44
37: ; preds = %31, %25
%38 = load i8**, i8*** %3
%39 = load i8*, i8** %38
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %38
%41 = load i8**, i8*** %3
%42 = load i32, i32* %4
%43 = call x86_fp80 @__scan_float_int(i8** %41, i32 %42)
store x86_fp80 %43, x86_fp80* %7
br label %45
44: ; preds = %31
store x86_fp80 0xK00000000000000000000, x86_fp80* %7
br label %45
45: ; preds = %44, %37
%46 = load x86_fp80, x86_fp80* %6
%47 = call i32 @log10l(x86_fp80 %46)
%48 = call x86_fp80 @ceill(i32 %47)
store x86_fp80 %48, x86_fp80* %8
%49 = load x86_fp80, x86_fp80* %8
%50 = fcmp olt x86_fp80 %49, 0xK3FFF8000000000000000
br i1 %50, label %51, label %52
51: ; preds = %45
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %8
br label %52
52: ; preds = %51, %45
%53 = load x86_fp80, x86_fp80* %5
%54 = load x86_fp80, x86_fp80* %6
%55 = load x86_fp80, x86_fp80* %8
%56 = call x86_fp80 @powl(i32 10, x86_fp80 %55)
%57 = fdiv x86_fp80 %54, %56
%58 = fadd x86_fp80 %53, %57
%59 = load x86_fp80, x86_fp80* %7
%60 = call x86_fp80 @powl(i32 10, x86_fp80 %59)
%61 = fmul x86_fp80 %58, %60
ret x86_fp80 %61
}

LLVM IR (-O2):
define x86_fp80 @__scan_float(i8** %0, i32 %1) {
%3 = tail call x86_fp80 @__scan_float_int(i8** %0, i32 %1)
%4 = load i8*, i8** %0
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 46
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %8, i8** %0
%9 = tail call x86_fp80 @__scan_float_uint(i8** %0, i32 %1)
%10 = load i8*, i8** %0
%11 = load i8, i8* %10
br label %12
12: ; preds = %2, %7
%13 = phi i8 [ %11, %7 ], [ %5, %2 ]
%14 = phi i8* [ %10, %7 ], [ %4, %2 ]
%15 = phi x86_fp80 [ %9, %7 ], [ 0xK00000000000000000000, %2 ]
switch i8 %13, label %19 [
i8 101, label %16
i8 69, label %16
]
16: ; preds = %12, %12
%17 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %17, i8** %0
%18 = tail call x86_fp80 @__scan_float_int(i8** %0, i32 %1)
br label %19
19: ; preds = %12, %16
%20 = phi x86_fp80 [ %18, %16 ], [ 0xK00000000000000000000, %12 ]
%21 = tail call i32 @log10l(x86_fp80 %15)
%22 = tail call x86_fp80 @ceill(i32 %21)
%23 = fcmp olt x86_fp80 %22, 0xK3FFF8000000000000000
%24 = select i1 %23, x86_fp80 0xK3FFF8000000000000000, x86_fp80 %22
%25 = tail call x86_fp80 @powl(i32 10, x86_fp80 %24)
%26 = fdiv x86_fp80 %15, %25
%27 = fadd x86_fp80 %3, %26
%28 = tail call x86_fp80 @powl(i32 10, x86_fp80 %20)
%29 = fmul x86_fp80 %28, %27
ret x86_fp80 %29
}