#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 */
int getchar();
int in() {
  int x = 0, ch;
  do
    ch = getchar();
  while (ch < '0' || ch > '9');
  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    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1142 <in+0x32>
cmpl   $0x39,-0x8(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    111f <in+0xf>
jmp    1152 <in+0x42>
xor    %eax,%eax
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jl     116b <in+0x5b>
cmpl   $0x39,-0x8(%rbp)
setle  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    117b <in+0x6b>
jmp    1197 <in+0x87>
imul   $0xa,-0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
jmp    1152 <in+0x42>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
lea    -0x3a(%rax),%ecx
cmp    $0xfffffff6,%ecx
jb     1120 <in+0x10>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
add    $0xffffffd0,%ebx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ecx
add    $0xffffffd0,%ecx
cmp    $0xa,%ecx
jb     1140 <in+0x30>
mov    %ebx,%eax
pop    %rbx
ret

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

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