user: 请将以下的汇编代码转换成C语言代码:

```asm
<charmap_parse>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rsi,%r13
  lea    D42(%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     L59
  mov    %rax,%r12
  xor    %ebp,%ebp
  lea    0x10(%rsp),%rbx
  nopl   (%rax)
L172:
  mov    %r12,%rdx
  mov    $0x3ff,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L51
  add    $0x1,%ebp
  cmpb   $0x23,0x10(%rsp)
  je     L172
  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     L57
  movslq 0xc(%rsp),%rdx
  cmpb   $0x2d,0x10(%rsp,%rdx,1)
  mov    %rdx,%rax
  je     L40
  movzbl 0xa(%rsp),%eax
  mov    %al,0xb(%rsp)
L6:
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <eat_ws@plt>
  movslq 0xc(%rsp),%rdx
  cmpb   $0x3d,0x10(%rsp,%rdx,1)
  mov    %rdx,%rax
  je     L106
  lea    D11(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L172
  nopl   (%rax)
L106:
  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     L53
  cmp    $0xa,%al
  je     L53
  add    %rbx,%rdi
  call   <get_value@plt>
  movzbl 0xa(%rsp),%edx
  movzbl 0xb(%rsp),%edi
  cmp    %dil,%dl
  ja     L172
  sub    %edx,%eax
  nopl   0x0(%rax)
L112:
  movzbl %dl,%ecx
  lea    (%rax,%rdx,1),%esi
  add    $0x1,%edx
  mov    %sil,0x0(%r13,%rcx,1)
  cmp    %dil,%dl
  jbe    L112
  jmp    L172
L57:
  lea    D57(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L172
  cs nopw 0x0(%rax,%rax,1)
L40:
  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     L154
  movzbl 0xa(%rsp),%eax
  cmp    %al,0xb(%rsp)
  jae    L6
  lea    D7(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L172
  nopl   0x0(%rax)
L51:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L167:
  mov    0x418(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L91
  add    $0x428,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L154:
  lea    D29(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L172
  cs nopw 0x0(%rax,%rax,1)
L59:
  xor    %eax,%eax
  jmp    L167
L53:
  lea    D27(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  xor    %eax,%eax
  jmp    L167
L91:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D42
type_infered: string
name: read_data
arguments: data_tag: D11
type_infered: string
name: read_data
arguments: data_tag: D57
type_infered: string
name: read_data
arguments: data_tag: D7
type_infered: string
name: read_data
arguments: data_tag: D29
type_infered: string
name: read_data
arguments: data_tag: D27
type_infered: string

tool: D42: rt

tool: D11: `=' expected

tool: D57: key expected

tool: D7: invalid range

tool: D29: high limit key expected

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