#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int carro, vaga, contador;
  char continuar;
  vaga = 10;
  carro = 0;
  do {
    printf("Digite [1] para adicionar um carro \n");
    printf("Digite [2] para remover um carro \n");
    scanf("%d", &contador);
    switch (contador) {
    case 1:
      carro++;
      vaga--;
      break;
    case 2:
      carro--;
      vaga++;
      if (vaga > 10)
        vaga = 10;
      break;
    default:
      printf("Opção inexistente! \n");
      break;
    }
    if ((carro < 10) && (contador == 1 || contador == 2)) {
      printf("ESTACIONAMENTO LIVRE, [%d VAGA] \n", vaga);
    } else if ((carro > (10 - 1)) && (contador == 1 || contador == 2)) {
      carro = 10;
      vaga = 0;
      printf("ESTACIONAMENTO OCUPADO, [%d VAGA] \n", vaga);
    }
    printf("\n");
    printf("Deseja continuar [s/n]: ");
    scanf(" %c", &continuar);
  } while (continuar == 's');
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xebc(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xee1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     1195 <main+0x75>
jmp    1184 <main+0x64>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     11ac <main+0x8c>
jmp    11d4 <main+0xb4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11e2 <main+0xc2>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jle    11cf <main+0xaf>
movl   $0xa,-0xc(%rbp)
jmp    11e2 <main+0xc2>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0x8(%rbp)
jge    1216 <main+0xf6>
cmpl   $0x1,-0x10(%rbp)
je     1200 <main+0xe0>
cmpl   $0x2,-0x10(%rbp)
jne    1216 <main+0xf6>
mov    -0xc(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <main+0x138>
cmpl   $0x9,-0x8(%rbp)
jle    1253 <main+0x133>
cmpl   $0x1,-0x10(%rbp)
je     1234 <main+0x114>
cmpl   $0x2,-0x10(%rbp)
jne    1253 <main+0x133>
movl   $0xa,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <main+0x138>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x73,%eax
je     113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xa,%ebp
lea    0x4(%rsp),%rbx
lea    0xeed(%rip),%r13
lea    0xeff(%rip),%r14
lea    0x3(%rsp),%r15
xor    %r12d,%r12d
jmp    119c <main+0x5c>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x73,0x3(%rsp)
jne    1266 <main+0x126>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
lea    0xedb(%rip),%rdi
call   1040 <puts@plt>
lea    0xe45(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     11e0 <main+0xa0>
cmp    $0x1,%eax
jne    1200 <main+0xc0>
add    $0x1,%r12d
add    $0xffffffff,%ebp
jmp    120c <main+0xcc>
nopl   0x0(%rax)
add    $0xffffffff,%r12d
cmp    $0x9,%ebp
mov    $0x9,%eax
cmovge %eax,%ebp
add    $0x1,%ebp
jmp    120c <main+0xcc>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x9,%r12d
jg     1240 <main+0x100>
cmp    $0x1,%eax
ja     1170 <main+0x30>
lea    0xdda(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1170 <main+0x30>
nopw   0x0(%rax,%rax,1)
cmp    $0x1,%eax
ja     1170 <main+0x30>
xor    %ebp,%ebp
lea    0xdd3(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%r12d
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Digite [1] para adicionar um carro \0A\00"
@.str.1 = [35 x i8] c"Digite [2] para remover um carro \0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"Op\C3\A7\C3\A3o inexistente! \0A\00"
@.str.4 = [34 x i8] c"ESTACIONAMENTO LIVRE, [%d VAGA] \0A\00"
@.str.5 = [36 x i8] c"ESTACIONAMENTO OCUPADO, [%d VAGA] \0A\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [25 x i8] c"Deseja continuar [s/n]: \00"
@.str.8 = [4 x i8] c" %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
store i32 10, i32* %3
store i32 0, i32* %2
br label %6
6: ; preds = %56, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
switch i32 %10, label %25 [
i32 1, label %11
i32 2, label %16
]
11: ; preds = %6
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, -1
store i32 %15, i32* %3
br label %27
16: ; preds = %6
%17 = load i32, i32* %2
%18 = add nsw i32 %17, -1
store i32 %18, i32* %2
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = icmp sgt i32 %21, 10
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 10, i32* %3
br label %24
24: ; preds = %23, %16
br label %27
25: ; preds = %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %24, %11
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i32, i32* %4
%32 = icmp eq i32 %31, 1
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 2
br i1 %35, label %36, label %39
36: ; preds = %33, %30
%37 = load i32, i32* %3
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %37)
br label %52
39: ; preds = %33, %27
%40 = load i32, i32* %2
%41 = icmp sgt i32 %40, 9
br i1 %41, label %42, label %51
42: ; preds = %39
%43 = load i32, i32* %4
%44 = icmp eq i32 %43, 1
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* %4
%47 = icmp eq i32 %46, 2
br i1 %47, label %48, label %51
48: ; preds = %45, %42
store i32 10, i32* %2
store i32 0, i32* %3
%49 = load i32, i32* %3
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48, %45, %39
br label %52
52: ; preds = %51, %36
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%55 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %5)
br label %56
56: ; preds = %52
%57 = load i8, i8* %5
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 115
br i1 %59, label %6, label %60
60: ; preds = %56
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@.str.4 = [34 x i8] c"ESTACIONAMENTO LIVRE, [%d VAGA] \0A\00"
@.str.5 = [36 x i8] c"ESTACIONAMENTO OCUPADO, [%d VAGA] \0A\00"
@.str.7 = [25 x i8] c"Deseja continuar [s/n]: \00"
@.str.8 = [4 x i8] c" %c\00"
@str = [36 x i8] c"Digite [1] para adicionar um carro \00"
@str.9 = [34 x i8] c"Digite [2] para remover um carro \00"
@str.10 = [22 x i8] c"Op\C3\A7\C3\A3o inexistente! \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
br label %4
4: ; preds = %34, %0
%5 = phi i32 [ 0, %0 ], [ %35, %34 ]
%6 = phi i32 [ 10, %0 ], [ %36, %34 ]
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.9, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %19 [
i32 1, label %11
i32 2, label %14
]
11: ; preds = %4
%12 = add nsw i32 %5, 1
%13 = add nsw i32 %6, -1
br label %21
14: ; preds = %4
%15 = add nsw i32 %5, -1
%16 = icmp slt i32 %6, 9
%17 = select i1 %16, i32 %6, i32 9
%18 = add nsw i32 %17, 1
br label %21
19: ; preds = %4
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.10, i64 0, i64 0))
br label %21
21: ; preds = %19, %14, %11
%22 = phi i32 [ %5, %19 ], [ %15, %14 ], [ %12, %11 ]
%23 = phi i32 [ %6, %19 ], [ %18, %14 ], [ %13, %11 ]
%24 = icmp slt i32 %22, 10
%25 = load i32, i32* %1
%26 = add i32 %25, -1
%27 = icmp ult i32 %26, 2
br i1 %24, label %28, label %31
28: ; preds = %21
br i1 %27, label %29, label %34
29: ; preds = %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %23)
br label %34
31: ; preds = %21
br i1 %27, label %32, label %34
32: ; preds = %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 0)
br label %34
34: ; preds = %28, %32, %31, %29
%35 = phi i32 [ %22, %29 ], [ 10, %32 ], [ %22, %31 ], [ %22, %28 ]
%36 = phi i32 [ %23, %29 ], [ 0, %32 ], [ %23, %31 ], [ %23, %28 ]
%37 = call i32 @putchar(i32 10)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %2)
%40 = load i8, i8* %2
%41 = icmp eq i8 %40, 115
br i1 %41, label %4, label %42
42: ; preds = %34
ret i32 0
}