#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;

/* Variables and functions */
double CLOCKS_PER_SEC;
int /*<<< orphan*/ bubbleSort(int, int *);
scalar_t__ clock();
int /*<<< orphan*/ countingSort(int *, int, int *, int *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ heapSort(int *, int);
int /*<<< orphan*/ insertionSort(int, int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ mergeSort(int *, int, int *);
int /*<<< orphan*/ printLog(char *);
int /*<<< orphan*/ printResult(char *, int, double);
int /*<<< orphan*/ quickSort(int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ selectionSort(int, int *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
void runSortAlgorithm(char *algorithm, int size, int *numbers) {
  int *arrTmp1;
  int *arrTmp2;
  int arrTmp1Allocated = 0, arrTmp2Allocated = 0;
  char log[300];
  sprintf(log,
          "----------------------------------------------------------------");
  printLog(log);
  sprintf(log, "Language C");
  printLog(log);
  sprintf(log, "Algorithm: %s", algorithm);
  printLog(log);
  sprintf(log, "Size of array: %d", size);
  printLog(log);
  clock_t timeStart, timeEnd;
  double timeSpent = (double)(timeEnd - timeStart) / CLOCKS_PER_SEC;
  if (strcmp(algorithm, "bubbleSort") == 0) {
    timeStart = clock();
    bubbleSort(size, numbers);
  } else if (strcmp(algorithm, "selectionSort") == 0) {
    timeStart = clock();
    selectionSort(size, numbers);
  } else if (strcmp(algorithm, "insertionSort") == 0) {
    timeStart = clock();
    insertionSort(size, numbers);
  } else if (strcmp(algorithm, "mergeSort") == 0) {
    arrTmp1Allocated = 1;
    arrTmp1 = (int *)malloc(sizeof(int) * size);
    timeStart = clock();
    mergeSort(numbers, size, arrTmp1);
  } else if (strcmp(algorithm, "heapSort") == 0) {
    timeStart = clock();
    heapSort(numbers, size);
  } else if (strcmp(algorithm, "quickSort") == 0) {
    timeStart = clock();
    quickSort(0, size, numbers);
  } else if (strcmp(algorithm, "countingSort") == 0) {
    timeStart = clock();
    countingSort(numbers, size, arrTmp1, arrTmp2);
  }
  timeEnd = clock();
  timeSpent = (double)(timeEnd - timeStart) / CLOCKS_PER_SEC;
  sprintf(log, "The algorithm task has taken  %f seconds", timeSpent);
  printLog(log);
  printResult(algorithm, size, timeSpent);
  if (arrTmp1Allocated == 1) {
    free(arrTmp1);
  }
  if (arrTmp2Allocated == 1) {
    free(arrTmp2);
  }
}


x86 assembly (clang, -O0):
<runSortAlgorithm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
lea    -0x160(%rbp),%rdi
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x160(%rbp),%rdi
call   10d0 <printLog@plt>
lea    -0x160(%rbp),%rdi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x160(%rbp),%rdi
call   10d0 <printLog@plt>
lea    -0x160(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x160(%rbp),%rdi
call   10d0 <printLog@plt>
lea    -0x160(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x160(%rbp),%rdi
call   10d0 <printLog@plt>
mov    -0x170(%rbp),%rax
sub    -0x168(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2d3f(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
mov    -0x8(%rbp),%rdi
lea    0xdac(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12ee <runSortAlgorithm+0x10e>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x168(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1080 <bubbleSort@plt>
jmp    1485 <runSortAlgorithm+0x2a5>
mov    -0x8(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1327 <runSortAlgorithm+0x147>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x168(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1070 <selectionSort@plt>
jmp    1480 <runSortAlgorithm+0x2a0>
mov    -0x8(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1360 <runSortAlgorithm+0x180>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x168(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   10c0 <insertionSort@plt>
jmp    147b <runSortAlgorithm+0x29b>
mov    -0x8(%rbp),%rdi
lea    0xd28(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    13b7 <runSortAlgorithm+0x1d7>
movl   $0x1,-0x2c(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x168(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   10a0 <mergeSort@plt>
jmp    1476 <runSortAlgorithm+0x296>
mov    -0x8(%rbp),%rdi
lea    0xcdb(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    13f0 <runSortAlgorithm+0x210>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x168(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <heapSort@plt>
jmp    1471 <runSortAlgorithm+0x291>
mov    -0x8(%rbp),%rdi
lea    0xcab(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    142b <runSortAlgorithm+0x24b>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x168(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
xor    %edi,%edi
call   10e0 <quickSort@plt>
jmp    146c <runSortAlgorithm+0x28c>
mov    -0x8(%rbp),%rdi
lea    0xc7a(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1467 <runSortAlgorithm+0x287>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x168(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   10f0 <countingSort@plt>
jmp    146c <runSortAlgorithm+0x28c>
jmp    1471 <runSortAlgorithm+0x291>
jmp    1476 <runSortAlgorithm+0x296>
jmp    147b <runSortAlgorithm+0x29b>
jmp    1480 <runSortAlgorithm+0x2a0>
jmp    1485 <runSortAlgorithm+0x2a5>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x170(%rbp)
mov    -0x170(%rbp),%rax
sub    -0x168(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2b3b(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
lea    -0x160(%rbp),%rdi
movsd  -0x178(%rbp),%xmm0
ff
lea    0xbee(%rip),%rsi
mov    $0x1,%al
call   1100 <sprintf@plt>
lea    -0x160(%rbp),%rdi
call   10d0 <printLog@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
movsd  -0x178(%rbp),%xmm0
ff
call   1030 <printResult@plt>
cmpl   $0x1,-0x2c(%rbp)
jne    1509 <runSortAlgorithm+0x329>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
cmpl   $0x1,-0x30(%rbp)
jne    151c <runSortAlgorithm+0x33c>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runSortAlgorithm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rdx,%r15
mov    %esi,%r14d
mov    %rdi,%rbp
movups 0xe2f(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xe13(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movups 0xdf7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xddb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movb   $0x0,0x50(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   10d0 <printLog@plt>
movabs $0x65676175676e614c,%rax
61 67 65
mov    %rax,0x10(%rsp)
movl   $0x432065,0x17(%rsp)
mov    %rbx,%rdi
call   10d0 <printLog@plt>
lea    0xdea(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    %rbx,%rdi
call   10d0 <printLog@plt>
lea    0xddc(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    %rbx,%rdi
call   10d0 <printLog@plt>
lea    0xdd2(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1343 <runSortAlgorithm+0x163>
lea    0xdc5(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1360 <runSortAlgorithm+0x180>
lea    0xdbb(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     137d <runSortAlgorithm+0x19d>
lea    0xdb1(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1397 <runSortAlgorithm+0x1b7>
lea    0xda3(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13c7 <runSortAlgorithm+0x1e7>
lea    0xd94(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13e1 <runSortAlgorithm+0x201>
lea    0xd86(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
xor    %r13d,%r13d
test   %rax,%rax
je     13fd <runSortAlgorithm+0x21d>
jmp    1412 <runSortAlgorithm+0x232>
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
mov    %r14d,%edi
mov    %r15,%rsi
call   1080 <bubbleSort@plt>
jmp    1412 <runSortAlgorithm+0x232>
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
mov    %r14d,%edi
mov    %r15,%rsi
call   1070 <selectionSort@plt>
jmp    1412 <runSortAlgorithm+0x232>
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
mov    %r14d,%edi
mov    %r15,%rsi
call   10c0 <insertionSort@plt>
jmp    1412 <runSortAlgorithm+0x232>
lea    0x0(,%r14,4),%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %rbx,%r15
mov    %r14d,%esi
mov    %rbx,%rdx
call   10a0 <mergeSort@plt>
mov    $0x1,%r13b
jmp    1412 <runSortAlgorithm+0x232>
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %r14d,%esi
call   1060 <heapSort@plt>
jmp    1412 <runSortAlgorithm+0x232>
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
xor    %edi,%edi
mov    %r14d,%esi
mov    %r15,%rdx
call   10e0 <quickSort@plt>
jmp    1412 <runSortAlgorithm+0x232>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %r14d,%esi
call   10f0 <countingSort@plt>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r12,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2bbd(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xc81(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1100 <sprintf@plt>
mov    %rbx,%rdi
call   10d0 <printLog@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
movsd  0x8(%rsp),%xmm0
call   1030 <printResult@plt>
test   %r13b,%r13b
je     1471 <runSortAlgorithm+0x291>
mov    %r15,%rdi
call   1040 <free@plt>
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [65 x i8] c"----------------------------------------------------------------\00"
@.str.1 = [11 x i8] c"Language C\00"
@.str.2 = [14 x i8] c"Algorithm: %s\00"
@.str.3 = [18 x i8] c"Size of array: %d\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.4 = [11 x i8] c"bubbleSort\00"
@.str.5 = [14 x i8] c"selectionSort\00"
@.str.6 = [14 x i8] c"insertionSort\00"
@.str.7 = [10 x i8] c"mergeSort\00"
@.str.8 = [9 x i8] c"heapSort\00"
@.str.9 = [10 x i8] c"quickSort\00"
@.str.10 = [13 x i8] c"countingSort\00"
@.str.11 = [41 x i8] c"The algorithm task has taken %f seconds\00"
define void @runSortAlgorithm(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [300 x i8]
%12 = alloca i64
%13 = alloca i64
%14 = alloca double
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i32 0, i32* %9
store i32 0, i32* %10
%15 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%18 = call i32 @printLog(i8* %17)
%19 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%21 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%22 = call i32 @printLog(i8* %21)
%23 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%24 = load i8*, i8** %4
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%27 = call i32 @printLog(i8* %26)
%28 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%29 = load i32, i32* %5
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %28, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%32 = call i32 @printLog(i8* %31)
%33 = load i64, i64* %13
%34 = load i64, i64* %12
%35 = sub nsw i64 %33, %34
%36 = sitofp i64 %35 to double
%37 = load double, double* @CLOCKS_PER_SEC
%38 = fdiv double %36, %37
store double %38, double* %14
%39 = load i8*, i8** %4
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %3
%43 = call i64 (...) @clock()
store i64 %43, i64* %12
%44 = load i32, i32* %5
%45 = load i32*, i32** %6
%46 = call i32 @bubbleSort(i32 %44, i32* %45)
br label %116
47: ; preds = %3
%48 = load i8*, i8** %4
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %56
51: ; preds = %47
%52 = call i64 (...) @clock()
store i64 %52, i64* %12
%53 = load i32, i32* %5
%54 = load i32*, i32** %6
%55 = call i32 @selectionSort(i32 %53, i32* %54)
br label %115
56: ; preds = %47
%57 = load i8*, i8** %4
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %56
%61 = call i64 (...) @clock()
store i64 %61, i64* %12
%62 = load i32, i32* %5
%63 = load i32*, i32** %6
%64 = call i32 @insertionSort(i32 %62, i32* %63)
br label %114
65: ; preds = %56
%66 = load i8*, i8** %4
%67 = call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %81
69: ; preds = %65
store i32 1, i32* %9
%70 = load i32, i32* %5
%71 = sext i32 %70 to i64
%72 = mul i64 4, %71
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to i32*
store i32* %75, i32** %7
%76 = call i64 (...) @clock()
store i64 %76, i64* %12
%77 = load i32*, i32** %6
%78 = load i32, i32* %5
%79 = load i32*, i32** %7
%80 = call i32 @mergeSort(i32* %77, i32 %78, i32* %79)
br label %113
81: ; preds = %65
%82 = load i8*, i8** %4
%83 = call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %90
85: ; preds = %81
%86 = call i64 (...) @clock()
store i64 %86, i64* %12
%87 = load i32*, i32** %6
%88 = load i32, i32* %5
%89 = call i32 @heapSort(i32* %87, i32 %88)
br label %112
90: ; preds = %81
%91 = load i8*, i8** %4
%92 = call i64 @strcmp(i8* %91, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %99
94: ; preds = %90
%95 = call i64 (...) @clock()
store i64 %95, i64* %12
%96 = load i32, i32* %5
%97 = load i32*, i32** %6
%98 = call i32 @quickSort(i32 0, i32 %96, i32* %97)
br label %111
99: ; preds = %90
%100 = load i8*, i8** %4
%101 = call i64 @strcmp(i8* %100, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %110
103: ; preds = %99
%104 = call i64 (...) @clock()
store i64 %104, i64* %12
%105 = load i32*, i32** %6
%106 = load i32, i32* %5
%107 = load i32*, i32** %7
%108 = load i32*, i32** %8
%109 = call i32 @countingSort(i32* %105, i32 %106, i32* %107, i32* %108)
br label %110
110: ; preds = %103, %99
br label %111
111: ; preds = %110, %94
br label %112
112: ; preds = %111, %85
br label %113
113: ; preds = %112, %69
br label %114
114: ; preds = %113, %60
br label %115
115: ; preds = %114, %51
br label %116
116: ; preds = %115, %42
%117 = call i64 (...) @clock()
store i64 %117, i64* %13
%118 = load i64, i64* %13
%119 = load i64, i64* %12
%120 = sub nsw i64 %118, %119
%121 = sitofp i64 %120 to double
%122 = load double, double* @CLOCKS_PER_SEC
%123 = fdiv double %121, %122
store double %123, double* %14
%124 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%125 = load double, double* %14
%126 = call i32 (i8*, i8*, ...) @sprintf(i8* %124, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0), double %125)
%127 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%128 = call i32 @printLog(i8* %127)
%129 = load i8*, i8** %4
%130 = load i32, i32* %5
%131 = load double, double* %14
%132 = call i32 @printResult(i8* %129, i32 %130, double %131)
%133 = load i32, i32* %9
%134 = icmp eq i32 %133, 1
br i1 %134, label %135, label %138
135: ; preds = %116
%136 = load i32*, i32** %7
%137 = call i32 @free(i32* %136)
br label %138
138: ; preds = %135, %116
%139 = load i32, i32* %10
%140 = icmp eq i32 %139, 1
br i1 %140, label %141, label %144
141: ; preds = %138
%142 = load i32*, i32** %8
%143 = call i32 @free(i32* %142)
br label %144
144: ; preds = %141, %138
ret void
}

LLVM IR (-O2):
@.str = [65 x i8] c"----------------------------------------------------------------\00"
@.str.1 = [11 x i8] c"Language C\00"
@.str.2 = [14 x i8] c"Algorithm: %s\00"
@.str.3 = [18 x i8] c"Size of array: %d\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.4 = [11 x i8] c"bubbleSort\00"
@.str.5 = [14 x i8] c"selectionSort\00"
@.str.6 = [14 x i8] c"insertionSort\00"
@.str.7 = [10 x i8] c"mergeSort\00"
@.str.8 = [9 x i8] c"heapSort\00"
@.str.9 = [10 x i8] c"quickSort\00"
@.str.10 = [13 x i8] c"countingSort\00"
@.str.11 = [41 x i8] c"The algorithm task has taken %f seconds\00"
define void @runSortAlgorithm(i8* %0, i32 %1, i32* %2) {
%4 = alloca [300 x i8]
%5 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%6 = call i32 @printLog(i8* %5)
%7 = call i32 @printLog(i8* %5)
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = call i32 @printLog(i8* %5)
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %1)
%11 = call i32 @printLog(i8* %5)
%12 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = call i64 (...) @clock()
%16 = call i32 @bubbleSort(i32 %1, i32* %2)
br label %56
17: ; preds = %3
%18 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = call i64 (...) @clock()
%22 = call i32 @selectionSort(i32 %1, i32* %2)
br label %56
23: ; preds = %17
%24 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = call i64 (...) @clock()
%28 = call i32 @insertionSort(i32 %1, i32* %2)
br label %56
29: ; preds = %23
%30 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = shl i32 %1, 2
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to i32*
%36 = call i64 (...) @clock()
%37 = call i32 @mergeSort(i32* %2, i32 %1, i32* %35)
br label %56
38: ; preds = %29
%39 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = call i64 (...) @clock()
%43 = call i32 @heapSort(i32* %2, i32 %1)
br label %56
44: ; preds = %38
%45 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = call i64 (...) @clock()
%49 = call i32 @quickSort(i32 0, i32 %1, i32* %2)
br label %56
50: ; preds = %44
%51 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = call i64 (...) @clock()
%55 = call i32 @countingSort(i32* %2, i32 %1, i32* undef, i32* undef)
br label %56
56: ; preds = %20, %32, %47, %53, %50, %41, %26, %14
%57 = phi i1 [ false, %20 ], [ true, %32 ], [ false, %47 ], [ false, %53 ], [ false, %50 ], [ false, %41 ], [ false, %26 ], [ false, %14 ]
%58 = phi i32* [ undef, %20 ], [ %35, %32 ], [ undef, %47 ], [ undef, %53 ], [ undef, %50 ], [ undef, %41 ], [ undef, %26 ], [ undef, %14 ]
%59 = phi i64 [ %21, %20 ], [ %36, %32 ], [ %48, %47 ], [ %54, %53 ], [ undef, %50 ], [ %42, %41 ], [ %27, %26 ], [ %15, %14 ]
%60 = call i64 (...) @clock()
%61 = sub nsw i64 %60, %59
%62 = sitofp i64 %61 to double
%63 = load double, double* @CLOCKS_PER_SEC
%64 = fdiv double %62, %63
%65 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0), double %64)
%66 = call i32 @printLog(i8* %5)
%67 = call i32 @printResult(i8* %0, i32 %1, double %64)
br i1 %57, label %68, label %70
68: ; preds = %56
%69 = call i32 @free(i32* %58)
br label %70
70: ; preds = %56, %68
ret void
}