// File: /workspace/github_cpp_makefile_star2_O3/rfotino[P]consolite-emulator/src/window.cpp
// Function: EmuWindow::_loadKeyMap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void EmuWindow::_loadKeyMap(const std::string& keymap_filename) {
  std::ifstream keyMapFile(keymap_filename);
  if (!keyMapFile.good()) {
    std::cerr << "Error: Failed to open keymap '"
              << keymap_filename << "'." << std::endl;
    return;
  }
  // Key map should be in the form
  // KEY INPUT_ID
  std::string line;
  int line_num = 0;
  while (std::getline(keyMapFile, line)) {
    line_num++;
    std::istringstream iss(line);
    std::string keyStr;
    int inputId;
    if (!(iss >> keyStr >> inputId)) {
      continue;
    }
    KeySym keysym = XStringToKeysym(keyStr.c_str());
    if (!keysym) {
      std::cerr << "Warning: Key '" << keyStr << "' not recognized in "
                << keymap_filename << " on line " << line << "."
                << std::endl;
      continue;
    }
    _keyMap[inputId] = keysym;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %rdi, %r14
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rsi, 0x10(%rsp)
movl $0x8, %edx
callq 0x33a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x80(%rsp,%rax)
je 0x3eed
movq 0x516f(%rip), %rdi      # 0x8ff0
leaq 0x22e6(%rip), %rsi      # 0x616e
movl $0x1e, %edx
callq 0x32a0
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x514b(%rip), %rdi      # 0x8ff0
callq 0x32a0
movq %rax, %rbx
leaq 0x22d9(%rip), %rsi      # 0x618d
movl $0x2, %edx
movq %rax, %rdi
callq 0x32a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
jmp 0x40f5
leaq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x28(%rsp), %rbx
addq $0x38, %r14
movq %r14, 0x58(%rsp)
leaq 0x60(%rsp), %r12
leaq 0x38(%rsp), %r13
leaq 0x268(%rsp), %rbp
movq 0x50a8(%rip), %r14      # 0x8fd0
leaq (%rsp,%rax), %rdi
addq $0x60, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x3480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40d9
movq %rbp, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x33d0
movq %rbx, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq %rbp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x32d0
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
callq 0x3140
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x409c
movq 0x18(%rsp), %rdi
callq 0x3420
movq %rax, %r15
testq %rax, %rax
je 0x3fdc
movzwl 0xc(%rsp), %eax
movw %ax, 0xa(%rsp)
movq 0x58(%rsp), %rdi
leaq 0xa(%rsp), %rsi
callq 0x44d8
movq %r15, (%rax)
jmp 0x409c
movl $0xe, %edx
movq 0x5008(%rip), %rdi      # 0x8ff0
leaq 0x21a1(%rip), %rsi      # 0x6190
callq 0x32a0
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x4feb(%rip), %rdi      # 0x8ff0
callq 0x32a0
movq %rax, %r15
movl $0x14, %edx
movq %rax, %rdi
leaq 0x2183(%rip), %rsi      # 0x619f
callq 0x32a0
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r15, %rdi
callq 0x32a0
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0x216d(%rip), %rsi      # 0x61b4
callq 0x32a0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r15, %rdi
callq 0x32a0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x211e(%rip), %rsi      # 0x618e
callq 0x32a0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x40b3
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbp, %rdi
movq %r14, %rsi
callq 0x3330
leaq 0x2e0(%rsp), %rdi
callq 0x30a0
movq 0x60(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x3f28
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x40f5
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x60(%rsp), %rdi
callq 0x3060
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x411c
movq %rax, %r14
jmp 0x4178
jmp 0x4159
jmp 0x411c
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4136
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x4e93(%rip), %rsi      # 0x8fd0
leaq 0x268(%rsp), %rdi
callq 0x3330
leaq 0x2e0(%rsp), %rdi
callq 0x30a0
jmp 0x415c
movq %rax, %r14
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x4178
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x60(%rsp), %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3430