#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ imprimir(int *, int *, int *, int *);
int /*<<< orphan*/ inserir(int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remover(int *, int *, int *, int *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int vet[10], ini = -1, fim = -1, num = 0, opc = 0, i = 0;
  for (i = 0; i < 10; ++i)
    vet[i] = 0;
  while (1) {
    printf("\n\tMenu:\n\t\t1) Inserir\n\t\t2) Remover\n\t\t3) Imprimir\n\t\t4) "
           "Sair\n\t\tOpcao -> ");
    scanf("%d", &opc);
    if (opc == 1)
      inserir(&vet[0], &ini, &fim, &num);
    else if (opc == 2)
      remover(&vet[0], &ini, &fim, &num);
    else if (opc == 3)
      imprimir(&vet[0], &ini, &fim, &num);
    else if (opc == 4)
      break;
    else
      printf("\n\a\tOpcao invalida!!!\n");
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x34(%rbp)
movl   $0xffffffff,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11bd <main+0x5d>
movslq -0x44(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1199 <main+0x39>
jmp    11c2 <main+0x62>
lea    0xe37(%rip),%rdi
call   1050 <printf@plt>
lea    0xe71(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x40(%rbp)
jne    1202 <main+0xa2>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1030 <inserir@plt>
jmp    1274 <main+0x114>
cmpl   $0x2,-0x40(%rbp)
jne    1226 <main+0xc6>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1040 <remover@plt>
jmp    126f <main+0x10f>
cmpl   $0x3,-0x40(%rbp)
jne    124a <main+0xea>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1060 <imprimir@plt>
jmp    126a <main+0x10a>
cmpl   $0x4,-0x40(%rbp)
jne    1259 <main+0xf9>
jmp    1279 <main+0x119>
lea    0xde9(%rip),%rdi
call   1050 <printf@plt>
jmp    126a <main+0x10a>
jmp    126f <main+0x10f>
jmp    1274 <main+0x114>
jmp    11c2 <main+0x62>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movl   $0xffffffff,(%rsp)
movl   $0xffffffff,0xc(%rsp)
ff
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xe56(%rip),%r14
lea    0xe95(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xe33(%rip),%rbp
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
jmp    11f3 <main+0x83>
nopl   0x0(%rax)
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1070 <imprimir@plt>
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1240 <main+0xd0>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1030 <inserir@plt>
jmp    11f3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe12(%rip),%rdi
call   1040 <puts@plt>
jmp    11f3 <main+0x83>
xchg   %ax,%ax
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1050 <remover@plt>
jmp    11f3 <main+0x83>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"\0A\09Menu:\0A\09\091) Inserir\0A\09\092) Remover\0A\09\093) Imprimir\0A\09\094) Sair\0A\09\09Opcao -> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\0A\07\09Opcao invalida!!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %3
store i32 -1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %7
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
store i32 0, i32* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
br label %8
18: ; preds = %8
br label %19
19: ; preds = %18, %48
%20 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%26 = call i32 @inserir(i32* %25, i32* %3, i32* %4, i32* %5)
br label %48
27: ; preds = %19
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 2
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%32 = call i32 @remover(i32* %31, i32* %3, i32* %4, i32* %5)
br label %47
33: ; preds = %27
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 3
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%38 = call i32 @imprimir(i32* %37, i32* %3, i32* %4, i32* %5)
br label %46
39: ; preds = %33
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, 4
br i1 %41, label %42, label %43
42: ; preds = %39
br label %49
43: ; preds = %39
%44 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43
br label %46
46: ; preds = %45, %36
br label %47
47: ; preds = %46, %30
br label %48
48: ; preds = %47, %24
br label %19
49: ; preds = %42
%50 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [70 x i8] c"\0A\09Menu:\0A\09\091) Inserir\0A\09\092) Remover\0A\09\093) Imprimir\0A\09\094) Sair\0A\09\09Opcao -> \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [21 x i8] c"\0A\07\09Opcao invalida!!!\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 -1, i32* %4
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
br label %12
12: ; preds = %20, %0
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%15 = load i32, i32* %6
switch i32 %15, label %23 [
i32 1, label %16
i32 2, label %18
i32 3, label %21
i32 4, label %25
]
16: ; preds = %12
%17 = call i32 @inserir(i32* %11, i32* %3, i32* %4, i32* %5)
br label %20
18: ; preds = %12
%19 = call i32 @remover(i32* %11, i32* %3, i32* %4, i32* %5)
br label %20
20: ; preds = %18, %23, %21, %16
br label %12
21: ; preds = %12
%22 = call i32 @imprimir(i32* %11, i32* %3, i32* %4, i32* %5)
br label %20
23: ; preds = %12
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %20
25: ; preds = %12
%26 = call i32 @exit(i32 0)
unreachable
}