#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();
void scanint(int *x) {
  register int c = getchar();
  *x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    *x = ((*x) << 1) + ((*x) << 3) + c - 48;
  }
  if (neg)
    *x = -(*x);
}


x86 assembly (clang, -O0):
<scanint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x10(%rbp)
cmpl   $0x30,-0xc(%rbp)
jl     1150 <scanint+0x40>
xor    %eax,%eax
cmpl   $0x39,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jle    115a <scanint+0x4a>
cmpl   $0x2d,-0xc(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    116a <scanint+0x5a>
jmp    117e <scanint+0x6e>
jmp    116f <scanint+0x5f>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    1137 <scanint+0x27>
cmpl   $0x2d,-0xc(%rbp)
jne    1199 <scanint+0x89>
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    119e <scanint+0x8e>
xor    %eax,%eax
cmpl   $0x2f,-0xc(%rbp)
mov    %al,-0x12(%rbp)
jle    11b7 <scanint+0xa7>
cmpl   $0x3a,-0xc(%rbp)
setl   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    11c7 <scanint+0xb7>
jmp    11f6 <scanint+0xe6>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x3,%eax
add    %eax,%ecx
add    -0xc(%rbp),%ecx
sub    $0x30,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    119e <scanint+0x8e>
cmpl   $0x0,-0x10(%rbp)
je     120e <scanint+0xfe>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scanint>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebp
movl   $0x0,(%rbx)
cmp    $0x2d,%eax
je     1158 <scanint+0x48>
mov    %ebp,%eax
add    $0xffffffc6,%eax
cmp    $0xfffffff5,%eax
ja     1158 <scanint+0x48>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebp
cmp    $0x2d,%eax
je     1158 <scanint+0x48>
mov    %ebp,%eax
add    $0xffffffc6,%eax
cmp    $0xfffffff6,%eax
jb     1140 <scanint+0x30>
mov    %ebp,%eax
cmp    $0x2d,%ebp
jne    1166 <scanint+0x56>
xor    %eax,%eax
call   1030 <getchar@plt>
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
ja     118e <scanint+0x7e>
xchg   %ax,%ax
mov    (%rbx),%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rax,%rcx,2),%eax
add    $0xffffffd0,%eax
mov    %eax,(%rbx)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ecx
add    $0xffffffd0,%ecx
cmp    $0xa,%ecx
jb     1170 <scanint+0x60>
cmp    $0x2d,%ebp
jne    1195 <scanint+0x85>
negl   (%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @scanint(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 (...) @getchar()
store i32 %5, i32* %3
%6 = load i32*, i32** %2
store i32 0, i32* %6
store i32 0, i32* %4
br label %7
7: ; preds = %19, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 48
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 57
br i1 %12, label %13, label %16
13: ; preds = %10, %7
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 45
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ false, %10 ], [ %15, %13 ]
br i1 %17, label %18, label %21
18: ; preds = %16
br label %19
19: ; preds = %18
%20 = call i32 (...) @getchar()
store i32 %20, i32* %3
br label %7
21: ; preds = %16
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %26
24: ; preds = %21
store i32 1, i32* %4
%25 = call i32 (...) @getchar()
store i32 %25, i32* %3
br label %26
26: ; preds = %24, %21
br label %27
27: ; preds = %47, %26
%28 = load i32, i32* %3
%29 = icmp sgt i32 %28, 47
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %3
%32 = icmp slt i32 %31, 58
br label %33
33: ; preds = %30, %27
%34 = phi i1 [ false, %27 ], [ %32, %30 ]
br i1 %34, label %35, label %49
35: ; preds = %33
%36 = load i32*, i32** %2
%37 = load i32, i32* %36
%38 = shl i32 %37, 1
%39 = load i32*, i32** %2
%40 = load i32, i32* %39
%41 = shl i32 %40, 3
%42 = add nsw i32 %38, %41
%43 = load i32, i32* %3
%44 = add nsw i32 %42, %43
%45 = sub nsw i32 %44, 48
%46 = load i32*, i32** %2
store i32 %45, i32* %46
br label %47
47: ; preds = %35
%48 = call i32 (...) @getchar()
store i32 %48, i32* %3
br label %27
49: ; preds = %33
%50 = load i32, i32* %4
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = load i32*, i32** %2
%54 = load i32, i32* %53
%55 = sub nsw i32 0, %54
%56 = load i32*, i32** %2
store i32 %55, i32* %56
br label %57
57: ; preds = %52, %49
ret void
}

LLVM IR (-O2):
define void @scanint(i32* nocapture %0) {
%2 = tail call i32 (...) @getchar()
store i32 0, i32* %0
%3 = add i32 %2, -58
%4 = icmp ult i32 %3, -10
%5 = icmp ne i32 %2, 45
%6 = and i1 %5, %4
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = tail call i32 (...) @getchar()
%9 = add i32 %8, -58
%10 = icmp ult i32 %9, -10
%11 = icmp ne i32 %8, 45
%12 = and i1 %11, %10
br i1 %12, label %7, label %13
13: ; preds = %7, %1
%14 = phi i32 [ %2, %1 ], [ %8, %7 ]
%15 = icmp eq i32 %14, 45
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 (...) @getchar()
br label %18
18: ; preds = %16, %13
%19 = phi i32 [ %17, %16 ], [ %14, %13 ]
%20 = add i32 %19, -48
%21 = icmp ult i32 %20, 10
br i1 %21, label %22, label %31
22: ; preds = %18, %22
%23 = phi i32 [ %28, %22 ], [ %19, %18 ]
%24 = load i32, i32* %0
%25 = mul i32 %24, 10
%26 = add nsw i32 %23, -48
%27 = add i32 %26, %25
store i32 %27, i32* %0
%28 = tail call i32 (...) @getchar()
%29 = add i32 %28, -48
%30 = icmp ult i32 %29, 10
br i1 %30, label %22, label %31
31: ; preds = %22, %18
br i1 %15, label %32, label %35
32: ; preds = %31
%33 = load i32, i32* %0
%34 = sub nsw i32 0, %33
store i32 %34, i32* %0
br label %35
35: ; preds = %32, %31
ret void
}