#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 scan();
int main() {
  int a[100];
  int len = 0;
  int x, i;
  x = scan();
  while (x != -1) {
    a[len++] = x;
    x = scan();
  }
  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)
mov    $0x0,%al
call   1040 <scan@plt>
mov    %eax,-0x1a8(%rbp)
cmpl   $0xffffffff,-0x1a8(%rbp)
je     1188 <main+0x68>
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)
mov    $0x0,%al
call   1040 <scan@plt>
mov    %eax,-0x1a8(%rbp)
jmp    1149 <main+0x29>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    11d4 <main+0xb4>
movslq -0x1ac(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    1192 <main+0x72>
lea    0xe29(%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    $0x190,%rsp
xor    %eax,%eax
call   1050 <scan@plt>
cmp    $0xffffffff,%eax
je     1196 <main+0x66>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
xor    %eax,%eax
call   1050 <scan@plt>
cmp    $0xffffffff,%eax
jne    1150 <main+0x20>
test   %ebx,%ebx
je     1196 <main+0x66>
mov    %ebx,%r15d
lea    0xe8f(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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