#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*/ checarQuantidade();
int /*<<< orphan*/ checarValidade();
int /*<<< orphan*/ deletarProduto();
int /*<<< orphan*/ deletarProdutosZerados();
int /*<<< orphan*/ inserirProduto();
int /*<<< orphan*/ limparTela();
int /*<<< orphan*/ marca();
int /*<<< orphan*/ menuExibir();
char *now();
int /*<<< orphan*/ pause();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ retirarDoEstoque();
int /*<<< orphan*/ scanf(char *, int *);
void menuEstoque() {
  int opcao;
  limparTela();
  deletarProdutosZerados();
  printf("                                        %s", now());
  marca();
  printf("\t\t\t      Estoque\n\n");
  printf("\t      1-Fazer Novo Pedido    4-Excluir Produtos\n\t      2-Listar "
         "Produtos      0-Voltar\n\t      3-Colocar para Venda");
  checarQuantidade();
  checarValidade();
  printf("\n\n\t      Opção: ");
  scanf("%d", &opcao);
  switch (opcao) {
  case 1:
    inserirProduto();
    break;
  case 2:
    menuExibir();
    break;
  case 3:
    retirarDoEstoque();
    break;
  case 4:
    deletarProduto();
    break;
  case 0:
    return;
  default:
    printf(" Opcao Invalida, voltando ao menu principal! \n");
    pause();
    break;
  }
}


x86 assembly (clang, -O0):
<menuEstoque>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   10f0 <limparTela@plt>
mov    -0x11(%rbp),%al
call   10a0 <deletarProdutosZerados@plt>
mov    -0x11(%rbp),%al
call   10c0 <now@plt>
mov    %rax,%rsi
mov    -0x11(%rbp),%al
lea    0xe15(%rip),%rdi
call   1060 <printf@plt>
mov    -0x11(%rbp),%al
call   1030 <marca@plt>
mov    -0x11(%rbp),%al
lea    0xe29(%rip),%rdi
call   1060 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xe2d(%rip),%rdi
call   1060 <printf@plt>
mov    -0x11(%rbp),%al
call   1050 <checarQuantidade@plt>
mov    -0x11(%rbp),%al
call   10d0 <checarValidade@plt>
mov    -0x11(%rbp),%al
lea    0xe82(%rip),%rdi
call   1060 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x4,%rax
ja     12b3 <menuEstoque+0xe3>
mov    -0x10(%rbp),%rax
lea    0xd8b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10e0 <inserirProduto@plt>
jmp    12c8 <menuEstoque+0xf8>
mov    $0x0,%al
call   1080 <menuExibir@plt>
jmp    12c8 <menuEstoque+0xf8>
mov    $0x0,%al
call   1040 <retirarDoEstoque@plt>
jmp    12c8 <menuEstoque+0xf8>
mov    $0x0,%al
call   1070 <deletarProduto@plt>
jmp    12c8 <menuEstoque+0xf8>
jmp    12c8 <menuEstoque+0xf8>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1090 <pause@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuEstoque>:
push   %rax
xor    %eax,%eax
call   1100 <limparTela@plt>
xor    %eax,%eax
call   10b0 <deletarProdutosZerados@plt>
xor    %eax,%eax
call   10d0 <now@plt>
lea    0xe17(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1030 <marca@plt>
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1060 <checarQuantidade@plt>
xor    %eax,%eax
call   10e0 <checarValidade@plt>
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe7b(%rip),%rdi
lea    0x4(%rsp),%rsi
call   10c0 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x4,%rax
ja     1278 <menuEstoque+0x98>
lea    0xd9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10f0 <inserirProduto@plt>
pop    %rax
ret
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10a0 <pause@plt>
pop    %rax
ret
xor    %eax,%eax
call   1090 <menuExibir@plt>
pop    %rax
ret
xor    %eax,%eax
call   1050 <retirarDoEstoque@plt>
pop    %rax
ret
xor    %eax,%eax
call   1080 <deletarProduto@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [43 x i8] c" %s\00"
@.str.1 = [19 x i8] c"\09\09\09 Estoque\0A\0A\00"
@.str.2 = [116 x i8] c"\09 1-Fazer Novo Pedido 4-Excluir Produtos\0A\09 2-Listar Produtos 0-Voltar\0A\09 3-Colocar para Venda\00"
@.str.3 = [19 x i8] c"\0A\0A\09 Op\C3\A7\C3\A3o: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [47 x i8] c" Opcao Invalida, voltando ao menu principal! \0A\00"
define void @menuEstoque() {
%1 = alloca i32
%2 = call i32 (...) @limparTela()
%3 = call i32 (...) @deletarProdutosZerados()
%4 = call i8* (...) @now()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @marca()
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (...) @checarQuantidade()
%10 = call i32 (...) @checarValidade()
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
switch i32 %13, label %23 [
i32 1, label %14
i32 2, label %16
i32 3, label %18
i32 4, label %20
i32 0, label %22
]
14: ; preds = %0
%15 = call i32 (...) @inserirProduto()
br label %26
16: ; preds = %0
%17 = call i32 (...) @menuExibir()
br label %26
18: ; preds = %0
%19 = call i32 (...) @retirarDoEstoque()
br label %26
20: ; preds = %0
%21 = call i32 (...) @deletarProduto()
br label %26
22: ; preds = %0
br label %26
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 (...) @pause()
br label %26
26: ; preds = %22, %23, %20, %18, %16, %14
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c" %s\00"
@.str.2 = [116 x i8] c"\09 1-Fazer Novo Pedido 4-Excluir Produtos\0A\09 2-Listar Produtos 0-Voltar\0A\09 3-Colocar para Venda\00"
@.str.3 = [19 x i8] c"\0A\0A\09 Op\C3\A7\C3\A3o: \00"
@.str.4 = [3 x i8] c"%d\00"
@str = [18 x i8] c"\09\09\09 Estoque\0A\00"
@str.6 = [46 x i8] c" Opcao Invalida, voltando ao menu principal! \00"
define void @menuEstoque() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @limparTela()
%4 = tail call i32 (...) @deletarProdutosZerados()
%5 = tail call i8* (...) @now()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 (...) @marca()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([116 x i8], [116 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (...) @checarQuantidade()
%11 = tail call i32 (...) @checarValidade()
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
switch i32 %14, label %23 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
i32 0, label %26
]
15: ; preds = %0
%16 = call i32 (...) @inserirProduto()
br label %26
17: ; preds = %0
%18 = call i32 (...) @menuExibir()
br label %26
19: ; preds = %0
%20 = call i32 (...) @retirarDoEstoque()
br label %26
21: ; preds = %0
%22 = call i32 (...) @deletarProduto()
br label %26
23: ; preds = %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.6, i64 0, i64 0))
%25 = call i32 (...) @pause()
br label %26
26: ; preds = %15, %17, %19, %21, %23, %0
ret void
}