#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int inteiros[299], i, stop;
  for (i = 299; i >= 0; i--) {
    scanf("%d", &inteiros[i]);
    if (inteiros[i] < 0) {
      stop = i;
      break;
    }
  }
  for (i = 0; i < stop; i++)
    printf("%d ", inteiros[i]);
  printf("%d\n", inteiros[stop]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x12b,-0x4b4(%rbp)
cmpl   $0x0,-0x4b4(%rbp)
jl     11a9 <main+0x89>
movslq -0x4b4(%rbp),%rax
lea    -0x4b0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9b(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x4b4(%rbp),%rax
cmpl   $0x0,-0x4b0(%rbp,%rax,4)
jge    1190 <main+0x70>
mov    -0x4b4(%rbp),%eax
mov    %eax,-0x4b8(%rbp)
jmp    11a9 <main+0x89>
jmp    1195 <main+0x75>
mov    -0x4b4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4b4(%rbp)
jmp    113c <main+0x1c>
movl   $0x0,-0x4b4(%rbp)
mov    -0x4b4(%rbp),%eax
cmp    -0x4b8(%rbp),%eax
jge    11f3 <main+0xd3>
movslq -0x4b4(%rbp),%rax
mov    -0x4b0(%rbp,%rax,4),%esi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4b4(%rbp)
jmp    11b3 <main+0x93>
movslq -0x4b8(%rbp),%rax
mov    -0x4b0(%rbp,%rax,4),%esi
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x4b8,%rsp
mov    $0x12b,%r15d
lea    0xec5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r15d,%ebx
lea    (%rsp,%rbx,4),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp,%rbx,4)
js     1167 <main+0x47>
add    $0xffffffffffffffff,%r15
cmp    $0xffffffff,%r15d
jne    1140 <main+0x20>
mov    $0xffffffff,%r15d
jmp    1194 <main+0x74>
test   %r15d,%r15d
jle    1194 <main+0x74>
mov    %rsp,%rbx
lea    0xe8d(%rip),%r14
mov    %r15,%r12
nopl   0x0(%rax)
mov    (%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r12
jne    1180 <main+0x60>
movslq %r15d,%rax
mov    (%rsp,%rax,4),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4b8,%rsp
pop    %rbx
pop    %r12
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 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [299 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 299, i32* %3
br label %5
5: ; preds = %21, %0
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [299 x i32], [299 x i32]* %2, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [299 x i32], [299 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %8
%19 = load i32, i32* %3
store i32 %19, i32* %4
br label %24
20: ; preds = %8
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %5
24: ; preds = %18, %5
store i32 0, i32* %3
br label %25
25: ; preds = %35, %24
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [299 x i32], [299 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %25
38: ; preds = %25
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [299 x i32], [299 x i32]* %2, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %42)
ret i32 0
}

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