#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 */
struct lookahead_state {
  int dummy;
};

/* Variables and functions */
int _lookahead_getc(struct lookahead_state *);
int /*<<< orphan*/ _lookahead_revert(struct lookahead_state *, unsigned int);
unsigned int _lookahead_tell(struct lookahead_state *);
unsigned int _parse_float_digits(struct lookahead_state *);
unsigned int _parse_float_exp(struct lookahead_state *lookahead) {
  unsigned int pos, pos2;
  int c;
  unsigned int eaten, digits;
  pos = _lookahead_tell(lookahead);
  c = _lookahead_getc(lookahead);
  if (c != 'e' && c != 'E') {
    _lookahead_revert(lookahead, pos);
    return 0;
  }
  pos2 = _lookahead_tell(lookahead);
  c = _lookahead_getc(lookahead);
  if (c == '-' || c == '+') {
    eaten = 2;
  } else {
    _lookahead_revert(lookahead, pos2);
    eaten = 1;
  }
  digits = _parse_float_digits(lookahead);
  if (!digits) {
    _lookahead_revert(lookahead, pos);
    return 0;
  }
  return eaten + digits;
}


x86 assembly (clang, -O0):
<_parse_float_exp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <_lookahead_tell@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_lookahead_getc@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x65,-0x1c(%rbp)
je     1190 <_parse_float_exp+0x50>
cmpl   $0x45,-0x1c(%rbp)
je     1190 <_parse_float_exp+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <_lookahead_revert@plt>
movl   $0x0,-0x4(%rbp)
jmp    1212 <_parse_float_exp+0xd2>
mov    -0x10(%rbp),%rdi
call   1060 <_lookahead_tell@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_lookahead_getc@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x2d,-0x1c(%rbp)
je     11bc <_parse_float_exp+0x7c>
cmpl   $0x2b,-0x1c(%rbp)
jne    11c8 <_parse_float_exp+0x88>
movl   $0x2,-0x20(%rbp)
jmp    11db <_parse_float_exp+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1050 <_lookahead_revert@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <_parse_float_digits@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1209 <_parse_float_exp+0xc9>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <_lookahead_revert@plt>
movl   $0x0,-0x4(%rbp)
jmp    1212 <_parse_float_exp+0xd2>
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_float_exp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1060 <_lookahead_tell@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <_lookahead_getc@plt>
and    $0xffffffdf,%eax
cmp    $0x45,%eax
jne    11a6 <_parse_float_exp+0x66>
mov    %rbx,%rdi
call   1060 <_lookahead_tell@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1040 <_lookahead_getc@plt>
mov    $0x2,%r15d
cmp    $0x2b,%eax
je     1195 <_parse_float_exp+0x55>
cmp    $0x2d,%eax
je     1195 <_parse_float_exp+0x55>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <_lookahead_revert@plt>
mov    $0x1,%r15d
mov    %rbx,%rdi
call   1030 <_parse_float_digits@plt>
test   %eax,%eax
je     11a6 <_parse_float_exp+0x66>
add    %r15d,%eax
jmp    11b2 <_parse_float_exp+0x72>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <_lookahead_revert@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.lookahead_state = type { i32 }
define i32 @_parse_float_exp(%struct.lookahead_state* %0) {
%2 = alloca i32
%3 = alloca %struct.lookahead_state*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.lookahead_state* %0, %struct.lookahead_state** %3
%9 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%10 = call i32 @_lookahead_tell(%struct.lookahead_state* %9)
store i32 %10, i32* %4
%11 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%12 = call i32 @_lookahead_getc(%struct.lookahead_state* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 101
br i1 %14, label %15, label %22
15: ; preds = %1
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 69
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%20 = load i32, i32* %4
%21 = call i32 @_lookahead_revert(%struct.lookahead_state* %19, i32 %20)
store i32 0, i32* %2
br label %50
22: ; preds = %15, %1
%23 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%24 = call i32 @_lookahead_tell(%struct.lookahead_state* %23)
store i32 %24, i32* %5
%25 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%26 = call i32 @_lookahead_getc(%struct.lookahead_state* %25)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 45
br i1 %28, label %32, label %29
29: ; preds = %22
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 43
br i1 %31, label %32, label %33
32: ; preds = %29, %22
store i32 2, i32* %7
br label %37
33: ; preds = %29
%34 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%35 = load i32, i32* %5
%36 = call i32 @_lookahead_revert(%struct.lookahead_state* %34, i32 %35)
store i32 1, i32* %7
br label %37
37: ; preds = %33, %32
%38 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%39 = call i32 @_parse_float_digits(%struct.lookahead_state* %38)
store i32 %39, i32* %8
%40 = load i32, i32* %8
%41 = icmp ne i32 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %37
%43 = load %struct.lookahead_state*, %struct.lookahead_state** %3
%44 = load i32, i32* %4
%45 = call i32 @_lookahead_revert(%struct.lookahead_state* %43, i32 %44)
store i32 0, i32* %2
br label %50
46: ; preds = %37
%47 = load i32, i32* %7
%48 = load i32, i32* %8
%49 = add i32 %47, %48
store i32 %49, i32* %2
br label %50
50: ; preds = %46, %42, %18
%51 = load i32, i32* %2
ret i32 %51
}

LLVM IR (-O2):
%struct.lookahead_state = type { i32 }
define i32 @_parse_float_exp(%struct.lookahead_state* %0) {
%2 = tail call i32 @_lookahead_tell(%struct.lookahead_state* %0)
%3 = tail call i32 @_lookahead_getc(%struct.lookahead_state* %0)
%4 = and i32 %3, -33
%5 = icmp eq i32 %4, 69
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @_lookahead_revert(%struct.lookahead_state* %0, i32 %2)
br label %21
8: ; preds = %1
%9 = tail call i32 @_lookahead_tell(%struct.lookahead_state* %0)
%10 = tail call i32 @_lookahead_getc(%struct.lookahead_state* %0)
switch i32 %10, label %11 [
i32 45, label %13
i32 43, label %13
]
11: ; preds = %8
%12 = tail call i32 @_lookahead_revert(%struct.lookahead_state* %0, i32 %9)
br label %13
13: ; preds = %8, %8, %11
%14 = phi i32 [ 1, %11 ], [ 2, %8 ], [ 2, %8 ]
%15 = tail call i32 @_parse_float_digits(%struct.lookahead_state* %0)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @_lookahead_revert(%struct.lookahead_state* %0, i32 %2)
br label %21
19: ; preds = %13
%20 = add i32 %15, %14
br label %21
21: ; preds = %19, %17, %6
%22 = phi i32 [ 0, %6 ], [ %20, %19 ], [ 0, %17 ]
ret i32 %22
}