#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(void) {
  int i, arr[10], pos[10], neg[10], p = 0, n = 0;
  printf("Enter the value of n:");
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &arr[i]);
  for (i = 0; i < n; i++)
    if (arr[i] % 2 == 0)
      pos[p++] = arr[i];
    else
      neg[n++] = arr[i];
  printf("The positive numbers are\n");
  for (i = 0; i < p; i++)
    printf("%d\n", pos[i]);
  printf("The negative numbers are\n");
  for (i = 0; i < n; i++)
    printf("%d\n", neg[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x98(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x98(%rbp),%eax
jge    11a6 <main+0x86>
movslq -0x8(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe83(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main+0x4e>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x98(%rbp),%eax
jge    122e <main+0x10e>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f9 <main+0xd9>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
mov    -0x94(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x94(%rbp)
cltq
mov    %ecx,-0x60(%rbp,%rax,4)
jmp    121b <main+0xfb>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
mov    -0x98(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x98(%rbp)
cltq
mov    %ecx,-0x90(%rbp,%rax,4)
jmp    1220 <main+0x100>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ad <main+0x8d>
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    1276 <main+0x156>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1243 <main+0x123>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x98(%rbp),%eax
jge    12c1 <main+0x1a1>
movslq -0x8(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%esi
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    128b <main+0x16b>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
movl   $0x0,0xc(%rsp)
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11f2 <main+0xc2>
lea    0x70(%rsp),%r15
xor    %ebx,%ebx
lea    0xe9a(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1180 <main+0x50>
test   %eax,%eax
jle    11f2 <main+0xc2>
xor    %ecx,%ecx
lea    0x40(%rsp),%r8
lea    0x10(%rsp),%r9
xor    %ebx,%ebx
jmp    11de <main+0xae>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%edx
add    $0x1,%eax
mov    %eax,0xc(%rsp)
mov    %r9,%rsi
movslq %edx,%rdx
mov    %edi,(%rsi,%rdx,4)
add    $0x1,%rcx
movslq %eax,%rdx
cmp    %rdx,%rcx
jge    1200 <main+0xd0>
mov    0x70(%rsp,%rcx,4),%edi
test   $0x1,%dil
jne    11c0 <main+0x90>
mov    %ebx,%edx
add    $0x1,%ebx
mov    %r8,%rsi
jmp    11cc <main+0x9c>
lea    0xe24(%rip),%rdi
call   1030 <puts@plt>
jmp    1237 <main+0x107>
lea    0xe16(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    1237 <main+0x107>
mov    %ebx,%r15d
lea    0xdff(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x40(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1220 <main+0xf0>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    127c <main+0x14c>
lea    0xdc8(%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
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1260 <main+0x130>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the value of n:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"The positive numbers are\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [26 x i8] c"The negative numbers are\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x 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* %6
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
store i32 0, i32* %2
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %2
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %10
22: ; preds = %10
store i32 0, i32* %2
br label %23
23: ; preds = %53, %22
%24 = load i32, i32* %2
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %56
27: ; preds = %23
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = srem i32 %31, 2
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %43
34: ; preds = %27
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %41
store i32 %38, i32* %42
br label %52
43: ; preds = %27
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %50
store i32 %47, i32* %51
br label %52
52: ; preds = %43, %34
br label %53
53: ; preds = %52
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
br label %23
56: ; preds = %23
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %58
58: ; preds = %68, %56
%59 = load i32, i32* %2
%60 = load i32, i32* %6
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %71
62: ; preds = %58
%63 = load i32, i32* %2
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %66)
br label %68
68: ; preds = %62
%69 = load i32, i32* %2
%70 = add nsw i32 %69, 1
store i32 %70, i32* %2
br label %58
71: ; preds = %58
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %2
br label %73
73: ; preds = %83, %71
%74 = load i32, i32* %2
%75 = load i32, i32* %7
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %86
77: ; preds = %73
%78 = load i32, i32* %2
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %81)
br label %83
83: ; preds = %77
%84 = load i32, i32* %2
%85 = add nsw i32 %84, 1
store i32 %85, i32* %2
br label %73
86: ; preds = %73
ret i32 0
}

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