#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 */
scalar_t__ cpc_TestKey(int);
int /*<<< orphan*/ printf(char *);
unsigned int elegirOpcion() {
  while (1) {
    if (cpc_TestKey(11)) {
      printf("Pulsado 1");
      return 1;
    } else if (cpc_TestKey(12)) {
      printf("Pulsado 2");
      return 2;
    } else if (cpc_TestKey(13)) {
      printf("Pulsado 3");
      return 3;
    } else if (cpc_TestKey(14)) {
      printf("Puchfuyfylsado 4");
      return 4;
    } else if (cpc_TestKey(15)) {
      return 5;
    }
  }
}


x86 assembly (clang, -O0):
<elegirOpcion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xb,%edi
call   1040 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     1154 <elegirOpcion+0x34>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1211 <elegirOpcion+0xf1>
mov    $0xc,%edi
call   1040 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     1180 <elegirOpcion+0x60>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1211 <elegirOpcion+0xf1>
mov    $0xd,%edi
call   1040 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     11ac <elegirOpcion+0x8c>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x4(%rbp)
jmp    1211 <elegirOpcion+0xf1>
mov    $0xe,%edi
call   1040 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     11d8 <elegirOpcion+0xb8>
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
movl   $0x4,-0x4(%rbp)
jmp    1211 <elegirOpcion+0xf1>
mov    $0xf,%edi
call   1040 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     11f8 <elegirOpcion+0xd8>
movl   $0x5,-0x4(%rbp)
jmp    1211 <elegirOpcion+0xf1>
jmp    11fd <elegirOpcion+0xdd>
jmp    1202 <elegirOpcion+0xe2>
jmp    1207 <elegirOpcion+0xe7>
jmp    120c <elegirOpcion+0xec>
jmp    1128 <elegirOpcion+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elegirOpcion>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xed1(%rip),%rbx
lea    0xed4(%rip),%r14
lea    0xed7(%rip),%r15
lea    0xeda(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xb,%edi
call   1040 <cpc_TestKey@plt>
test   %rax,%rax
jne    11a2 <elegirOpcion+0x82>
mov    $0xc,%edi
call   1040 <cpc_TestKey@plt>
test   %rax,%rax
jne    11a9 <elegirOpcion+0x89>
mov    $0xd,%edi
call   1040 <cpc_TestKey@plt>
test   %rax,%rax
jne    11b3 <elegirOpcion+0x93>
mov    $0xe,%edi
call   1040 <cpc_TestKey@plt>
test   %rax,%rax
jne    11bd <elegirOpcion+0x9d>
mov    $0xf,%edi
call   1040 <cpc_TestKey@plt>
test   %rax,%rax
je     1150 <elegirOpcion+0x30>
mov    $0x5,%ebp
jmp    11cd <elegirOpcion+0xad>
mov    $0x1,%ebp
jmp    11c5 <elegirOpcion+0xa5>
mov    $0x2,%ebp
mov    %r14,%rbx
jmp    11c5 <elegirOpcion+0xa5>
mov    $0x3,%ebp
mov    %r15,%rbx
jmp    11c5 <elegirOpcion+0xa5>
mov    $0x4,%ebp
mov    %r12,%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Pulsado 1\00"
@.str.1 = [10 x i8] c"Pulsado 2\00"
@.str.2 = [10 x i8] c"Pulsado 3\00"
@.str.3 = [17 x i8] c"Puchfuyfylsado 4\00"
define i32 @elegirOpcion() {
%1 = alloca i32
br label %2
2: ; preds = %0, %30
%3 = call i64 @cpc_TestKey(i32 11)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %31
7: ; preds = %2
%8 = call i64 @cpc_TestKey(i32 12)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %1
br label %31
12: ; preds = %7
%13 = call i64 @cpc_TestKey(i32 13)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 3, i32* %1
br label %31
17: ; preds = %12
%18 = call i64 @cpc_TestKey(i32 14)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 4, i32* %1
br label %31
22: ; preds = %17
%23 = call i64 @cpc_TestKey(i32 15)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 5, i32* %1
br label %31
26: ; preds = %22
br label %27
27: ; preds = %26
br label %28
28: ; preds = %27
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
br label %2
31: ; preds = %25, %20, %15, %10, %5
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [10 x i8] c"Pulsado 1\00"
@.str.1 = [10 x i8] c"Pulsado 2\00"
@.str.2 = [10 x i8] c"Pulsado 3\00"
@.str.3 = [17 x i8] c"Puchfuyfylsado 4\00"
define i32 @elegirOpcion() {
br label %1
1: ; preds = %13, %0
%2 = tail call i64 @cpc_TestKey(i32 11)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = tail call i64 @cpc_TestKey(i32 12)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = tail call i64 @cpc_TestKey(i32 13)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = tail call i64 @cpc_TestKey(i32 14)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i64 @cpc_TestKey(i32 15)
%15 = icmp eq i64 %14, 0
br i1 %15, label %1, label %20
16: ; preds = %10, %7, %4, %1
%17 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %10 ]
%18 = phi i32 [ 1, %1 ], [ 2, %4 ], [ 3, %7 ], [ 4, %10 ]
%19 = tail call i32 @printf(i8* dereferenceable(1) %17)
br label %20
20: ; preds = %13, %16
%21 = phi i32 [ %18, %16 ], [ 5, %13 ]
ret i32 %21
}