#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*/ free(int *);
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ selecciona_pares(int *, int, int **, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(void) {
  int vector[10], i;
  int *seleccion, seleccionados;
  srand(time(0));
  for (i = 0; i < 10; i++)
    vector[i] = rand();
  selecciona_pares(vector, 10, &seleccion, &seleccionados);
  for (i = 0; i < seleccionados; i++)
    printf("%d\n", seleccion[i]);
  free(seleccion);
  seleccion = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11ad <main+0x4d>
mov    $0x0,%al
call   1080 <rand@plt>
mov    %eax,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1184 <main+0x24>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
lea    -0x40(%rbp),%rdx
lea    -0x44(%rbp),%rcx
call   1060 <selecciona_pares@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11fb <main+0x9b>
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ca <main+0x6a>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x40(%rbp)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x18(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x1c(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x20(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x24(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x28(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x2c(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x30(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,0x34(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    $0xa,%esi
call   1060 <selecciona_pares@plt>
cmpl   $0x0,0x4(%rsp)
jle    122e <main+0xce>
xor    %ebx,%ebx
lea    0xdf4(%rip),%r14
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
mov    (%rax,%rbx,4),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     1210 <main+0xb0>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @time(i32 0)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %11
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %8
19: ; preds = %8
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%21 = call i32 @selecciona_pares(i32* %20, i32 10, i32** %4, i32* %5)
store i32 0, i32* %3
br label %22
22: ; preds = %33, %19
%23 = load i32, i32* %3
%24 = load i32, i32* %5
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i32*, i32** %4
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %26
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %22
36: ; preds = %22
%37 = load i32*, i32** %4
%38 = call i32 @free(i32* %37)
store i32* null, i32** %4
ret i32 0
}

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