// File: /workspace/github_cpp_makefile_star2_O1/BrianEnigma[P]cryptoslam/src/cryptoslam.cpp
// Function: handleKey(char, _win_st*, _win_st*, _win_st*, Cryptogram*)
void handleKey(char key, 
               WINDOW *menu, 
               WINDOW *message, 
               WINDOW *alphabet, 
               Cryptogram *cr)
{
    char key1, key2;
    switch(key)
    {
        case 's':
        case 'S':
            wclear(menu);
            mvwprintw(menu, 0, 0, "Cyphertext letter to set? ");
            wrefresh(menu);
            key1 = getch();
            wclear(menu);
            mvwprintw(menu, 0, 0, "Set letter \"%c\" to which plaintext letter (spacebar to unset)? ", 
                      key1);
            wrefresh(menu);
            key2 = getch();
            cr->set(key1, key2);
            cr->calcPlaintext();
            break;
        case 'u':
        case 'U':
            wclear(menu);
            mvwprintw(menu, 0, 0, "Cyphertext letter to unset? ");
            wrefresh(menu);
            key1 = getch();
            cr->unset(key1);
            cr->calcPlaintext();
            break;
        case 'r':
        case 'R':
            for (char c = 'A'; c <= 'Z'; c++)
                cr->unset(c);
            cr->calcPlaintext();
            break;
        case 't':
        case 'T':
            toolsMenu(menu, message, alphabet, cr);
            break;
        case 'f':
        case 'F':
            fileMenu(menu, cr);
            break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rsi, %r14
cmpl $0x65, %edi
jg 0x3e12
leal -0x52(%rdi), %eax
cmpl $0x3, %eax
ja 0x3f2f
leaq 0x155f(%rip), %rcx      # 0x5368
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leal -0x72(%rdi), %eax
cmpl $0x3, %eax
ja 0x3f3f
leaq 0x1553(%rip), %rcx      # 0x5378
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x41, %bpl
movsbl %bpl, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2956
incb %bpl
cmpb $0x5b, %bpl
jne 0x3e31
jmp 0x3f1d
movq %r14, %rdi
movq %rdx, %rsi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3baf
movq %r14, %rdi
callq 0x2190
leaq 0x16e8(%rip), %rcx      # 0x555c
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2070
movq %r14, %rdi
callq 0x21d0
movq 0x414f(%rip), %rax      # 0x7fe0
movq (%rax), %rdi
callq 0x20b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2956
jmp 0x3f1d
movq %r14, %rdi
callq 0x2190
leaq 0x164c(%rip), %rcx      # 0x5501
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2070
movq %r14, %rdi
callq 0x21d0
movq 0x410e(%rip), %r15      # 0x7fe0
movq (%r15), %rdi
callq 0x20b0
movl %eax, %ebp
movq %r14, %rdi
callq 0x2190
leaq 0x1631(%rip), %rcx      # 0x551c
movsbl %bpl, %ebp
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2070
movq %r14, %rdi
callq 0x21d0
movq (%r15), %rdi
callq 0x20b0
movsbl %al, %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2908
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2566
cmpl $0x46, %edi
je 0x3f44
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x66, %edi
jne 0x3f34
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3826