#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();
scalar_t__ isspace(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
int read_number(int number[]) {
  size_t i;
  int c;
  while (isspace(c = getchar()))
    ;
  ungetc(c, stdin);
  for (i = 0; i < 7; i++) {
    c = getchar();
    if (!('0' <= c && c <= '9')) {
      return 0;
    }
    number[i] = c - '0';
  }
  return 1;
}


x86 assembly (clang, -O0):
<read_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%edi
mov    %edi,-0x1c(%rbp)
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     115c <read_number+0x2c>
jmp    113c <read_number+0xc>
mov    -0x1c(%rbp),%edi
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
call   1050 <ungetc@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x7,-0x18(%rbp)
jae    11d0 <read_number+0xa0>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x30,%eax
cmp    -0x1c(%rbp),%eax
jg     11a2 <read_number+0x72>
cmpl   $0x39,-0x1c(%rbp)
jle    11ae <read_number+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <read_number+0xa7>
mov    -0x1c(%rbp),%edx
sub    $0x30,%edx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1175 <read_number+0x45>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_number>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1140 <read_number+0x10>
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1050 <ungetc@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11f5 <read_number+0xc5>
mov    %eax,(%rbx)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11f5 <read_number+0xc5>
mov    %eax,0x4(%rbx)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11f5 <read_number+0xc5>
mov    %eax,0x8(%rbx)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11f5 <read_number+0xc5>
mov    %eax,0xc(%rbx)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11f5 <read_number+0xc5>
mov    %eax,0x10(%rbx)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11f5 <read_number+0xc5>
mov    %eax,0x14(%rbx)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     11f5 <read_number+0xc5>
mov    %eax,0x18(%rbx)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @read_number(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
store i32* %0, i32** %3
br label %6
6: ; preds = %10, %1
%7 = call i32 (...) @getchar()
store i32 %7, i32* %5
%8 = call i64 @isspace(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = load i32, i32* %5
%13 = load i32, i32* @stdin
%14 = call i32 @ungetc(i32 %12, i32 %13)
store i64 0, i64* %4
br label %15
15: ; preds = %32, %11
%16 = load i64, i64* %4
%17 = icmp ult i64 %16, 7
br i1 %17, label %18, label %35
18: ; preds = %15
%19 = call i32 (...) @getchar()
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = icmp sle i32 48, %20
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* %5
%24 = icmp sle i32 %23, 57
br i1 %24, label %26, label %25
25: ; preds = %22, %18
store i32 0, i32* %2
br label %36
26: ; preds = %22
%27 = load i32, i32* %5
%28 = sub nsw i32 %27, 48
%29 = load i32*, i32** %3
%30 = load i64, i64* %4
%31 = getelementptr inbounds i32, i32* %29, i64 %30
store i32 %28, i32* %31
br label %32
32: ; preds = %26
%33 = load i64, i64* %4
%34 = add i64 %33, 1
store i64 %34, i64* %4
br label %15
35: ; preds = %15
store i32 1, i32* %2
br label %36
36: ; preds = %35, %25
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @read_number(i32* nocapture writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 (...) @getchar()
%4 = tail call i64 @isspace(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = load i32, i32* @stdin
%8 = tail call i32 @ungetc(i32 %3, i32 %7)
%9 = tail call i32 (...) @getchar()
%10 = add i32 %9, -48
%11 = icmp ult i32 %10, 10
br i1 %11, label %12, label %43
12: ; preds = %6
store i32 %10, i32* %0
%13 = tail call i32 (...) @getchar()
%14 = add i32 %13, -48
%15 = icmp ult i32 %14, 10
br i1 %15, label %16, label %43
16: ; preds = %12
%17 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %14, i32* %17
%18 = tail call i32 (...) @getchar()
%19 = add i32 %18, -48
%20 = icmp ult i32 %19, 10
br i1 %20, label %21, label %43
21: ; preds = %16
%22 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %19, i32* %22
%23 = tail call i32 (...) @getchar()
%24 = add i32 %23, -48
%25 = icmp ult i32 %24, 10
br i1 %25, label %26, label %43
26: ; preds = %21
%27 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %24, i32* %27
%28 = tail call i32 (...) @getchar()
%29 = add i32 %28, -48
%30 = icmp ult i32 %29, 10
br i1 %30, label %31, label %43
31: ; preds = %26
%32 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %29, i32* %32
%33 = tail call i32 (...) @getchar()
%34 = add i32 %33, -48
%35 = icmp ult i32 %34, 10
br i1 %35, label %36, label %43
36: ; preds = %31
%37 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %34, i32* %37
%38 = tail call i32 (...) @getchar()
%39 = add i32 %38, -48
%40 = icmp ult i32 %39, 10
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %39, i32* %42
br label %43
43: ; preds = %41, %36, %31, %26, %21, %16, %12, %6
%44 = phi i32 [ 0, %6 ], [ 0, %12 ], [ 0, %16 ], [ 0, %21 ], [ 0, %26 ], [ 0, %31 ], [ 0, %36 ], [ 1, %41 ]
ret i32 %44
}