#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*/ menuOperacao(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int menuEntidade() {
  int entidade;
  do {
    printf("escolha a entidade com a qual deseja trabalhar:\n");
    printf("1-Livro\n");
    printf("2-Leitor\n");
    printf("3-Autor\n");
    printf("4-Autor Do Livro\n");
    printf("0-Sair do programa\n");
    scanf("%d", &entidade);
    system("cls");
    if (entidade != 0)
      menuOperacao(entidade);
  } while (entidade != 0);
  return entidade;
}


x86 assembly (clang, -O0):
<menuEntidade>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xecf(%rip),%rdi
call   1030 <system@plt>
cmpl   $0x0,-0x4(%rbp)
je     11be <menuEntidade+0x7e>
mov    -0x4(%rbp),%edi
call   1060 <menuOperacao@plt>
jmp    11c3 <menuEntidade+0x83>
cmpl   $0x0,-0x4(%rbp)
jne    1148 <menuEntidade+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuEntidade>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xef6(%rip),%r13
lea    0xef7(%rip),%rbx
lea    0xf01(%rip),%rbp
lea    0xe99(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe90(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1040 <system@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
je     11e3 <menuEntidade+0xa3>
call   1060 <menuOperacao@plt>
cmpl   $0x0,0x4(%rsp)
jne    1180 <menuEntidade+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"escolha a entidade com a qual deseja trabalhar:\0A\00"
@.str.1 = [9 x i8] c"1-Livro\0A\00"
@.str.2 = [10 x i8] c"2-Leitor\0A\00"
@.str.3 = [9 x i8] c"3-Autor\0A\00"
@.str.4 = [18 x i8] c"4-Autor Do Livro\0A\00"
@.str.5 = [20 x i8] c"0-Sair do programa\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"cls\00"
define i32 @menuEntidade() {
%1 = alloca i32
br label %2
2: ; preds = %17, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* %1
%15 = call i32 @menuOperacao(i32 %14)
br label %16
16: ; preds = %13, %2
br label %17
17: ; preds = %16
%18 = load i32, i32* %1
%19 = icmp ne i32 %18, 0
br i1 %19, label %2, label %20
20: ; preds = %17
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"cls\00"
@str = [48 x i8] c"escolha a entidade com a qual deseja trabalhar:\00"
@str.8 = [8 x i8] c"1-Livro\00"
@str.9 = [9 x i8] c"2-Leitor\00"
@str.10 = [8 x i8] c"3-Autor\00"
@str.11 = [17 x i8] c"4-Autor Do Livro\00"
@str.12 = [19 x i8] c"0-Sair do programa\00"
define i32 @menuEntidade() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %14, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.8, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.11, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %3
%15 = call i32 @menuOperacao(i32 %12)
%16 = load i32, i32* %1
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %3
18: ; preds = %3, %14
ret i32 0
}