#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*/ printf(char *, ...);
int scanf(char *, int *);
int main() {
  int a[100];
  int len = 0;
  int x, i;
  while (1 == scanf("%d", &x)) {
    a[len++] = x;
  }
  for (i = 0; i < len; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
lea    0xebd(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    1183 <main+0x63>
mov    -0x1a8(%rbp),%ecx
mov    -0x1a4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1a4(%rbp)
cltq
mov    %ecx,-0x1a0(%rbp,%rax,4)
jmp    113c <main+0x1c>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    11cf <main+0xaf>
movslq -0x1ac(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    118d <main+0x6d>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11a7 <main+0x77>
xor    %ebx,%ebx
lea    0xea5(%rip),%r14
lea    0xc(%rsp),%r15
mov    0xc(%rsp),%eax
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1160 <main+0x30>
test   %ebx,%ebx
je     11a7 <main+0x77>
mov    %ebx,%r15d
lea    0xe79(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1190 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %9, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = icmp eq i32 1, %7
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %13
store i32 %10, i32* %14
br label %6
15: ; preds = %6
store i32 0, i32* %5
br label %16
16: ; preds = %26, %15
%17 = load i32, i32* %5
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %20
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %16
29: ; preds = %16
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %12, label %26
7: ; preds = %12
%8 = trunc i64 %15 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %7
%11 = and i64 %15, 4294967295
br label %19
12: ; preds = %0, %12
%13 = phi i64 [ %15, %12 ], [ 0, %0 ]
%14 = load i32, i32* %2
%15 = add nuw i64 %13, 1
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %13
store i32 %14, i32* %16
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%18 = icmp eq i32 %17, 1
br i1 %18, label %12, label %7
19: ; preds = %10, %19
%20 = phi i64 [ 0, %10 ], [ %24, %19 ]
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, %11
br i1 %25, label %26, label %19
26: ; preds = %19, %0, %7
%27 = call i32 @putchar(i32 10)
ret i32 0
}