#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_unlocked();
int getint() {
  int x = 0;
  register int 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):
<getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1142 <getint+0x32>
cmpl   $0x39,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1154 <getint+0x44>
jmp    1163 <getint+0x53>
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %eax,-0x8(%rbp)
jmp    1129 <getint+0x19>
jmp    1168 <getint+0x58>
xor    %eax,%eax
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jl     1181 <getint+0x71>
cmpl   $0x39,-0x8(%rbp)
setle  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1191 <getint+0x81>
jmp    11b9 <getint+0xa9>
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %eax,-0x8(%rbp)
jmp    1168 <getint+0x58>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint>:
push   %rbx
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
mov    %eax,%ecx
add    $0xffffffc6,%ecx
cmp    $0xfffffff5,%ecx
ja     113f <getint+0x2f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
lea    -0x3a(%rax),%ecx
cmp    $0xfffffff6,%ecx
jb     1130 <getint+0x20>
add    $0xffffffd0,%eax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     1150 <getint+0x40>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getint() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @getchar_unlocked()
store i32 %3, i32* %2
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %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 i32 (...) @getchar_unlocked()
store i32 %14, i32* %2
br label %4
15: ; preds = %10
br label %16
16: ; preds = %24, %15
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 48
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp sle i32 %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 i32, i32* %1
%26 = shl i32 %25, 3
%27 = load i32, i32* %1
%28 = shl i32 %27, 1
%29 = add nsw i32 %26, %28
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 48
%32 = add nsw i32 %29, %31
store i32 %32, i32* %1
%33 = call i32 (...) @getchar_unlocked()
store i32 %33, i32* %2
br label %16
34: ; preds = %22
%35 = load i32, i32* %1
ret i32 %35
}

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