user: Translate the below assembly code into C programming language:

```asm
<charmap_parse>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x440,%rsp
  mov    %rdi,-0x438(%rbp)
  mov    %rsi,-0x440(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x438(%rbp),%rax
  lea    D5(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x418(%rbp)
  cmpq   $0x0,-0x418(%rbp)
  jne    L174
  mov    $0x0,%eax
  jmp    L139
L174:
  movl   $0x0,-0x41c(%rbp)
  jmp    L34
L194:
  addl   $0x1,-0x41c(%rbp)
  movzbl -0x410(%rbp),%eax
  cmp    $0x23,%al
  je     L198
  movl   $0x0,-0x420(%rbp)
  lea    -0x423(%rbp),%rdx
  lea    -0x420(%rbp),%rcx
  lea    -0x410(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <get_key@plt>
  test   %rax,%rax
  jne    L85
  mov    -0x41c(%rbp),%ecx
  mov    -0x438(%rbp),%rax
  lea    D38(%rip),%rdx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <maperr@plt>
  jmp    L34
L85:
  mov    -0x420(%rbp),%eax
  cltq
  movzbl -0x410(%rbp,%rax,1),%eax
  cmp    $0x2d,%al
  jne    L196
  mov    -0x420(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x420(%rbp)
  lea    -0x422(%rbp),%rdx
  lea    -0x420(%rbp),%rcx
  lea    -0x410(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <get_key@plt>
  test   %rax,%rax
  jne    L107
  mov    -0x41c(%rbp),%ecx
  mov    -0x438(%rbp),%rax
  lea    D52(%rip),%rdx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <maperr@plt>
  jmp    L34
L107:
  movzbl -0x422(%rbp),%edx
  movzbl -0x423(%rbp),%eax
  cmp    %al,%dl
  jae    L119
  mov    -0x41c(%rbp),%ecx
  mov    -0x438(%rbp),%rax
  lea    D16(%rip),%rdx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <maperr@plt>
  jmp    L34
L196:
  movzbl -0x423(%rbp),%eax
  mov    %al,-0x422(%rbp)
L119:
  lea    -0x420(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <eat_ws@plt>
  mov    -0x420(%rbp),%eax
  cltq
  movzbl -0x410(%rbp,%rax,1),%eax
  cmp    $0x3d,%al
  je     L87
  mov    -0x41c(%rbp),%ecx
  mov    -0x438(%rbp),%rax
  lea    D4(%rip),%rdx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <maperr@plt>
  jmp    L34
L87:
  mov    -0x420(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x420(%rbp)
  lea    -0x420(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <eat_ws@plt>
  mov    -0x420(%rbp),%eax
  cltq
  movzbl -0x410(%rbp,%rax,1),%eax
  test   %al,%al
  je     L161
  mov    -0x420(%rbp),%eax
  cltq
  movzbl -0x410(%rbp,%rax,1),%eax
  cmp    $0xa,%al
  jne    L168
L161:
  mov    -0x41c(%rbp),%ecx
  mov    -0x438(%rbp),%rax
  lea    D26(%rip),%rdx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <maperr@plt>
  mov    $0x0,%eax
  jmp    L139
L168:
  mov    -0x420(%rbp),%eax
  lea    -0x410(%rbp),%rdx
  cltq
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <get_value@plt>
  mov    %al,-0x421(%rbp)
  jmp    L84
L61:
  movzbl -0x421(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %dl,-0x421(%rbp)
  movzbl -0x423(%rbp),%edx
  movzbl %dl,%ecx
  mov    -0x440(%rbp),%rdx
  add    %rcx,%rdx
  mov    %al,(%rdx)
  movzbl -0x423(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x423(%rbp)
L84:
  movzbl -0x423(%rbp),%edx
  movzbl -0x422(%rbp),%eax
  cmp    %al,%dl
  jbe    L61
  jmp    L34
L198:
  nop
L34:
  mov    -0x418(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    $0x3ff,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L194
  mov    -0x418(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L139:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L206
  call   <__stack_chk_fail@plt>
L206:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D5
datatype: string
name: unpack_data
arguments: tag: D38
datatype: string
name: unpack_data
arguments: tag: D52
datatype: string
name: unpack_data
arguments: tag: D16
datatype: string
name: unpack_data
arguments: tag: D4
datatype: string
name: unpack_data
arguments: tag: D26
datatype: string

tool: D5: rt

tool: D38: key expected

tool: D52: high limit key expected

tool: D16: invalid range

tool: D4: `=' expected

tool: D26: value expected

assistant: ```c
int charmap_parse(const char *filename, unsigned char *map) {
  int lineno;
  FILE *fp;
  char line[1024];
  fp = fopen(filename, "rt");
  if (fp == NULL) {
    return 0;
  }
  lineno = 0;
  while (fgets(line, 1023, fp) != NULL) {
    unsigned char key;
    unsigned char hkey;
    unsigned char value;
    int i;
    lineno++;
    if (line[0] == '#')
      continue;
    i = 0;
    if (get_key(line, &i, &key) == 0) {
      maperr(filename, lineno, "key expected");
      continue;
    }
    if (line[i] == '-') {
      i++;
      if (get_key(line, &i, &hkey) == 0) {
        maperr(filename, lineno, "high limit key expected");
        continue;
      }
      if (hkey < key) {
        maperr(filename, lineno, "invalid range");
        continue;
      }
    } else {
      hkey = key;
    }
    eat_ws(line, &i);
    if (line[i] != '=') {
      maperr(filename, lineno, "`=' expected");
      continue;
    }
    i++;
    eat_ws(line, &i);
    if ((line[i] == '\0') || (line[i] == '\n')) {
      maperr(filename, lineno, "value expected");
      return 0;
    }
    value = get_value(&line[i]);
    for (; key <= hkey; key++) {
      map[key] = value++;
    }
  }
  fclose(fp);
  return 1;
}
```