// File: /workspace/github_cpp_makefile_star2_O3/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 0xfd31
movl %eax, %ebx
leal 0x3(%rbx), %eax
cmpl $0x3, %eax
ja 0x1b0bc
leaq 0xee51b(%rip), %rcx     # 0x1094cc
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 0x1b155
testl %eax, %eax
je 0x1b006
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq 0x145562(%rip), %rcx    # 0x160550
leaq 0xeefc6(%rip), %rdx     # 0x109fbb
movq %rdx, 0x8(%rcx,%rax)
leaq 0x145e4f(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax)
movslq 0x325177(%rip), %rax    # 0x340184
testq %rax, %rax
je 0x1b1a3
leaq (%rax,%rax,2), %rax
leaq 0x14672f(%rip), %rcx    # 0x161750
leaq 0xeef93(%rip), %rdx     # 0x109fbb
jmp 0x1b19e
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 0x1b0fb
testl %eax, %eax
je 0x1b079
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq 0x1454ef(%rip), %rcx    # 0x160550
leaq 0xeef4f(%rip), %rdx     # 0x109fb7
movq %rdx, 0x8(%rcx,%rax)
leaq 0x145ddc(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax)
movl 0x3250fd(%rip), %eax    # 0x34017c
testl %eax, %eax
je 0x1b149
leaq 0xeef29(%rip), %rcx     # 0x109fb7
jmp 0x1b137
movl 0x2f171b(%rip), %eax    # 0x30c7b4
movl %eax, 0x200185(%rip)    # 0x21b224
callq 0xfd00
xorl %edi, %edi
callq 0xd4c8
jmp 0x1b1a3
xorb $0x1, 0x3250d9(%rip)    # 0x340190
jmp 0x1b1a3
movl %ebx, %edi
callq 0xd4c8
movl $0x0, 0x3250c3(%rip)    # 0x340190
movl $0x3f, %eax
cmpl $0x3f, %ebx
je 0x1b1a5
cmpl $0xd, %ebx
jne 0x1b1a3
movl $0x3e7, %eax            # imm = 0x3E7
cmpl $0x3f, 0x200138(%rip)   # 0x21b228
je 0x1b1a5
jmp 0x1b1a3
testl %eax, %eax
je 0x1b126
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq 0x145442(%rip), %rcx    # 0x160550
leaq 0xefabc(%rip), %rdx     # 0x10abd1
movq %rdx, 0x8(%rcx,%rax)
leaq 0x145d2f(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax)
movl 0x325050(%rip), %eax    # 0x34017c
testl %eax, %eax
je 0x1b149
leaq 0xefa9a(%rip), %rcx     # 0x10abd1
cltq
leaq (%rax,%rax,2), %rax
leaq 0x14660c(%rip), %rdx    # 0x161750
movq %rcx, 0x8(%rdx,%rax,8)
movl $0x0, 0x32503d(%rip)    # 0x340190
jmp 0x1b1a3
testl %eax, %eax
je 0x1b180
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq 0x1453e8(%rip), %rcx    # 0x160550
leaq 0xefa5e(%rip), %rdx     # 0x10abcd
movq %rdx, 0x8(%rcx,%rax)
leaq 0x145cd5(%rip), %rcx    # 0x160e50
movq %rdx, 0x8(%rcx,%rax)
movslq 0x324ffd(%rip), %rax    # 0x340184
testq %rax, %rax
je 0x1b1a3
leaq (%rax,%rax,2), %rax
leaq 0x1465b9(%rip), %rcx    # 0x161750
leaq 0xefa2f(%rip), %rdx     # 0x10abcd
movq %rdx, 0x8(%rcx,%rax,8)
xorl %eax, %eax
movl %eax, 0x20007d(%rip)    # 0x21b228
xorl %edi, %edi
callq 0xedfe
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq