#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);
scalar_t__ scanf(char *, int *);
int main() {
  int in[100000], len, i;
  len = 0;
  while (scanf("%d", &i)) {
    if (i == -1)
      break;
    in[len] = i;
    len++;
  }
  for (i = len - 1; i >= 0; i--)
    printf("%d\n", in[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x61a94(%rbp)
lea    0xebd(%rip),%rdi
lea    -0x61a98(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     1193 <main+0x73>
cmpl   $0xffffffff,-0x61a98(%rbp)
jne    116b <main+0x4b>
jmp    1193 <main+0x73>
mov    -0x61a98(%rbp),%ecx
movslq -0x61a94(%rbp),%rax
mov    %ecx,-0x61a90(%rbp,%rax,4)
mov    -0x61a94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a94(%rbp)
jmp    113c <main+0x1c>
mov    -0x61a94(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x61a98(%rbp)
cmpl   $0x0,-0x61a98(%rbp)
jl     11dd <main+0xbd>
movslq -0x61a98(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%esi
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x61a98(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x61a98(%rbp)
jmp    11a2 <main+0x82>
xor    %eax,%eax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x61a90,%rsp
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11bd <main+0x9d>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     11bd <main+0x9d>
xor    %ebx,%ebx
lea    0xeac(%rip),%r14
lea    0xc(%rsp),%r15
nopl   0x0(%rax)
mov    %eax,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1181 <main+0x61>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
jne    1160 <main+0x40>
lea    -0x1(%rbx),%rax
mov    %eax,0xc(%rsp)
test   %ebx,%ebx
jle    11bd <main+0x9d>
lea    0xe6f(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%eax
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
test   %ecx,%ecx
jg     11a0 <main+0x80>
xor    %eax,%eax
add    $0x61a90,%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\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100000 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %12, %0
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %8
br label %19
12: ; preds = %8
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %15
store i32 %13, i32* %16
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %5
19: ; preds = %11, %5
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %4
br label %22
22: ; preds = %31, %19
%23 = load i32, i32* %4
%24 = icmp sge i32 %23, 0
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %4
%33 = add nsw i32 %32, -1
store i32 %33, i32* %4
br label %22
34: ; preds = %22
ret i32 0
}

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