#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*/ imprime(int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ mergeSort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ preenche(int, int *);
int /*<<< orphan*/ printf(char *);
int main() {
  int vetor[10], tamanho = 10;
  preenche(tamanho, vetor);
  printf("Vetor sem ordenar:\n");
  imprime(0, tamanho - 1, vetor);
  mergeSort(vetor, 0, tamanho - 1);
  printf("Vetor ordenado:\n");
  imprime(0, tamanho - 1, vetor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x34(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1060 <preenche@plt>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
sub    $0x1,%esi
lea    -0x30(%rbp),%rdx
xor    %edi,%edi
call   1040 <imprime@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1050 <mergeSort@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
sub    $0x1,%esi
lea    -0x30(%rbp),%rdx
xor    %edi,%edi
call   1040 <imprime@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <preenche@plt>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x9,%esi
mov    %rbx,%rdx
call   1040 <imprime@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1050 <mergeSort@plt>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x9,%esi
mov    %rbx,%rdx
call   1040 <imprime@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Vetor sem ordenar:\0A\00"
@.str.1 = [17 x i8] c"Vetor ordenado:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %3
%4 = load i32, i32* %3
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = call i32 @preenche(i32 %4, i32* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%11 = call i32 @imprime(i32 0, i32 %9, i32* %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = call i32 @mergeSort(i32* %12, i32 0, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%20 = call i32 @imprime(i32 0, i32 %18, i32* %19)
ret i32 0
}

LLVM IR (-O2):
@str = [19 x i8] c"Vetor sem ordenar:\00"
@str.2 = [16 x i8] c"Vetor ordenado:\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @preenche(i32 10, i32* %3)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = call i32 @imprime(i32 0, i32 9, i32* %3)
%7 = call i32 @mergeSort(i32* %3, i32 0, i32 9)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0))
%9 = call i32 @imprime(i32 0, i32 9, i32* %3)
ret i32 0
}