#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 */
char _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 *lookahead) {
  unsigned int eaten;
  for (eaten = 0;; eaten++) {
    unsigned int pos = _lookahead_tell(lookahead);
    char c = _lookahead_getc(lookahead);
    if (c < '0' || c > '9') {
      _lookahead_revert(lookahead, pos);
      break;
    }
  }
  return eaten;
}


x86 assembly (clang, -O0):
<_parse_float_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <_lookahead_tell@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_lookahead_getc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x30,%eax
jl     1175 <_parse_float_digits+0x45>
movsbl -0x11(%rbp),%eax
cmp    $0x39,%eax
jle    1186 <_parse_float_digits+0x56>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <_lookahead_revert@plt>
jmp    1199 <_parse_float_digits+0x69>
jmp    118b <_parse_float_digits+0x5b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <_parse_float_digits+0x13>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_float_digits>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0xffffffff,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <_lookahead_tell@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <_lookahead_getc@plt>
add    $0xc6,%al
add    $0x1,%ebx
cmp    $0xf5,%al
ja     1140 <_parse_float_digits+0x10>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <_lookahead_revert@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.lookahead_state = type { i32 }
define i32 @_parse_float_digits(%struct.lookahead_state* %0) {
%2 = alloca %struct.lookahead_state*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store %struct.lookahead_state* %0, %struct.lookahead_state** %2
store i32 0, i32* %3
br label %6
6: ; preds = %23, %1
%7 = load %struct.lookahead_state*, %struct.lookahead_state** %2
%8 = call i32 @_lookahead_tell(%struct.lookahead_state* %7)
store i32 %8, i32* %4
%9 = load %struct.lookahead_state*, %struct.lookahead_state** %2
%10 = call signext i8 @_lookahead_getc(%struct.lookahead_state* %9)
store i8 %10, i8* %5
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %12, 48
br i1 %13, label %18, label %14
14: ; preds = %6
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
%17 = icmp sgt i32 %16, 57
br i1 %17, label %18, label %22
18: ; preds = %14, %6
%19 = load %struct.lookahead_state*, %struct.lookahead_state** %2
%20 = load i32, i32* %4
%21 = call i32 @_lookahead_revert(%struct.lookahead_state* %19, i32 %20)
br label %26
22: ; preds = %14
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = add i32 %24, 1
store i32 %25, i32* %3
br label %6
26: ; preds = %18
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
%struct.lookahead_state = type { i32 }
define i32 @_parse_float_digits(%struct.lookahead_state* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = tail call i32 @_lookahead_tell(%struct.lookahead_state* %0)
%5 = tail call signext i8 @_lookahead_getc(%struct.lookahead_state* %0)
%6 = add i8 %5, -58
%7 = icmp ult i8 %6, -10
%8 = add i32 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
%10 = tail call i32 @_lookahead_revert(%struct.lookahead_state* %0, i32 %4)
ret i32 %3
}