#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printSeznam(unsigned int *, int);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sodiBubleSort(unsigned int *, unsigned int *, int);
int main() {
  int n;
  scanf("%d", &n);
  unsigned int *tabela = (unsigned int *)malloc(sizeof(unsigned int) * n);
  unsigned int *nova_tabela = (unsigned int *)malloc(sizeof(unsigned int) * n);
  if (tabela == NULL || nova_tabela == NULL) {
    return 1;
  }
  int j = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%u", &tabela[i]);
    if (tabela[i] % 2 == 0) {
      nova_tabela[j] = i;
      j++;
    }
  }
  sodiBubleSort(tabela, nova_tabela, j);
  printSeznam(tabela, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     119d <main+0x5d>
cmpq   $0x0,-0x18(%rbp)
jne    11a9 <main+0x69>
movl   $0x1,-0x4(%rbp)
jmp    1244 <main+0x104>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1221 <main+0xe1>
mov    -0x10(%rbp),%rsi
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    120e <main+0xce>
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1213 <main+0xd3>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b7 <main+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <sodiBubleSort@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <printSeznam@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,%r15
mov    $0x1,%eax
test   %r13,%r13
je     11ff <main+0xbf>
test   %r15,%r15
je     11ff <main+0xbf>
cmpl   $0x0,0x4(%rsp)
mov    $0x0,%ebp
jle    11e4 <main+0xa4>
lea    0xe65(%rip),%r12
xor    %ebx,%ebx
xor    %r14d,%r14d
xor    %ebp,%ebp
jmp    11c2 <main+0x82>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
movslq 0x4(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r14
jge    11e4 <main+0xa4>
lea    (%rbx,%r13,1),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
testb  $0x1,0x0(%r13,%r14,4)
jne    11b0 <main+0x70>
movslq %ebp,%rbp
mov    %r14d,(%r15,%rbp,4)
add    $0x1,%ebp
jmp    11b0 <main+0x70>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <sodiBubleSort@plt>
mov    0x4(%rsp),%esi
mov    %r13,%rdi
call   1060 <printSeznam@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = shl i32 %4, 2
%6 = call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i32*
%8 = load i32, i32* %1
%9 = shl i32 %8, 2
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
%12 = icmp eq i64 %6, 0
%13 = icmp eq i64 %10, 0
%14 = select i1 %12, i1 true, i1 %13
br i1 %14, label %42, label %15
15: ; preds = %0
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %36, %15
%19 = phi i32 [ 0, %15 ], [ %37, %36 ]
%20 = call i32 @sodiBubleSort(i32* %7, i32* %11, i32 %19)
%21 = load i32, i32* %1
%22 = call i32 @printSeznam(i32* %7, i32 %21)
br label %42
23: ; preds = %15, %36
%24 = phi i64 [ %38, %36 ], [ 0, %15 ]
%25 = phi i32 [ %37, %36 ], [ 0, %15 ]
%26 = getelementptr inbounds i32, i32* %7, i64 %24
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %26)
%28 = load i32, i32* %26
%29 = and i32 %28, 1
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %23
%32 = sext i32 %25 to i64
%33 = getelementptr inbounds i32, i32* %11, i64 %32
%34 = trunc i64 %24 to i32
store i32 %34, i32* %33
%35 = add nsw i32 %25, 1
br label %36
36: ; preds = %23, %31
%37 = phi i32 [ %35, %31 ], [ %25, %23 ]
%38 = add nuw nsw i64 %24, 1
%39 = load i32, i32* %1
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %23, label %18
42: ; preds = %0, %18
%43 = phi i32 [ 0, %18 ], [ 1, %0 ]
ret i32 %43
}