#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int getchar();
int rin(void) {
  register int n, c;
  n = 0;
  c = getchar();
  while (c != '\n' && c != ' ') {
    if (c < '0' || c > '9') {
      while (c != '\n') {
        if (c == 0)
          exit(0);
        c = getchar();
      }
      return (0);
    }
    n = n * 10 + c - '0';
    c = getchar();
  }
  return (n);
}


x86 assembly (clang, -O0):
<rin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1152 <rin+0x32>
cmpl   $0x20,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1162 <rin+0x42>
jmp    11cd <rin+0xad>
cmpl   $0x30,-0xc(%rbp)
jl     1176 <rin+0x56>
cmpl   $0x39,-0xc(%rbp)
jle    11b1 <rin+0x91>
jmp    117b <rin+0x5b>
cmpl   $0xa,-0xc(%rbp)
je     11a5 <rin+0x85>
cmpl   $0x0,-0xc(%rbp)
jne    1196 <rin+0x76>
xor    %edi,%edi
call   1040 <exit@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    117b <rin+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <rin+0xb3>
imul   $0xa,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    1139 <rin+0x19>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rin>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1179 <rin+0x59>
cmp    $0x20,%eax
je     1179 <rin+0x59>
lea    -0x3a(%rax),%ecx
cmp    $0xfffffff5,%ecx
jbe    1167 <rin+0x47>
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
add    $0xffffffd0,%ebx
jmp    1130 <rin+0x10>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1177 <rin+0x57>
test   %eax,%eax
jne    1160 <rin+0x40>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

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