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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x64,-0x198(%rbp)
mov    -0x198(%rbp),%edi
lea    -0x190(%rbp),%rsi
call   1060 <preenche@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x198(%rbp),%edi
lea    -0x190(%rbp),%rsi
call   1040 <imprime@plt>
lea    -0x190(%rbp),%rdi
mov    -0x198(%rbp),%esi
call   1050 <InsertionSort@plt>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x198(%rbp),%edi
lea    -0x190(%rbp),%rsi
call   1040 <imprime@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
mov    $0x64,%edi
mov    %rbx,%rsi
call   1060 <preenche@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x64,%edi
mov    %rbx,%rsi
call   1040 <imprime@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <InsertionSort@plt>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x64,%edi
mov    %rbx,%rsi
call   1040 <imprime@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
ret

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

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