// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rbx
pushq %rax
movl 0x2002af(%rip), %edi    # 0x21b240
movl 0x2002ad(%rip), %esi    # 0x21b244
callq 0xfdb4
movl %eax, %ebx
leal 0x3(%rbx), %eax
cmpl $0x3, %eax
ja 0x1b0b5
leaq 0xee50b(%rip), %rcx     # 0x1094bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x3251b4(%rip), %ecx    # 0x340174
movl %ecx, %eax
xorl $0x1, %eax
movl %eax, 0x3251a9(%rip)    # 0x340174
movslq 0x3251ae(%rip), %rax    # 0x340180
cmpl $0x1, %ecx
jne 0x1b114
testl %eax, %eax
je 0x1b006
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq 0x145562(%rip), %rcx    # 0x160550
leaq 0xeefb6(%rip), %rdx     # 0x109fab
movq %rdx, 0x8(%rcx,%rax)
leaq 0x145e4f(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax)
movslq 0x325177(%rip), %rax    # 0x340184
testq %rax, %rax
je 0x1b15e
leaq (%rax,%rax,2), %rax
leaq 0x14672f(%rip), %rcx    # 0x161750
leaq 0xeef83(%rip), %rdx     # 0x109fab
jmp 0x1b159
movl 0x32513d(%rip), %ecx    # 0x340170
movl %ecx, %eax
xorl $0x1, %eax
movl %eax, 0x325132(%rip)    # 0x340170
movslq 0x325133(%rip), %rax    # 0x340178
cmpl $0x1, %ecx
jne 0x1b0be
testl %eax, %eax
je 0x1b075
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq 0x1454f3(%rip), %rcx    # 0x160550
leaq 0xeef43(%rip), %rdx     # 0x109fa7
movq %rdx, 0x8(%rcx,%rax)
leaq 0x145de0(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax)
movl 0x325101(%rip), %eax    # 0x34017c
testl %eax, %eax
je 0x1b108
leaq 0xeef1d(%rip), %rcx     # 0x109fa7
jmp 0x1b0f6
movl 0x2f1722(%rip), %eax    # 0x30c7b4
movl %eax, 0x20018c(%rip)    # 0x21b224
callq 0xfd83
xorl %edi, %edi
callq 0xd4e7
jmp 0x1b15e
xorb $0x1, 0x3250e0(%rip)    # 0x340190
jmp 0x1b15e
movl %ebx, %edi
callq 0xd4e7
jmp 0x1b108
testl %eax, %eax
je 0x1b0e5
leaq (%rax,%rax,2), %rax
leaq 0x145483(%rip), %rcx    # 0x160550
leaq 0xefaed(%rip), %rdx     # 0x10abc1
movq %rdx, 0x8(%rcx,%rax,8)
leaq 0x145d70(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax,8)
movl 0x325091(%rip), %eax    # 0x34017c
testl %eax, %eax
je 0x1b108
leaq 0xefacb(%rip), %rcx     # 0x10abc1
cltq
leaq (%rax,%rax,2), %rax
leaq 0x14664d(%rip), %rdx    # 0x161750
movq %rcx, 0x8(%rdx,%rax,8)
movl $0x0, 0x32507e(%rip)    # 0x340190
jmp 0x1b15e
testl %eax, %eax
je 0x1b13b
leaq (%rax,%rax,2), %rax
leaq 0x14542d(%rip), %rcx    # 0x160550
leaq 0xefa93(%rip), %rdx     # 0x10abbd
movq %rdx, 0x8(%rcx,%rax,8)
leaq 0x145d1a(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax,8)
movslq 0x325042(%rip), %rax    # 0x340184
testq %rax, %rax
je 0x1b15e
leaq (%rax,%rax,2), %rax
leaq 0x1465fe(%rip), %rcx    # 0x161750
leaq 0xefa64(%rip), %rdx     # 0x10abbd
movq %rdx, 0x8(%rcx,%rax,8)
movl $0x3f, %eax
cmpl $0x3f, %ebx
je 0x1b182
movl %ebx, %eax
xorl $0xd, %eax
movl 0x2000b5(%rip), %ecx    # 0x21b228
xorl $0x3f, %ecx
xorl %edx, %edx
orl %eax, %ecx
movl $0x3e7, %eax            # imm = 0x3E7
cmovnel %edx, %eax
movl %eax, 0x2000a0(%rip)    # 0x21b228
xorl %edi, %edi
callq 0xee7d
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq