// File: /workspace/github_cpp_makefile_star2_O1/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
movl %esi, %r15d
xorl %eax, %eax
testl %edx, %edx
movl $0xf, %ecx
cmovel %ecx, %eax
movl %eax, -0x40(%rbp)
movl %edi, %r12d
cmovel %edx, %ecx
movl %ecx, -0x30(%rbp)
movl 0x3305a7(%rip), %edx    # 0x340168
movl %edx, %ebx
imull %esi, %ebx
movl 0x208c47(%rip), %r14d   # 0x218814
leal (%rbx,%r14,2), %edi
movl 0x330595(%rip), %ecx    # 0x34016c
movl %ecx, %r13d
imull %r12d, %r13d
leal (%r13,%r14,2), %esi
cmpl $0x1, 0x208c3e(%rip)    # 0x218828
sbbl $-0x1, %ecx
movl %edi, -0x3c(%rbp)
movl %esi, -0x38(%rbp)
movl $0xe, %r8d
callq 0xf296
leal (%rbx,%r14,2), %edi
incl %edi
leal 0x1(%r13,%r14,2), %esi
movl 0x330559(%rip), %edx    # 0x340168
addl $-0x2, %edx
movl 0x330554(%rip), %ecx    # 0x34016c
addl $-0x2, %ecx
movl -0x30(%rbp), %r8d
callq 0xf30c
movq 0x3302bd(%rip), %rdx    # 0x33fee8
movzbl 0x208be2(%rip), %esi    # 0x218814
movzbl 0x208bd7(%rip), %edi    # 0x218810
leaq 0x149bc0(%rip), %rax    # 0x159800
movq %rax, 0x3302a1(%rip)    # 0x33fee8
movzbl 0x149bba(%rip), %ebx    # 0x159808
movl %ebx, 0x208bc0(%rip)    # 0x218814
movzwl 0x149ce9(%rip), %ecx    # 0x159944
movzbl (%rcx,%rax), %r14d
movl %r14d, 0x208ba9(%rip)   # 0x218810
movl 0x330523(%rip), %eax    # 0x340190
cmpl 0x3304fd(%rip), %eax    # 0x340170
jne 0xfc95
movl 0x2fcb39(%rip), %eax    # 0x30c7b4
orl 0x32bba7(%rip), %eax    # 0x33b828
leaq 0x1511c8(%rip), %rcx    # 0x160e50
leaq 0x1508c1(%rip), %rax    # 0x160550
cmovneq %rcx, %rax
jmp 0xfc9c
leaq 0x151ab4(%rip), %rax    # 0x161750
movl $0x8, %ecx
movq (%rax,%rcx), %r13
testq %r13, %r13
je 0xfcb8
cmpl %r12d, -0x8(%rax,%rcx)
jne 0xfcb8
cmpl %r15d, -0x4(%rax,%rcx)
je 0xfcca
addq $0x18, %rcx
cmpq $0x908, %rcx            # imm = 0x908
jne 0xfca1
jmp 0xfd61
incb 0x208b98(%rip)          # 0x218868
movslq 0x330491(%rip), %r15    # 0x340168
movl %edi, -0x34(%rbp)
movq %r13, %rdi
movq %rdx, -0x30(%rbp)
movl %esi, %r12d
callq 0x9120
movslq 0x213854(%rip), %rcx    # 0x223544
imulq %rcx, %r14
imulq %r14, %rax
shrq $0x2, %rax
movabsq $0x28f5c28f5c28f5c3, %rdx # imm = 0x28F5C28F5C28F5C3
mulq %rdx
shrq $0x2, %rdx
subq %rdx, %r15
shrq %r15
movl -0x3c(%rbp), %esi
addl %r15d, %esi
imull %ecx, %ebx
movslq %ebx, %rax
imulq $-0x51eb851f, %rax, %rax # imm = 0xAE147AE1
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
addl 0x330433(%rip), %eax    # 0x34016c
movl %eax, %edi
shrl $0x1f, %edi
addl %eax, %edi
sarl %edi
addl -0x38(%rbp), %edi
movzbl -0x40(%rbp), %edx
movq %r13, %rcx
callq 0xe7d0
movl -0x34(%rbp), %edi
movl %r12d, %esi
movq -0x30(%rbp), %rdx
decb 0x208b07(%rip)          # 0x218868
movq %rdx, 0x330180(%rip)    # 0x33fee8
movl %esi, 0x208aa6(%rip)    # 0x218814
movl %edi, 0x208a9c(%rip)    # 0x218810
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq