#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 EOF;
int getchar();
scalar_t__ isnumber(int);
int /*<<< orphan*/ isspace(int);
int get_number() {
  int character, number = 0;
  while ((character = getchar()) != EOF && !isspace(character)) {
    if (isnumber(character))
      number = number * 10 + character - '0';
    else
      return 0;
  }
  return (character == EOF) ? EOF : number;
}


x86 assembly (clang, -O0):
<get_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
mov    0x2e94(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xd(%rbp)
je     1172 <get_number+0x42>
mov    -0x8(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1182 <get_number+0x52>
jmp    11b7 <get_number+0x87>
mov    -0x8(%rbp),%edi
call   1050 <isnumber@plt>
cmp    $0x0,%rax
je     11a6 <get_number+0x76>
imul   $0xa,-0xc(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    11b2 <get_number+0x82>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <get_number+0xb6>
jmp    113f <get_number+0xf>
mov    -0x8(%rbp),%eax
mov    0x2e27(%rip),%rcx
cmp    (%rcx),%eax
jne    11da <get_number+0xaa>
mov    0x2e18(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    11e0 <get_number+0xb0>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_number>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    0x2ea3(%rip),%r14
cmp    (%r14),%eax
je     118a <get_number+0x5a>
xor    %r15d,%r15d
nopl   (%rax)
mov    %ebx,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1183 <get_number+0x53>
mov    %ebx,%edi
call   1050 <isnumber@plt>
test   %rax,%rax
je     1188 <get_number+0x58>
lea    (%r15,%r15,4),%eax
lea    (%rbx,%rax,2),%r15d
add    $0xffffffd0,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
jne    1150 <get_number+0x20>
jmp    118a <get_number+0x5a>
mov    %r15d,%ebx
jmp    118a <get_number+0x5a>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @get_number() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %19, label %4
4: ; preds = %0, %12
%5 = phi i32 [ %16, %12 ], [ %1, %0 ]
%6 = phi i32 [ %15, %12 ], [ 0, %0 ]
%7 = tail call i32 @isspace(i32 %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = tail call i64 @isnumber(i32 %5)
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = mul nsw i32 %6, 10
%14 = add i32 %5, -48
%15 = add i32 %14, %13
%16 = tail call i32 (...) @getchar()
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %4
19: ; preds = %9, %12, %4, %0
%20 = phi i32 [ %1, %0 ], [ %6, %4 ], [ %16, %12 ], [ 0, %9 ]
ret i32 %20
}