// File: fulhax[P]ncpamixer/src/config.cpp
// Function: Config::getKeycodeName[abi:cxx11](char const*)
std::string Config::getKeycodeName(const char *keycode)
{
    if (keycode == nullptr) return {};
    if (keycode[0] == 0) return {};
    if (memcmp(keycode, KEY, KEY_SIZE) != 0) return {};
    if (strlen(keycode) < KEY_SIZE + 2) return {};
    const auto key_val{keycode + KEY_SIZE + 1};
    const auto is_vt100{key_val[0] == 'f' && key_val[1] == '.'};
    int k{0};
    try { k = std::stoi((is_vt100) ? key_val + 2 : key_val); }
    catch (const std::exception&) { return{}; }
    if (is_vt100) return { "VT100_F" + std::to_string(k - 79) };
    return {keyname(k)};
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0x40(%rsp)
movq %rdi, %rax
movq %rax, 0x48(%rsp)
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
cmpq $0x0, 0xc8(%rsp)
jne 0xf2ae
movq 0x40(%rsp), %rdi
callq 0x7950
jmp 0xf562
movq 0xc8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xf2cd
movq 0x40(%rsp), %rdi
callq 0x7950
jmp 0xf562
movq 0xc8(%rsp), %rdi
leaq 0x1110b(%rip), %rsi     # 0x203e7
movl $0x7, %edx
callq 0x7330
cmpl $0x0, %eax
je 0xf2fa
movq 0x40(%rsp), %rdi
callq 0x7950
jmp 0xf562
movq 0xc8(%rsp), %rdi
callq 0x7310
cmpq $0x9, %rax
jae 0xf31c
movq 0x40(%rsp), %rdi
callq 0x7950
jmp 0xf562
movq 0xc8(%rsp), %rax
addq $0x7, %rax
addq $0x1, %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x66, %ecx
movb %al, 0x3f(%rsp)
jne 0xf360
movq 0xc0(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2e, %eax
sete %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
andb $0x1, %al
movb %al, 0xbf(%rsp)
movl $0x0, 0xb8(%rsp)
testb $0x1, 0xbf(%rsp)
je 0xf395
movq 0xc0(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x30(%rsp)
jmp 0xf3a2
movq 0xc0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x97(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x7c50
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x98(%rsp), %rdi
callq 0x10940
jmp 0xf3d7
xorl %eax, %eax
movl %eax, %esi
leaq 0x98(%rsp), %rdi
movl $0xa, %edx
callq 0x108f0
movl %eax, 0x1c(%rsp)
jmp 0xf3f3
movl 0x1c(%rsp), %eax
movl %eax, 0xb8(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x7480
leaq 0x97(%rsp), %rdi
callq 0x7760
jmp 0xf498
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0xf451
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x7480
leaq 0x97(%rsp), %rdi
callq 0x7760
movl 0x84(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xf56f
movq 0x88(%rsp), %rdi
callq 0x72d0
movq 0x40(%rsp), %rdi
movq %rax, 0x78(%rsp)
callq 0x7950
callq 0x7b40
jmp 0xf562
testb $0x1, 0xbf(%rsp)
je 0xf502
movl 0xb8(%rsp), %esi
addl $-0x4f, %esi
leaq 0x58(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x10a50
movq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rdx
leaq 0x10f23(%rip), %rsi     # 0x203ef
callq 0x10a00
jmp 0xf4d3
leaq 0x58(%rsp), %rdi
callq 0x7480
jmp 0xf562
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x7480
jmp 0xf56f
movl 0xb8(%rsp), %edi
callq 0x79a0
movq %rax, (%rsp)
leaq 0x57(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7c50
movq 0x40(%rsp), %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x10940
jmp 0xf536
leaq 0x57(%rsp), %rdi
callq 0x7760
jmp 0xf562
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x57(%rsp), %rdi
callq 0x7760
jmp 0xf56f
movq 0x48(%rsp), %rax
addq $0xd8, %rsp
retq
movq 0x88(%rsp), %rdi
callq 0x7c40
nopl (%rax)