#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 a[100], i, v = 0;
  for (i = 0; i < 100; i++) {
    scanf("%d", a + i);
    if (a[i] == -1)
      break;
    v++;
  }
  for (i = (v > 3) ? v - 3 : 0; i < v; i++)
    printf("%d ", a[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a8(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    11b1 <main+0x91>
lea    -0x1a0(%rbp),%rsi
movslq -0x1a4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe91(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x1a4(%rbp),%rax
cmpl   $0xffffffff,-0x1a0(%rbp,%rax,4)
ff
jne    118e <main+0x6e>
jmp    11b1 <main+0x91>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1146 <main+0x26>
cmpl   $0x3,-0x1a8(%rbp)
jle    11d2 <main+0xb2>
mov    -0x1a8(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x1ac(%rbp)
jmp    11df <main+0xbf>
xor    %eax,%eax
mov    %eax,-0x1ac(%rbp)
jmp    11df <main+0xbf>
mov    -0x1ac(%rbp),%eax
mov    %eax,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    122b <main+0x10b>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11eb <main+0xcb>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
xor    %r15d,%r15d
lea    0xec3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,(%rbx)
je     1166 <main+0x46>
add    $0xffffffffffffffff,%r15
add    $0x4,%rbx
cmp    $0xffffffffffffff9c,%r15
jne    1140 <main+0x20>
mov    $0x64,%r15d
jmp    1169 <main+0x49>
neg    %r15d
xor    %ecx,%ecx
mov    %r15d,%eax
sub    $0x3,%eax
cmovb  %ecx,%eax
cmp    %r15d,%eax
jae    11b5 <main+0x95>
mov    %eax,%eax
lea    (%rsp,%rax,4),%r12
cmp    $0x3,%r15d
mov    $0x3,%r13d
cmovb  %r15d,%r13d
xor    %ebx,%ebx
lea    0xe6d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r13d
jne    11a0 <main+0x80>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %8
br label %26
20: ; preds = %8
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %23
23: ; preds = %20
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %5
26: ; preds = %19, %5
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, 3
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 3
br label %33
32: ; preds = %26
br label %33
33: ; preds = %32, %29
%34 = phi i32 [ %31, %29 ], [ 0, %32 ]
store i32 %34, i32* %3
br label %35
35: ; preds = %45, %33
%36 = load i32, i32* %3
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %35
48: ; preds = %35
%49 = load i32, i32* %1
ret i32 %49
}

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 = bitcast [100 x i32]* %1 to i8*
br label %3
3: ; preds = %0, %9
%4 = phi i64 [ 0, %0 ], [ %10, %9 ]
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, -1
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = add nuw nsw i64 %4, 1
%11 = icmp eq i64 %10, 100
br i1 %11, label %14, label %3
12: ; preds = %3
%13 = trunc i64 %4 to i32
br label %14
14: ; preds = %9, %12
%15 = phi i32 [ %13, %12 ], [ 100, %9 ]
%16 = call i32 @llvm.usub.sat.i32(i32 %15, i32 3)
%17 = icmp ult i32 %16, %15
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = zext i32 %16 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ %19, %18 ], [ %25, %20 ]
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %21, 1
%26 = trunc i64 %25 to i32
%27 = icmp eq i32 %15, %26
br i1 %27, label %28, label %20
28: ; preds = %20, %14
ret i32 0
}