#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 */
char getchar();
int inputnum(int a[]) {
  int s = 0, n = 0;
  char c;
  for (c = getchar();; c = getchar()) {
    if (c == ' ' || c == '\n') {
      *a = s;
      a++;
      n++;
      s = 0;
    } else
      s = s * 10 + c - '0';
    if (c == '\n')
      break;
  }
  return n;
}


x86 assembly (clang, -O0):
<inputnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
je     114e <inputnum+0x3e>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    1178 <inputnum+0x68>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1188 <inputnum+0x78>
imul   $0xa,-0xc(%rbp),%eax
movsbl -0x11(%rbp),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    119a <inputnum+0x8a>
jmp    11ae <inputnum+0x9e>
jmp    119f <inputnum+0x8f>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x11(%rbp)
jmp    1134 <inputnum+0x24>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputnum>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    1130 <inputnum+0x20>
xchg   %ax,%ax
mov    %ebp,(%rbx)
add    $0x4,%rbx
add    $0x1,%r14d
xor    %ebp,%ebp
cmp    $0xa,%al
je     1150 <inputnum+0x40>
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0x20,%al
je     1120 <inputnum+0x10>
cmp    $0xa,%al
je     1120 <inputnum+0x10>
movsbl %al,%ecx
lea    0x0(%rbp,%rbp,4),%edx
lea    (%rcx,%rdx,2),%ebp
add    $0xffffffd0,%ebp
cmp    $0xa,%al
jne    1130 <inputnum+0x20>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @inputnum(i32* nocapture writeonly %0) {
br label %2
2: ; preds = %16, %1
%3 = phi i32* [ %0, %1 ], [ %17, %16 ]
%4 = phi i32 [ 0, %1 ], [ %18, %16 ]
%5 = phi i32 [ 0, %1 ], [ %19, %16 ]
%6 = tail call signext i8 (...) @getchar()
%7 = icmp eq i8 %6, 10
switch i8 %6, label %11 [
i8 32, label %8
i8 10, label %8
]
8: ; preds = %2, %2
store i32 %4, i32* %3
%9 = getelementptr inbounds i32, i32* %3, i64 1
%10 = add nsw i32 %5, 1
br label %16
11: ; preds = %2
%12 = sext i8 %6 to i32
%13 = mul nsw i32 %4, 10
%14 = add i32 %13, -48
%15 = add i32 %14, %12
br label %16
16: ; preds = %11, %8
%17 = phi i32* [ %9, %8 ], [ %3, %11 ]
%18 = phi i32 [ 0, %8 ], [ %15, %11 ]
%19 = phi i32 [ %10, %8 ], [ %5, %11 ]
br i1 %7, label %20, label %2
20: ; preds = %16
ret i32 %19
}