#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 /*<<< orphan*/ inserir(int *, int *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remover(int *, int *, int *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int vet[10], ini = 0, 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, &num);
    else if (opc == 2)
      remover(&vet[0], &ini, &num);
    else if (opc == 3)
      imprimir(&vet[0], &ini, &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    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0xa,-0x40(%rbp)
jge    11b6 <main+0x56>
movslq -0x40(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1192 <main+0x32>
jmp    11bb <main+0x5b>
lea    0xe3e(%rip),%rdi
call   1050 <printf@plt>
lea    0xe78(%rip),%rdi
lea    -0x3c(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x3c(%rbp)
jne    11f7 <main+0x97>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <inserir@plt>
jmp    1261 <main+0x101>
cmpl   $0x2,-0x3c(%rbp)
jne    1217 <main+0xb7>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1040 <remover@plt>
jmp    125c <main+0xfc>
cmpl   $0x3,-0x3c(%rbp)
jne    1237 <main+0xd7>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1060 <imprimir@plt>
jmp    1257 <main+0xf7>
cmpl   $0x4,-0x3c(%rbp)
jne    1246 <main+0xe6>
jmp    1266 <main+0x106>
lea    0xdfc(%rip),%rdi
call   1050 <printf@plt>
jmp    1257 <main+0xf7>
jmp    125c <main+0xfc>
jmp    1261 <main+0x101>
jmp    11bb <main+0x5b>
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   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xe5d(%rip),%r14
lea    0xe9c(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xe3a(%rip),%r13
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r12
jmp    11f0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
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     1230 <main+0xc0>
movslq 0x0(%r13,%rax,4),%rax
add    %r13,%rax
jmp    *%rax
lea    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <inserir@plt>
jmp    11f0 <main+0x80>
nopl   0x0(%rax,%rax,1)
lea    0xe22(%rip),%rdi
call   1040 <puts@plt>
jmp    11f0 <main+0x80>
xchg   %ax,%ax
lea    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1050 <remover@plt>
jmp    11f0 <main+0x80>
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
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %6
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %12
store i32 0, i32* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %6
br label %7
17: ; preds = %7
br label %18
18: ; preds = %17, %47
%19 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%25 = call i32 @inserir(i32* %24, i32* %3, i32* %4)
br label %47
26: ; preds = %18
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%31 = call i32 @remover(i32* %30, i32* %3, i32* %4)
br label %46
32: ; preds = %26
%33 = load i32, i32* %5
%34 = icmp eq i32 %33, 3
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%37 = call i32 @imprimir(i32* %36, i32* %3, i32* %4)
br label %45
38: ; preds = %32
%39 = load i32, i32* %5
%40 = icmp eq i32 %39, 4
br i1 %40, label %41, label %42
41: ; preds = %38
br label %48
42: ; preds = %38
%43 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42
br label %45
45: ; preds = %44, %35
br label %46
46: ; preds = %45, %29
br label %47
47: ; preds = %46, %23
br label %18
48: ; preds = %41
%49 = 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 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
br label %10
10: ; preds = %18, %0
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%13 = load i32, i32* %5
switch i32 %13, label %21 [
i32 1, label %14
i32 2, label %16
i32 3, label %19
i32 4, label %23
]
14: ; preds = %10
%15 = call i32 @inserir(i32* %9, i32* %3, i32* %4)
br label %18
16: ; preds = %10
%17 = call i32 @remover(i32* %9, i32* %3, i32* %4)
br label %18
18: ; preds = %16, %21, %19, %14
br label %10
19: ; preds = %10
%20 = call i32 @imprimir(i32* %9, i32* %3, i32* %4)
br label %18
21: ; preds = %10
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %18
23: ; preds = %10
%24 = call i32 @exit(i32 0)
unreachable
}