#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, n, odd = 0, even = 0;
  printf("Please input an integer:");
  scanf("%d", &n);
  do {
    if (n % 2)
      odd = 1;
    else
      even = 1;
  } while (n /= 10);
  if (odd && even)
    printf("both!");
  else if (odd)
    printf("odd number only!");
  else if (even)
    printf("even number only!");
  else
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1179 <main+0x59>
movl   $0x1,-0x10(%rbp)
jmp    1180 <main+0x60>
movl   $0x1,-0x14(%rbp)
jmp    1185 <main+0x65>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    1159 <main+0x39>
cmpl   $0x0,-0x10(%rbp)
je     11c1 <main+0xa1>
cmpl   $0x0,-0x14(%rbp)
je     11c1 <main+0xa1>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
cmpl   $0x0,-0x10(%rbp)
je     11dc <main+0xbc>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
jmp    1201 <main+0xe1>
cmpl   $0x0,-0x14(%rbp)
je     11f7 <main+0xd7>
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
jmp    11fc <main+0xdc>
jmp    11fc <main+0xdc>
jmp    1201 <main+0xe1>
jmp    1206 <main+0xe6>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
mov    0x4(%rsp),%edx
mov    $0x1,%r8d
xor    %ecx,%ecx
nopl   0x0(%rax)
test   $0x1,%dl
cmovne %r8d,%eax
cmove  %r8d,%ecx
movslq %edx,%rdi
imul   $0x66666667,%rdi,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    $0x9,%edi
cmp    $0x12,%edi
ja     1150 <main+0x30>
mov    %edx,0x4(%rsp)
mov    %eax,%edx
or     %ecx,%edx
je     11ae <main+0x8e>
test   %ecx,%ecx
lea    0xe8f(%rip),%rcx
lea    0xe8e(%rip),%rdx
cmove  %rdx,%rcx
test   %eax,%eax
cmove  %rdx,%rcx
lea    0xe8e(%rip),%rdi
cmovne %rcx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"Please input an integer:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"both!\00"
@.str.3 = [17 x i8] c"odd number only!\00"
@.str.4 = [18 x i8] c"even number only!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
br label %6
6: ; preds = %6, %0
%7 = phi i32 [ %5, %0 ], [ %14, %6 ]
%8 = phi i32 [ 0, %0 ], [ %12, %6 ]
%9 = phi i32 [ 0, %0 ], [ %13, %6 ]
%10 = and i32 %7, 1
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 %8, i32 1
%13 = select i1 %11, i32 1, i32 %9
%14 = sdiv i32 %7, 10
%15 = add i32 %7, 9
%16 = icmp ult i32 %15, 19
br i1 %16, label %17, label %6
17: ; preds = %6
store i32 %14, i32* %1
%18 = icmp ne i32 %12, 0
%19 = icmp ne i32 %13, 0
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = select i1 %18, i1 %19, i1 false
%23 = select i1 %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0)
%24 = select i1 %18, i8* %23, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0)
%25 = call i32 @printf(i8* dereferenceable(1) %24)
br label %26
26: ; preds = %17, %21
ret i32 0
}