#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 long getchar();
long long in() {
  long long ch = getchar(), x = 0;
  while (ch < '0' || ch > '9')
    ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = x * 10 + ch - '0', ch = getchar();
  return x;
}


x86 assembly (clang, -O0):
<in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %rax,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x1,%al
cmpq   $0x30,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jl     1146 <in+0x36>
cmpq   $0x39,-0x8(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1156 <in+0x46>
jmp    1166 <in+0x56>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %rax,-0x8(%rbp)
jmp    112b <in+0x1b>
jmp    116b <in+0x5b>
xor    %eax,%eax
cmpq   $0x30,-0x8(%rbp)
mov    %al,-0x12(%rbp)
jl     1186 <in+0x76>
cmpq   $0x39,-0x8(%rbp)
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1196 <in+0x86>
jmp    11b7 <in+0xa7>
imul   $0xa,-0x10(%rbp),%rax
add    -0x8(%rbp),%rax
sub    $0x30,%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %rax,-0x8(%rbp)
jmp    116b <in+0x5b>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

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

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