#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 /*<<< orphan*/ Mergesort(int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ debug(char *, int *);
int /*<<< orphan*/ gera_vetor(int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int v[16];
  srand(time(NULL));
  gera_vetor(v);
  debug("Antes: ", v);
  Mergesort(0, 16, v);
  debug("Final: ", v);
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    -0x40(%rbp),%rdi
call   1070 <gera_vetor@plt>
lea    -0x40(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1040 <debug@plt>
lea    -0x40(%rbp),%rdx
xor    %edi,%edi
mov    $0x10,%esi
call   1030 <Mergesort@plt>
lea    -0x40(%rbp),%rsi
lea    0xe5c(%rip),%rdi
call   1040 <debug@plt>
lea    0xe58(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <gera_vetor@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
call   1040 <debug@plt>
xor    %edi,%edi
mov    $0x10,%esi
mov    %rbx,%rdx
call   1030 <Mergesort@plt>
lea    0xe65(%rip),%rdi
mov    %rbx,%rsi
call   1040 <debug@plt>
lea    0xe5e(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Antes: \00"
@.str.1 = [8 x i8] c"Final: \00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%5 = call i32 @gera_vetor(i32* %4)
%6 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%7 = call i32 @debug(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%9 = call i32 @Mergesort(i32 0, i32 16, i32* %8)
%10 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%11 = call i32 @debug(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Antes: \00"
@.str.1 = [8 x i8] c"Final: \00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = bitcast [16 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%6 = call i32 @gera_vetor(i32* %5)
%7 = call i32 @debug(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %5)
%8 = call i32 @Mergesort(i32 0, i32 16, i32* %5)
%9 = call i32 @debug(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%10 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}