#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fread(char *, int, int, int /*<<< orphan*/ *);
size_t E_ReadField(FILE *input, char *field) {
  int p = 0;
  while (((!feof(input)) && (fread(&field[p], 1, 1, input) == 1) &&
          (field[p] >= '0') && (field[p] <= '9')) ||
         (field[p] == '.') || (field[p] == '-')) {
    p += 1;
  }
  field[p] = '\0';
  return p;
}


x86 assembly (clang, -O0):
<E_ReadField>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
jne    119c <E_ReadField+0x7c>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    119c <E_ReadField+0x7c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     119c <E_ReadField+0x7c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x15(%rbp)
jle    11cb <E_ReadField+0xab>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x2e,%ecx
mov    %al,-0x15(%rbp)
je     11cb <E_ReadField+0xab>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11db <E_ReadField+0xbb>
jmp    11e9 <E_ReadField+0xc9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <E_ReadField+0x17>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movslq -0x14(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<E_ReadField>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    114f <E_ReadField+0x2f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%eax
add    $0xd3,%al
cmp    $0x1,%al
ja     1186 <E_ReadField+0x66>
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <feof@plt>
test   %eax,%eax
jne    1140 <E_ReadField+0x20>
lea    (%r14,%rbx,1),%r12
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    1140 <E_ReadField+0x20>
movzbl (%r12),%eax
add    $0xd0,%al
cmp    $0xa,%al
jae    1140 <E_ReadField+0x20>
jmp    114b <E_ReadField+0x2b>
mov    %ebx,%eax
movb   $0x0,(%r14,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @E_ReadField(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %52, %2
%7 = load i32*, i32** %3
%8 = call i32 @feof(i32* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %34, label %10
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i32*, i32** %3
%16 = call i32 @fread(i8* %14, i32 1, i32 1, i32* %15)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %34
18: ; preds = %10
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 48
br i1 %25, label %26, label %34
26: ; preds = %18
%27 = load i8*, i8** %4
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp sle i32 %32, 57
br i1 %33, label %50, label %34
34: ; preds = %26, %18, %10, %6
%35 = load i8*, i8** %4
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 46
br i1 %41, label %50, label %42
42: ; preds = %34
%43 = load i8*, i8** %4
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 45
br label %50
50: ; preds = %42, %34, %26
%51 = phi i1 [ true, %34 ], [ true, %26 ], [ %49, %42 ]
br i1 %51, label %52, label %55
52: ; preds = %50
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %6
55: ; preds = %50
%56 = load i8*, i8** %4
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %56, i64 %58
store i8 0, i8* %59
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
ret i64 %61
}

LLVM IR (-O2):
define i64 @E_ReadField(i32* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %20, %2
%4 = phi i64 [ %21, %20 ], [ 0, %2 ]
%5 = tail call i32 @feof(i32* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %1, i64 %4
%9 = tail call i32 @fread(i8* %8, i32 1, i32 1, i32* %0)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %8
%13 = add i8 %12, -48
%14 = icmp ult i8 %13, 10
br i1 %14, label %20, label %15
15: ; preds = %11, %7, %3
%16 = getelementptr inbounds i8, i8* %1, i64 %4
%17 = load i8, i8* %16
%18 = add i8 %17, -45
%19 = icmp ult i8 %18, 2
br i1 %19, label %20, label %22
20: ; preds = %15, %11
%21 = add nuw i64 %4, 1
br label %3
22: ; preds = %15
%23 = and i64 %4, 4294967295
%24 = getelementptr inbounds i8, i8* %1, i64 %23
store i8 0, i8* %24
ret i64 %23
}