#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*/ Insercao(int, int *);
int /*<<< orphan*/ Mergesort(int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ Quicksort(int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ Selecao(int, int *);
double abst(double);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int num_buscas(int *, int *, int, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, double *);
double tempo();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ vetor_copy(int *, int *, int);
int /*<<< orphan*/ vetor_rand(int *, int);
int main(int argc, char **argv) {
  double duracao, tempo_inicial, tempo_total, inicio_temp, tempo_ordenacao_sel,
      tempo_ordenacao_ins, tempo_ordenacao_merge, tempo_ordenacao_quick;
  int n, *v, *v_aux, buscas_sel, buscas_ins, buscas_merge, buscas_quick;
  char algoritmo;
  srand(time(NULL));
  if (argc != 3) {
    printf("Uso: %s tipo duracao\n", argv[0]);
    printf("   tipo: s(elecao) ou i(nsercao) ou m(ergesort) ou q(uicksort) ou "
           "t(odos)\n");
    printf("   duracao: duracao em segundos\n");
    return (0);
  }
  algoritmo = argv[1][0];
  if (algoritmo != 's' && algoritmo != 'i' && algoritmo != 'm' &&
      algoritmo != 'q' && algoritmo != 't') {
    printf("opcao nao valida\n");
    return (-1);
  }
  sscanf(argv[2], "%lf", &duracao);
  printf("|-------------------------[EP1 - Vale a pena "
         "ordenar?]--------------------|\n"
         "|  Algoritmo escolhido: %10s     Duracao dos testes: %9.2f      |\n"
         "|            Tempos de Ordenacao                 Numero de Buscas    "
         "     |\n"
         "|            Nome: Ariane Prado                                      "
         "     |\n"
         "|--------------------------------------------------------------------"
         "-----|\n"
         "|   n   | Insercao Selecao Merge. Quick. | Insercao Selecao Merge. "
         "Quick. |\n"
         "|-------|------------------------------------------------------------"
         "-----|\n",
         algoritmo == 's'   ? "selecao"
         : algoritmo == 'i' ? "insercao"
         : algoritmo == 'm' ? "mergesort"
         : algoritmo == 'q' ? "quicksort"
                            : "todos",
         duracao);
  tempo_inicial = tempo();
  tempo_total = 0;
  for (n = 2000; tempo_total < duracao; n += 2000) {
    v = malloc(n * sizeof(int));
    if (v == NULL) {
      printf("Erro na alocacao de memoria para o vetor v com %d elementos.\n",
             n);
      return (-1);
    }
    v_aux = malloc(n * sizeof(int));
    if (v_aux == NULL) {
      printf(
          "Erro na alocacao de memoria para o vetor v_aux com %d elementos.\n",
          n);
      return (-1);
    }
    vetor_rand(v, n);
    vetor_copy(v, v_aux, n);
    if (algoritmo == 's' || algoritmo == 't') {
      inicio_temp = tempo();
      Selecao(n, v_aux);
      tempo_ordenacao_sel = abst(tempo() - inicio_temp);
      buscas_sel = num_buscas(v, v_aux, n, tempo_ordenacao_sel);
      if (algoritmo != 't')
        printf("%d  \t            %4.2f                              %d\t\n", n,
               tempo_ordenacao_sel, buscas_sel);
      if (algoritmo != 's')
        vetor_copy(v, v_aux, n);
    }
    if (algoritmo == 'i' || algoritmo == 't') {
      inicio_temp = tempo();
      Insercao(n, v_aux);
      tempo_ordenacao_ins = abst(tempo() - inicio_temp);
      buscas_ins = num_buscas(v, v_aux, n, tempo_ordenacao_ins);
      if (algoritmo != 't')
        printf("%d  \t    %4.2f                              %d\t\n", n,
               tempo_ordenacao_ins, buscas_ins);
      if (algoritmo != 'i')
        vetor_copy(v, v_aux, n);
    }
    if (algoritmo == 'm' || algoritmo == 't') {
      inicio_temp = tempo();
      Mergesort(0, n - 1, v_aux);
      tempo_ordenacao_merge = abst(tempo() - inicio_temp);
      buscas_merge = num_buscas(v, v_aux, n, tempo_ordenacao_merge);
      if (algoritmo != 't')
        printf("%d\t\t\t   %4.2f\t\t\t\t    %d\t\n", n, tempo_ordenacao_merge,
               buscas_merge);
      if (algoritmo != 'm')
        vetor_copy(v, v_aux, n);
    }
    if (algoritmo == 'q' || algoritmo == 't') {
      inicio_temp = tempo();
      Quicksort(0, n - 1, v_aux);
      tempo_ordenacao_quick = abst(tempo() - inicio_temp);
      buscas_quick = num_buscas(v, v_aux, n, tempo_ordenacao_quick);
      if (algoritmo != 't')
        printf("%d \t\t                   %4.2f                \t           "
               "%d\t\n",
               n, tempo_ordenacao_quick, buscas_quick);
    }
    if (algoritmo == 't') {
      printf("%d\t   %4.2f\t   %4.2f\t   %4.2f\t   %4.2f", n,
             tempo_ordenacao_ins, tempo_ordenacao_sel, tempo_ordenacao_merge,
             tempo_ordenacao_quick);
      printf("\t %d\t %d\t %d\t %d\n", buscas_ins, buscas_sel, buscas_merge,
             buscas_quick);
    }
    free(v);
    free(v_aux);
    tempo_total = tempo() - tempo_inicial;
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
cmpl   $0x3,-0x8(%rbp)
je     1260 <main+0x70>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    176b <main+0x57b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x79(%rbp)
movsbl -0x79(%rbp),%eax
cmp    $0x73,%eax
je     12c8 <main+0xd8>
movsbl -0x79(%rbp),%eax
cmp    $0x69,%eax
je     12c8 <main+0xd8>
movsbl -0x79(%rbp),%eax
cmp    $0x6d,%eax
je     12c8 <main+0xd8>
movsbl -0x79(%rbp),%eax
cmp    $0x71,%eax
je     12c8 <main+0xd8>
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
je     12c8 <main+0xd8>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    176b <main+0x57b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdbd(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   10e0 <sscanf@plt>
movsbl -0x79(%rbp),%eax
cmp    $0x73,%eax
jne    1300 <main+0x110>
lea    0xfaf(%rip),%rax
mov    %rax,-0x88(%rbp)
jmp    137c <main+0x18c>
movsbl -0x79(%rbp),%eax
cmp    $0x69,%eax
jne    1320 <main+0x130>
lea    0xf97(%rip),%rax
mov    %rax,-0x90(%rbp)
jmp    136e <main+0x17e>
movsbl -0x79(%rbp),%eax
cmp    $0x6d,%eax
jne    1340 <main+0x150>
lea    0xf80(%rip),%rax
mov    %rax,-0x98(%rbp)
jmp    1360 <main+0x170>
movsbl -0x79(%rbp),%edx
lea    0xf7d(%rip),%rax
lea    0xf6c(%rip),%rcx
cmp    $0x71,%edx
cmove  %rcx,%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
lea    0xd09(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10f0 <tempo@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x7d0,-0x54(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1764 <main+0x574>
movslq -0x54(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1400 <main+0x210>
mov    -0x54(%rbp),%esi
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    176b <main+0x57b>
movslq -0x54(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    143b <main+0x24b>
mov    -0x54(%rbp),%esi
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    176b <main+0x57b>
mov    -0x60(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1070 <vetor_rand@plt>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
call   10a0 <vetor_copy@plt>
movsbl -0x79(%rbp),%eax
cmp    $0x73,%eax
je     1471 <main+0x281>
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
jne    14ff <main+0x30f>
mov    $0x0,%al
call   10f0 <tempo@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x68(%rbp),%rsi
call   10c0 <Selecao@plt>
mov    $0x0,%al
call   10f0 <tempo@plt>
subsd  -0x30(%rbp),%xmm0
call   1100 <abst@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
movsd  -0x38(%rbp),%xmm0
call   1110 <num_buscas@plt>
mov    %eax,-0x6c(%rbp)
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
je     14dd <main+0x2ed>
mov    -0x54(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
mov    -0x6c(%rbp),%edx
lea    0xe78(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsbl -0x79(%rbp),%eax
cmp    $0x73,%eax
je     14fa <main+0x30a>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
call   10a0 <vetor_copy@plt>
jmp    14ff <main+0x30f>
movsbl -0x79(%rbp),%eax
cmp    $0x69,%eax
je     1519 <main+0x329>
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
jne    15a7 <main+0x3b7>
mov    $0x0,%al
call   10f0 <tempo@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x68(%rbp),%rsi
call   1090 <Insercao@plt>
mov    $0x0,%al
call   10f0 <tempo@plt>
subsd  -0x30(%rbp),%xmm0
call   1100 <abst@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
movsd  -0x40(%rbp),%xmm0
call   1110 <num_buscas@plt>
mov    %eax,-0x70(%rbp)
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
je     1585 <main+0x395>
mov    -0x54(%rbp),%esi
movsd  -0x40(%rbp),%xmm0
mov    -0x70(%rbp),%edx
lea    0xe09(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsbl -0x79(%rbp),%eax
cmp    $0x69,%eax
je     15a2 <main+0x3b2>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
call   10a0 <vetor_copy@plt>
jmp    15a7 <main+0x3b7>
movsbl -0x79(%rbp),%eax
cmp    $0x6d,%eax
je     15c1 <main+0x3d1>
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
jne    1654 <main+0x464>
mov    $0x0,%al
call   10f0 <tempo@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x54(%rbp),%esi
sub    $0x1,%esi
mov    -0x68(%rbp),%rdx
xor    %edi,%edi
call   1040 <Mergesort@plt>
mov    $0x0,%al
call   10f0 <tempo@plt>
subsd  -0x30(%rbp),%xmm0
call   1100 <abst@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
movsd  -0x48(%rbp),%xmm0
call   1110 <num_buscas@plt>
mov    %eax,-0x74(%rbp)
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
je     1632 <main+0x442>
mov    -0x54(%rbp),%esi
movsd  -0x48(%rbp),%xmm0
mov    -0x74(%rbp),%edx
lea    0xd8d(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsbl -0x79(%rbp),%eax
cmp    $0x6d,%eax
je     164f <main+0x45f>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
call   10a0 <vetor_copy@plt>
jmp    1654 <main+0x464>
movsbl -0x79(%rbp),%eax
cmp    $0x71,%eax
je     166e <main+0x47e>
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
jne    16e4 <main+0x4f4>
mov    $0x0,%al
call   10f0 <tempo@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x54(%rbp),%esi
sub    $0x1,%esi
mov    -0x68(%rbp),%rdx
xor    %edi,%edi
call   1050 <Quicksort@plt>
mov    $0x0,%al
call   10f0 <tempo@plt>
subsd  -0x30(%rbp),%xmm0
call   1100 <abst@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x54(%rbp),%edx
movsd  -0x50(%rbp),%xmm0
call   1110 <num_buscas@plt>
mov    %eax,-0x78(%rbp)
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
je     16df <main+0x4ef>
mov    -0x54(%rbp),%esi
movsd  -0x50(%rbp),%xmm0
mov    -0x78(%rbp),%edx
lea    0xcfa(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    16e4 <main+0x4f4>
movsbl -0x79(%rbp),%eax
cmp    $0x74,%eax
jne    1731 <main+0x541>
mov    -0x54(%rbp),%esi
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
lea    0xd01(%rip),%rdi
mov    $0x4,%al
call   1060 <printf@plt>
mov    -0x70(%rbp),%esi
mov    -0x6c(%rbp),%edx
mov    -0x74(%rbp),%ecx
mov    -0x78(%rbp),%r8d
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10f0 <tempo@plt>
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x54(%rbp),%eax
add    $0x7d0,%eax
mov    %eax,-0x54(%rbp)
jmp    13b1 <main+0x1c1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
xor    %ebp,%ebp
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
cmp    $0x3,%ebx
jne    127e <main+0x7e>
mov    0x8(%r14),%rax
mov    (%rax),%r12b
lea    -0x69(%r12),%eax
cmp    $0xb,%al
ja     160f <main+0x40f>
movzbl %al,%eax
mov    $0xd11,%ecx
bt     %rax,%rcx
jae    160f <main+0x40f>
mov    0x10(%r14),%rdi
lea    0xdbd(%rip),%rsi
lea    0x30(%rsp),%rdx
call   10f0 <sscanf@plt>
cmp    $0x69,%r12b
je     12ac <main+0xac>
cmp    $0x6d,%r12b
je     12b5 <main+0xb5>
cmp    $0x73,%r12b
jne    12be <main+0xbe>
lea    0xfa9(%rip),%rsi
jmp    12d4 <main+0xd4>
mov    (%r14),%rsi
lea    0xd78(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x1146(%rip),%rdi
call   1050 <puts@plt>
lea    0x1184(%rip),%rdi
call   1050 <puts@plt>
jmp    163b <main+0x43b>
lea    0xf7a(%rip),%rsi
jmp    12d4 <main+0xd4>
lea    0xf7a(%rip),%rsi
jmp    12d4 <main+0xd4>
cmp    $0x71,%r12b
lea    0xf77(%rip),%rax
lea    0xf7a(%rip),%rsi
cmove  %rax,%rsi
movsd  0x30(%rsp),%xmm0
lea    0xd39(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1100 <tempo@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x30(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    163b <main+0x43b>
lea    -0x73(%r12),%eax
mov    %eax,0x3c(%rsp)
mov    $0x7d0,%ebx
mov    $0x1f40,%r13d
jmp    13b3 <main+0x1b3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x105b(%rip),%rdi
mov    %ebx,%esi
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
mov    $0x4,%al
call   1070 <printf@plt>
lea    0x105a(%rip),%rdi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x4(%rsp),%ecx
mov    0x38(%rsp),%r8d
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1100 <tempo@plt>
subsd  0x40(%rsp),%xmm0
add    $0x7d0,%ebx
movsd  0x30(%rsp),%xmm1
add    $0x1f40,%r13d
ucomisd %xmm0,%xmm1
jbe    163b <main+0x43b>
mov    %r13d,%edi
call   10e0 <malloc@plt>
test   %rax,%rax
je     161d <main+0x41d>
mov    %rax,%r14
mov    %r13d,%edi
call   10e0 <malloc@plt>
test   %rax,%rax
je     1626 <main+0x426>
mov    %rax,%r15
mov    %r14,%rdi
mov    %ebx,%esi
call   1080 <vetor_rand@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   10b0 <vetor_copy@plt>
cmpb   $0x1,0x3c(%rsp)
ja     1480 <main+0x280>
xor    %eax,%eax
call   1100 <tempo@plt>
movsd  %xmm0,0x28(%rsp)
mov    %ebx,%edi
mov    %r15,%rsi
call   10d0 <Selecao@plt>
xor    %eax,%eax
call   1100 <tempo@plt>
subsd  0x28(%rsp),%xmm0
call   1110 <abst@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
movsd  %xmm0,0x28(%rsp)
call   1120 <num_buscas@plt>
mov    %eax,0xc(%rsp)
cmp    $0x74,%r12b
je     145d <main+0x25d>
lea    0xe86(%rip),%rdi
mov    %ebx,%esi
movsd  0x28(%rsp),%xmm0
mov    0xc(%rsp),%edx
mov    $0x1,%al
call   1070 <printf@plt>
cmp    $0x73,%r12b
je     1600 <main+0x400>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   10b0 <vetor_copy@plt>
jmp    1486 <main+0x286>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x69,%r12b
jne    14fd <main+0x2fd>
xor    %eax,%eax
call   1100 <tempo@plt>
movsd  %xmm0,0x20(%rsp)
mov    %ebx,%edi
mov    %r15,%rsi
call   10a0 <Insercao@plt>
xor    %eax,%eax
call   1100 <tempo@plt>
subsd  0x20(%rsp),%xmm0
call   1110 <abst@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
movsd  %xmm0,0x20(%rsp)
call   1120 <num_buscas@plt>
mov    %eax,0x8(%rsp)
cmp    $0x74,%r12b
je     14e6 <main+0x2e6>
lea    0xe36(%rip),%rdi
mov    %ebx,%esi
movsd  0x20(%rsp),%xmm0
mov    0x8(%rsp),%edx
mov    $0x1,%al
call   1070 <printf@plt>
cmp    $0x69,%r12b
je     1600 <main+0x400>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   10b0 <vetor_copy@plt>
cmp    $0x74,%r12b
je     1509 <main+0x309>
cmp    $0x6d,%r12b
jne    1583 <main+0x383>
xor    %eax,%eax
call   1100 <tempo@plt>
movsd  %xmm0,0x18(%rsp)
lea    -0x1(%rbx),%esi
xor    %edi,%edi
mov    %r15,%rdx
call   1040 <Mergesort@plt>
xor    %eax,%eax
call   1100 <tempo@plt>
subsd  0x18(%rsp),%xmm0
call   1110 <abst@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
movsd  %xmm0,0x18(%rsp)
call   1120 <num_buscas@plt>
mov    %eax,0x4(%rsp)
cmp    $0x74,%r12b
je     156c <main+0x36c>
lea    0xde1(%rip),%rdi
mov    %ebx,%esi
movsd  0x18(%rsp),%xmm0
mov    0x4(%rsp),%edx
mov    $0x1,%al
call   1070 <printf@plt>
cmp    $0x6d,%r12b
je     1600 <main+0x400>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   10b0 <vetor_copy@plt>
cmp    $0x74,%r12b
je     158f <main+0x38f>
cmp    $0x71,%r12b
jne    1600 <main+0x400>
xor    %eax,%eax
call   1100 <tempo@plt>
movsd  %xmm0,0x10(%rsp)
lea    -0x1(%rbx),%esi
xor    %edi,%edi
mov    %r15,%rdx
call   1060 <Quicksort@plt>
xor    %eax,%eax
call   1100 <tempo@plt>
subsd  0x10(%rsp),%xmm0
call   1110 <abst@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
movsd  %xmm0,0x10(%rsp)
call   1120 <num_buscas@plt>
cmp    $0x74,%r12b
mov    %eax,0x38(%rsp)
je     1330 <main+0x130>
lea    0xd71(%rip),%rdi
mov    %ebx,%esi
movsd  0x10(%rsp),%xmm0
mov    %eax,%edx
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1377 <main+0x177>
nopl   0x0(%rax)
cmp    $0x74,%r12b
jne    1377 <main+0x177>
jmp    1330 <main+0x130>
lea    0xdb5(%rip),%rdi
call   1050 <puts@plt>
jmp    1636 <main+0x436>
lea    0xc2c(%rip),%rdi
jmp    162d <main+0x42d>
lea    0xc61(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Uso: %s tipo duracao\0A\00"
@.str.1 = [75 x i8] c" tipo: s(elecao) ou i(nsercao) ou m(ergesort) ou q(uicksort) ou t(odos)\0A\00"
@.str.2 = [33 x i8] c" duracao: duracao em segundos\0A\00"
@.str.3 = [18 x i8] c"opcao nao valida\0A\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [523 x i8] c"|-------------------------[EP1 - Vale a pena ordenar?]--------------------|\0A| Algoritmo escolhido: %10s Duracao dos testes: %9.2f |\0A| Tempos de Ordenacao Numero de Buscas |\0A| Nome: Ariane Prado |\0A|-------------------------------------------------------------------------|\0A| n | Insercao Selecao Merge. Quick. | Insercao Selecao Merge. Quick. |\0A|-------|-----------------------------------------------------------------|\0A\00"
@.str.6 = [8 x i8] c"selecao\00"
@.str.7 = [9 x i8] c"insercao\00"
@.str.8 = [10 x i8] c"mergesort\00"
@.str.9 = [10 x i8] c"quicksort\00"
@.str.10 = [6 x i8] c"todos\00"
@.str.11 = [62 x i8] c"Erro na alocacao de memoria para o vetor v com %d elementos.\0A\00"
@.str.12 = [66 x i8] c"Erro na alocacao de memoria para o vetor v_aux com %d elementos.\0A\00"
@.str.13 = [57 x i8] c"%d \09 %4.2f %d\09\0A\00"
@.str.14 = [49 x i8] c"%d \09 %4.2f %d\09\0A\00"
@.str.15 = [26 x i8] c"%d\09\09\09 %4.2f\09\09\09\09 %d\09\0A\00"
@.str.16 = [62 x i8] c"%d \09\09 %4.2f \09 %d\09\0A\00"
@.str.17 = [39 x i8] c"%d\09 %4.2f\09 %4.2f\09 %4.2f\09 %4.2f\00"
@.str.18 = [18 x i8] c"\09 %d\09 %d\09 %d\09 %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = call i32 @time(i32* null)
%23 = call i32 @srand(i32 %22)
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 3
br i1 %25, label %26, label %33
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %308
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = getelementptr inbounds i8, i8* %36, i64 0
%38 = load i8, i8* %37
store i8 %38, i8* %21
%39 = load i8, i8* %21
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 115
br i1 %41, label %42, label %60
42: ; preds = %33
%43 = load i8, i8* %21
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 105
br i1 %45, label %46, label %60
46: ; preds = %42
%47 = load i8, i8* %21
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 109
br i1 %49, label %50, label %60
50: ; preds = %46
%51 = load i8, i8* %21
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 113
br i1 %53, label %54, label %60
54: ; preds = %50
%55 = load i8, i8* %21
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 116
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %308
60: ; preds = %54, %50, %46, %42, %33
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
%64 = call i32 @sscanf(i8* %63, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %6)
%65 = load i8, i8* %21
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 115
br i1 %67, label %68, label %69
68: ; preds = %60
br label %89
69: ; preds = %60
%70 = load i8, i8* %21
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 105
br i1 %72, label %73, label %74
73: ; preds = %69
br label %87
74: ; preds = %69
%75 = load i8, i8* %21
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 109
br i1 %77, label %78, label %79
78: ; preds = %74
br label %85
79: ; preds = %74
%80 = load i8, i8* %21
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 113
%83 = zext i1 %82 to i64
%84 = select i1 %82, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0)
br label %85
85: ; preds = %79, %78
%86 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), %78 ], [ %84, %79 ]
br label %87
87: ; preds = %85, %73
%88 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %73 ], [ %86, %85 ]
br label %89
89: ; preds = %87, %68
%90 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %68 ], [ %88, %87 ]
%91 = load double, double* %6
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([523 x i8], [523 x i8]* @.str.5, i64 0, i64 0), i8* %90, double %91)
%93 = call double (...) @tempo()
store double %93, double* %7
store double 0.000000e+00, double* %8
store i32 2000, i32* %14
br label %94
94: ; preds = %304, %89
%95 = load double, double* %8
%96 = load double, double* %6
%97 = fcmp olt double %95, %96
br i1 %97, label %98, label %307
98: ; preds = %94
%99 = load i32, i32* %14
%100 = sext i32 %99 to i64
%101 = mul i64 %100, 4
%102 = trunc i64 %101 to i32
%103 = call i32* @malloc(i32 %102)
store i32* %103, i32** %15
%104 = load i32*, i32** %15
%105 = icmp eq i32* %104, null
br i1 %105, label %106, label %109
106: ; preds = %98
%107 = load i32, i32* %14
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0), i32 %107)
store i32 -1, i32* %3
br label %308
109: ; preds = %98
%110 = load i32, i32* %14
%111 = sext i32 %110 to i64
%112 = mul i64 %111, 4
%113 = trunc i64 %112 to i32
%114 = call i32* @malloc(i32 %113)
store i32* %114, i32** %16
%115 = load i32*, i32** %16
%116 = icmp eq i32* %115, null
br i1 %116, label %117, label %120
117: ; preds = %109
%118 = load i32, i32* %14
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0), i32 %118)
store i32 -1, i32* %3
br label %308
120: ; preds = %109
%121 = load i32*, i32** %15
%122 = load i32, i32* %14
%123 = call i32 @vetor_rand(i32* %121, i32 %122)
%124 = load i32*, i32** %15
%125 = load i32*, i32** %16
%126 = load i32, i32* %14
%127 = call i32 @vetor_copy(i32* %124, i32* %125, i32 %126)
%128 = load i8, i8* %21
%129 = sext i8 %128 to i32
%130 = icmp eq i32 %129, 115
br i1 %130, label %135, label %131
131: ; preds = %120
%132 = load i8, i8* %21
%133 = sext i8 %132 to i32
%134 = icmp eq i32 %133, 116
br i1 %134, label %135, label %167
135: ; preds = %131, %120
%136 = call double (...) @tempo()
store double %136, double* %9
%137 = load i32, i32* %14
%138 = load i32*, i32** %16
%139 = call i32 @Selecao(i32 %137, i32* %138)
%140 = call double (...) @tempo()
%141 = load double, double* %9
%142 = fsub double %140, %141
%143 = call double @abst(double %142)
store double %143, double* %10
%144 = load i32*, i32** %15
%145 = load i32*, i32** %16
%146 = load i32, i32* %14
%147 = load double, double* %10
%148 = call i32 @num_buscas(i32* %144, i32* %145, i32 %146, double %147)
store i32 %148, i32* %17
%149 = load i8, i8* %21
%150 = sext i8 %149 to i32
%151 = icmp ne i32 %150, 116
br i1 %151, label %152, label %157
152: ; preds = %135
%153 = load i32, i32* %14
%154 = load double, double* %10
%155 = load i32, i32* %17
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.13, i64 0, i64 0), i32 %153, double %154, i32 %155)
br label %157
157: ; preds = %152, %135
%158 = load i8, i8* %21
%159 = sext i8 %158 to i32
%160 = icmp ne i32 %159, 115
br i1 %160, label %161, label %166
161: ; preds = %157
%162 = load i32*, i32** %15
%163 = load i32*, i32** %16
%164 = load i32, i32* %14
%165 = call i32 @vetor_copy(i32* %162, i32* %163, i32 %164)
br label %166
166: ; preds = %161, %157
br label %167
167: ; preds = %166, %131
%168 = load i8, i8* %21
%169 = sext i8 %168 to i32
%170 = icmp eq i32 %169, 105
br i1 %170, label %175, label %171
171: ; preds = %167
%172 = load i8, i8* %21
%173 = sext i8 %172 to i32
%174 = icmp eq i32 %173, 116
br i1 %174, label %175, label %207
175: ; preds = %171, %167
%176 = call double (...) @tempo()
store double %176, double* %9
%177 = load i32, i32* %14
%178 = load i32*, i32** %16
%179 = call i32 @Insercao(i32 %177, i32* %178)
%180 = call double (...) @tempo()
%181 = load double, double* %9
%182 = fsub double %180, %181
%183 = call double @abst(double %182)
store double %183, double* %11
%184 = load i32*, i32** %15
%185 = load i32*, i32** %16
%186 = load i32, i32* %14
%187 = load double, double* %11
%188 = call i32 @num_buscas(i32* %184, i32* %185, i32 %186, double %187)
store i32 %188, i32* %18
%189 = load i8, i8* %21
%190 = sext i8 %189 to i32
%191 = icmp ne i32 %190, 116
br i1 %191, label %192, label %197
192: ; preds = %175
%193 = load i32, i32* %14
%194 = load double, double* %11
%195 = load i32, i32* %18
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.14, i64 0, i64 0), i32 %193, double %194, i32 %195)
br label %197
197: ; preds = %192, %175
%198 = load i8, i8* %21
%199 = sext i8 %198 to i32
%200 = icmp ne i32 %199, 105
br i1 %200, label %201, label %206
201: ; preds = %197
%202 = load i32*, i32** %15
%203 = load i32*, i32** %16
%204 = load i32, i32* %14
%205 = call i32 @vetor_copy(i32* %202, i32* %203, i32 %204)
br label %206
206: ; preds = %201, %197
br label %207
207: ; preds = %206, %171
%208 = load i8, i8* %21
%209 = sext i8 %208 to i32
%210 = icmp eq i32 %209, 109
br i1 %210, label %215, label %211
211: ; preds = %207
%212 = load i8, i8* %21
%213 = sext i8 %212 to i32
%214 = icmp eq i32 %213, 116
br i1 %214, label %215, label %248
215: ; preds = %211, %207
%216 = call double (...) @tempo()
store double %216, double* %9
%217 = load i32, i32* %14
%218 = sub nsw i32 %217, 1
%219 = load i32*, i32** %16
%220 = call i32 @Mergesort(i32 0, i32 %218, i32* %219)
%221 = call double (...) @tempo()
%222 = load double, double* %9
%223 = fsub double %221, %222
%224 = call double @abst(double %223)
store double %224, double* %12
%225 = load i32*, i32** %15
%226 = load i32*, i32** %16
%227 = load i32, i32* %14
%228 = load double, double* %12
%229 = call i32 @num_buscas(i32* %225, i32* %226, i32 %227, double %228)
store i32 %229, i32* %19
%230 = load i8, i8* %21
%231 = sext i8 %230 to i32
%232 = icmp ne i32 %231, 116
br i1 %232, label %233, label %238
233: ; preds = %215
%234 = load i32, i32* %14
%235 = load double, double* %12
%236 = load i32, i32* %19
%237 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0), i32 %234, double %235, i32 %236)
br label %238
238: ; preds = %233, %215
%239 = load i8, i8* %21
%240 = sext i8 %239 to i32
%241 = icmp ne i32 %240, 109
br i1 %241, label %242, label %247
242: ; preds = %238
%243 = load i32*, i32** %15
%244 = load i32*, i32** %16
%245 = load i32, i32* %14
%246 = call i32 @vetor_copy(i32* %243, i32* %244, i32 %245)
br label %247
247: ; preds = %242, %238
br label %248
248: ; preds = %247, %211
%249 = load i8, i8* %21
%250 = sext i8 %249 to i32
%251 = icmp eq i32 %250, 113
br i1 %251, label %256, label %252
252: ; preds = %248
%253 = load i8, i8* %21
%254 = sext i8 %253 to i32
%255 = icmp eq i32 %254, 116
br i1 %255, label %256, label %280
256: ; preds = %252, %248
%257 = call double (...) @tempo()
store double %257, double* %9
%258 = load i32, i32* %14
%259 = sub nsw i32 %258, 1
%260 = load i32*, i32** %16
%261 = call i32 @Quicksort(i32 0, i32 %259, i32* %260)
%262 = call double (...) @tempo()
%263 = load double, double* %9
%264 = fsub double %262, %263
%265 = call double @abst(double %264)
store double %265, double* %13
%266 = load i32*, i32** %15
%267 = load i32*, i32** %16
%268 = load i32, i32* %14
%269 = load double, double* %13
%270 = call i32 @num_buscas(i32* %266, i32* %267, i32 %268, double %269)
store i32 %270, i32* %20
%271 = load i8, i8* %21
%272 = sext i8 %271 to i32
%273 = icmp ne i32 %272, 116
br i1 %273, label %274, label %279
274: ; preds = %256
%275 = load i32, i32* %14
%276 = load double, double* %13
%277 = load i32, i32* %20
%278 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.16, i64 0, i64 0), i32 %275, double %276, i32 %277)
br label %279
279: ; preds = %274, %256
br label %280
280: ; preds = %279, %252
%281 = load i8, i8* %21
%282 = sext i8 %281 to i32
%283 = icmp eq i32 %282, 116
br i1 %283, label %284, label %296
284: ; preds = %280
%285 = load i32, i32* %14
%286 = load double, double* %11
%287 = load double, double* %10
%288 = load double, double* %12
%289 = load double, double* %13
%290 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i32 %285, double %286, double %287, double %288, double %289)
%291 = load i32, i32* %18
%292 = load i32, i32* %17
%293 = load i32, i32* %19
%294 = load i32, i32* %20
%295 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i32 %291, i32 %292, i32 %293, i32 %294)
br label %296
296: ; preds = %284, %280
%297 = load i32*, i32** %15
%298 = call i32 @free(i32* %297)
%299 = load i32*, i32** %16
%300 = call i32 @free(i32* %299)
%301 = call double (...) @tempo()
%302 = load double, double* %7
%303 = fsub double %301, %302
store double %303, double* %8
br label %304
304: ; preds = %296
%305 = load i32, i32* %14
%306 = add nsw i32 %305, 2000
store i32 %306, i32* %14
br label %94
307: ; preds = %94
store i32 0, i32* %3
br label %308
308: ; preds = %307, %117, %106, %58, %26
%309 = load i32, i32* %3
ret i32 %309
}

