#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*/ compactar(int *);
int /*<<< orphan*/ inicializar(int *, int);
int /*<<< orphan*/ inserir(int *);
int menu();
int /*<<< orphan*/ mostrar(int *);
int /*<<< orphan*/ mostrar2(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remover(int *);
int main(void) {
  int lista[10], op;
  inicializar(lista, -1);
  do {
    op = menu();
    switch (op) {
    case 1:
      inserir(lista);
      break;
    case 2:
      remover(lista);
      break;
    case 3:
      mostrar(lista);
      break;
    case 4:
      break;
    case 0:
      compactar(lista);
      break;
    case -1:
      mostrar2(lista);
      break;
    default:
      printf("Opcao invalida! \nEscolha outra.");
      break;
    }
  } while (op < 4);
  printf("FIM!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xffffffff,%esi
call   1070 <inicializar@plt>
xor    %eax,%eax
call   1050 <menu@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x5,%eax
ja     121b <main+0x9b>
mov    -0x40(%rbp),%rax
lea    0xe39(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x30(%rbp),%rdi
call   1030 <inserir@plt>
jmp    1227 <main+0xa7>
lea    -0x30(%rbp),%rdi
call   1040 <remover@plt>
jmp    1227 <main+0xa7>
lea    -0x30(%rbp),%rdi
call   10a0 <mostrar@plt>
jmp    1227 <main+0xa7>
jmp    1227 <main+0xa7>
lea    -0x30(%rbp),%rdi
call   1090 <compactar@plt>
jmp    1227 <main+0xa7>
lea    -0x30(%rbp),%rdi
call   1080 <mostrar2@plt>
jmp    1227 <main+0xa7>
lea    0xdf6(%rip),%rdi
call   1060 <printf@plt>
jmp    122c <main+0xac>
cmpl   $0x4,-0x34(%rbp)
jl     119d <main+0x1d>
lea    0xdfb(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xffffffff,%esi
call   1080 <inicializar@plt>
lea    0xe66(%rip),%r14
lea    0xe47(%rip),%r12
jmp    11d5 <main+0x45>
mov    %r14,%rdi
call   1070 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x4,%ebx
jge    1221 <main+0x91>
xor    %eax,%eax
call   1060 <menu@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%eax
cmp    $0x5,%eax
ja     11bb <main+0x2b>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %r15,%rdi
call   1090 <mostrar2@plt>
jmp    11d0 <main+0x40>
mov    %r15,%rdi
call   10a0 <compactar@plt>
jmp    11d0 <main+0x40>
mov    %r15,%rdi
call   1030 <inserir@plt>
jmp    11d0 <main+0x40>
mov    %r15,%rdi
call   1050 <remover@plt>
jmp    11d0 <main+0x40>
mov    %r15,%rdi
call   10b0 <mostrar@plt>
jmp    11d0 <main+0x40>
lea    0xe10(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Opcao invalida! \0AEscolha outra.\00"
@.str.1 = [6 x i8] c"FIM!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%5 = call i32 @inicializar(i32* %4, i32 -1)
br label %6
6: ; preds = %28, %0
%7 = call i32 (...) @menu()
store i32 %7, i32* %3
%8 = load i32, i32* %3
switch i32 %8, label %25 [
i32 1, label %9
i32 2, label %12
i32 3, label %15
i32 4, label %18
i32 0, label %19
i32 -1, label %22
]
9: ; preds = %6
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%11 = call i32 @inserir(i32* %10)
br label %27
12: ; preds = %6
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%14 = call i32 @remover(i32* %13)
br label %27
15: ; preds = %6
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%17 = call i32 @mostrar(i32* %16)
br label %27
18: ; preds = %6
br label %27
19: ; preds = %6
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%21 = call i32 @compactar(i32* %20)
br label %27
22: ; preds = %6
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%24 = call i32 @mostrar2(i32* %23)
br label %27
25: ; preds = %6
%26 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25, %22, %19, %18, %15, %12, %9
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 4
br i1 %30, label %6, label %31
31: ; preds = %28
%32 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Opcao invalida! \0AEscolha outra.\00"
@str = [5 x i8] c"FIM!\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 @inicializar(i32* %3, i32 -1)
br label %5
5: ; preds = %19, %0
%6 = call i32 (...) @menu()
switch i32 %6, label %17 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %21
i32 0, label %13
i32 -1, label %15
]
7: ; preds = %5
%8 = call i32 @inserir(i32* %3)
br label %19
9: ; preds = %5
%10 = call i32 @remover(i32* %3)
br label %19
11: ; preds = %5
%12 = call i32 @mostrar(i32* %3)
br label %19
13: ; preds = %5
%14 = call i32 @compactar(i32* %3)
br label %19
15: ; preds = %5
%16 = call i32 @mostrar2(i32* %3)
br label %19
17: ; preds = %5
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %7, %9, %11, %13, %15, %17
%20 = icmp slt i32 %6, 4
br i1 %20, label %5, label %21
21: ; preds = %5, %19
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}