#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(char **);
scalar_t__ malloc(int);
int /*<<< orphan*/ parse(char *, char **, char **, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ quickSort(int *, int *, int);
int main(int argc, char **argv) {
  char **songList = (char **)malloc(10000);
  char **playcountList = (char **)malloc(10000);
  int numSongs = 0;
  printf("%s\n", argv[1]);
  parse(argv[1], songList, playcountList, &numSongs);
  printf("~*~*~*~*~*~ HELLO WORLD ~*~*~*~*~*~");
  int playcountArry[numSongs];
  int map[numSongs];
  for (int i = 0; i < numSongs; i++) {
    playcountArry[i] = atoi(playcountList[i]);
    map[i] = i;
  }
  quickSort(playcountArry, map, numSongs);
  for (int j = 0; j < numSongs; j++) {
    printf("Song : %s || Playcount : %d\n", songList[map[j]], playcountArry[j]);
  }
  free(songList);
  free(playcountList);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2710,%edi
mov    %edi,-0x60(%rbp)
call   1050 <malloc@plt>
mov    -0x60(%rbp),%edi
mov    %rax,-0x18(%rbp)
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe57(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x59(%rbp)
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1080 <parse@plt>
mov    -0x59(%rbp),%al
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    126f <main+0x10f>
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <atoi@plt>
mov    -0x58(%rbp),%rcx
mov    %eax,%esi
mov    -0x50(%rbp),%rax
movslq -0x44(%rbp),%rdx
mov    %esi,(%rcx,%rdx,4)
mov    -0x44(%rbp),%edx
movslq -0x44(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1229 <main+0xc9>
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdi
mov    -0x24(%rbp),%edx
call   1060 <quickSort@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12cd <main+0x16d>
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rdx
mov    -0x18(%rbp),%rcx
movslq -0x48(%rbp),%rsi
movslq (%rdx,%rsi,4),%rdx
mov    (%rcx,%rdx,8),%rsi
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1286 <main+0x126>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r15
mov    $0x2710,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0x2710,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
movl   $0x0,-0x2c(%rbp)
mov    0x8(%r15),%rdi
call   1040 <puts@plt>
mov    0x8(%r15),%rdi
lea    -0x2c(%rbp),%rcx
mov    %rbx,-0x48(%rbp)
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <parse@plt>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x2c(%rbp),%r13d
mov    %rsp,%r15
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
test   %r13d,%r13d
jle    122a <main+0xba>
xor    %ebx,%ebx
nop
mov    (%r14,%rbx,8),%rdi
call   1080 <atoi@plt>
mov    %eax,(%r12,%rbx,4)
mov    %ebx,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1210 <main+0xa0>
mov    %r14,-0x40(%rbp)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13d,%edx
call   1070 <quickSort@plt>
cmpl   $0x0,-0x2c(%rbp)
mov    -0x48(%rbp),%rbx
jle    1273 <main+0x103>
lea    0xdd7(%rip),%r13
xor    %r14d,%r14d
movslq (%r15,%r14,4),%rax
mov    (%rbx,%rax,8),%rsi
mov    (%r12,%r14,4),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
movslq -0x2c(%rbp),%rax
cmp    %rax,%r14
jl     1250 <main+0xe0>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [36 x i8] c"~*~*~*~*~*~ HELLO WORLD ~*~*~*~*~*~\00"
@.str.2 = [29 x i8] c"Song : %s || Playcount : %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i64 @malloc(i32 10000)
%15 = inttoptr i64 %14 to i8**
store i8** %15, i8*** %6
%16 = call i64 @malloc(i32 10000)
%17 = inttoptr i64 %16 to i8**
store i8** %17, i8*** %7
store i32 0, i32* %8
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %6
%26 = load i8**, i8*** %7
%27 = call i32 @parse(i8* %24, i8** %25, i8** %26, i32* %8)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* %8
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %9
%32 = alloca i32, i64 %30
store i64 %30, i64* %10
%33 = load i32, i32* %8
%34 = zext i32 %33 to i64
%35 = alloca i32, i64 %34
store i64 %34, i64* %11
store i32 0, i32* %12
br label %36
36: ; preds = %54, %2
%37 = load i32, i32* %12
%38 = load i32, i32* %8
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %57
40: ; preds = %36
%41 = load i8**, i8*** %7
%42 = load i32, i32* %12
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
%47 = load i32, i32* %12
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %32, i64 %48
store i32 %46, i32* %49
%50 = load i32, i32* %12
%51 = load i32, i32* %12
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %35, i64 %52
store i32 %50, i32* %53
br label %54
54: ; preds = %40
%55 = load i32, i32* %12
%56 = add nsw i32 %55, 1
store i32 %56, i32* %12
br label %36
57: ; preds = %36
%58 = load i32, i32* %8
%59 = call i32 @quickSort(i32* %32, i32* %35, i32 %58)
store i32 0, i32* %13
br label %60
60: ; preds = %78, %57
%61 = load i32, i32* %13
%62 = load i32, i32* %8
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %81
64: ; preds = %60
%65 = load i8**, i8*** %6
%66 = load i32, i32* %13
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i32, i32* %35, i64 %67
%69 = load i32, i32* %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %65, i64 %70
%72 = load i8*, i8** %71
%73 = load i32, i32* %13
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %32, i64 %74
%76 = load i32, i32* %75
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %72, i32 %76)
br label %78
78: ; preds = %64
%79 = load i32, i32* %13
%80 = add nsw i32 %79, 1
store i32 %80, i32* %13
br label %60
81: ; preds = %60
%82 = load i8**, i8*** %6
%83 = call i32 @free(i8** %82)
%84 = load i8**, i8*** %7
%85 = call i32 @free(i8** %84)
store i32 0, i32* %3
%86 = load i8*, i8** %9
%87 = load i32, i32* %3
ret i32 %87
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"~*~*~*~*~*~ HELLO WORLD ~*~*~*~*~*~\00"
@.str.2 = [29 x i8] c"Song : %s || Playcount : %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = tail call i64 @malloc(i32 10000)
%5 = inttoptr i64 %4 to i8**
%6 = tail call i64 @malloc(i32 10000)
%7 = inttoptr i64 %6 to i8**
%8 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = load i8*, i8** %9
%13 = call i32 @parse(i8* %12, i8** %5, i8** %7, i32* %3)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %3
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
%18 = alloca i32, i64 %16
%19 = load i32, i32* %3
%20 = zext i32 %19 to i64
%21 = alloca i32, i64 %20
%22 = icmp sgt i32 %19, 0
br i1 %22, label %27, label %23
23: ; preds = %27, %2
%24 = call i32 @quickSort(i32* %18, i32* %21, i32 %19)
%25 = load i32, i32* %3
%26 = icmp sgt i32 %25, 0
br i1 %26, label %40, label %37
27: ; preds = %2, %27
%28 = phi i64 [ %35, %27 ], [ 0, %2 ]
%29 = getelementptr inbounds i8*, i8** %7, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
%32 = getelementptr inbounds i32, i32* %18, i64 %28
store i32 %31, i32* %32
%33 = getelementptr inbounds i32, i32* %21, i64 %28
%34 = trunc i64 %28 to i32
store i32 %34, i32* %33
%35 = add nuw nsw i64 %28, 1
%36 = icmp eq i64 %35, %20
br i1 %36, label %23, label %27
37: ; preds = %40, %23
%38 = call i32 @free(i8** %5)
%39 = call i32 @free(i8** %7)
ret i32 0
40: ; preds = %23, %40
%41 = phi i64 [ %50, %40 ], [ 0, %23 ]
%42 = getelementptr inbounds i32, i32* %21, i64 %41
%43 = load i32, i32* %42
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %5, i64 %44
%46 = load i8*, i8** %45
%47 = getelementptr inbounds i32, i32* %18, i64 %41
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %46, i32 %48)
%50 = add nuw nsw i64 %41, 1
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = icmp slt i64 %50, %52
br i1 %53, label %40, label %37
}