// File: /workspace/github_cpp_makefile_star2_O2/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 0x1eae55(%rip), %edi    # 0x205240
movl 0x1eae53(%rip), %esi    # 0x205244
callq 0xf690
movl %eax, %ebx
leal 0x3(%rbx), %eax
cmpl $0x3, %eax
ja 0x1a50e
leaq 0xd90c1(%rip), %rcx     # 0xf34cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x30fd5a(%rip), %ecx    # 0x32a174
movl %ecx, %eax
xorl $0x1, %eax
movl %eax, 0x30fd4f(%rip)    # 0x32a174
movslq 0x30fd54(%rip), %rax    # 0x32a180
cmpl $0x1, %ecx
jne 0x1a580
testl %eax, %eax
je 0x1a45c
imulq $0x18, %rax, %rax
leaq 0x13010c(%rip), %rcx    # 0x14a550
leaq 0xd9bc0(%rip), %rdx     # 0xf400b
movq %rdx, 0x8(%rax,%rcx)
leaq 0x1309f9(%rip), %rcx    # 0x14ae50
movq %rdx, 0x8(%rax,%rcx)
movslq 0x30fd21(%rip), %rax    # 0x32a184
testq %rax, %rax
je 0x1a5ca
imulq $0x18, %rax, %rax
leaq 0x1312d9(%rip), %rcx    # 0x14b750
leaq 0xd9b8d(%rip), %rdx     # 0xf400b
jmp 0x1a5c5
movl 0x30fce7(%rip), %ecx    # 0x32a170
movl %ecx, %eax
xorl $0x1, %eax
movl %eax, 0x30fcdc(%rip)    # 0x32a170
movslq 0x30fcdd(%rip), %rax    # 0x32a178
cmpl $0x1, %ecx
jne 0x1a52d
testl %eax, %eax
je 0x1a4cb
imulq $0x18, %rax, %rax
leaq 0x13009d(%rip), %rcx    # 0x14a550
leaq 0xd9b4d(%rip), %rdx     # 0xf4007
movq %rdx, 0x8(%rax,%rcx)
leaq 0x13098a(%rip), %rcx    # 0x14ae50
movq %rdx, 0x8(%rax,%rcx)
movl 0x30fcab(%rip), %eax    # 0x32a17c
testl %eax, %eax
je 0x1a577
leaq 0xd9b27(%rip), %rcx     # 0xf4007
jmp 0x1a565
movl 0x2dc2c9(%rip), %eax    # 0x2f67b4
movl %eax, 0x1ead33(%rip)    # 0x205224
callq 0xf662
xorl %edi, %edi
callq 0xd140
jmp 0x1a5ca
xorb $0x1, 0x30fc87(%rip)    # 0x32a190
jmp 0x1a5ca
movl %ebx, %edi
callq 0xd140
andl $0x0, 0x30fc74(%rip)    # 0x32a190
cmpl $0x3f, %ebx
jne 0x1a5ca
pushq $0x3f
popq %rax
jmp 0x1a5e4
testl %eax, %eax
je 0x1a554
imulq $0x18, %rax, %rax
leaq 0x130014(%rip), %rcx    # 0x14a550
leaq 0xda709(%rip), %rdx     # 0xf4c4c
movq %rdx, 0x8(%rax,%rcx)
leaq 0x130901(%rip), %rcx    # 0x14ae50
movq %rdx, 0x8(%rax,%rcx)
movl 0x30fc22(%rip), %eax    # 0x32a17c
testl %eax, %eax
je 0x1a577
leaq 0xda6e7(%rip), %rcx     # 0xf4c4c
cltq
imulq $0x18, %rax, %rax
leaq 0x1311de(%rip), %rdx    # 0x14b750
movq %rcx, 0x8(%rax,%rdx)
andl $0x0, 0x30fc12(%rip)    # 0x32a190
jmp 0x1a5ca
testl %eax, %eax
je 0x1a5a7
imulq $0x18, %rax, %rax
leaq 0x12ffc1(%rip), %rcx    # 0x14a550
leaq 0xda6b2(%rip), %rdx     # 0xf4c48
movq %rdx, 0x8(%rax,%rcx)
leaq 0x1308ae(%rip), %rcx    # 0x14ae50
movq %rdx, 0x8(%rax,%rcx)
movslq 0x30fbd6(%rip), %rax    # 0x32a184
testq %rax, %rax
je 0x1a5ca
imulq $0x18, %rax, %rax
leaq 0x131192(%rip), %rcx    # 0x14b750
leaq 0xda683(%rip), %rdx     # 0xf4c48
movq %rdx, 0x8(%rax,%rcx)
movl %ebx, %eax
xorl $0xd, %eax
movl 0x1eac53(%rip), %ecx    # 0x205228
xorl $0x3f, %ecx
xorl %edx, %edx
orl %eax, %ecx
movl $0x3e7, %eax            # imm = 0x3E7
cmovnel %edx, %eax
movl %eax, 0x1eac3e(%rip)    # 0x205228
xorl %edi, %edi
callq 0xe8d9
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq