#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*/ LC_ALL;
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main() {
  setlocale(LC_ALL, "");
  char opcao;
  int sair = 0;
  do {
    printf("\n\n\n*********************************\nO QUÊ VOCÊ DESEJA "
           "FAZER?\n---------------------------------\n");
    printf("S - Sair\n---------------------------------\n>>> ");
    scanf("%c", &opcao);
    getchar();
    switch (opcao) {
    case 's':
    case 'S':
      printf("\nTchau!\n");
      sair = 1;
      break;
    default:
      printf("\n---------------------------------\nERRO: Opção "
             "Inválida\n---------------------------------\n");
      break;
    }
  } while (sair == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xf3f(%rip),%rsi
call   1050 <setlocale@plt>
movl   $0x0,-0xc(%rbp)
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf09(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl -0x5(%rbp),%eax
or     $0x20,%eax
sub    $0x73,%eax
je     11af <main+0x6f>
jmp    11c7 <main+0x87>
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    11d3 <main+0x93>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <main+0x98>
cmpl   $0x0,-0xc(%rbp)
je     116b <main+0x2b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1060 <setlocale@plt>
lea    0xeba(%rip),%r14
lea    0xe80(%rip),%r15
lea    0xea9(%rip),%r12
lea    0xf(%rsp),%rbx
lea    0xf0a(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl 0xf(%rsp),%eax
or     $0x20,%eax
cmp    $0x73,%eax
je     11d9 <main+0x89>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    11a0 <main+0x50>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [99 x i8] c"\0A\0A\0A*********************************\0AO QU\C3\8A VOC\C3\8A DESEJA FAZER?\0A---------------------------------\0A\00"
@.str.2 = [48 x i8] c"S - Sair\0A---------------------------------\0A>>> \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [9 x i8] c"\0ATchau!\0A\00"
@.str.5 = [94 x i8] c"\0A---------------------------------\0AERRO: Op\C3\A7\C3\A3o Inv\C3\A1lida\0A---------------------------------\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @LC_ALL
%5 = call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %18, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%10 = call i32 (...) @getchar()
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
switch i32 %12, label %15 [
i32 115, label %13
i32 83, label %13
]
13: ; preds = %6, %6
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %17
15: ; preds = %6
%16 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.5, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
br i1 %20, label %6, label %21
21: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.2 = [48 x i8] c"S - Sair\0A---------------------------------\0A>>> \00"
@.str.3 = [3 x i8] c"%c\00"
@str = [98 x i8] c"\0A\0A\0A*********************************\0AO QU\C3\8A VOC\C3\8A DESEJA FAZER?\0A---------------------------------\00"
@str.6 = [8 x i8] c"\0ATchau!\00"
@str.7 = [93 x i8] c"\0A---------------------------------\0AERRO: Op\C3\A7\C3\A3o Inv\C3\A1lida\0A---------------------------------\00"
define i32 @main() {
%1 = alloca i8
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %13, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str, i64 0, i64 0))
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%8 = call i32 (...) @getchar()
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
switch i32 %10, label %13 [
i32 115, label %11
i32 83, label %11
]
11: ; preds = %4, %4
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.6, i64 0, i64 0))
ret i32 0
13: ; preds = %4
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str.7, i64 0, i64 0))
br label %4
}