#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 */
int ReadFraction(char **, int);
int ReadInteger(char **, int);
int ReadSign(char **);
double pow(int, double);
char tolower(char);
double ReadFloat(char *string[], int base) {
  int sign;
  double integer, fraction, exponent;
  char *mark;
  fraction = 0;
  exponent = 0;
  sign = ReadSign(string);
  mark = *string;
  integer = sign * ReadInteger(string, base);
  if (**string == '.') {
    *string += 1;
    fraction = sign * ReadFraction(string, base);
  }
  if (*string == mark)
    return (0);
  if (tolower(**string) != 'e')
    return (integer + fraction);
  *string += 1;
  sign = ReadSign(string);
  exponent = sign * ReadInteger(string, base);
  return ((integer + fraction) * pow(base, exponent));
}


x86 assembly (clang, -O0):
<ReadFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <ReadSign@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <ReadInteger@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11ed <ReadFloat+0x9d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <ReadFraction@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x38(%rbp),%rax
jne    120b <ReadFloat+0xbb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a4 <ReadFloat+0x154>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1060 <tolower@plt>
movsbl %al,%eax
cmp    $0x65,%eax
je     123a <ReadFloat+0xea>
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a4 <ReadFloat+0x154>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
call   1050 <ReadSign@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <ReadInteger@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x14(%rbp),%edi
movsd  -0x30(%rbp),%xmm0
call   1070 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadFloat>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
call   1050 <ReadSign@plt>
mov    %eax,%r15d
mov    (%rbx),%r12
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <ReadInteger@plt>
mov    %eax,%ebp
mov    (%rbx),%rax
xorpd  %xmm0,%xmm0
cmpb   $0x2e,(%rax)
jne    11ae <ReadFloat+0x5e>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <ReadFraction@plt>
xorpd  %xmm0,%xmm0
imul   %r15d,%eax
cvtsi2sd %eax,%xmm1
mov    (%rbx),%rax
cmp    %r12,%rax
jne    11b7 <ReadFloat+0x67>
jmp    1226 <ReadFloat+0xd6>
xorpd  %xmm1,%xmm1
cmp    %r12,%rax
je     1226 <ReadFloat+0xd6>
movsd  %xmm1,(%rsp)
imul   %r15d,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x8(%rsp)
movsbl (%rax),%edi
call   1060 <tolower@plt>
cmp    $0x65,%al
jne    121b <ReadFloat+0xcb>
addq   $0x1,(%rbx)
mov    %rbx,%rdi
call   1050 <ReadSign@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <ReadInteger@plt>
imul   %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %r14d,%edi
call   1070 <pow@plt>
mulsd  (%rsp),%xmm0
jmp    1226 <ReadFloat+0xd6>
movsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @ReadFloat(i8** %0, i32 %1) {
%3 = alloca double
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i8*
store i8** %0, i8*** %4
store i32 %1, i32* %5
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
%11 = load i8**, i8*** %4
%12 = call i32 @ReadSign(i8** %11)
store i32 %12, i32* %6
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
store i8* %14, i8** %10
%15 = load i32, i32* %6
%16 = load i8**, i8*** %4
%17 = load i32, i32* %5
%18 = call i32 @ReadInteger(i8** %16, i32 %17)
%19 = mul nsw i32 %15, %18
%20 = sitofp i32 %19 to double
store double %20, double* %7
%21 = load i8**, i8*** %4
%22 = load i8*, i8** %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 46
br i1 %25, label %26, label %36
26: ; preds = %2
%27 = load i8**, i8*** %4
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 1
store i8* %29, i8** %27
%30 = load i32, i32* %6
%31 = load i8**, i8*** %4
%32 = load i32, i32* %5
%33 = call i32 @ReadFraction(i8** %31, i32 %32)
%34 = mul nsw i32 %30, %33
%35 = sitofp i32 %34 to double
store double %35, double* %8
br label %36
36: ; preds = %26, %2
%37 = load i8**, i8*** %4
%38 = load i8*, i8** %37
%39 = load i8*, i8** %10
%40 = icmp eq i8* %38, %39
br i1 %40, label %41, label %42
41: ; preds = %36
store double 0.000000e+00, double* %3
br label %72
42: ; preds = %36
%43 = load i8**, i8*** %4
%44 = load i8*, i8** %43
%45 = load i8, i8* %44
%46 = call signext i8 @tolower(i8 signext %45)
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 101
br i1 %48, label %49, label %53
49: ; preds = %42
%50 = load double, double* %7
%51 = load double, double* %8
%52 = fadd double %50, %51
store double %52, double* %3
br label %72
53: ; preds = %42
%54 = load i8**, i8*** %4
%55 = load i8*, i8** %54
%56 = getelementptr inbounds i8, i8* %55, i64 1
store i8* %56, i8** %54
%57 = load i8**, i8*** %4
%58 = call i32 @ReadSign(i8** %57)
store i32 %58, i32* %6
%59 = load i32, i32* %6
%60 = load i8**, i8*** %4
%61 = load i32, i32* %5
%62 = call i32 @ReadInteger(i8** %60, i32 %61)
%63 = mul nsw i32 %59, %62
%64 = sitofp i32 %63 to double
store double %64, double* %9
%65 = load double, double* %7
%66 = load double, double* %8
%67 = fadd double %65, %66
%68 = load i32, i32* %5
%69 = load double, double* %9
%70 = call double @pow(i32 %68, double %69)
%71 = fmul double %67, %70
store double %71, double* %3
br label %72
72: ; preds = %53, %49, %41
%73 = load double, double* %3
ret double %73
}

LLVM IR (-O2):
define double @ReadFloat(i8** %0, i32 %1) {
%3 = tail call i32 @ReadSign(i8** %0)
%4 = load i8*, i8** %0
%5 = tail call i32 @ReadInteger(i8** %0, i32 %1)
%6 = mul nsw i32 %5, %3
%7 = sitofp i32 %6 to double
%8 = load i8*, i8** %0
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 46
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %12, i8** %0
%13 = tail call i32 @ReadFraction(i8** %0, i32 %1)
%14 = mul nsw i32 %13, %3
%15 = sitofp i32 %14 to double
%16 = load i8*, i8** %0
br label %17
17: ; preds = %11, %2
%18 = phi i8* [ %16, %11 ], [ %8, %2 ]
%19 = phi double [ %15, %11 ], [ 0.000000e+00, %2 ]
%20 = icmp eq i8* %18, %4
br i1 %20, label %37, label %21
21: ; preds = %17
%22 = load i8, i8* %18
%23 = tail call signext i8 @tolower(i8 signext %22)
%24 = icmp eq i8 %23, 101
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = fadd double %19, %7
br label %37
27: ; preds = %21
%28 = load i8*, i8** %0
%29 = getelementptr inbounds i8, i8* %28, i64 1
store i8* %29, i8** %0
%30 = tail call i32 @ReadSign(i8** %0)
%31 = tail call i32 @ReadInteger(i8** %0, i32 %1)
%32 = mul nsw i32 %31, %30
%33 = sitofp i32 %32 to double
%34 = fadd double %19, %7
%35 = tail call double @pow(i32 %1, double %33)
%36 = fmul double %34, %35
br label %37
37: ; preds = %17, %27, %25
%38 = phi double [ %26, %25 ], [ %36, %27 ], [ 0.000000e+00, %17 ]
ret double %38
}