#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 /*<<< orphan*/ fflush(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ stdout;
int rin(void) {
  register int n, c;
  n = 0;
  fflush(stdout);
  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    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1170 <rin+0x40>
cmpl   $0x20,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1180 <rin+0x50>
jmp    11eb <rin+0xbb>
cmpl   $0x30,-0xc(%rbp)
jl     1194 <rin+0x64>
cmpl   $0x39,-0xc(%rbp)
jle    11cf <rin+0x9f>
jmp    1199 <rin+0x69>
cmpl   $0xa,-0xc(%rbp)
je     11c3 <rin+0x93>
cmpl   $0x0,-0xc(%rbp)
jne    11b4 <rin+0x84>
xor    %edi,%edi
call   1050 <exit@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    1199 <rin+0x69>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <rin+0xc1>
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    1157 <rin+0x27>
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
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1199 <rin+0x69>
cmp    $0x20,%eax
je     1199 <rin+0x69>
lea    -0x3a(%rax),%ecx
cmp    $0xfffffff5,%ecx
jbe    1187 <rin+0x57>
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
add    $0xffffffd0,%ebx
jmp    1150 <rin+0x20>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1197 <rin+0x67>
test   %eax,%eax
jne    1180 <rin+0x50>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

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