#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*/ MergesortI(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);
  MergesortI(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   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    -0x40(%rbp),%rdi
call   1060 <gera_vetor@plt>
lea    -0x40(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1030 <debug@plt>
lea    -0x40(%rbp),%rsi
mov    $0x10,%edi
call   1080 <MergesortI@plt>
lea    -0x40(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1030 <debug@plt>
lea    0xe5a(%rip),%rdi
call   1040 <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   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gera_vetor@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
call   1030 <debug@plt>
mov    $0x10,%edi
mov    %rbx,%rsi
call   1080 <MergesortI@plt>
lea    0xe67(%rip),%rdi
mov    %rbx,%rsi
call   1030 <debug@plt>
lea    0xe60(%rip),%rdi
call   1040 <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 @MergesortI(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 @MergesortI(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
}