#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 */
typedef scalar_t__ clock_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ calloc(int, int);
scalar_t__ clock();
int /*<<< orphan*/ countingSort(int *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, double);
int /*<<< orphan*/ free(int *);
char getchar();
int /*<<< orphan*/ heapSort(int *, int);
int /*<<< orphan*/ insertionSort(int *, int);
int /*<<< orphan*/ mergeSort(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quickSort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ radixSort(int *, int);
int /*<<< orphan*/ randomGenerator(int *, int);
int main(int argc, char const *argv[]) {
  int tam, k;
  int *A, *B;
  FILE *fp[7];
  clock_t start_t, end_t;
  do {
    for (k = 1; k <= 13; k++) {
      tam = 1 << k;
      A = (int *)calloc(tam, sizeof(int));
      if (A == NULL)
        exit(1);
      randomGenerator(A, tam);
      quickSort(A, 0, 0.2 * (tam - 1));
      start_t = clock();
      insertionSort(A, tam);
      end_t = clock();
      fp[0] = fopen("insertion.txt", "a+");
      fprintf(fp[0], "%d,%lf\n", k, (double)(end_t - start_t) / CLOCKS_PER_SEC);
      fclose(fp[0]);
      start_t = clock();
      mergeSort(A, tam);
      end_t = clock();
      fp[1] = fopen("merge.txt", "a+");
      fprintf(fp[1], "%d,%lf\n", k, (double)(end_t - start_t) / CLOCKS_PER_SEC);
      fclose(fp[1]);
      start_t = clock();
      quickSort(A, 0, tam - 1);
      end_t = clock();
      fp[2] = fopen("quick.txt", "a+");
      fprintf(fp[2], "%d,%lf\n", k, (double)(end_t - start_t) / CLOCKS_PER_SEC);
      fclose(fp[2]);
      start_t = clock();
      countingSort(A, tam);
      end_t = clock();
      fp[3] = fopen("counting.txt", "a+");
      fprintf(fp[3], "%d,%lf\n", k, (double)(end_t - start_t) / CLOCKS_PER_SEC);
      fclose(fp[3]);
      start_t = clock();
      heapSort(A, tam);
      end_t = clock();
      fp[4] = fopen("heap.txt", "a+");
      fprintf(fp[4], "%d,%lf\n", k, (double)(end_t - start_t) / CLOCKS_PER_SEC);
      fclose(fp[4]);
      start_t = clock();
      radixSort(A, tam);
      end_t = clock();
      fp[5] = fopen("radix.txt", "a+");
      fprintf(fp[5], "%d,%lf\n", k, (double)(end_t - start_t) / CLOCKS_PER_SEC);
      fclose(fp[5]);
    }
    printf("Digite 'q' (sem aspas) para sair.\n");
  } while (getchar() != 'q');
  free(A);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0xd,-0x18(%rbp)
jg     152c <main+0x32c>
mov    -0x18(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    125a <main+0x5a>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10f0 <randomGenerator@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xd84(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
xor    %esi,%esi
call   10e0 <quickSort@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10d0 <insertionSort@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x70(%rbp)
lea    0xd54(%rip),%rdi
lea    0xd5b(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x70(%rbp),%rax
sub    -0x68(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2d09(%rip),%rax
divsd  (%rax),%xmm0
lea    0xd2f(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x60(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10c0 <mergeSort@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x70(%rbp)
lea    0xd00(%rip),%rdi
lea    0xcee(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x70(%rbp),%rax
sub    -0x68(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2c9c(%rip),%rax
divsd  (%rax),%xmm0
lea    0xcc2(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x58(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   10e0 <quickSort@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x70(%rbp)
lea    0xc98(%rip),%rdi
lea    0xc7c(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x70(%rbp),%rax
sub    -0x68(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2c2a(%rip),%rax
divsd  (%rax),%xmm0
lea    0xc50(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x50(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1110 <countingSort@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x70(%rbp)
lea    0xc35(%rip),%rdi
lea    0xc0f(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x70(%rbp),%rax
sub    -0x68(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2bbd(%rip),%rax
divsd  (%rax),%xmm0
lea    0xbe3(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <heapSort@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x70(%rbp)
lea    0xbd5(%rip),%rdi
lea    0xba2(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x70(%rbp),%rax
sub    -0x68(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2b50(%rip),%rax
divsd  (%rax),%xmm0
lea    0xb76(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10b0 <radixSort@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x70(%rbp)
lea    0xb71(%rip),%rdi
lea    0xb35(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x70(%rbp),%rax
sub    -0x68(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2ae3(%rip),%rax
divsd  (%rax),%xmm0
lea    0xb09(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    121d <main+0x1d>
lea    0xb22(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
movsbl %al,%eax
cmp    $0x71,%eax
jne    1216 <main+0x16>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%ebp
mov    $0x1,%r14d
mov    %ebp,%ecx
shl    %cl,%r14d
mov    %r14d,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
test   %rax,%rax
je     150f <main+0x30f>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r14d,%esi
call   10f0 <randomGenerator@plt>
lea    -0x1(%r14),%eax
mov    %eax,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xdaa(%rip),%xmm0
cvttsd2si %xmm0,%edx
mov    %r13,%rdi
xor    %esi,%esi
call   10e0 <quickSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r15
mov    %r13,%rdi
mov    %r14d,%esi
call   10d0 <insertionSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%rbx
lea    0xd7e(%rip),%rdi
lea    0xd85(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%r12
sub    %r15,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
mov    0x2d3d(%rip),%rax
divsd  (%rax),%xmm0
mov    %r12,%rdi
lea    0xd60(%rip),%rsi
mov    %ebp,%edx
call   10a0 <fprintf@plt>
mov    %r12,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r15
mov    %r13,%rdi
mov    %r14d,%esi
call   10c0 <mergeSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %ebp,%r12d
mov    %rax,%rbp
lea    0xd30(%rip),%rdi
lea    0xd1e(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%rbx
sub    %r15,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
mov    0x2cd6(%rip),%rax
divsd  (%rax),%xmm0
mov    %rbx,%rdi
lea    0xcf9(%rip),%rsi
mov    %r12d,%edx
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r15
mov    %r13,%rdi
xor    %esi,%esi
mov    0x4(%rsp),%edx
call   10e0 <quickSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%rbp
lea    0xcd2(%rip),%rdi
lea    0xcb6(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%rbx
sub    %r15,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
mov    0x2c6e(%rip),%rax
divsd  (%rax),%xmm0
mov    %rbx,%rdi
lea    0xc91(%rip),%rsi
mov    %r12d,%edx
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r15
mov    %r13,%rdi
mov    %r14d,%esi
call   1110 <countingSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%rbp
lea    0xc77(%rip),%rdi
lea    0xc51(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%rbx
sub    %r15,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
mov    0x2c09(%rip),%rax
divsd  (%rax),%xmm0
mov    %rbx,%rdi
lea    0xc2c(%rip),%rsi
mov    %r12d,%edx
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r15
mov    %r13,%rdi
mov    %r14d,%esi
call   1070 <heapSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%rbp
lea    0xc1f(%rip),%rdi
lea    0xbec(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%rbx
sub    %r15,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
mov    0x2ba4(%rip),%rax
divsd  (%rax),%xmm0
mov    %rbx,%rdi
lea    0xbc7(%rip),%rsi
mov    %r12d,%edx
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r15
mov    %r13,%rdi
mov    %r14d,%esi
call   10b0 <radixSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%rbp
lea    0xbc3(%rip),%rdi
lea    0xb87(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%rbx
sub    %r15,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
mov    %r12d,%ebp
mov    0x2b3c(%rip),%rax
divsd  (%rax),%xmm0
mov    %rbx,%rdi
lea    0xb5f(%rip),%rsi
mov    %r12d,%edx
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
add    $0x1,%ebp
cmp    $0xe,%ebp
jne    1210 <main+0x10>
lea    0xb78(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    $0x1,%ebp
cmp    $0x71,%al
jne    1210 <main+0x10>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"insertion.txt\00"
@.str.1 = [3 x i8] c"a+\00"
@.str.2 = [8 x i8] c"%d,%lf\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.3 = [10 x i8] c"merge.txt\00"
@.str.4 = [10 x i8] c"quick.txt\00"
@.str.5 = [13 x i8] c"counting.txt\00"
@.str.6 = [9 x i8] c"heap.txt\00"
@.str.7 = [10 x i8] c"radix.txt\00"
@.str.8 = [35 x i8] c"Digite 'q' (sem aspas) para sair.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca [7 x i32*]
%11 = alloca i64
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %13
13: ; preds = %164, %2
store i32 1, i32* %7
br label %14
14: ; preds = %159, %13
%15 = load i32, i32* %7
%16 = icmp sle i32 %15, 13
br i1 %16, label %17, label %162
17: ; preds = %14
%18 = load i32, i32* %7
%19 = shl i32 1, %18
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = call i64 @calloc(i32 %20, i32 4)
%22 = inttoptr i64 %21 to i32*
store i32* %22, i32** %8
%23 = load i32*, i32** %8
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %27
25: ; preds = %17
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %17
%28 = load i32*, i32** %8
%29 = load i32, i32* %6
%30 = call i32 @randomGenerator(i32* %28, i32 %29)
%31 = load i32*, i32** %8
%32 = load i32, i32* %6
%33 = sub nsw i32 %32, 1
%34 = sitofp i32 %33 to double
%35 = fmul double 2.000000e-01, %34
%36 = fptosi double %35 to i32
%37 = call i32 @quickSort(i32* %31, i32 0, i32 %36)
%38 = call i64 (...) @clock()
store i64 %38, i64* %11
%39 = load i32*, i32** %8
%40 = load i32, i32* %6
%41 = call i32 @insertionSort(i32* %39, i32 %40)
%42 = call i64 (...) @clock()
store i64 %42, i64* %12
%43 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%44 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 0
store i32* %43, i32** %44
%45 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 0
%46 = load i32*, i32** %45
%47 = load i32, i32* %7
%48 = load i64, i64* %12
%49 = load i64, i64* %11
%50 = sub nsw i64 %48, %49
%51 = sitofp i64 %50 to double
%52 = load double, double* @CLOCKS_PER_SEC
%53 = fdiv double %51, %52
%54 = call i32 @fprintf(i32* %46, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %47, double %53)
%55 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 0
%56 = load i32*, i32** %55
%57 = call i32 @fclose(i32* %56)
%58 = call i64 (...) @clock()
store i64 %58, i64* %11
%59 = load i32*, i32** %8
%60 = load i32, i32* %6
%61 = call i32 @mergeSort(i32* %59, i32 %60)
%62 = call i64 (...) @clock()
store i64 %62, i64* %12
%63 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%64 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 1
store i32* %63, i32** %64
%65 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 1
%66 = load i32*, i32** %65
%67 = load i32, i32* %7
%68 = load i64, i64* %12
%69 = load i64, i64* %11
%70 = sub nsw i64 %68, %69
%71 = sitofp i64 %70 to double
%72 = load double, double* @CLOCKS_PER_SEC
%73 = fdiv double %71, %72
%74 = call i32 @fprintf(i32* %66, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %67, double %73)
%75 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 1
%76 = load i32*, i32** %75
%77 = call i32 @fclose(i32* %76)
%78 = call i64 (...) @clock()
store i64 %78, i64* %11
%79 = load i32*, i32** %8
%80 = load i32, i32* %6
%81 = sub nsw i32 %80, 1
%82 = call i32 @quickSort(i32* %79, i32 0, i32 %81)
%83 = call i64 (...) @clock()
store i64 %83, i64* %12
%84 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%85 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 2
store i32* %84, i32** %85
%86 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 2
%87 = load i32*, i32** %86
%88 = load i32, i32* %7
%89 = load i64, i64* %12
%90 = load i64, i64* %11
%91 = sub nsw i64 %89, %90
%92 = sitofp i64 %91 to double
%93 = load double, double* @CLOCKS_PER_SEC
%94 = fdiv double %92, %93
%95 = call i32 @fprintf(i32* %87, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %88, double %94)
%96 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 2
%97 = load i32*, i32** %96
%98 = call i32 @fclose(i32* %97)
%99 = call i64 (...) @clock()
store i64 %99, i64* %11
%100 = load i32*, i32** %8
%101 = load i32, i32* %6
%102 = call i32 @countingSort(i32* %100, i32 %101)
%103 = call i64 (...) @clock()
store i64 %103, i64* %12
%104 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%105 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 3
store i32* %104, i32** %105
%106 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 3
%107 = load i32*, i32** %106
%108 = load i32, i32* %7
%109 = load i64, i64* %12
%110 = load i64, i64* %11
%111 = sub nsw i64 %109, %110
%112 = sitofp i64 %111 to double
%113 = load double, double* @CLOCKS_PER_SEC
%114 = fdiv double %112, %113
%115 = call i32 @fprintf(i32* %107, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %108, double %114)
%116 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 3
%117 = load i32*, i32** %116
%118 = call i32 @fclose(i32* %117)
%119 = call i64 (...) @clock()
store i64 %119, i64* %11
%120 = load i32*, i32** %8
%121 = load i32, i32* %6
%122 = call i32 @heapSort(i32* %120, i32 %121)
%123 = call i64 (...) @clock()
store i64 %123, i64* %12
%124 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%125 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 4
store i32* %124, i32** %125
%126 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 4
%127 = load i32*, i32** %126
%128 = load i32, i32* %7
%129 = load i64, i64* %12
%130 = load i64, i64* %11
%131 = sub nsw i64 %129, %130
%132 = sitofp i64 %131 to double
%133 = load double, double* @CLOCKS_PER_SEC
%134 = fdiv double %132, %133
%135 = call i32 @fprintf(i32* %127, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %128, double %134)
%136 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 4
%137 = load i32*, i32** %136
%138 = call i32 @fclose(i32* %137)
%139 = call i64 (...) @clock()
store i64 %139, i64* %11
%140 = load i32*, i32** %8
%141 = load i32, i32* %6
%142 = call i32 @radixSort(i32* %140, i32 %141)
%143 = call i64 (...) @clock()
store i64 %143, i64* %12
%144 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%145 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 5
store i32* %144, i32** %145
%146 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 5
%147 = load i32*, i32** %146
%148 = load i32, i32* %7
%149 = load i64, i64* %12
%150 = load i64, i64* %11
%151 = sub nsw i64 %149, %150
%152 = sitofp i64 %151 to double
%153 = load double, double* @CLOCKS_PER_SEC
%154 = fdiv double %152, %153
%155 = call i32 @fprintf(i32* %147, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %148, double %154)
%156 = getelementptr inbounds [7 x i32*], [7 x i32*]* %10, i64 0, i64 5
%157 = load i32*, i32** %156
%158 = call i32 @fclose(i32* %157)
br label %159
159: ; preds = %27
%160 = load i32, i32* %7
%161 = add nsw i32 %160, 1
store i32 %161, i32* %7
br label %14
162: ; preds = %14
%163 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %164
164: ; preds = %162
%165 = call signext i8 (...) @getchar()
%166 = sext i8 %165 to i32
%167 = icmp ne i32 %166, 113
br i1 %167, label %13, label %168
168: ; preds = %164
%169 = load i32*, i32** %8
%170 = call i32 @free(i32* %169)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"insertion.txt\00"
@.str.1 = [3 x i8] c"a+\00"
@.str.2 = [8 x i8] c"%d,%lf\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.3 = [10 x i8] c"merge.txt\00"
@.str.4 = [10 x i8] c"quick.txt\00"
@.str.5 = [13 x i8] c"counting.txt\00"
@.str.6 = [9 x i8] c"heap.txt\00"
@.str.7 = [10 x i8] c"radix.txt\00"
@str = [34 x i8] c"Digite 'q' (sem aspas) para sair.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %80, %2
%4 = phi i32 [ 1, %2 ], [ %81, %80 ]
%5 = shl nuw nsw i32 1, %4
%6 = tail call i64 @calloc(i32 %5, i32 4)
%7 = inttoptr i64 %6 to i32*
%8 = icmp eq i64 %6, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %3
%12 = tail call i32 @randomGenerator(i32* %7, i32 %5)
%13 = add nsw i32 %5, -1
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 2.000000e-01
%16 = fptosi double %15 to i32
%17 = tail call i32 @quickSort(i32* %7, i32 0, i32 %16)
%18 = tail call i64 (...) @clock()
%19 = tail call i32 @insertionSort(i32* %7, i32 %5)
%20 = tail call i64 (...) @clock()
%21 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = sub nsw i64 %20, %18
%23 = sitofp i64 %22 to double
%24 = load double, double* @CLOCKS_PER_SEC
%25 = fdiv double %23, %24
%26 = tail call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4, double %25)
%27 = tail call i32 @fclose(i32* %21)
%28 = tail call i64 (...) @clock()
%29 = tail call i32 @mergeSort(i32* %7, i32 %5)
%30 = tail call i64 (...) @clock()
%31 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%32 = sub nsw i64 %30, %28
%33 = sitofp i64 %32 to double
%34 = load double, double* @CLOCKS_PER_SEC
%35 = fdiv double %33, %34
%36 = tail call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4, double %35)
%37 = tail call i32 @fclose(i32* %31)
%38 = tail call i64 (...) @clock()
%39 = tail call i32 @quickSort(i32* %7, i32 0, i32 %13)
%40 = tail call i64 (...) @clock()
%41 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%42 = sub nsw i64 %40, %38
%43 = sitofp i64 %42 to double
%44 = load double, double* @CLOCKS_PER_SEC
%45 = fdiv double %43, %44
%46 = tail call i32 @fprintf(i32* %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4, double %45)
%47 = tail call i32 @fclose(i32* %41)
%48 = tail call i64 (...) @clock()
%49 = tail call i32 @countingSort(i32* %7, i32 %5)
%50 = tail call i64 (...) @clock()
%51 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%52 = sub nsw i64 %50, %48
%53 = sitofp i64 %52 to double
%54 = load double, double* @CLOCKS_PER_SEC
%55 = fdiv double %53, %54
%56 = tail call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4, double %55)
%57 = tail call i32 @fclose(i32* %51)
%58 = tail call i64 (...) @clock()
%59 = tail call i32 @heapSort(i32* %7, i32 %5)
%60 = tail call i64 (...) @clock()
%61 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%62 = sub nsw i64 %60, %58
%63 = sitofp i64 %62 to double
%64 = load double, double* @CLOCKS_PER_SEC
%65 = fdiv double %63, %64
%66 = tail call i32 @fprintf(i32* %61, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4, double %65)
%67 = tail call i32 @fclose(i32* %61)
%68 = tail call i64 (...) @clock()
%69 = tail call i32 @radixSort(i32* %7, i32 %5)
%70 = tail call i64 (...) @clock()
%71 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%72 = sub nsw i64 %70, %68
%73 = sitofp i64 %72 to double
%74 = load double, double* @CLOCKS_PER_SEC
%75 = fdiv double %73, %74
%76 = tail call i32 @fprintf(i32* %71, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4, double %75)
%77 = tail call i32 @fclose(i32* %71)
%78 = add nuw nsw i32 %4, 1
%79 = icmp eq i32 %78, 14
br i1 %79, label %82, label %80
80: ; preds = %11, %82
%81 = phi i32 [ %78, %11 ], [ 1, %82 ]
br label %3
82: ; preds = %11
%83 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%84 = tail call signext i8 (...) @getchar()
%85 = icmp eq i8 %84, 113
br i1 %85, label %86, label %80
86: ; preds = %82
%87 = inttoptr i64 %6 to i32*
%88 = tail call i32 @free(i32* %87)
ret i32 0
}