#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 atoi(char *);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ readNumbersFromFile(int, int *);
int /*<<< orphan*/ runSortAlgorithm(char *, int, int *);
int main(int argc, char *argv[]) {
  char *algorithm;
  if (argc < 2) {
    printf(
        "----------------------------------------------------------------\n");
    printf("At least two params are expected");
  } else {
    algorithm = argv[1];
    int size = atoi(argv[2]);
    int *numbers = (int *)malloc(sizeof(int) * size);
    readNumbersFromFile(size, numbers);
    runSortAlgorithm(algorithm, size, numbers);
    free(numbers);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    119d <main+0x3d>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
lea    0xeaf(%rip),%rdi
call   1050 <printf@plt>
jmp    11f1 <main+0x91>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1060 <readNumbersFromFile@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1040 <runSortAlgorithm@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x1,%edi
jg     1194 <main+0x24>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
lea    0xe73(%rip),%rdi
call   1060 <printf@plt>
jmp    11d5 <main+0x65>
mov    0x8(%rsi),%r14
mov    0x10(%rsi),%rdi
call   1090 <atoi@plt>
mov    %eax,%r15d
lea    0x0(,%r15,4),%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %r15d,%edi
mov    %rax,%rsi
call   1070 <readNumbersFromFile@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1050 <runSortAlgorithm@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [66 x i8] c"----------------------------------------------------------------\0A\00"
@.str.1 = [33 x i8] c"At least two params are expected\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %37
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
store i8* %17, i8** %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = mul i64 4, %23
%25 = trunc i64 %24 to i32
%26 = call i64 @malloc(i32 %25)
%27 = inttoptr i64 %26 to i32*
store i32* %27, i32** %8
%28 = load i32, i32* %7
%29 = load i32*, i32** %8
%30 = call i32 @readNumbersFromFile(i32 %28, i32* %29)
%31 = load i8*, i8** %6
%32 = load i32, i32* %7
%33 = load i32*, i32** %8
%34 = call i32 @runSortAlgorithm(i8* %31, i32 %32, i32* %33)
%35 = load i32*, i32** %8
%36 = call i32 @free(i32* %35)
br label %37
37: ; preds = %14, %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [33 x i8] c"At least two params are expected\00"
@str = [65 x i8] c"----------------------------------------------------------------\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %19
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = shl i32 %12, 2
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
%16 = tail call i32 @readNumbersFromFile(i32 %12, i32* %15)
%17 = tail call i32 @runSortAlgorithm(i8* %9, i32 %12, i32* %15)
%18 = tail call i32 @free(i32* %15)
br label %19
19: ; preds = %7, %4
ret i32 0
}