#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int scanf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main() {
  char word[10];
  int i = 0;
  while (scanf("%9s", word) == 1) {
    i = i + 1;
    if (i % 2)
      fprintf(stdout, "%s\n", word);
    else
      fprintf(stderr, "%s\n", word);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11a8 <main+0x88>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     118a <main+0x6a>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    -0xe(%rbp),%rdx
lea    0xe84(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11a3 <main+0x83>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    -0xe(%rbp),%rdx
lea    0xe66(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0xe(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    119e <main+0x7e>
mov    $0x1,%ebp
mov    0x2e88(%rip),%r12
mov    0x2e89(%rip),%r13
lea    0xea6(%rip),%r14
lea    0xe(%rsp),%rbx
lea    0xe96(%rip),%r15
jmp    1190 <main+0x70>
nopl   0x0(%rax)
mov    (%rax),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%ebp
cmp    $0x1,%eax
jne    119e <main+0x7e>
mov    %r12,%rax
test   $0x1,%bpl
jne    1170 <main+0x50>
mov    %r13,%rax
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%9s\00"
@stdout = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@stderr = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %22, %0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %23
8: ; preds = %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = srem i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = load i32, i32* @stdout
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %22
18: ; preds = %8
%19 = load i32, i32* @stderr
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %18, %14
br label %4
23: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%9s\00"
@stdout = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@stderr = global i32 0
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %16
5: ; preds = %0, %5
%6 = phi i32 [ %7, %5 ], [ 0, %0 ]
%7 = add nuw nsw i32 %6, 1
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
%10 = load i32, i32* @stderr
%11 = load i32, i32* @stdout
%12 = select i1 %9, i32 %10, i32 %11
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%15 = icmp eq i32 %14, 1
br i1 %15, label %5, label %16
16: ; preds = %5, %0
ret i32 0
}