#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*/ cpc_ClrScr();
int /*<<< orphan*/ cpc_RedefineKey(int);
scalar_t__ cpc_TestKey(int);
int /*<<< orphan*/ printf(char *);
void RedefinicionTeclas() {
  cpc_ClrScr();
  printf("Define la tecla >");
  cpc_RedefineKey(0);
  cpc_ClrScr();
  printf("Define la tecla <");
  cpc_RedefineKey(1);
  cpc_ClrScr();
  printf("Define la tecla ^");
  cpc_RedefineKey(2);
  cpc_ClrScr();
  printf("Define la tecla v");
  cpc_RedefineKey(3);
  cpc_ClrScr();
  printf("Define la tecla Fire");
  cpc_RedefineKey(4);
  cpc_ClrScr();
  while (1) {
    printf("\n");
    if (cpc_TestKey(0)) {
      printf("Has pulsado la tecla >");
    } else if (cpc_TestKey(1)) {
      printf("Has pulsado la tecla <");
    } else if (cpc_TestKey(2)) {
      printf("Has pulsado la tecla ^");
    } else if (cpc_TestKey(3)) {
      printf("Has pulsado la tecla v");
    } else if (cpc_TestKey(4)) {
      printf("Has pulsado la tecla Fire");
    } else if (cpc_TestKey(11)) {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<RedefinicionTeclas>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <cpc_ClrScr@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <cpc_RedefineKey@plt>
mov    $0x0,%al
call   1050 <cpc_ClrScr@plt>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <cpc_RedefineKey@plt>
mov    $0x0,%al
call   1050 <cpc_ClrScr@plt>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <cpc_RedefineKey@plt>
mov    $0x0,%al
call   1050 <cpc_ClrScr@plt>
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1030 <cpc_RedefineKey@plt>
mov    $0x0,%al
call   1050 <cpc_ClrScr@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <cpc_RedefineKey@plt>
mov    $0x0,%al
call   1050 <cpc_ClrScr@plt>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     1207 <RedefinicionTeclas+0xc7>
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
jmp    12cd <RedefinicionTeclas+0x18d>
mov    $0x1,%edi
call   1060 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     122c <RedefinicionTeclas+0xec>
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
jmp    12c8 <RedefinicionTeclas+0x188>
mov    $0x2,%edi
call   1060 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     1251 <RedefinicionTeclas+0x111>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
jmp    12c3 <RedefinicionTeclas+0x183>
mov    $0x3,%edi
call   1060 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     1276 <RedefinicionTeclas+0x136>
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
jmp    12be <RedefinicionTeclas+0x17e>
mov    $0x4,%edi
call   1060 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     129b <RedefinicionTeclas+0x15b>
lea    0xe2a(%rip),%rdi
call   1040 <printf@plt>
jmp    12b9 <RedefinicionTeclas+0x179>
mov    $0xb,%edi
call   1060 <cpc_TestKey@plt>
cmp    $0x0,%rax
je     12b4 <RedefinicionTeclas+0x174>
jmp    12d2 <RedefinicionTeclas+0x192>
jmp    12b9 <RedefinicionTeclas+0x179>
jmp    12be <RedefinicionTeclas+0x17e>
jmp    12c3 <RedefinicionTeclas+0x183>
jmp    12c8 <RedefinicionTeclas+0x188>
jmp    12cd <RedefinicionTeclas+0x18d>
jmp    11d9 <RedefinicionTeclas+0x99>
pop    %rbp
ret

x86 assembly (clang, -O2):
<RedefinicionTeclas>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %eax,%eax
call   1060 <cpc_ClrScr@plt>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1040 <cpc_RedefineKey@plt>
xor    %eax,%eax
call   1060 <cpc_ClrScr@plt>
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1040 <cpc_RedefineKey@plt>
xor    %eax,%eax
call   1060 <cpc_ClrScr@plt>
lea    0xe86(%rip),%rdi
call   1050 <printf@plt>
mov    $0x2,%edi
call   1040 <cpc_RedefineKey@plt>
xor    %eax,%eax
call   1060 <cpc_ClrScr@plt>
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
mov    $0x3,%edi
call   1040 <cpc_RedefineKey@plt>
xor    %eax,%eax
call   1060 <cpc_ClrScr@plt>
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
mov    $0x4,%edi
call   1040 <cpc_RedefineKey@plt>
xor    %eax,%eax
call   1060 <cpc_ClrScr@plt>
lea    0xe68(%rip),%rbx
lea    0xe78(%rip),%r14
lea    0xe88(%rip),%r15
lea    0xe98(%rip),%r12
lea    0xea8(%rip),%r13
jmp    1225 <RedefinicionTeclas+0xd5>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1070 <cpc_TestKey@plt>
mov    %rbx,%rdi
test   %rax,%rax
jne    1220 <RedefinicionTeclas+0xd0>
mov    $0x1,%edi
call   1070 <cpc_TestKey@plt>
mov    %r14,%rdi
test   %rax,%rax
jne    1220 <RedefinicionTeclas+0xd0>
mov    $0x2,%edi
call   1070 <cpc_TestKey@plt>
mov    %r15,%rdi
test   %rax,%rax
jne    1220 <RedefinicionTeclas+0xd0>
mov    $0x3,%edi
call   1070 <cpc_TestKey@plt>
mov    %r12,%rdi
test   %rax,%rax
jne    1220 <RedefinicionTeclas+0xd0>
mov    $0x4,%edi
call   1070 <cpc_TestKey@plt>
mov    %r13,%rdi
test   %rax,%rax
jne    1220 <RedefinicionTeclas+0xd0>
mov    $0xb,%edi
call   1070 <cpc_TestKey@plt>
test   %rax,%rax
je     1225 <RedefinicionTeclas+0xd5>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Define la tecla >\00"
@.str.1 = [18 x i8] c"Define la tecla <\00"
@.str.2 = [18 x i8] c"Define la tecla ^\00"
@.str.3 = [18 x i8] c"Define la tecla v\00"
@.str.4 = [21 x i8] c"Define la tecla Fire\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [23 x i8] c"Has pulsado la tecla >\00"
@.str.7 = [23 x i8] c"Has pulsado la tecla <\00"
@.str.8 = [23 x i8] c"Has pulsado la tecla ^\00"
@.str.9 = [23 x i8] c"Has pulsado la tecla v\00"
@.str.10 = [26 x i8] c"Has pulsado la tecla Fire\00"
define void @RedefinicionTeclas() {
%1 = call i32 (...) @cpc_ClrScr()
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @cpc_RedefineKey(i32 0)
%4 = call i32 (...) @cpc_ClrScr()
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @cpc_RedefineKey(i32 1)
%7 = call i32 (...) @cpc_ClrScr()
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @cpc_RedefineKey(i32 2)
%10 = call i32 (...) @cpc_ClrScr()
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @cpc_RedefineKey(i32 3)
%13 = call i32 (...) @cpc_ClrScr()
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @cpc_RedefineKey(i32 4)
%16 = call i32 (...) @cpc_ClrScr()
br label %17
17: ; preds = %0, %52
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%19 = call i64 @cpc_TestKey(i32 0)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %52
23: ; preds = %17
%24 = call i64 @cpc_TestKey(i32 1)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %51
28: ; preds = %23
%29 = call i64 @cpc_TestKey(i32 2)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %50
33: ; preds = %28
%34 = call i64 @cpc_TestKey(i32 3)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %49
38: ; preds = %33
%39 = call i64 @cpc_TestKey(i32 4)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
br label %48
43: ; preds = %38
%44 = call i64 @cpc_TestKey(i32 11)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %43
br label %53
47: ; preds = %43
br label %48
48: ; preds = %47, %41
br label %49
49: ; preds = %48, %36
br label %50
50: ; preds = %49, %31
br label %51
51: ; preds = %50, %26
br label %52
52: ; preds = %51, %21
br label %17
53: ; preds = %46
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Define la tecla >\00"
@.str.1 = [18 x i8] c"Define la tecla <\00"
@.str.2 = [18 x i8] c"Define la tecla ^\00"
@.str.3 = [18 x i8] c"Define la tecla v\00"
@.str.4 = [21 x i8] c"Define la tecla Fire\00"
@.str.6 = [23 x i8] c"Has pulsado la tecla >\00"
@.str.7 = [23 x i8] c"Has pulsado la tecla <\00"
@.str.8 = [23 x i8] c"Has pulsado la tecla ^\00"
@.str.9 = [23 x i8] c"Has pulsado la tecla v\00"
@.str.10 = [26 x i8] c"Has pulsado la tecla Fire\00"
define void @RedefinicionTeclas() {
%1 = tail call i32 (...) @cpc_ClrScr()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @cpc_RedefineKey(i32 0)
%4 = tail call i32 (...) @cpc_ClrScr()
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @cpc_RedefineKey(i32 1)
%7 = tail call i32 (...) @cpc_ClrScr()
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @cpc_RedefineKey(i32 2)
%10 = tail call i32 (...) @cpc_ClrScr()
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @cpc_RedefineKey(i32 3)
%13 = tail call i32 (...) @cpc_ClrScr()
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%15 = tail call i32 @cpc_RedefineKey(i32 4)
%16 = tail call i32 (...) @cpc_ClrScr()
br label %17
17: ; preds = %39, %0
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i64 @cpc_TestKey(i32 0)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %36
21: ; preds = %17
%22 = tail call i64 @cpc_TestKey(i32 1)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %36
24: ; preds = %21
%25 = tail call i64 @cpc_TestKey(i32 2)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = tail call i64 @cpc_TestKey(i32 3)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = tail call i64 @cpc_TestKey(i32 4)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = tail call i64 @cpc_TestKey(i32 11)
%35 = icmp eq i64 %34, 0
br i1 %35, label %39, label %40
36: ; preds = %30, %27, %24, %21, %17
%37 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), %17 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), %21 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), %24 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %27 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), %30 ]
%38 = tail call i32 @printf(i8* dereferenceable(1) %37)
br label %39
39: ; preds = %36, %33
br label %17
40: ; preds = %33
ret void
}