#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 */
char EOF;
char getc(int /*<<< orphan*/);
scalar_t__ is_digit(char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/);
long long unsigned int fparse_lluint() {
  long long unsigned int v = 0;
  char c = getc(stdin);
  do {
    v = 10 * v + (c - '0');
    c = getc(stdin);
  } while (c != EOF && is_digit(c));
  ungetc(c, stdin);
  return v;
}


x86 assembly (clang, -O0):
<fparse_lluint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %al,-0x9(%rbp)
imul   $0xa,-0x8(%rbp),%rax
movsbl -0x9(%rbp),%ecx
sub    $0x30,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
mov    0x2e5d(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0xa(%rbp)
je     11a6 <fparse_lluint+0x76>
movsbl -0x9(%rbp),%edi
call   1040 <is_digit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1151 <fparse_lluint+0x21>
mov    -0x9(%rbp),%al
mov    0x2e2d(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1030 <ungetc@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fparse_lluint>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eaa(%rip),%r14
mov    (%r14),%edi
call   1050 <getc@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
mov    0x2e8f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbx,4),%rax
movsbq %bpl,%rcx
lea    (%rcx,%rax,2),%rbx
add    $0xffffffffffffffd0,%rbx
mov    (%r14),%edi
call   1050 <getc@plt>
movsbl %al,%ebp
cmp    (%r15),%al
je     118c <fparse_lluint+0x5c>
mov    %ebp,%edi
call   1040 <is_digit@plt>
test   %rax,%rax
jne    1160 <fparse_lluint+0x30>
mov    (%r14),%esi
mov    %ebp,%edi
call   1030 <ungetc@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i8 0
define i64 @fparse_lluint() {
%1 = alloca i64
%2 = alloca i8
store i64 0, i64* %1
%3 = load i32, i32* @stdin
%4 = call signext i8 @getc(i32 %3)
store i8 %4, i8* %2
br label %5
5: ; preds = %25, %0
%6 = load i64, i64* %1
%7 = mul i64 10, %6
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
%11 = sext i32 %10 to i64
%12 = add i64 %7, %11
store i64 %12, i64* %1
%13 = load i32, i32* @stdin
%14 = call signext i8 @getc(i32 %13)
store i8 %14, i8* %2
br label %15
15: ; preds = %5
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = load i8, i8* @EOF
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %25
21: ; preds = %15
%22 = load i8, i8* %2
%23 = call i64 @is_digit(i8 signext %22)
%24 = icmp ne i64 %23, 0
br label %25
25: ; preds = %21, %15
%26 = phi i1 [ false, %15 ], [ %24, %21 ]
br i1 %26, label %5, label %27
27: ; preds = %25
%28 = load i8, i8* %2
%29 = load i32, i32* @stdin
%30 = call i32 @ungetc(i8 signext %28, i32 %29)
%31 = load i64, i64* %1
ret i64 %31
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i8 0
define i64 @fparse_lluint() {
%1 = load i32, i32* @stdin
%2 = tail call signext i8 @getc(i32 %1)
br label %3
3: ; preds = %14, %0
%4 = phi i64 [ 0, %0 ], [ %9, %14 ]
%5 = phi i8 [ %2, %0 ], [ %11, %14 ]
%6 = mul i64 %4, 10
%7 = sext i8 %5 to i64
%8 = add i64 %6, -48
%9 = add i64 %8, %7
%10 = load i32, i32* @stdin
%11 = tail call signext i8 @getc(i32 %10)
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %11, %12
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = tail call i64 @is_digit(i8 signext %11)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %3
17: ; preds = %3, %14
%18 = load i32, i32* @stdin
%19 = tail call i32 @ungetc(i8 signext %11, i32 %18)
ret i64 %9
}