#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*/ getch();
int /*<<< orphan*/ limpa();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ vetor_adjacencia();
int main() {
  int opcao;
  do {
    puts("Digite 1 para Vetor de Adjacencia\n");
    puts("Digite 0 para Encerrar o Programa\n");
    printf("::>");
    scanf("%i", &opcao);
    limpa();
    if (opcao == 1)
      vetor_adjacencia();
    else if (opcao == 0) {
      puts("Fim do programa\n");
      return 0;
    } else
      puts("Entrada Inválida!\n");
    puts("Digite algo para continuar...");
    getch();
    limpa();
  } while (opcao != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <limpa@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11c0 <main+0x60>
mov    $0x0,%al
call   1050 <vetor_adjacencia@plt>
jmp    11f3 <main+0x93>
cmpl   $0x0,-0x8(%rbp)
jne    11e2 <main+0x82>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    1217 <main+0xb7>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
jmp    11f3 <main+0x93>
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1080 <getch@plt>
mov    $0x0,%al
call   1060 <limpa@plt>
cmpl   $0x0,-0x8(%rbp)
jne    116f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%r14
lea    0xeaa(%rip),%r15
lea    0xec6(%rip),%r12
lea    0xec3(%rip),%r13
lea    0x4(%rsp),%rbx
lea    0xedf(%rip),%rbp
jmp    11c4 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <vetor_adjacencia@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <getch@plt>
xor    %eax,%eax
call   1060 <limpa@plt>
cmpl   $0x0,0x4(%rsp)
je     1215 <main+0xb5>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1060 <limpa@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     11a0 <main+0x40>
test   %eax,%eax
je     1209 <main+0xa9>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
jmp    11a7 <main+0x47>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Digite 1 para Vetor de Adjacencia\0A\00"
@.str.1 = [35 x i8] c"Digite 0 para Encerrar o Programa\0A\00"
@.str.2 = [4 x i8] c"::>\00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [17 x i8] c"Fim do programa\0A\00"
@.str.5 = [20 x i8] c"Entrada Inv\C3\A1lida!\0A\00"
@.str.6 = [30 x i8] c"Digite algo para continuar...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %25, %0
%4 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 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), i32* %2)
%8 = call i32 (...) @limpa()
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 (...) @vetor_adjacencia()
br label %21
13: ; preds = %3
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %28
18: ; preds = %13
%19 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %20
20: ; preds = %18
br label %21
21: ; preds = %20, %11
%22 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 (...) @getch()
%24 = call i32 (...) @limpa()
br label %25
25: ; preds = %21
%26 = load i32, i32* %2
%27 = icmp ne i32 %26, 0
br i1 %27, label %3, label %28
28: ; preds = %16, %25
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [35 x i8] c"Digite 1 para Vetor de Adjacencia\0A\00"
@.str.1 = [35 x i8] c"Digite 0 para Encerrar o Programa\0A\00"
@.str.2 = [4 x i8] c"::>\00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [17 x i8] c"Fim do programa\0A\00"
@.str.5 = [20 x i8] c"Entrada Inv\C3\A1lida!\0A\00"
@.str.6 = [30 x i8] c"Digite algo para continuar...\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %16, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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), i32* %1)
%8 = call i32 (...) @limpa()
%9 = load i32, i32* %1
switch i32 %9, label %14 [
i32 1, label %10
i32 0, label %12
]
10: ; preds = %3
%11 = call i32 (...) @vetor_adjacencia()
br label %16
12: ; preds = %3
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %22
14: ; preds = %3
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 (...) @getch()
%19 = call i32 (...) @limpa()
%20 = load i32, i32* %1
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %3
22: ; preds = %16, %12
ret i32 0
}