// File: /workspace/github_cpp_makefile_star2_O1/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 0x1e0(%rsp), %r15
movq %r15, %rdi
movq %rsi, 0x10(%rsp)
movl $0x8, %edx
callq 0x33a0
movq (%r15), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x200(%rsp,%rax)
je 0x3f0c
movq 0x5150(%rip), %rdi      # 0x8ff0
leaq 0x22c7(%rip), %rsi      # 0x616e
movl $0x1e, %edx
callq 0x32a0
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x512c(%rip), %rdi      # 0x8ff0
callq 0x32a0
movq %rax, %rbx
leaq 0x22ba(%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 0x410a
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x28(%rsp), %rbx
addq $0x38, %r14
movq %r14, 0x58(%rsp)
leaq 0x38(%rsp), %r13
leaq 0x60(%rsp), %rbp
movq 0x5091(%rip), %r12      # 0x8fd0
movq 0x1e0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3480
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40ee
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 0x40ba
movq 0x18(%rsp), %rdi
callq 0x3420
movq %rax, %r14
testq %rax, %rax
je 0x3ffa
movzwl 0xc(%rsp), %eax
movw %ax, 0xa(%rsp)
movq 0x58(%rsp), %rdi
leaq 0xa(%rsp), %rsi
callq 0x4530
movq %r14, (%rax)
jmp 0x40ba
movl $0xe, %edx
movq 0x4fea(%rip), %rdi      # 0x8ff0
leaq 0x2183(%rip), %rsi      # 0x6190
callq 0x32a0
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x4fcd(%rip), %rdi      # 0x8ff0
callq 0x32a0
movq %rax, %r14
movl $0x14, %edx
movq %rax, %rdi
leaq 0x2165(%rip), %rsi      # 0x619f
callq 0x32a0
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x32a0
movq %rax, %r14
movl $0x9, %edx
movq %rax, %rdi
leaq 0x214f(%rip), %rsi      # 0x61b4
callq 0x32a0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r14, %rdi
callq 0x32a0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2100(%rip), %rsi      # 0x618e
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x40d1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3330
leaq 0xd8(%rsp), %rdi
callq 0x30a0
jmp 0x3f3f
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x410a
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x1e0(%rsp), %rdi
callq 0x3060
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4134
movq %rax, %r14
jmp 0x418d
jmp 0x416e
jmp 0x4134
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x414e
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x4e7b(%rip), %rsi      # 0x8fd0
leaq 0x60(%rsp), %rdi
callq 0x3330
leaq 0xd8(%rsp), %rdi
callq 0x30a0
jmp 0x4171
movq %rax, %r14
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x418d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x1e0(%rsp), %rdi
callq 0x3060
movq %r14, %rdi
callq 0x3430