#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_frac(struct lookahead_state *lookahead) {
  unsigned int pos;
  int c;
  unsigned int eaten;
  pos = _lookahead_tell(lookahead);
  c = _lookahead_getc(lookahead);
  if (c == '.') {
    eaten = _parse_float_digits(lookahead);
    if (eaten) {
      return eaten + 1;
    }
    _lookahead_revert(lookahead, pos);
    return 0;
  }
  _lookahead_revert(lookahead, pos);
  eaten = _parse_float_digits(lookahead);
  if (eaten) {
    c = _lookahead_getc(lookahead);
    if (c == '.') {
      return eaten + 1 + _parse_float_digits(lookahead);
    }
  }
  _lookahead_revert(lookahead, pos);
  return 0;
}


x86 assembly (clang, -O0):
<_parse_float_frac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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,-0x18(%rbp)
cmpl   $0x2e,-0x18(%rbp)
jne    11aa <_parse_float_frac+0x6a>
mov    -0x10(%rbp),%rdi
call   1030 <_parse_float_digits@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1192 <_parse_float_frac+0x52>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    121b <_parse_float_frac+0xdb>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <_lookahead_revert@plt>
movl   $0x0,-0x4(%rbp)
jmp    121b <_parse_float_frac+0xdb>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <_lookahead_revert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <_parse_float_digits@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1208 <_parse_float_frac+0xc8>
mov    -0x10(%rbp),%rdi
call   1040 <_lookahead_getc@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x2e,-0x18(%rbp)
jne    1203 <_parse_float_frac+0xc3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <_parse_float_digits@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    121b <_parse_float_frac+0xdb>
jmp    1208 <_parse_float_frac+0xc8>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <_lookahead_revert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_float_frac>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1060 <_lookahead_tell@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <_lookahead_getc@plt>
mov    %rbx,%rdi
cmp    $0x2e,%eax
jne    116c <_parse_float_frac+0x2c>
call   1030 <_parse_float_digits@plt>
test   %eax,%eax
je     119f <_parse_float_frac+0x5f>
add    $0x1,%eax
jmp    11ab <_parse_float_frac+0x6b>
mov    %ebp,%esi
call   1050 <_lookahead_revert@plt>
mov    %rbx,%rdi
call   1030 <_parse_float_digits@plt>
test   %eax,%eax
je     119f <_parse_float_frac+0x5f>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1040 <_lookahead_getc@plt>
cmp    $0x2e,%eax
jne    119f <_parse_float_frac+0x5f>
mov    %rbx,%rdi
call   1030 <_parse_float_digits@plt>
add    %r14d,%eax
add    $0x1,%eax
jmp    11ab <_parse_float_frac+0x6b>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <_lookahead_revert@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.lookahead_state = type { i32 }
define i32 @_parse_float_frac(%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 = icmp eq i32 %3, 46
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = tail call i32 @_parse_float_digits(%struct.lookahead_state* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = add i32 %6, 1
br label %25
10: ; preds = %5
%11 = tail call i32 @_lookahead_revert(%struct.lookahead_state* %0, i32 %2)
br label %25
12: ; preds = %1
%13 = tail call i32 @_lookahead_revert(%struct.lookahead_state* %0, i32 %2)
%14 = tail call i32 @_parse_float_digits(%struct.lookahead_state* %0)
%15 = icmp eq i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %12
%17 = tail call i32 @_lookahead_getc(%struct.lookahead_state* %0)
%18 = icmp eq i32 %17, 46
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = add i32 %14, 1
%21 = tail call i32 @_parse_float_digits(%struct.lookahead_state* %0)
%22 = add i32 %20, %21
br label %25
23: ; preds = %16, %12
%24 = tail call i32 @_lookahead_revert(%struct.lookahead_state* %0, i32 %2)
br label %25
25: ; preds = %23, %19, %10, %8
%26 = phi i32 [ %9, %8 ], [ 0, %10 ], [ %22, %19 ], [ 0, %23 ]
ret i32 %26
}