// File: /workspace/github_c_makefile_star2_O0/aap[P]rx-0/misc/crt.c
// Function: keydn
void
keydn(int scancode)
{
	int i;
	u32 ojoys[NUMJOYS];

	for(i = 0; i < NUMJOYS; i++)
		ojoys[i] = joys[i].b;
	switch(scancode){
	case SDL_SCANCODE_ESCAPE:
		exit(0);
		break;

	case SDL_SCANCODE_E: KEY1(04);
	case SDL_SCANCODE_X: KEY1(010);
	case SDL_SCANCODE_C: KEY1(020000);
	case SDL_SCANCODE_A: KEY1(020);
	case SDL_SCANCODE_D: KEY1(040);
	case SDL_SCANCODE_S: KEY1(0100);
	case SDL_SCANCODE_W: KEY1(0200);

	case SDL_SCANCODE_U: KEY2(04);
	case SDL_SCANCODE_N: KEY2(010);
	case SDL_SCANCODE_M: KEY2(020000);
	case SDL_SCANCODE_J: KEY2(020);
	case SDL_SCANCODE_L: KEY2(040);
	case SDL_SCANCODE_K: KEY2(0100);
	case SDL_SCANCODE_I: KEY2(0200);

	case SDL_SCANCODE_F:
		fullscreen = !fullscreen;
		SDL_SetWindowFullscreen(window, modes[fullscreen]);
		resize();
		break;
	}
	for(i = 0; i < NUMJOYS; i++)
		if(joys[i].b != ojoys[i])
			updatejoy(&joys[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
cmpl $0x4, -0x8(%rbp)
jge 0x2790
movslq -0x8(%rbp), %rcx
leaq 0x5b7d(%rip), %rax      # 0x82f0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movslq -0x8(%rbp), %rax
movl %ecx, -0x20(%rbp,%rax,4)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2762
movl -0x4(%rbp), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x25, %eax
ja 0x290a
movq -0x28(%rbp), %rax
leaq 0x38a0(%rip), %rcx      # 0x6050
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %edi, %edi
callq 0x22d0
movl 0x5b2e(%rip), %eax      # 0x82f4
orl $0x4, %eax
movl %eax, 0x5b25(%rip)      # 0x82f4
jmp 0x290a
movl 0x5b1a(%rip), %eax      # 0x82f4
orl $0x8, %eax
movl %eax, 0x5b11(%rip)      # 0x82f4
jmp 0x290a
movl 0x5b06(%rip), %eax      # 0x82f4
orl $0x2000, %eax           # imm = 0x2000
movl %eax, 0x5afb(%rip)      # 0x82f4
jmp 0x290a
movl 0x5af0(%rip), %eax      # 0x82f4
orl $0x10, %eax
movl %eax, 0x5ae7(%rip)      # 0x82f4
jmp 0x290a
movl 0x5adc(%rip), %eax      # 0x82f4
orl $0x20, %eax
movl %eax, 0x5ad3(%rip)      # 0x82f4
jmp 0x290a
movl 0x5ac8(%rip), %eax      # 0x82f4
orl $0x40, %eax
movl %eax, 0x5abf(%rip)      # 0x82f4
jmp 0x290a
movl 0x5ab4(%rip), %eax      # 0x82f4
orl $0x80, %eax
movl %eax, 0x5aa9(%rip)      # 0x82f4
jmp 0x290a
movl 0x5aae(%rip), %eax      # 0x8304
orl $0x4, %eax
movl %eax, 0x5aa5(%rip)      # 0x8304
jmp 0x290a
movl 0x5a9a(%rip), %eax      # 0x8304
orl $0x8, %eax
movl %eax, 0x5a91(%rip)      # 0x8304
jmp 0x290a
movl 0x5a86(%rip), %eax      # 0x8304
orl $0x2000, %eax           # imm = 0x2000
movl %eax, 0x5a7b(%rip)      # 0x8304
jmp 0x290a
movl 0x5a73(%rip), %eax      # 0x8304
orl $0x10, %eax
movl %eax, 0x5a6a(%rip)      # 0x8304
jmp 0x290a
movl 0x5a62(%rip), %eax      # 0x8304
orl $0x20, %eax
movl %eax, 0x5a59(%rip)      # 0x8304
jmp 0x290a
movl 0x5a51(%rip), %eax      # 0x8304
orl $0x40, %eax
movl %eax, 0x5a48(%rip)      # 0x8304
jmp 0x290a
movl 0x5a40(%rip), %eax      # 0x8304
orl $0x80, %eax
movl %eax, 0x5a35(%rip)      # 0x8304
jmp 0x290a
cmpl $0x0, 0x5a58(%rip)      # 0x8330
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x5a48(%rip)      # 0x8330
movq 0x59e9(%rip), %rdi      # 0x82d8
movslq 0x5a3a(%rip), %rcx      # 0x8330
leaq 0x5967(%rip), %rax      # 0x8264
movl (%rax,%rcx,4), %esi
callq 0x2290
callq 0x26e0
movl $0x0, -0x8(%rbp)
cmpl $0x4, -0x8(%rbp)
jge 0x295a
movslq -0x8(%rbp), %rcx
leaq 0x59ce(%rip), %rax      # 0x82f0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movslq -0x8(%rbp), %rcx
cmpl -0x20(%rbp,%rcx,4), %eax
je 0x294d
movslq -0x8(%rbp), %rax
leaq 0x59af(%rip), %rdi      # 0x82f0
shlq $0x4, %rax
addq %rax, %rdi
callq 0x26a0
jmp 0x294f
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2911
addq $0x30, %rsp
popq %rbp
retq