// File: /workspace/github_cpp_makefile_star2_O3/khedoros[P]khednes/mem.cpp
// Function: mem::sendkeydown(SDL_Scancode)
void mem::sendkeydown(SDL_Scancode test) {
        //util::debug(ORIGIN,"Key down! (%04x)\n",test);
        switch(test) {
                case SDL_SCANCODE_A:
                        joy1_buttons[6]=true; //left
                        //printf("LEFT!\n");
                        break;
                case SDL_SCANCODE_D:
                        joy1_buttons[7]=true; //right
                        //printf("RIGHT! ");
                        break;
                case SDL_SCANCODE_G:
                        joy1_buttons[2]=true; //select
                        //printf("SELECT!\n");
                        break;
                case SDL_SCANCODE_H:
                        joy1_buttons[3]=true; //start
                        //printf("START!\n");
                        break;
                case SDL_SCANCODE_K:
                        joy1_buttons[1]=true; //b
                        //printf("B!\n");
                        break;
                case SDL_SCANCODE_L:
                        joy1_buttons[0]=true; //a
                        //printf("A!\n");
                        break;
                case SDL_SCANCODE_S:
                        joy1_buttons[5]=true; //down
                        //printf("DOWN!\n");
                        break;
                case SDL_SCANCODE_W:
                        joy1_buttons[4]=true; //up
                        //printf("UP!\n");
                        break;
                case SDL_SCANCODE_GRAVE:
                        pu.speedup(true);
                        break;
                case SDL_SCANCODE_X:
                        joy2_trigger=16;
                        break;
                case SDL_SCANCODE_Z:
                        joy2_light=0;
                        break;
                case SDL_SCANCODE_N:
                        pu.print_name_table();
                        break;
                default: cout<<"Saw button "<<int(test)<<endl;
        }        
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
leal -0x4(%rbx), %eax
cmpl $0x19, %eax
ja 0xa6e3
leaq 0xa1ff(%rip), %rcx      # 0x148d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
orb $0x40, 0x70(%rdi)
jmp 0xa79d
cmpl $0x35, %ebx
jne 0xa6fd
movq 0x8(%rdi), %rdi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xfbb4
movq 0x118ac(%rip), %r14     # 0x1bfb0
leaq 0xa2b5(%rip), %rsi      # 0x149c0
movl $0xb, %edx
movq %r14, %rdi
callq 0x4410
movq %r14, %rdi
movl %ebx, %esi
callq 0x45e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4290
movq 0x8(%rdi), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xfbc8
orb $0x1, 0x70(%rdi)
jmp 0xa79d
orb $0x8, 0x70(%rdi)
jmp 0xa79d
orb $0x4, 0x70(%rdi)
jmp 0xa79d
orb $0x20, 0x70(%rdi)
jmp 0xa79d
orb $0x2, 0x70(%rdi)
jmp 0xa79d
movl $0x0, 0x64(%rdi)
jmp 0xa79d
orb $-0x80, 0x70(%rdi)
jmp 0xa79d
movl $0x10, 0x60(%rdi)
jmp 0xa79d
orb $0x10, 0x70(%rdi)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop