#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*/ ApagarCarroPorChassi(int);
int /*<<< orphan*/ ApagarVagaPorId(int);
int /*<<< orphan*/ Cria_lista();
int /*<<< orphan*/ EstacionarCarro(int, int);
int /*<<< orphan*/ ImprimirFilaDeCarros(int);
int /*<<< orphan*/ ImprimirVagasLivres(int);
int /*<<< orphan*/ ImprimirVagasOcupadas(int);
int /*<<< orphan*/ InserirCarro(char *, int *);
int /*<<< orphan*/ InserirVaga(char *, int *);
int /*<<< orphan*/ ListarCarros(int);
int Menu2(int, int);
int /*<<< orphan*/ SalvarCarros(char *, int);
int /*<<< orphan*/ SalvarVagas(char *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(void) {
  int escolha;
  int QtdeCarros;
  int QtdeVagas;
  Cria_lista();
  InserirVaga("vagas.txt", &QtdeVagas);
  InserirCarro("veiculos.txt", &QtdeCarros);
  for (;;) {
    escolha = Menu2(QtdeCarros, QtdeVagas);
    switch (escolha) {
    case 1:
      InserirCarro("veiculos.txt", &QtdeCarros);
      break;
    case 2:
      InserirVaga("vagas.txt", &QtdeVagas);
      break;
    case 3:
      ApagarCarroPorChassi(QtdeCarros);
      break;
    case 4:
      ApagarVagaPorId(QtdeVagas);
      break;
    case 5:
      ImprimirVagasOcupadas(QtdeVagas);
      break;
    case 6:
      ImprimirVagasLivres(QtdeVagas);
      break;
    case 7:
      ImprimirFilaDeCarros(QtdeCarros);
      break;
    case 8:
      SalvarVagas("VagasSalvas.txt", QtdeVagas);
      break;
    case 9:
      SalvarCarros("CarrosSalvos.txt", QtdeCarros);
      break;
    case 10:
      EstacionarCarro(QtdeCarros, QtdeVagas);
      break;
    case 11:
      ListarCarros(QtdeCarros);
      break;
    case 0:
      exit(0);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <Cria_lista@plt>
lea    0xe33(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1100 <InserirVaga@plt>
lea    0xe2d(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <InserirCarro@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10a0 <Menu2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0xb,%rax
ja     1300 <main+0x120>
mov    -0x18(%rbp),%rax
lea    0xdc0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xdea(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <InserirCarro@plt>
jmp    1300 <main+0x120>
lea    0xdcb(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1100 <InserirVaga@plt>
jmp    1300 <main+0x120>
mov    -0xc(%rbp),%edi
call   1030 <ApagarCarroPorChassi@plt>
jmp    1300 <main+0x120>
mov    -0x10(%rbp),%edi
call   10b0 <ApagarVagaPorId@plt>
jmp    1300 <main+0x120>
mov    -0x10(%rbp),%edi
call   1050 <ImprimirVagasOcupadas@plt>
jmp    1300 <main+0x120>
mov    -0x10(%rbp),%edi
call   10e0 <ImprimirVagasLivres@plt>
jmp    1300 <main+0x120>
mov    -0xc(%rbp),%edi
call   1080 <ImprimirFilaDeCarros@plt>
jmp    1300 <main+0x120>
mov    -0x10(%rbp),%esi
lea    0xd89(%rip),%rdi
call   10c0 <SalvarVagas@plt>
jmp    1300 <main+0x120>
mov    -0xc(%rbp),%esi
lea    0xd85(%rip),%rdi
call   1070 <SalvarCarros@plt>
jmp    1300 <main+0x120>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10d0 <EstacionarCarro@plt>
jmp    1300 <main+0x120>
mov    -0xc(%rbp),%edi
call   1090 <ListarCarros@plt>
jmp    1300 <main+0x120>
xor    %edi,%edi
call   10f0 <exit@plt>
jmp    1216 <main+0x36>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <Cria_lista@plt>
lea    0xe37(%rip),%rdi
mov    %rsp,%rsi
mov    %rsi,%r15
call   1100 <InserirVaga@plt>
lea    0xe2f(%rip),%r12
lea    0x4(%rsp),%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <InserirCarro@plt>
lea    0xdde(%rip),%r14
lea    0xe1e(%rip),%rbx
lea    0xe27(%rip),%rbp
jmp    1240 <main+0x60>
mov    0x4(%rsp),%edi
call   1090 <ListarCarros@plt>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   10a0 <Menu2@plt>
cmp    $0xb,%eax
ja     1240 <main+0x60>
mov    %eax,%eax
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <InserirCarro@plt>
jmp    1240 <main+0x60>
lea    0xdc0(%rip),%rdi
mov    %r15,%rsi
call   1100 <InserirVaga@plt>
jmp    1240 <main+0x60>
mov    0x4(%rsp),%edi
call   1030 <ApagarCarroPorChassi@plt>
jmp    1240 <main+0x60>
mov    (%rsp),%edi
call   10b0 <ApagarVagaPorId@plt>
jmp    1240 <main+0x60>
mov    (%rsp),%edi
call   1050 <ImprimirVagasOcupadas@plt>
jmp    1240 <main+0x60>
mov    (%rsp),%edi
call   10e0 <ImprimirVagasLivres@plt>
jmp    1240 <main+0x60>
mov    0x4(%rsp),%edi
call   1080 <ImprimirFilaDeCarros@plt>
jmp    1240 <main+0x60>
mov    (%rsp),%esi
mov    %rbx,%rdi
call   10c0 <SalvarVagas@plt>
jmp    1240 <main+0x60>
mov    0x4(%rsp),%esi
mov    %rbp,%rdi
call   1070 <SalvarCarros@plt>
jmp    1240 <main+0x60>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   10d0 <EstacionarCarro@plt>
jmp    1240 <main+0x60>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"vagas.txt\00"
@.str.1 = [13 x i8] c"veiculos.txt\00"
@.str.2 = [16 x i8] c"VagasSalvas.txt\00"
@.str.3 = [17 x i8] c"CarrosSalvos.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @Cria_lista()
%6 = call i32 @InserirVaga(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = call i32 @InserirCarro(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %8
8: ; preds = %47, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @Menu2(i32 %9, i32 %10)
store i32 %11, i32* %2
%12 = load i32, i32* %2
switch i32 %12, label %47 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %20
i32 5, label %23
i32 6, label %26
i32 7, label %29
i32 8, label %32
i32 9, label %35
i32 10, label %38
i32 11, label %42
i32 0, label %45
]
13: ; preds = %8
%14 = call i32 @InserirCarro(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %47
15: ; preds = %8
%16 = call i32 @InserirVaga(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %47
17: ; preds = %8
%18 = load i32, i32* %3
%19 = call i32 @ApagarCarroPorChassi(i32 %18)
br label %47
20: ; preds = %8
%21 = load i32, i32* %4
%22 = call i32 @ApagarVagaPorId(i32 %21)
br label %47
23: ; preds = %8
%24 = load i32, i32* %4
%25 = call i32 @ImprimirVagasOcupadas(i32 %24)
br label %47
26: ; preds = %8
%27 = load i32, i32* %4
%28 = call i32 @ImprimirVagasLivres(i32 %27)
br label %47
29: ; preds = %8
%30 = load i32, i32* %3
%31 = call i32 @ImprimirFilaDeCarros(i32 %30)
br label %47
32: ; preds = %8
%33 = load i32, i32* %4
%34 = call i32 @SalvarVagas(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %47
35: ; preds = %8
%36 = load i32, i32* %3
%37 = call i32 @SalvarCarros(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %47
38: ; preds = %8
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = call i32 @EstacionarCarro(i32 %39, i32 %40)
br label %47
42: ; preds = %8
%43 = load i32, i32* %3
%44 = call i32 @ListarCarros(i32 %43)
br label %47
45: ; preds = %8
%46 = call i32 @exit(i32 0)
unreachable
47: ; preds = %8, %42, %38, %35, %32, %29, %26, %23, %20, %17, %15, %13
br label %8
}

LLVM IR (-O2):
@.str = [10 x i8] c"vagas.txt\00"
@.str.1 = [13 x i8] c"veiculos.txt\00"
@.str.2 = [16 x i8] c"VagasSalvas.txt\00"
@.str.3 = [17 x i8] c"CarrosSalvos.txt\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 (...) @Cria_lista()
%6 = call i32 @InserirVaga(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i32 @InserirCarro(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %8
8: ; preds = %12, %0
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 @Menu2(i32 %9, i32 %10)
switch i32 %11, label %12 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
i32 4, label %20
i32 5, label %23
i32 6, label %26
i32 7, label %29
i32 8, label %32
i32 9, label %35
i32 10, label %38
i32 11, label %42
i32 0, label %45
]
12: ; preds = %8, %42, %38, %35, %32, %29, %26, %23, %20, %17, %15, %13
br label %8
13: ; preds = %8
%14 = call i32 @InserirCarro(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %12
15: ; preds = %8
%16 = call i32 @InserirVaga(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %12
17: ; preds = %8
%18 = load i32, i32* %1
%19 = call i32 @ApagarCarroPorChassi(i32 %18)
br label %12
20: ; preds = %8
%21 = load i32, i32* %2
%22 = call i32 @ApagarVagaPorId(i32 %21)
br label %12
23: ; preds = %8
%24 = load i32, i32* %2
%25 = call i32 @ImprimirVagasOcupadas(i32 %24)
br label %12
26: ; preds = %8
%27 = load i32, i32* %2
%28 = call i32 @ImprimirVagasLivres(i32 %27)
br label %12
29: ; preds = %8
%30 = load i32, i32* %1
%31 = call i32 @ImprimirFilaDeCarros(i32 %30)
br label %12
32: ; preds = %8
%33 = load i32, i32* %2
%34 = call i32 @SalvarVagas(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %12
35: ; preds = %8
%36 = load i32, i32* %1
%37 = call i32 @SalvarCarros(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %12
38: ; preds = %8
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = call i32 @EstacionarCarro(i32 %39, i32 %40)
br label %12
42: ; preds = %8
%43 = load i32, i32* %1
%44 = call i32 @ListarCarros(i32 %43)
br label %12
45: ; preds = %8
%46 = call i32 @exit(i32 0)
unreachable
}