#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*/ initfila();
int /*<<< orphan*/ pop();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push(int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int opt, num;
  printf("Bem vindo ao programa!\n");
  initfila();
  while (1) {
    printf("Escolha uma das opções abaixo:\n");
    printf("--1--Inserir novo valor\n");
    printf("--2--Remover um valor\n");
    printf("--0--Finalizar o prgrama\n");
    scanf("%d", &opt);
    switch (opt) {
    case 1:
      printf("Digite um numero para inserir na fila:\n");
      scanf("%d", &num);
      push(num);
      break;
    case 2:
      pop();
      break;
    case 0:
      return 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <initfila@plt>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     121c <main+0xcc>
jmp    11c5 <main+0x75>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     11e7 <main+0x97>
jmp    11d6 <main+0x86>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1210 <main+0xc0>
jmp    1224 <main+0xd4>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1060 <push@plt>
jmp    1224 <main+0xd4>
mov    $0x0,%al
call   1040 <pop@plt>
jmp    1224 <main+0xd4>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1172 <main+0x22>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <initfila@plt>
lea    0xea5(%rip),%r14
lea    0xebf(%rip),%r15
lea    0xed0(%rip),%r12
lea    0xedf(%rip),%r13
lea    0xe6f(%rip),%rbx
lea    0x4(%rsp),%rbp
jmp    11a7 <main+0x57>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <pop@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     11f0 <main+0xa0>
cmp    $0x2,%eax
je     11a0 <main+0x50>
test   %eax,%eax
jne    11a7 <main+0x57>
jmp    1211 <main+0xc1>
cs nopw 0x0(%rax,%rax,1)
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%edi
call   1060 <push@plt>
jmp    11a7 <main+0x57>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Bem vindo ao programa!\0A\00"
@.str.1 = [34 x i8] c"Escolha uma das op\C3\A7\C3\B5es abaixo:\0A\00"
@.str.2 = [25 x i8] c"--1--Inserir novo valor\0A\00"
@.str.3 = [23 x i8] c"--2--Remover um valor\0A\00"
@.str.4 = [26 x i8] c"--0--Finalizar o prgrama\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [40 x i8] c"Digite um numero para inserir na fila:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @initfila()
br label %6
6: ; preds = %0, %21
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
switch i32 %12, label %21 [
i32 1, label %13
i32 2, label %18
i32 0, label %20
]
13: ; preds = %6
%14 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = call i32 @push(i32 %16)
br label %21
18: ; preds = %6
%19 = call i32 (...) @pop()
br label %21
20: ; preds = %6
ret i32 0
21: ; preds = %6, %18, %13
br label %6
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%d\00"
@str = [23 x i8] c"Bem vindo ao programa!\00"
@str.7 = [33 x i8] c"Escolha uma das op\C3\A7\C3\B5es abaixo:\00"
@str.8 = [24 x i8] c"--1--Inserir novo valor\00"
@str.9 = [22 x i8] c"--2--Remover um valor\00"
@str.10 = [25 x i8] c"--0--Finalizar o prgrama\00"
@str.11 = [39 x i8] c"Digite um numero para inserir na fila:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @initfila()
br label %7
7: ; preds = %14, %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.8, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
switch i32 %13, label %14 [
i32 1, label %15
i32 2, label %20
i32 0, label %22
]
14: ; preds = %7, %20, %15
br label %7
15: ; preds = %7
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.11, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = call i32 @push(i32 %18)
br label %14
20: ; preds = %7
%21 = call i32 (...) @pop()
br label %14
22: ; preds = %7
ret i32 0
}