#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 */
long getchar_unlocked();
long int getlint() {
  long int x = 0, c = getchar_unlocked();
  while (!(c >= '0' && c <= '9')) {
    c = getchar_unlocked();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c - '0');
    c = getchar_unlocked();
  }
  return x;
}


x86 assembly (clang, -O0):
<getlint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x30,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jl     1146 <getlint+0x36>
cmpq   $0x39,-0x10(%rbp)
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1158 <getlint+0x48>
jmp    1168 <getlint+0x58>
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %rax,-0x10(%rbp)
jmp    112b <getlint+0x1b>
jmp    116d <getlint+0x5d>
xor    %eax,%eax
cmpq   $0x30,-0x10(%rbp)
mov    %al,-0x12(%rbp)
jl     1188 <getlint+0x78>
cmpq   $0x39,-0x10(%rbp)
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1198 <getlint+0x88>
jmp    11ca <getlint+0xba>
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
mov    -0x8(%rbp),%rcx
shl    $0x1,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
sub    $0x30,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %rax,-0x10(%rbp)
jmp    116d <getlint+0x5d>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getlint>:
push   %rbx
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
mov    %rax,%rcx
add    $0xffffffffffffffc6,%rcx
cmp    $0xfffffffffffffff5,%rcx
ja     1141 <getlint+0x31>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
lea    -0x3a(%rax),%rcx
cmp    $0xfffffffffffffff6,%rcx
jb     1130 <getlint+0x20>
add    $0xffffffffffffffd0,%rax
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%rbx,4),%rcx
lea    (%rax,%rcx,2),%rbx
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
add    $0xffffffffffffffd0,%rax
cmp    $0xa,%rax
jb     1150 <getlint+0x40>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @getlint() {
%1 = alloca i64
%2 = alloca i64
store i64 0, i64* %1
%3 = call i64 (...) @getchar_unlocked()
store i64 %3, i64* %2
br label %4
4: ; preds = %13, %0
%5 = load i64, i64* %2
%6 = icmp sge i64 %5, 48
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i64, i64* %2
%9 = icmp sle i64 %8, 57
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ false, %4 ], [ %9, %7 ]
%12 = xor i1 %11, true
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i64 (...) @getchar_unlocked()
store i64 %14, i64* %2
br label %4
15: ; preds = %10
br label %16
16: ; preds = %24, %15
%17 = load i64, i64* %2
%18 = icmp sge i64 %17, 48
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i64, i64* %2
%21 = icmp sle i64 %20, 57
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ false, %16 ], [ %21, %19 ]
br i1 %23, label %24, label %34
24: ; preds = %22
%25 = load i64, i64* %1
%26 = shl i64 %25, 3
%27 = load i64, i64* %1
%28 = shl i64 %27, 1
%29 = add nsw i64 %26, %28
%30 = load i64, i64* %2
%31 = sub nsw i64 %30, 48
%32 = add nsw i64 %29, %31
store i64 %32, i64* %1
%33 = call i64 (...) @getchar_unlocked()
store i64 %33, i64* %2
br label %16
34: ; preds = %22
%35 = load i64, i64* %1
ret i64 %35
}

LLVM IR (-O2):
define i64 @getlint() {
%1 = tail call i64 (...) @getchar_unlocked()
%2 = add i64 %1, -58
%3 = icmp ult i64 %2, -10
br i1 %3, label %7, label %4
4: ; preds = %7, %0
%5 = phi i64 [ %1, %0 ], [ %8, %7 ]
%6 = add nsw i64 %5, -48
br label %11
7: ; preds = %0, %7
%8 = tail call i64 (...) @getchar_unlocked()
%9 = add i64 %8, -58
%10 = icmp ult i64 %9, -10
br i1 %10, label %7, label %4
11: ; preds = %4, %11
%12 = phi i64 [ %17, %11 ], [ %6, %4 ]
%13 = phi i64 [ %15, %11 ], [ 0, %4 ]
%14 = mul i64 %13, 10
%15 = add nsw i64 %12, %14
%16 = tail call i64 (...) @getchar_unlocked()
%17 = add i64 %16, -48
%18 = icmp ult i64 %17, 10
br i1 %18, label %11, label %19
19: ; preds = %11
ret i64 %15
}