#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*/ consultarQueue();
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ pop();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
void opciones() {
  int opcion;
  char name[20];
  do {
    printf("\n\nQueue en lenguaje c\n");
    printf("1) Push\n");
    printf("2) Pop\n");
    printf("3) Consultar Queue\n");
    printf("4) Exit\n");
    printf("Opcion = ");
    scanf("%d", &opcion);
    if (opcion == 1) {
      printf("Nombre:");
      fgets(name, 20, stdin);
      fgets(name, 20, stdin);
      push(name);
    } else if (opcion == 2) {
      pop();
    } else if (opcion == 3) {
      consultarQueue();
    }
  } while (opcion != 4);
}


x86 assembly (clang, -O0):
<opciones>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1212 <opciones+0xb2>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e07(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1060 <fgets@plt>
lea    -0x20(%rbp),%rdi
mov    0x2df0(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1060 <fgets@plt>
lea    -0x20(%rbp),%rdi
call   1080 <push@plt>
jmp    1243 <opciones+0xe3>
cmpl   $0x2,-0x4(%rbp)
jne    1228 <opciones+0xc8>
mov    $0x0,%al
call   1050 <pop@plt>
jmp    123e <opciones+0xde>
cmpl   $0x3,-0x4(%rbp)
jne    1239 <opciones+0xd9>
mov    $0x0,%al
call   1040 <consultarQueue@plt>
jmp    123e <opciones+0xde>
jmp    1243 <opciones+0xe3>
jmp    1248 <opciones+0xe8>
cmpl   $0x4,-0x4(%rbp)
jne    1168 <opciones+0x8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opciones>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeae(%rip),%rbx
lea    0xeae(%rip),%rbp
lea    0xeba(%rip),%r12
lea    0xe66(%rip),%r13
lea    0xe69(%rip),%r14
lea    0xc(%rsp),%r15
jmp    11c4 <opciones+0x54>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <pop@plt>
mov    0xc(%rsp),%eax
cmp    $0x4,%eax
je     127c <opciones+0x10c>
lea    0xe4a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
je     1270 <opciones+0x100>
cmp    $0x2,%eax
je     11b0 <opciones+0x40>
cmp    $0x1,%eax
jne    11bb <opciones+0x4b>
lea    0xdec(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rdi
mov    $0x14,%esi
call   1070 <fgets@plt>
mov    0x2da3(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rdi
mov    $0x14,%esi
call   1070 <fgets@plt>
lea    0x10(%rsp),%rdi
call   1090 <push@plt>
jmp    11b7 <opciones+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <consultarQueue@plt>
jmp    11b7 <opciones+0x47>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\0AQueue en lenguaje c\0A\00"
@.str.1 = [9 x i8] c"1) Push\0A\00"
@.str.2 = [8 x i8] c"2) Pop\0A\00"
@.str.3 = [20 x i8] c"3) Consultar Queue\0A\00"
@.str.4 = [9 x i8] c"4) Exit\0A\00"
@.str.5 = [10 x i8] c"Opcion = \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [8 x i8] c"Nombre:\00"
@stdin = global i32 0
define void @opciones() {
%1 = alloca i32
%2 = alloca [20 x i8]
br label %3
3: ; preds = %36, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, 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 = load i32, i32* %1
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %23
13: ; preds = %3
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%16 = load i32, i32* @stdin
%17 = call i32 @fgets(i8* %15, i32 20, i32 %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %18, i32 20, i32 %19)
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%22 = call i32 @push(i8* %21)
br label %35
23: ; preds = %3
%24 = load i32, i32* %1
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (...) @pop()
br label %34
28: ; preds = %23
%29 = load i32, i32* %1
%30 = icmp eq i32 %29, 3
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 (...) @consultarQueue()
br label %33
33: ; preds = %31, %28
br label %34
34: ; preds = %33, %26
br label %35
35: ; preds = %34, %13
br label %36
36: ; preds = %35
%37 = load i32, i32* %1
%38 = icmp ne i32 %37, 4
br i1 %38, label %3, label %39
39: ; preds = %36
ret void
}

LLVM IR (-O2):
@.str.5 = [10 x i8] c"Opcion = \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [8 x i8] c"Nombre:\00"
@stdin = global i32 0
@str = [22 x i8] c"\0A\0AQueue en lenguaje c\00"
@str.8 = [8 x i8] c"1) Push\00"
@str.9 = [7 x i8] c"2) Pop\00"
@str.10 = [19 x i8] c"3) Consultar Queue\00"
@str.11 = [8 x i8] c"4) Exit\00"
define void @opciones() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %27, %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.8, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.9, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.11, i64 0, i64 0))
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
switch i32 %13, label %27 [
i32 1, label %14
i32 2, label %21
i32 3, label %23
]
14: ; preds = %5
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%16 = load i32, i32* @stdin
%17 = call i32 @fgets(i8* %4, i32 20, i32 %16)
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %4, i32 20, i32 %18)
%20 = call i32 @push(i8* %4)
br label %25
21: ; preds = %5
%22 = call i32 (...) @pop()
br label %25
23: ; preds = %5
%24 = call i32 (...) @consultarQueue()
br label %25
25: ; preds = %21, %23, %14
%26 = load i32, i32* %1
br label %27
27: ; preds = %25, %5
%28 = phi i32 [ %26, %25 ], [ %13, %5 ]
%29 = icmp eq i32 %28, 4
br i1 %29, label %30, label %5
30: ; preds = %27
ret void
}