#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*/ bubblesort_inverso(int *, int);
int cont_elemt_impar(int *, int);
int cont_elemt_par(int *, int);
int /*<<< orphan*/ insere_lista_auto(int *, int);
float media_maior_50(int *, int);
int /*<<< orphan*/ mostra_lista(int *, int);
int /*<<< orphan*/ printf(char *, ...);
void question_one() {
  int tam_vetor = 100;
  int vetor[tam_vetor];
  printf("\n------------- Questao 1 -------------\n");
  insere_lista_auto(vetor, tam_vetor);
  printf("Lista incial:\n");
  mostra_lista(vetor, tam_vetor);
  int numPar = cont_elemt_par(vetor, tam_vetor);
  int numImpar = cont_elemt_impar(vetor, tam_vetor);
  printf("par: %d\nimpar: %d\n", numPar, numImpar);
  float media = media_maior_50(vetor, tam_vetor);
  printf("media: %.2f\n\n", media);
  bubblesort_inverso(vetor, tam_vetor);
  printf("lista ordenada: \n");
  mostra_lista(vetor, tam_vetor);
}


x86 assembly (clang, -O0):
<question_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1090 <insere_lista_auto@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1080 <mostra_lista@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <cont_elemt_par@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%esi
call   1030 <cont_elemt_impar@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1070 <media_maior_50@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1d(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <bubblesort_inverso@plt>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1080 <mostra_lista@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<question_one>:
push   %rbp
push   %rbx
sub    $0x198,%rsp
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   10a0 <insere_lista_auto@plt>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1090 <mostra_lista@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1060 <cont_elemt_par@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <cont_elemt_impar@plt>
lea    0xe1f(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1080 <media_maior_50@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe0f(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <bubblesort_inverso@plt>
lea    0xe37(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1090 <mostra_lista@plt>
add    $0x198,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"\0A------------- Questao 1 -------------\0A\00"
@.str.1 = [15 x i8] c"Lista incial:\0A\00"
@.str.2 = [19 x i8] c"par: %d\0Aimpar: %d\0A\00"
@.str.3 = [14 x i8] c"media: %.2f\0A\0A\00"
@.str.4 = [18 x i8] c"lista ordenada: \0A\00"
define void @question_one() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 100, i32* %1
%7 = load i32, i32* %1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %2
%10 = alloca i32, i64 %8
store i64 %8, i64* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = call i32 @insere_lista_auto(i32* %10, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = call i32 @mostra_lista(i32* %10, i32 %15)
%17 = load i32, i32* %1
%18 = call i32 @cont_elemt_par(i32* %10, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %1
%20 = call i32 @cont_elemt_impar(i32* %10, i32 %19)
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32, i32* %1
%25 = call float @media_maior_50(i32* %10, i32 %24)
store float %25, float* %6
%26 = load float, float* %6
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %27)
%29 = load i32, i32* %1
%30 = call i32 @bubblesort_inverso(i32* %10, i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32, i32* %1
%33 = call i32 @mostra_lista(i32* %10, i32 %32)
%34 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
@.str.2 = [19 x i8] c"par: %d\0Aimpar: %d\0A\00"
@.str.3 = [14 x i8] c"media: %.2f\0A\0A\00"
@str = [39 x i8] c"\0A------------- Questao 1 -------------\00"
@str.5 = [14 x i8] c"Lista incial:\00"
@str.6 = [17 x i8] c"lista ordenada: \00"
define void @question_one() {
%1 = alloca [100 x i32]
%2 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%4 = call i32 @insere_lista_auto(i32* %2, i32 100)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0))
%6 = call i32 @mostra_lista(i32* %2, i32 100)
%7 = call i32 @cont_elemt_par(i32* %2, i32 100)
%8 = call i32 @cont_elemt_impar(i32* %2, i32 100)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
%10 = call float @media_maior_50(i32* %2, i32 100)
%11 = fpext float %10 to double
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %11)
%13 = call i32 @bubblesort_inverso(i32* %2, i32 100)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%15 = call i32 @mostra_lista(i32* %2, i32 100)
ret void
}