// File: jkingan[P]ladyheather/heather.cpp
// Function: do_touch_key()
int do_touch_key()
{
int key;

    // process a touch keyboard key click
    key = touch_key(mouse_x,mouse_y);
    if(key == TOUCH_SH) {  // shift key pressed - shift next keystroke
       shifted ^= 1;
    }
    else if(key == TOUCH_BUT) {  // right click mode enabled
       button_lock ^= 1;
       if(button_lock) {
          if(lc_but_lock_index) normal_lc_table[lc_but_lock_index].label = "MOU";
          if(lc_but_lock_index) calc_lc_table[lc_but_lock_index].label = "MOU";
          if(uc_but_lock_index) uc_table[uc_but_lock_index].label = "MOU";
       }
       else {
          if(lc_but_lock_index) normal_lc_table[lc_but_lock_index].label = "mou";
          if(lc_but_lock_index) calc_lc_table[lc_but_lock_index].label = "mou";
          if(uc_but_lock_index) uc_table[uc_but_lock_index].label = "mou";
       }
    }
    else if(key == TOUCH_CAP) { // caps lock pressed
       caps_lock ^= 1;
       if(caps_lock) {
          if(lc_cap_lock_index) normal_lc_table[lc_cap_lock_index].label = "CAP";
          if(lc_cap_lock_index) calc_lc_table[lc_cap_lock_index].label = "CAP";
          if(uc_cap_lock_index) uc_table[uc_cap_lock_index].label = "CAP";
       }
       else {
          if(lc_cap_lock_index) normal_lc_table[lc_cap_lock_index].label = "cap";
          if(lc_cap_lock_index) calc_lc_table[lc_cap_lock_index].label = "cap";
          if(uc_cap_lock_index) uc_table[uc_cap_lock_index].label = "cap";
       }
       shifted = 0;
    }
    else if(key) {    // text key pressed
       add_kbd(key);  // add key to keystroke buffer
       shifted = 0;   // reset shift state
    }
    else {   // touched a blank key
       last_null_key = last_zoom_calc;
       hide_kbd(99);
       add_kbd(0);
    }

    if(key == '?') last_touch_key = key;
    else if((key == 0x0D) && (last_touch_key == '?')) last_touch_key = 999;
    else last_touch_key = 0;

    show_touch_kbd(0);
    return key;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl 0x253752(%rip), %edi    # 0x27a420
movl 0x253750(%rip), %esi    # 0x27a424
callq 0x12e80
movl %eax, -0x4(%rbp)
cmpl $-0x2, -0x4(%rbp)
jne 0x26cf6
movl 0x378688(%rip), %eax    # 0x39f370
xorl $0x1, %eax
movl %eax, 0x37867f(%rip)    # 0x39f370
jmp 0x26f7c
cmpl $-0x3, -0x4(%rbp)
jne 0x26e17
movl 0x37864e(%rip), %eax    # 0x39f354
xorl $0x1, %eax
movl %eax, 0x378645(%rip)    # 0x39f354
cmpl $0x0, 0x37863e(%rip)    # 0x39f354
je 0x26d95
cmpl $0x0, 0x378641(%rip)    # 0x39f360
je 0x26d41
movslq 0x378638(%rip), %rcx    # 0x39f360
leaq 0x198811(%rip), %rax    # 0x1bf540
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149e7d(%rip), %rcx    # 0x170bba
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x378618(%rip)    # 0x39f360
je 0x26d6a
movslq 0x37860f(%rip), %rcx    # 0x39f360
leaq 0x1990e8(%rip), %rax    # 0x1bfe40
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149e54(%rip), %rcx    # 0x170bba
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x3785f3(%rip)    # 0x39f364
je 0x26d93
movslq 0x3785ea(%rip), %rcx    # 0x39f364
leaq 0x1999bf(%rip), %rax    # 0x1c0740
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149e2b(%rip), %rcx    # 0x170bba
movq %rcx, 0x8(%rax)
jmp 0x26e12
cmpl $0x0, 0x3785c4(%rip)    # 0x39f360
je 0x26dbe
movslq 0x3785bb(%rip), %rcx    # 0x39f360
leaq 0x198794(%rip), %rax    # 0x1bf540
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x1491aa(%rip), %rcx    # 0x16ff64
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x37859b(%rip)    # 0x39f360
je 0x26de7
movslq 0x378592(%rip), %rcx    # 0x39f360
leaq 0x19906b(%rip), %rax    # 0x1bfe40
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149181(%rip), %rcx    # 0x16ff64
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x378576(%rip)    # 0x39f364
je 0x26e10
movslq 0x37856d(%rip), %rcx    # 0x39f364
leaq 0x199942(%rip), %rax    # 0x1c0740
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149158(%rip), %rcx    # 0x16ff64
movq %rcx, 0x8(%rax)
jmp 0x26e12
jmp 0x26f7a
cmpl $-0x1, -0x4(%rbp)
jne 0x26f3f
movl 0x378529(%rip), %eax    # 0x39f350
xorl $0x1, %eax
movl %eax, 0x378520(%rip)    # 0x39f350
cmpl $0x0, 0x378519(%rip)    # 0x39f350
je 0x26eb6
cmpl $0x0, 0x378518(%rip)    # 0x39f358
je 0x26e62
movslq 0x37850f(%rip), %rcx    # 0x39f358
leaq 0x1986f0(%rip), %rax    # 0x1bf540
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149d60(%rip), %rcx    # 0x170bbe
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x3784ef(%rip)    # 0x39f358
je 0x26e8b
movslq 0x3784e6(%rip), %rcx    # 0x39f358
leaq 0x198fc7(%rip), %rax    # 0x1bfe40
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149d37(%rip), %rcx    # 0x170bbe
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x3784ca(%rip)    # 0x39f35c
je 0x26eb4
movslq 0x3784c1(%rip), %rcx    # 0x39f35c
leaq 0x19989e(%rip), %rax    # 0x1c0740
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149d0e(%rip), %rcx    # 0x170bbe
movq %rcx, 0x8(%rax)
jmp 0x26f33
cmpl $0x0, 0x37849b(%rip)    # 0x39f358
je 0x26edf
movslq 0x378492(%rip), %rcx    # 0x39f358
leaq 0x198673(%rip), %rax    # 0x1bf540
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149085(%rip), %rcx    # 0x16ff60
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x378472(%rip)    # 0x39f358
je 0x26f08
movslq 0x378469(%rip), %rcx    # 0x39f358
leaq 0x198f4a(%rip), %rax    # 0x1bfe40
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x14905c(%rip), %rcx    # 0x16ff60
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x37844d(%rip)    # 0x39f35c
je 0x26f31
movslq 0x378444(%rip), %rcx    # 0x39f35c
leaq 0x199821(%rip), %rax    # 0x1c0740
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq 0x149033(%rip), %rcx    # 0x16ff60
movq %rcx, 0x8(%rax)
jmp 0x26f33
movl $0x0, 0x378433(%rip)    # 0x39f370
jmp 0x26f78
cmpl $0x0, -0x4(%rbp)
je 0x26f59
movl -0x4(%rbp), %edi
callq 0xf320
movl $0x0, 0x378419(%rip)    # 0x39f370
jmp 0x26f76
movl 0x344a35(%rip), %eax    # 0x36b994
movl %eax, 0x25349f(%rip)    # 0x27a404
movl $0x63, %edi
callq 0x12e30
xorl %edi, %edi
callq 0xf320
jmp 0x26f78
jmp 0x26f7a
jmp 0x26f7c
cmpl $0x3f, -0x4(%rbp)
jne 0x26f8d
movl -0x4(%rbp), %eax
movl %eax, 0x25347d(%rip)    # 0x27a408
jmp 0x26fb4
cmpl $0xd, -0x4(%rbp)
jne 0x26fa8
cmpl $0x3f, 0x25346e(%rip)   # 0x27a408
jne 0x26fa8
movl $0x3e7, 0x253462(%rip)  # imm = 0x3E7
jmp 0x26fb2
movl $0x0, 0x253456(%rip)    # 0x27a408
jmp 0x26fb4
xorl %edi, %edi
callq 0x11970
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)