#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*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ submenu_compra();
submenu_adquisicion(void) {
  int op;
  do {
    puts("1. Compra");
    puts("2. Reserva");
    puts("3. Cancelar pasaje");
    puts("4. Volver al menu principal\n\n");
    printf("Opcion: ");
    scanf("%d", &op);
    switch (op) {
    case 1:
      submenu_compra();
      break;
    case 2:
      break;
    case 3:
      break;
    case 4:
      op = 0;
      break;
    }
  } while (op != 0);
}


x86 assembly (clang, -O0):
<submenu_adquisicion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11da <submenu_adquisicion+0x9a>
mov    -0x10(%rbp),%rax
lea    0xe4c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <submenu_compra@plt>
jmp    11da <submenu_adquisicion+0x9a>
jmp    11da <submenu_adquisicion+0x9a>
jmp    11da <submenu_adquisicion+0x9a>
movl   $0x0,-0x8(%rbp)
jmp    11df <submenu_adquisicion+0x9f>
cmpl   $0x0,-0x8(%rbp)
jne    1148 <submenu_adquisicion+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<submenu_adquisicion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeb8(%rip),%r15
lea    0xebc(%rip),%r12
lea    0xec8(%rip),%r13
lea    0xedf(%rip),%rbx
lea    0xee1(%rip),%rbp
lea    0x4(%rsp),%r14
jmp    118f <submenu_adquisicion+0x4f>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <submenu_compra@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11d4 <submenu_adquisicion+0x94>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     1180 <submenu_adquisicion+0x40>
cmp    $0x4,%eax
jne    118b <submenu_adquisicion+0x4b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"1. Compra\00"
@.str.1 = [11 x i8] c"2. Reserva\00"
@.str.2 = [19 x i8] c"3. Cancelar pasaje\00"
@.str.3 = [30 x i8] c"4. Volver al menu principal\0A\0A\00"
@.str.4 = [9 x i8] c"Opcion: \00"
@.str.5 = [3 x i8] c"%d\00"
define i32 @submenu_adquisicion() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %17, %0
%4 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 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 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
switch i32 %10, label %16 [
i32 1, label %11
i32 2, label %13
i32 3, label %14
i32 4, label %15
]
11: ; preds = %3
%12 = call i32 (...) @submenu_compra()
br label %16
13: ; preds = %3
br label %16
14: ; preds = %3
br label %16
15: ; preds = %3
store i32 0, i32* %2
br label %16
16: ; preds = %3, %15, %14, %13, %11
br label %17
17: ; preds = %16
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 0
br i1 %19, label %3, label %20
20: ; preds = %17
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [10 x i8] c"1. Compra\00"
@.str.1 = [11 x i8] c"2. Reserva\00"
@.str.2 = [19 x i8] c"3. Cancelar pasaje\00"
@.str.3 = [30 x i8] c"4. Volver al menu principal\0A\0A\00"
@.str.4 = [9 x i8] c"Opcion: \00"
@.str.5 = [3 x i8] c"%d\00"
define i32 @submenu_adquisicion() {
%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 ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %14 [
i32 1, label %11
i32 4, label %17
]
11: ; preds = %3
%12 = call i32 (...) @submenu_compra()
%13 = load i32, i32* %1
br label %14
14: ; preds = %11, %3
%15 = phi i32 [ %13, %11 ], [ %10, %3 ]
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %3
17: ; preds = %14, %3
ret i32 undef
}