#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 */
struct timeval {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ Selecao(int *, int);
int /*<<< orphan*/ aleatorio(int *, int);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
void *runner(void *param) {
  int tam = 1000;
  int vet[tam];
  double ti, tf, insert, qu, sh, he, se;
  struct timeval tempo_inicio, tempo_fim;
  aleatorio(vet, tam);
  gettimeofday(&tempo_inicio, NULL);
  Selecao(vet, tam);
  gettimeofday(&tempo_fim, NULL);
  tf = (double)tempo_fim.tv_usec + ((double)tempo_fim.tv_sec * 1000000);
  ti = (double)tempo_inicio.tv_usec + ((double)tempo_inicio.tv_sec * 1000000);
  se = (tf - ti);
  printf("|  Selecao  | %.0lf microsegundos \n", se);
  pthread_exit(0);
}


x86 assembly (clang, -O0):
<runner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x88(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%esi
call   1070 <aleatorio@plt>
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x88(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <Selecao@plt>
lea    -0x80(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
cvtsi2sdq -0x78(%rbp),%xmm1
cvtsi2sdq -0x80(%rbp),%xmm0
movsd  0xe2b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdq -0x68(%rbp),%xmm1
cvtsi2sdq -0x70(%rbp),%xmm0
movsd  0xe0a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
lea    0xdea(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <pthread_exit@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runner>:
push   %rbx
sub    $0xfc0,%rsp
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1070 <aleatorio@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1050 <Selecao@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
cvtsi2sdq 0x8(%rsp),%xmm1
cvtsi2sdq (%rsp),%xmm0
movsd  0xe5e(%rip),%xmm2
mulsd  %xmm2,%xmm0
cvtsi2sdq 0x18(%rsp),%xmm3
cvtsi2sdq 0x10(%rsp),%xmm4
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm4
addsd  %xmm3,%xmm4
subsd  %xmm4,%xmm0
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <pthread_exit@plt>
add    $0xfc0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@.str = [36 x i8] c"| Selecao | %.0lf microsegundos \0A\00"
define i8* @runner(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca %struct.timeval
%15 = alloca %struct.timeval
store i8* %0, i8** %3
store i32 1000, i32* %4
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %5
%19 = alloca i32, i64 %17
store i64 %17, i64* %6
%20 = load i32, i32* %4
%21 = call i32 @aleatorio(i32* %19, i32 %20)
%22 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
%23 = load i32, i32* %4
%24 = call i32 @Selecao(i32* %19, i32 %23)
%25 = call i32 @gettimeofday(%struct.timeval* %15, i32* null)
%26 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 1
%27 = load i64, i64* %26
%28 = sitofp i64 %27 to double
%29 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 0
%30 = load i64, i64* %29
%31 = sitofp i64 %30 to double
%32 = call double @llvm.fmuladd.f64(double %31, double 1.000000e+06, double %28)
store double %32, double* %8
%33 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%34 = load i64, i64* %33
%35 = sitofp i64 %34 to double
%36 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%37 = load i64, i64* %36
%38 = sitofp i64 %37 to double
%39 = call double @llvm.fmuladd.f64(double %38, double 1.000000e+06, double %35)
store double %39, double* %7
%40 = load double, double* %8
%41 = load double, double* %7
%42 = fsub double %40, %41
store double %42, double* %13
%43 = load double, double* %13
%44 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %43)
%45 = call i32 @pthread_exit(i32 0)
%46 = load i8*, i8** %5
%47 = load i8*, i8** %2
ret i8* %47
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@.str = [36 x i8] c"| Selecao | %.0lf microsegundos \0A\00"
define noalias i8* @runner(i8* nocapture readnone %0) {
%2 = alloca %struct.timeval
%3 = alloca %struct.timeval
%4 = alloca [1000 x i32]
%5 = getelementptr inbounds [1000 x i32], [1000 x i32]* %4, i64 0, i64 0
%6 = bitcast %struct.timeval* %2 to i8*
%7 = bitcast %struct.timeval* %3 to i8*
%8 = call i32 @aleatorio(i32* %5, i32 1000)
%9 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%10 = call i32 @Selecao(i32* %5, i32 1000)
%11 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%13 = load i64, i64* %12
%14 = sitofp i64 %13 to double
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%16 = load i64, i64* %15
%17 = sitofp i64 %16 to double
%18 = call double @llvm.fmuladd.f64(double %17, double 1.000000e+06, double %14)
%19 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%20 = load i64, i64* %19
%21 = sitofp i64 %20 to double
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%23 = load i64, i64* %22
%24 = sitofp i64 %23 to double
%25 = call double @llvm.fmuladd.f64(double %24, double 1.000000e+06, double %21)
%26 = fsub double %18, %25
%27 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %26)
%28 = call i32 @pthread_exit(i32 0)
ret i8* undef
}