#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 /*<<< orphan*/ inserir(int *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remover(int *, int *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int vet[10], topo = -1, 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], &topo);
    else if (opc == 2)
      remover(&vet[0], &topo);
    else if (opc == 3)
      imprimir(&vet[0], &topo);
    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   $0xffffffff,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    11af <main+0x4f>
movslq -0x3c(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    118b <main+0x2b>
jmp    11b4 <main+0x54>
lea    0xe45(%rip),%rdi
call   1050 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x38(%rbp)
jne    11ec <main+0x8c>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
call   1030 <inserir@plt>
jmp    124e <main+0xee>
cmpl   $0x2,-0x38(%rbp)
jne    1208 <main+0xa8>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <remover@plt>
jmp    1249 <main+0xe9>
cmpl   $0x3,-0x38(%rbp)
jne    1224 <main+0xc4>
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
call   1060 <imprimir@plt>
jmp    1244 <main+0xe4>
cmpl   $0x4,-0x38(%rbp)
jne    1233 <main+0xd3>
jmp    1253 <main+0xf3>
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
jmp    1244 <main+0xe4>
jmp    1249 <main+0xe9>
jmp    124e <main+0xee>
jmp    11b4 <main+0x54>
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,0xc(%rsp)
ff
movl   $0x0,0x8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xe65(%rip),%r14
lea    0xea4(%rip),%r15
lea    0x8(%rsp),%rbx
lea    0xe42(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbp
jmp    11db <main+0x6b>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbp,%rsi
call   1070 <imprimir@plt>
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1210 <main+0xa0>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %r13,%rdi
mov    %rbp,%rsi
call   1030 <inserir@plt>
jmp    11db <main+0x6b>
lea    0xe42(%rip),%rdi
call   1040 <puts@plt>
jmp    11db <main+0x6b>
xchg   %ax,%ax
mov    %r13,%rdi
mov    %rbp,%rsi
call   1050 <remover@plt>
jmp    11db <main+0x6b>
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
store i32 0, i32* %1
store i32 -1, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %5
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
br label %17
17: ; preds = %16, %46
%18 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%24 = call i32 @inserir(i32* %23, i32* %3)
br label %46
25: ; preds = %17
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%30 = call i32 @remover(i32* %29, i32* %3)
br label %45
31: ; preds = %25
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 3
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%36 = call i32 @imprimir(i32* %35, i32* %3)
br label %44
37: ; preds = %31
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 4
br i1 %39, label %40, label %41
40: ; preds = %37
br label %47
41: ; preds = %37
%42 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41
br label %44
44: ; preds = %43, %34
br label %45
45: ; preds = %44, %28
br label %46
46: ; preds = %45, %22
br label %17
47: ; preds = %40
%48 = 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 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
br label %8
8: ; preds = %16, %0
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %4
switch i32 %11, label %19 [
i32 1, label %12
i32 2, label %14
i32 3, label %17
i32 4, label %21
]
12: ; preds = %8
%13 = call i32 @inserir(i32* %7, i32* %3)
br label %16
14: ; preds = %8
%15 = call i32 @remover(i32* %7, i32* %3)
br label %16
16: ; preds = %14, %19, %17, %12
br label %8
17: ; preds = %8
%18 = call i32 @imprimir(i32* %7, i32* %3)
br label %16
19: ; preds = %8
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %16
21: ; preds = %8
%22 = call i32 @exit(i32 0)
unreachable
}