#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*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x = 0, y = 0, even[10] = {0}, odd[10] = {0};
  int i = 0;
  printf("Enter ten numbers : ");
  while (x + y < 10) {
    int temp = 0;
    scanf("%d", &temp);
    if (temp % 2 == 0)
      even[x++] = temp;
    else
      odd[y++] = temp;
  }
  printf("Even numbers(%d) : ", x);
  for (i = 0; i < x; i++)
    printf("%d ", even[i]);
  printf("\n");
  printf("Odd numbers(%d) : ", y);
  for (i = 0; i < y; i++)
    printf("%d ", odd[i]);
  printf("\n");
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x0,-0x74(%rbp)
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0xa,%eax
jge    1201 <main+0xc1>
movl   $0x0,-0x78(%rbp)
lea    0xe63(%rip),%rdi
lea    -0x78(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x78(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11e8 <main+0xa8>
mov    -0x78(%rbp),%ecx
mov    -0x8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cltq
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    11fc <main+0xbc>
mov    -0x78(%rbp),%ecx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    1195 <main+0x55>
mov    -0x8(%rbp),%esi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1249 <main+0x109>
movslq -0x74(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1219 <main+0xd9>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    129f <main+0x15f>
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%esi
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    126f <main+0x12f>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0x60(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xe82(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe86(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x40(%rsp),%r13
lea    0x10(%rsp),%rbp
xor    %ebx,%ebx
jmp    11cc <main+0x8c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14d,%ecx
lea    0x1(%r14),%esi
mov    %rbp,%rdx
mov    %esi,%r14d
movslq %ecx,%rcx
mov    %eax,(%rdx,%rcx,4)
lea    (%r14,%rbx,1),%eax
cmp    $0xa,%eax
jge    11f3 <main+0xb3>
movl   $0x0,0xc(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   $0x1,%al
jne    11b0 <main+0x70>
mov    %ebx,%ecx
lea    0x1(%rbx),%esi
mov    %r13,%rdx
mov    %esi,%ebx
jmp    11bd <main+0x7d>
lea    0xe1e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    1237 <main+0xf7>
mov    %ebx,%ebp
lea    0xe1c(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x40(%rsp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1220 <main+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xde8(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    1287 <main+0x147>
mov    %r14d,%ebp
lea    0xdcb(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1270 <main+0x130>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter ten numbers : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Even numbers(%d) : \00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [19 x i8] c"Odd numbers(%d) : \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca [10 x i32]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%8 = bitcast [10 x i32]* %4 to i8*
%9 = bitcast [10 x i32]* %5 to i8*
store i32 0, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %33, %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %34
16: ; preds = %11
store i32 0, i32* %7
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%18 = load i32, i32* %7
%19 = srem i32 %18, 2
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %16
%22 = load i32, i32* %7
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %25
store i32 %22, i32* %26
br label %33
27: ; preds = %16
%28 = load i32, i32* %7
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %31
store i32 %28, i32* %32
br label %33
33: ; preds = %27, %21
br label %11
34: ; preds = %11
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %35)
store i32 0, i32* %6
br label %37
37: ; preds = %47, %34
%38 = load i32, i32* %6
%39 = load i32, i32* %2
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %50
41: ; preds = %37
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %41
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %37
50: ; preds = %37
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%52 = load i32, i32* %3
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %52)
store i32 0, i32* %6
br label %54
54: ; preds = %64, %50
%55 = load i32, i32* %6
%56 = load i32, i32* %3
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %67
58: ; preds = %54
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %58
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %54
67: ; preds = %54
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%69 = call i32 (...) @getch()
ret i32 0
}

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