// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: show_key(int, int, int)
void show_key(int row, int col, int invert)
{
int num_keys;
int i;
int shift;
int x,y;
int fg, bg;
unsigned char *old_font;
unsigned char old_height;
unsigned char old_width;
struct KEY_CAP *table;
char *lab;

   // Draw a touch screen keyboard key.  Invert allows flashing the key when
   // it is touched.

   if(invert) {            // set keycap colors
      bg = KBD_FG_COLOR;
      fg = KBD_BG_COLOR;
   }
   else {
      fg = KBD_FG_COLOR;
      bg = KBD_BG_COLOR;
   }

   x = (col * key_width) + TOUCH_MARGIN;  // where to draw the key cap
   y = (row * key_height) + TOUCH_MARGIN;

   if(rotate_screen) i = 1;  // rotate_screen
   else i = 0;
   draw_rectangle(x,y, key_width,key_height+i, KBD_GRID_COLOR);   // key outline
   fill_rectangle(x+1,y+1, key_width-2,key_height-2, bg);         // key interior

   old_font = dot_font;       // switch to large font for key labels
   old_height = TEXT_HEIGHT;
   old_width = TEXT_WIDTH;

   dot_font = (unsigned char *) &h_large_font[0];
   TEXT_HEIGHT = dot_font[8];         // char height
   TEXT_WIDTH = character_width('M'); // character_width('M');

   shift = (shifted ^ caps_lock);

   if(shift) {
      table = &uc_table[0];
      num_keys = sizeof(uc_table) / sizeof(struct KEY_CAP);
   }
   else if(rpn_mode || last_zoom_calc) {
      table = &calc_lc_table[0];
      num_keys = sizeof(calc_lc_table) / sizeof(struct KEY_CAP);
   }
   else {
      table = &normal_lc_table[0];
      num_keys = sizeof(normal_lc_table) / sizeof(struct KEY_CAP);
   }

   for(i=0; i<num_keys; i++) {  // find the key in the table and display it
      lab = table[i].label;
      if(lab == 0) ;
      else if((table[i].row == row) && (table[i].col == col)) {
         ++graphics_coords;
         x += ((key_width - (strlen(lab)*TEXT_WIDTH*vc_font_scale/100)) / 2);
         y += ((key_height - TEXT_HEIGHT*vc_font_scale/100) / 2);
         vidstr(y,x, fg, lab);
         --graphics_coords;
         break;
      }
   }

   dot_font = old_font;       // restore font size
   TEXT_HEIGHT = old_height;
   TEXT_WIDTH = old_width;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %eax, %eax
testl %edx, %edx
pushq $0xf
popq %rbx
cmovel %ebx, %eax
movl %eax, -0x34(%rbp)
movl %edi, %r12d
cmovel %edx, %ebx
movl 0x31acab(%rip), %edx    # 0x32a168
movl %edx, %r13d
movl %esi, -0x38(%rbp)
imull %esi, %r13d
movl 0x1f3346(%rip), %r14d   # 0x202814
leal (%r13,%r14,2), %edi
movl 0x31ac93(%rip), %ecx    # 0x32a16c
movl %ecx, %r15d
imull %r12d, %r15d
leal (%r15,%r14,2), %esi
cmpl $0x1, 0x1f333d(%rip)    # 0x202828
sbbl $-0x1, %ecx
pushq $0xe
popq %r8
movl %edi, -0x30(%rbp)
movl %esi, -0x2c(%rbp)
callq 0xecd5
leal 0x1(%r13,%r14,2), %edi
leal (%r15,%r14,2), %esi
incl %esi
movl 0x31ac5a(%rip), %edx    # 0x32a168
addl $-0x2, %edx
movl 0x31ac55(%rip), %ecx    # 0x32a16c
addl $-0x2, %ecx
movl %ebx, %r8d
callq 0xed4b
movq 0x31a9bf(%rip), %r15    # 0x329ee8
movzbl 0x1f32e3(%rip), %r14d   # 0x202814
movzbl 0x1f32d8(%rip), %eax    # 0x202810
movl %eax, -0x3c(%rbp)
leaq 0x1342be(%rip), %rax    # 0x143800
movq %rax, 0x31a99f(%rip)    # 0x329ee8
movzbl 0x1342b8(%rip), %eax    # 0x143808
movl %eax, 0x1f32be(%rip)    # 0x202814
pushq $0x4d
popq %rdi
callq 0xdaf5
movl %eax, %ebx
movl %eax, 0x1f32aa(%rip)    # 0x202810
movl 0x31ac24(%rip), %eax    # 0x32a190
cmpl 0x31abfe(%rip), %eax    # 0x32a170
jne 0xf594
movl 0x2e723a(%rip), %eax    # 0x2f67b4
orl 0x3162a8(%rip), %eax    # 0x325828
leaq 0x13b8c9(%rip), %rcx    # 0x14ae50
leaq 0x13afc2(%rip), %rax    # 0x14a550
cmovneq %rcx, %rax
jmp 0xf59b
leaq 0x13c1b5(%rip), %rax    # 0x14b750
pushq $0x8
popq %rcx
movl -0x38(%rbp), %edx
cmpq $0x908, %rcx            # imm = 0x908
je 0xf63c
movq (%rax,%rcx), %r13
testq %r13, %r13
je 0xf5c4
cmpl %r12d, -0x8(%rax,%rcx)
jne 0xf5c4
cmpl %edx, -0x4(%rax,%rcx)
je 0xf5ca
addq $0x18, %rcx
jmp 0xf5a1
incb 0x1f3298(%rip)          # 0x202868
movl %r14d, %r12d
movslq 0x31ab8e(%rip), %r14    # 0x32a168
movq %r13, %rdi
callq 0x9120
movl %ebx, %ecx
movslq 0x1fdf59(%rip), %rdi    # 0x20d544
imulq %rdi, %rcx
imulq %rcx, %rax
pushq $0x64
popq %rcx
xorl %edx, %edx
divq %rcx
subq %rax, %r14
shrq %r14
movl -0x30(%rbp), %esi
addl %r14d, %esi
movl %r12d, %r14d
movl 0x1f3204(%rip), %eax    # 0x202814
imull %edi, %eax
pushq $-0x64
popq %rcx
cltd
idivl %ecx
addl 0x31ab4d(%rip), %eax    # 0x32a16c
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl -0x2c(%rbp), %edi
addl %eax, %edi
movzbl -0x34(%rbp), %edx
movq %r13, %rcx
callq 0xe2d2
decb 0x1f322c(%rip)          # 0x202868
movq %r15, 0x31a8a5(%rip)    # 0x329ee8
movl %r14d, 0x1f31ca(%rip)   # 0x202814
movl -0x3c(%rbp), %eax
movl %eax, 0x1f31bd(%rip)    # 0x202810
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq