#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*/ agregar_invitado();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ imprimir_menu();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ver_invitados();
int main() {
  int salir = 0;
  int opcion;
  while (salir == 0) {
    opcion = -1;
    imprimir_menu();
    fflush(stdin);
    scanf("%d", &opcion);
    if (opcion == 3)
      salir = 1;
    else if (opcion == 1)
      agregar_invitado();
    else if (opcion == 2)
      ver_invitados();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11e8 <main+0x98>
movl   $0xffffffff,-0xc(%rbp)
mov    $0x0,%al
call   1070 <imprimir_menu@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xe6d(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x3,-0xc(%rbp)
jne    11b2 <main+0x62>
movl   $0x1,-0x8(%rbp)
jmp    11e3 <main+0x93>
cmpl   $0x1,-0xc(%rbp)
jne    11c8 <main+0x78>
mov    $0x0,%al
call   1030 <agregar_invitado@plt>
jmp    11de <main+0x8e>
cmpl   $0x2,-0xc(%rbp)
jne    11d9 <main+0x89>
mov    $0x0,%al
call   1040 <ver_invitados@plt>
jmp    11de <main+0x8e>
jmp    11e3 <main+0x93>
jmp    1166 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2e88(%rip),%r15
lea    0xe99(%rip),%r14
lea    0xc(%rsp),%rbx
jmp    1177 <main+0x27>
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <ver_invitados@plt>
movl   $0xffffffff,0xc(%rsp)
ff
xor    %eax,%eax
call   1070 <imprimir_menu@plt>
mov    (%r15),%edi
call   1050 <fflush@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     11b0 <main+0x60>
cmp    $0x2,%eax
je     1170 <main+0x20>
cmp    $0x3,%eax
jne    1177 <main+0x27>
jmp    11b9 <main+0x69>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <agregar_invitado@plt>
jmp    1177 <main+0x27>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %27, %0
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %28
7: ; preds = %4
store i32 -1, i32* %3
%8 = call i32 (...) @imprimir_menu()
%9 = load i32, i32* @stdin
%10 = call i32 @fflush(i32 %9)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %15
14: ; preds = %7
store i32 1, i32* %2
br label %27
15: ; preds = %7
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (...) @agregar_invitado()
br label %26
20: ; preds = %15
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @ver_invitados()
br label %25
25: ; preds = %23, %20
br label %26
26: ; preds = %25, %18
br label %27
27: ; preds = %26, %14
br label %4
28: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %9, %0
store i32 -1, i32* %1
%4 = call i32 (...) @imprimir_menu()
%5 = load i32, i32* @stdin
%6 = call i32 @fflush(i32 %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %9 [
i32 3, label %14
i32 1, label %10
i32 2, label %12
]
9: ; preds = %3, %10, %12
br label %3
10: ; preds = %3
%11 = call i32 (...) @agregar_invitado()
br label %9
12: ; preds = %3
%13 = call i32 (...) @ver_invitados()
br label %9
14: ; preds = %3
ret i32 0
}