#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 getchar();
long long int input() {
  char c = getchar();
  while (c < '0' || c > '9')
    c = getchar();
  long long int ret = 0;
  while (c >= '0' && c <= '9') {
    ret = 10 * ret + c - 48;
    c = getchar();
  }
  return ret;
}


x86 assembly (clang, -O0):
<input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x30,%ecx
mov    %al,-0x11(%rbp)
jl     1141 <input+0x31>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1151 <input+0x41>
jmp    1160 <input+0x50>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
jmp    1122 <input+0x12>
movq   $0x0,-0x10(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x12(%rbp)
jl     1187 <input+0x77>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1197 <input+0x87>
jmp    11bb <input+0xab>
imul   $0xa,-0x10(%rbp),%rax
movsbq -0x1(%rbp),%rcx
add    %rcx,%rax
sub    $0x30,%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
jmp    1168 <input+0x58>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input>:
push   %rbx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ecx
add    $0xc6,%cl
cmp    $0xf5,%cl
ja     113f <input+0x2f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     1130 <input+0x20>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbx,4),%rcx
movzbl %al,%eax
lea    (%rax,%rcx,2),%rbx
add    $0xffffffffffffffd0,%rbx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ecx
add    $0xd0,%cl
cmp    $0xa,%cl
jb     1150 <input+0x40>
mov    %rbx,%rax
pop    %rbx
ret

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

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