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

/* Variables and functions */
int /*<<< orphan*/ arrayPrint(int /*<<< orphan*/ *, int *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ getArray(int /*<<< orphan*/ *, int *, int);
int getLen(int /*<<< orphan*/ *);
int /*<<< orphan*/ mergeSort(int *, int /*<<< orphan*/, int);
int main() {
  FILE *in = fopen("task.in", "r");
  FILE *out = fopen("task.out", "w");
  int len = getLen(in);
  int array[len];
  getArray(in, array, len);
  mergeSort(array, 0, len);
  arrayPrint(out, array, len);
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe7d(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getLen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x38(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   1070 <getArray@plt>
mov    -0x38(%rbp),%rdi
mov    -0x1c(%rbp),%edx
xor    %esi,%esi
call   1060 <mergeSort@plt>
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   1040 <arrayPrint@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%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   %r12
push   %rbx
lea    0xe8e(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
lea    0xe82(%rip),%rdi
lea    0xe84(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1050 <getLen@plt>
mov    %eax,%r12d
mov    %eax,%eax
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1070 <getArray@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r12d,%edx
call   1060 <mergeSort@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1040 <arrayPrint@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"task.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"task.out\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
%8 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %8, i32** %3
%9 = load i32*, i32** %2
%10 = call i32 @getLen(i32* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %5
%14 = alloca i32, i64 %12
store i64 %12, i64* %6
%15 = load i32*, i32** %2
%16 = load i32, i32* %4
%17 = call i32 @getArray(i32* %15, i32* %14, i32 %16)
%18 = load i32, i32* %4
%19 = call i32 @mergeSort(i32* %14, i32 0, i32 %18)
%20 = load i32*, i32** %3
%21 = load i32, i32* %4
%22 = call i32 @arrayPrint(i32* %20, i32* %14, i32 %21)
%23 = load i32*, i32** %2
%24 = call i32 @fclose(i32* %23)
%25 = load i32*, i32** %3
%26 = call i32 @fclose(i32* %25)
store i32 0, i32* %1
%27 = load i8*, i8** %5
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [8 x i8] c"task.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"task.out\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 @getLen(i32* %1)
%4 = zext i32 %3 to i64
%5 = alloca i32, i64 %4
%6 = call i32 @getArray(i32* %1, i32* %5, i32 %3)
%7 = call i32 @mergeSort(i32* %5, i32 0, i32 %3)
%8 = call i32 @arrayPrint(i32* %2, i32* %5, i32 %3)
%9 = call i32 @fclose(i32* %1)
%10 = call i32 @fclose(i32* %2)
ret i32 0
}