#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(void) {
  int a[10];
  int i, res;
  res = -1;
  for (i = 0; i < 10; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < 10; i++) {
    res = a[i];
    if ((res >= 0) && (res % 2 == 0)) {
      printf("%d\n", res);
    } else if (res < 0 && i < 9 && a[i + 1] >= 0) {
      printf("%d\n", res);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1170 <main+0x50>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea3(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    120c <main+0xec>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jl     11be <main+0x9e>
mov    -0x38(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11be <main+0x9e>
mov    -0x38(%rbp),%esi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0xd9>
cmpl   $0x0,-0x38(%rbp)
jge    11f4 <main+0xd4>
cmpl   $0x9,-0x34(%rbp)
jge    11f4 <main+0xd4>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
cmpl   $0x0,-0x30(%rbp,%rax,4)
jl     11f4 <main+0xd4>
mov    -0x38(%rbp),%esi
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0xd9>
jmp    11fe <main+0xde>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1177 <main+0x57>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xed2(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
xor    %ebx,%ebx
lea    0xe4c(%rip),%r14
jmp    11d2 <main+0xb2>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0xa,%rbx
je     11f0 <main+0xd0>
mov    (%rsp,%rbx,4),%esi
test   $0x80000001,%esi
je     11c0 <main+0xa0>
test   %esi,%esi
jns    11c8 <main+0xa8>
cmp    $0x8,%rbx
ja     11c8 <main+0xa8>
cmpl   $0x0,0x4(%rsp,%rbx,4)
jns    11c0 <main+0xa0>
jmp    11c8 <main+0xa8>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
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 [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %13, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i32], [10 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)
br label %13
13: ; preds = %8
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %5
16: ; preds = %5
store i32 0, i32* %3
br label %17
17: ; preds = %52, %16
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %55
20: ; preds = %17
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = icmp sge i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %20
%28 = load i32, i32* %4
%29 = srem i32 %28, 2
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* %4
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %51
34: ; preds = %27, %20
%35 = load i32, i32* %4
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %50
37: ; preds = %34
%38 = load i32, i32* %3
%39 = icmp slt i32 %38, 9
br i1 %39, label %40, label %50
40: ; preds = %37
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = icmp sge i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %40
%48 = load i32, i32* %4
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %47, %40, %37, %34
br label %51
51: ; preds = %50, %31
br label %52
52: ; preds = %51
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
br label %17
55: ; preds = %17
%56 = load i32, i32* %1
ret i32 %56
}

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