LLVM IR (-O2):
@.str = [22 x i8] c"Uso: %s tipo duracao\0A\00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [523 x i8] c"|-------------------------[EP1 - Vale a pena ordenar?]--------------------|\0A| Algoritmo escolhido: %10s Duracao dos testes: %9.2f |\0A| Tempos de Ordenacao Numero de Buscas |\0A| Nome: Ariane Prado |\0A|-------------------------------------------------------------------------|\0A| n | Insercao Selecao Merge. Quick. | Insercao Selecao Merge. Quick. |\0A|-------|-----------------------------------------------------------------|\0A\00"
@.str.6 = [8 x i8] c"selecao\00"
@.str.7 = [9 x i8] c"insercao\00"
@.str.8 = [10 x i8] c"mergesort\00"
@.str.9 = [10 x i8] c"quicksort\00"
@.str.10 = [6 x i8] c"todos\00"
@.str.11 = [62 x i8] c"Erro na alocacao de memoria para o vetor v com %d elementos.\0A\00"
@.str.12 = [66 x i8] c"Erro na alocacao de memoria para o vetor v_aux com %d elementos.\0A\00"
@.str.13 = [57 x i8] c"%d \09 %4.2f %d\09\0A\00"
@.str.14 = [49 x i8] c"%d \09 %4.2f %d\09\0A\00"
@.str.15 = [26 x i8] c"%d\09\09\09 %4.2f\09\09\09\09 %d\09\0A\00"
@.str.16 = [62 x i8] c"%d \09\09 %4.2f \09 %d\09\0A\00"
@.str.17 = [39 x i8] c"%d\09 %4.2f\09 %4.2f\09 %4.2f\09 %4.2f\00"
@.str.18 = [18 x i8] c"\09 %d\09 %d\09 %d\09 %d\0A\00"
@str = [17 x i8] c"opcao nao valida\00"
@str.19 = [74 x i8] c" tipo: s(elecao) ou i(nsercao) ou m(ergesort) ou q(uicksort) ou t(odos)\00"
@str.20 = [32 x i8] c" duracao: duracao em segundos\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = icmp eq i32 %0, 3
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.19, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.20, i64 0, i64 0))
br label %157
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 115
%18 = icmp eq i8 %16, 105
%19 = icmp eq i8 %16, 109
%20 = icmp eq i8 %16, 116
switch i8 %16, label %21 [
i8 116, label %23
i8 115, label %23
i8 113, label %23
i8 109, label %23
i8 105, label %23
]
21: ; preds = %13
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %157
23: ; preds = %13, %13, %13, %13, %13
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %3)
switch i8 %16, label %27 [
i8 115, label %32
i8 105, label %30
i8 109, label %31
]
27: ; preds = %23
%28 = icmp eq i8 %16, 113
%29 = select i1 %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0)
br label %32
30: ; preds = %23
br label %32
31: ; preds = %23
br label %32
32: ; preds = %23, %31, %30, %27
%33 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %23 ], [ %29, %27 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %30 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), %31 ]
%34 = load double, double* %3
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([523 x i8], [523 x i8]* @.str.5, i64 0, i64 0), i8* %33, double %34)
%36 = call double (...) @tempo()
%37 = load double, double* %3
%38 = fcmp ogt double %37, 0.000000e+00
br i1 %38, label %39, label %157
39: ; preds = %32
%40 = add nsw i8 %16, -115
%41 = icmp ult i8 %40, 2
br label %42
42: ; preds = %39, %141
%43 = phi i32 [ undef, %39 ], [ %142, %141 ]
%44 = phi i32 [ undef, %39 ], [ %149, %141 ]
%45 = phi i32 [ undef, %39 ], [ %144, %141 ]
%46 = phi i32 [ undef, %39 ], [ %147, %141 ]
%47 = phi i32 [ 2000, %39 ], [ %154, %141 ]
%48 = phi double [ undef, %39 ], [ %143, %141 ]
%49 = phi double [ undef, %39 ], [ %148, %141 ]
%50 = phi double [ undef, %39 ], [ %145, %141 ]
%51 = phi double [ undef, %39 ], [ %146, %141 ]
%52 = shl i32 %47, 2
%53 = call i32* @malloc(i32 %52)
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %57
55: ; preds = %42
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0), i32 %47)
br label %157
57: ; preds = %42
%58 = call i32* @malloc(i32 %52)
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0), i32 %47)
br label %157
62: ; preds = %57
%63 = call i32 @vetor_rand(i32* %53, i32 %47)
%64 = call i32 @vetor_copy(i32* %53, i32* %58, i32 %47)
br i1 %41, label %65, label %77
65: ; preds = %62
%66 = call double (...) @tempo()
%67 = call i32 @Selecao(i32 %47, i32* %58)
%68 = call double (...) @tempo()
%69 = fsub double %68, %66
%70 = call double @abst(double %69)
%71 = call i32 @num_buscas(i32* %53, i32* %58, i32 %47, double %70)
br i1 %20, label %74, label %72
72: ; preds = %65
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.13, i64 0, i64 0), i32 %47, double %70, i32 %71)
br label %74
74: ; preds = %72, %65
br i1 %17, label %123, label %75
75: ; preds = %74
%76 = call i32 @vetor_copy(i32* %53, i32* %58, i32 %47)
br label %78
77: ; preds = %62
br i1 %18, label %78, label %92
78: ; preds = %77, %75
%79 = phi i32 [ %71, %75 ], [ %46, %77 ]
%80 = phi double [ %70, %75 ], [ %51, %77 ]
%81 = call double (...) @tempo()
%82 = call i32 @Insercao(i32 %47, i32* %58)
%83 = call double (...) @tempo()
%84 = fsub double %83, %81
%85 = call double @abst(double %84)
%86 = call i32 @num_buscas(i32* %53, i32* %58, i32 %47, double %85)
br i1 %20, label %89, label %87
87: ; preds = %78
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.14, i64 0, i64 0), i32 %47, double %85, i32 %86)
br label %89
89: ; preds = %87, %78
br i1 %18, label %123, label %90
90: ; preds = %89
%91 = call i32 @vetor_copy(i32* %53, i32* %58, i32 %47)
br label %92
92: ; preds = %77, %90
%93 = phi i32 [ %79, %90 ], [ %46, %77 ]
%94 = phi double [ %80, %90 ], [ %51, %77 ]
%95 = phi double [ %85, %90 ], [ %50, %77 ]
%96 = phi i32 [ %86, %90 ], [ %45, %77 ]
switch i8 %16, label %110 [
i8 116, label %97
i8 109, label %97
]
97: ; preds = %92, %92
%98 = call double (...) @tempo()
%99 = add nsw i32 %47, -1
%100 = call i32 @Mergesort(i32 0, i32 %99, i32* %58)
%101 = call double (...) @tempo()
%102 = fsub double %101, %98
%103 = call double @abst(double %102)
%104 = call i32 @num_buscas(i32* %53, i32* %58, i32 %47, double %103)
br i1 %20, label %107, label %105
105: ; preds = %97
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0), i32 %47, double %103, i32 %104)
br label %107
107: ; preds = %105, %97
br i1 %19, label %123, label %108
108: ; preds = %107
%109 = call i32 @vetor_copy(i32* %53, i32* %58, i32 %47)
br label %110
110: ; preds = %92, %108
%111 = phi double [ %103, %108 ], [ %49, %92 ]
%112 = phi i32 [ %104, %108 ], [ %44, %92 ]
switch i8 %16, label %123 [
i8 116, label %113
i8 113, label %113
]
113: ; preds = %110, %110
%114 = call double (...) @tempo()
%115 = add nsw i32 %47, -1
%116 = call i32 @Quicksort(i32 0, i32 %115, i32* %58)
%117 = call double (...) @tempo()
%118 = fsub double %117, %114
%119 = call double @abst(double %118)
%120 = call i32 @num_buscas(i32* %53, i32* %58, i32 %47, double %119)
br i1 %20, label %130, label %121
121: ; preds = %113
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.16, i64 0, i64 0), i32 %47, double %119, i32 %120)
br label %141
123: ; preds = %89, %74, %107, %110
%124 = phi i32 [ %112, %110 ], [ %104, %107 ], [ %44, %74 ], [ %44, %89 ]
%125 = phi double [ %111, %110 ], [ %103, %107 ], [ %49, %74 ], [ %49, %89 ]
%126 = phi i32 [ %93, %110 ], [ %93, %107 ], [ %71, %74 ], [ %79, %89 ]
%127 = phi double [ %94, %110 ], [ %94, %107 ], [ %70, %74 ], [ %80, %89 ]
%128 = phi double [ %95, %110 ], [ %95, %107 ], [ %50, %74 ], [ %85, %89 ]
%129 = phi i32 [ %96, %110 ], [ %96, %107 ], [ %45, %74 ], [ %86, %89 ]
br i1 %20, label %130, label %141
130: ; preds = %113, %123
%131 = phi i32 [ %43, %123 ], [ %120, %113 ]
%132 = phi double [ %48, %123 ], [ %119, %113 ]
%133 = phi i32 [ %129, %123 ], [ %96, %113 ]
%134 = phi double [ %128, %123 ], [ %95, %113 ]
%135 = phi double [ %127, %123 ], [ %94, %113 ]
%136 = phi i32 [ %126, %123 ], [ %93, %113 ]
%137 = phi double [ %125, %123 ], [ %111, %113 ]
%138 = phi i32 [ %124, %123 ], [ %112, %113 ]
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i32 %47, double %134, double %135, double %137, double %132)
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i32 %133, i32 %136, i32 %138, i32 %131)
br label %141
141: ; preds = %121, %130, %123
%142 = phi i32 [ %131, %130 ], [ %43, %123 ], [ %120, %121 ]
%143 = phi double [ %132, %130 ], [ %48, %123 ], [ %119, %121 ]
%144 = phi i32 [ %133, %130 ], [ %129, %123 ], [ %96, %121 ]
%145 = phi double [ %134, %130 ], [ %128, %123 ], [ %95, %121 ]
%146 = phi double [ %135, %130 ], [ %127, %123 ], [ %94, %121 ]
%147 = phi i32 [ %136, %130 ], [ %126, %123 ], [ %93, %121 ]
%148 = phi double [ %137, %130 ], [ %125, %123 ], [ %111, %121 ]
%149 = phi i32 [ %138, %130 ], [ %124, %123 ], [ %112, %121 ]
%150 = call i32 @free(i32* %53)
%151 = call i32 @free(i32* %58)
%152 = call double (...) @tempo()
%153 = fsub double %152, %36
%154 = add nuw nsw i32 %47, 2000
%155 = load double, double* %3
%156 = fcmp olt double %153, %155
br i1 %156, label %42, label %157
157: ; preds = %141, %32, %60, %55, %21, %8
%158 = phi i32 [ 0, %8 ], [ -1, %21 ], [ -1, %55 ], [ -1, %60 ], [ 0, %32 ], [ 0, %141 ]
ret i32 %158
}