user: Converte this assembly snippet into its equivalent C code:

```asm
<charmap_parse>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rsi,%r13
  lea    D39(%rip),%rsi
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x428,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x418(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  test   %rax,%rax
  je     L28
  mov    %rax,%r12
  xor    %ebp,%ebp
  lea    0x10(%rsp),%rbx
  nopl   (%rax)
L50:
  mov    %r12,%rdx
  mov    $0x3ff,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L111
  add    $0x1,%ebp
  cmpb   $0x23,0x10(%rsp)
  je     L50
  lea    0xc(%rsp),%r15
  lea    0xa(%rsp),%rdx
  mov    %rbx,%rdi
  movl   $0x0,0xc(%rsp)
  mov    %r15,%rsi
  call   <get_key@plt>
  test   %rax,%rax
  je     L199
  movslq 0xc(%rsp),%rdx
  cmpb   $0x2d,0x10(%rsp,%rdx,1)
  mov    %rdx,%rax
  je     L188
  movzbl 0xa(%rsp),%eax
  mov    %al,0xb(%rsp)
L194:
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <eat_ws@plt>
  movslq 0xc(%rsp),%rdx
  cmpb   $0x3d,0x10(%rsp,%rdx,1)
  mov    %rdx,%rax
  je     L34
  lea    D49(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L50
  nopl   (%rax)
L34:
  add    $0x1,%eax
  mov    %rbx,%rdi
  mov    %r15,%rsi
  mov    %eax,0xc(%rsp)
  call   <eat_ws@plt>
  movslq 0xc(%rsp),%rdi
  movzbl 0x10(%rsp,%rdi,1),%eax
  test   %al,%al
  je     L95
  cmp    $0xa,%al
  je     L95
  add    %rbx,%rdi
  call   <get_value@plt>
  movzbl 0xa(%rsp),%edx
  movzbl 0xb(%rsp),%edi
  cmp    %dil,%dl
  ja     L50
  sub    %edx,%eax
  nopl   0x0(%rax)
L130:
  movzbl %dl,%ecx
  lea    (%rdx,%rax,1),%esi
  add    $0x1,%edx
  mov    %sil,0x0(%r13,%rcx,1)
  cmp    %dil,%dl
  jbe    L130
  jmp    L50
L199:
  lea    D34(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L50
  cs nopw 0x0(%rax,%rax,1)
L188:
  add    $0x1,%eax
  lea    0xb(%rsp),%rdx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  mov    %eax,0xc(%rsp)
  call   <get_key@plt>
  test   %rax,%rax
  je     L133
  movzbl 0xa(%rsp),%eax
  cmp    %al,0xb(%rsp)
  jae    L194
  lea    D37(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L50
  nopl   0x0(%rax)
L111:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L179:
  mov    0x418(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L171
  add    $0x428,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L133:
  lea    D27(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L50
  cs nopw 0x0(%rax,%rax,1)
L28:
  xor    %eax,%eax
  jmp    L179
L95:
  lea    D32(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  xor    %eax,%eax
  jmp    L179
L171:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D39
data_type: string
name: extract_symbolic_data
arguments: data_tag: D49
data_type: string
name: extract_symbolic_data
arguments: data_tag: D34
data_type: string
name: extract_symbolic_data
arguments: data_tag: D37
data_type: string
name: extract_symbolic_data
arguments: data_tag: D27
data_type: string
name: extract_symbolic_data
arguments: data_tag: D32
data_type: string

tool: D39: rt

tool: D49: `=' expected

tool: D34: key expected

tool: D37: invalid range

tool: D27: high limit key expected

tool: D32: 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;
}
```