#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int main(void) {
  char a;
  int even = 0, odd = 0;
  a = getchar();
  while (a != '\n') {
    if ((a - '0') % 2 == 0) {
      even++;
    } else {
      odd++;
    }
    a = getchar();
  }
  if (0 != odd && 0 != even) {
    printf("both");
  } else if (0 == odd) {
    printf("even only");
  } else {
    printf("odd only");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1192 <main+0x72>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117a <main+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1183 <main+0x63>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    1147 <main+0x27>
xor    %eax,%eax
cmp    -0x10(%rbp),%eax
je     11b9 <main+0x99>
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
je     11b9 <main+0x99>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
jmp    11e6 <main+0xc6>
xor    %eax,%eax
cmp    -0x10(%rbp),%eax
jne    11d5 <main+0xb5>
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0xc1>
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
jmp    11e6 <main+0xc6>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1137 <main+0x17>
lea    0xed0(%rip),%rdi
jmp    117e <main+0x5e>
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
and    $0x1,%al
movzbl %al,%ecx
xor    $0x1,%al
movzbl %al,%eax
add    %eax,%ebp
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1140 <main+0x20>
test   %ebx,%ebx
je     116a <main+0x4a>
test   %ebp,%ebp
je     116a <main+0x4a>
lea    0xe98(%rip),%rdi
jmp    117e <main+0x5e>
test   %ebx,%ebx
lea    0xe92(%rip),%rax
lea    0xe95(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"both\00"
@.str.1 = [10 x i8] c"even only\00"
@.str.2 = [9 x i8] c"odd only\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 10
br i1 %2, label %22, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %12, %3 ], [ 0, %0 ]
%5 = phi i32 [ %10, %3 ], [ 0, %0 ]
%6 = phi i8 [ %13, %3 ], [ %1, %0 ]
%7 = and i8 %6, 1
%8 = xor i8 %7, 1
%9 = zext i8 %8 to i32
%10 = add nuw nsw i32 %5, %9
%11 = zext i8 %7 to i32
%12 = add nuw nsw i32 %4, %11
%13 = tail call signext i8 (...) @getchar()
%14 = icmp eq i8 %13, 10
br i1 %14, label %15, label %3
15: ; preds = %3
%16 = icmp ne i32 %10, 0
%17 = icmp ne i32 %12, 0
%18 = select i1 %17, i1 %16, i1 false
br i1 %18, label %22, label %19
19: ; preds = %15
%20 = icmp eq i32 %12, 0
%21 = select i1 %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0)
br label %22
22: ; preds = %19, %0, %15
%23 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %15 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %0 ], [ %21, %19 ]
%24 = tail call i32 @printf(i8* dereferenceable(1) %23)
ret i32 0
}