#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 */
char getch();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int aula_20170928() {
  int sair = 0;
  char escolha;
  while (!sair) {
    system("cls");
    printf("Aula 28/09\n");
    printf("==============\n");
    printf("1. Atividade A\n");
    printf("2. Atividade B\n");
    printf("3. Atividade C\n");
    printf("4. Atividade D\n");
    printf("0. Sair\n");
    printf("==============\n");
    escolha = getch();
    switch (escolha) {
    case '1':
      break;
    case '0':
      sair = 1;
      break;
    default:
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<aula_20170928>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1155 <aula_20170928+0x25>
jmp    120d <aula_20170928+0xdd>
lea    0xea4(%rip),%rdi
call   1030 <system@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    %rdi,-0x18(%rbp)
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x30,%eax
je     11f7 <aula_20170928+0xc7>
jmp    11e1 <aula_20170928+0xb1>
mov    -0xc(%rbp),%eax
sub    $0x31,%eax
jne    1203 <aula_20170928+0xd3>
jmp    11f2 <aula_20170928+0xc2>
jmp    1208 <aula_20170928+0xd8>
movl   $0x1,-0x4(%rbp)
jmp    1208 <aula_20170928+0xd8>
jmp    1208 <aula_20170928+0xd8>
jmp    113f <aula_20170928+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aula_20170928>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf11(%rip),%rbx
lea    0xec6(%rip),%r12
lea    0xece(%rip),%r13
lea    0xed6(%rip),%rbp
lea    0xede(%rip),%r14
lea    0xee6(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe89(%rip),%rdi
call   1040 <system@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0x30,%al
jne    1170 <aula_20170928+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [12 x i8] c"Aula 28/09\0A\00"
@.str.2 = [16 x i8] c"==============\0A\00"
@.str.3 = [16 x i8] c"1. Atividade A\0A\00"
@.str.4 = [16 x i8] c"2. Atividade B\0A\00"
@.str.5 = [16 x i8] c"3. Atividade C\0A\00"
@.str.6 = [16 x i8] c"4. Atividade D\0A\00"
@.str.7 = [9 x i8] c"0. Sair\0A\00"
define i32 @aula_20170928() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %23, %0
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %24
7: ; preds = %3
%8 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%17 = call signext i8 (...) @getch()
store i8 %17, i8* %2
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
switch i32 %19, label %22 [
i32 49, label %20
i32 48, label %21
]
20: ; preds = %7
br label %23
21: ; preds = %7
store i32 1, i32* %1
br label %23
22: ; preds = %7
br label %23
23: ; preds = %22, %21, %20
br label %3
24: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@str = [11 x i8] c"Aula 28/09\00"
@str.9 = [15 x i8] c"1. Atividade A\00"
@str.10 = [15 x i8] c"2. Atividade B\00"
@str.11 = [15 x i8] c"3. Atividade C\00"
@str.12 = [15 x i8] c"4. Atividade D\00"
@str.13 = [8 x i8] c"0. Sair\00"
@str.14 = [15 x i8] c"==============\00"
define i32 @aula_20170928() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.11, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
%11 = tail call signext i8 (...) @getch()
%12 = icmp eq i8 %11, 48
br i1 %12, label %13, label %1
13: ; preds = %1
ret i32 0
}