#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*/ CompileCondition();
unsigned short NumberOnly();
int /*<<< orphan*/ ResetIf();
int /*<<< orphan*/ WriteInstruction(char *);
int /*<<< orphan*/ WriteNumber(int);
void CR_Key(void) {
  unsigned short int nNum = NumberOnly();
  WriteInstruction("ld a,(joyval)");
  WriteInstruction("and ");
  WriteNumber(1 << nNum);
  WriteInstruction("jp nz,      ");
  CompileCondition();
  ResetIf();
}


x86 assembly (clang, -O0):
<CR_Key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <NumberOnly@plt>
mov    %ax,-0x2(%rbp)
lea    0xe96(%rip),%rdi
call   1050 <WriteInstruction@plt>
lea    0xe98(%rip),%rdi
call   1050 <WriteInstruction@plt>
movzwl -0x2(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
call   1040 <WriteNumber@plt>
lea    0xe81(%rip),%rdi
call   1050 <WriteInstruction@plt>
mov    $0x0,%al
call   1060 <CompileCondition@plt>
mov    $0x0,%al
call   1030 <ResetIf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CR_Key>:
push   %rbx
xor    %eax,%eax
call   1070 <NumberOnly@plt>
mov    %eax,%ebx
lea    0xe9f(%rip),%rdi
call   1050 <WriteInstruction@plt>
lea    0xea1(%rip),%rdi
call   1050 <WriteInstruction@plt>
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%edi
call   1040 <WriteNumber@plt>
lea    0xe8c(%rip),%rdi
call   1050 <WriteInstruction@plt>
xor    %eax,%eax
call   1060 <CompileCondition@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <ResetIf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"ld a,(joyval)\00"
@.str.1 = [5 x i8] c"and \00"
@.str.2 = [13 x i8] c"jp nz, \00"
define void @CR_Key() {
%1 = alloca i16
%2 = call zeroext i16 (...) @NumberOnly()
store i16 %2, i16* %1
%3 = call i32 @WriteInstruction(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @WriteInstruction(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = load i16, i16* %1
%6 = zext i16 %5 to i32
%7 = shl i32 1, %6
%8 = call i32 @WriteNumber(i32 %7)
%9 = call i32 @WriteInstruction(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (...) @CompileCondition()
%11 = call i32 (...) @ResetIf()
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"ld a,(joyval)\00"
@.str.1 = [5 x i8] c"and \00"
@.str.2 = [13 x i8] c"jp nz, \00"
define void @CR_Key() {
%1 = tail call zeroext i16 (...) @NumberOnly()
%2 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = zext i16 %1 to i32
%5 = shl nuw i32 1, %4
%6 = tail call i32 @WriteNumber(i32 %5)
%7 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @CompileCondition()
%9 = tail call i32 (...) @ResetIf()
ret void
}