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

```asm
<charmap_parse>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  lea    D6(%rip),%rsi
  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     L83
  mov    %rax,%r13
  xor    %ebp,%ebp
  lea    0x10(%rsp),%rbx
  nopl   (%rax)
L21:
  mov    %r13,%rdx
  mov    $0x3ff,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L137
  lea    0xc(%rsp),%r15
  lea    0xa(%rsp),%rdx
  mov    %rbx,%rdi
  add    $0x1,%ebp
  mov    %r15,%rsi
  movl   $0x0,0xc(%rsp)
  call   <get_key@plt>
  test   %rax,%rax
  je     L141
  movslq 0xc(%rsp),%rdx
  cmpb   $0x2d,0x10(%rsp,%rdx,1)
  mov    %rdx,%rax
  je     L177
  movzbl 0xa(%rsp),%eax
  mov    %al,0xb(%rsp)
L22:
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <eat_ws@plt>
  movslq 0xc(%rsp),%rdx
  cmpb   $0x3d,0x10(%rsp,%rdx,1)
  mov    %rdx,%rax
  je     L70
  lea    D33(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L21
  xchg   %ax,%ax
L70:
  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     L102
  cmp    $0xa,%al
  je     L102
  add    %rbx,%rdi
  call   <get_value@plt>
  movzbl 0xa(%rsp),%edx
  movzbl 0xb(%rsp),%edi
  cmp    %dil,%dl
  ja     L21
  sub    %edx,%eax
  nopl   0x0(%rax)
L145:
  movzbl %dl,%ecx
  lea    (%rax,%rdx,1),%esi
  add    $0x1,%edx
  mov    %sil,(%r12,%rcx,1)
  cmp    %dil,%dl
  jbe    L145
  mov    %dl,0xa(%rsp)
  jmp    L21
  nopl   0x0(%rax,%rax,1)
L141:
  lea    D13(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L21
  cs nopw 0x0(%rax,%rax,1)
L177:
  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     L171
  movzbl 0xa(%rsp),%eax
  cmp    %al,0xb(%rsp)
  jae    L22
  lea    D55(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L21
  nopl   0x0(%rax)
L137:
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L104:
  mov    0x418(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L24
  add    $0x428,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L171:
  lea    D8(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  jmp    L21
L83:
  xor    %eax,%eax
  jmp    L104
L102:
  lea    D30(%rip),%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <maperr@plt>
  xor    %eax,%eax
  jmp    L104
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D6
type_infered: string
name: read_data
arguments: tag: D33
type_infered: string
name: read_data
arguments: tag: D13
type_infered: string
name: read_data
arguments: tag: D55
type_infered: string
name: read_data
arguments: tag: D8
type_infered: string
name: read_data
arguments: tag: D30
type_infered: string

tool: D6: rt

tool: D33: `=' expected

tool: D13: key expected

tool: D55: invalid range

tool: D8: high limit key expected

tool: D30: value expected

assistant: ```c
int charmap_parse(const char *filename, unsigned char *map) {
  int lineno;
  FILE *fp;
  unsigned char key;
  unsigned char hkey;
  unsigned char value;
  int i;
  char line[1024];
  fp = fopen(filename, "rt");
  if (fp == NULL) {
    return 0;
  }
  lineno = 0;
  while (fgets(line, 1023, fp) != NULL) {
    lineno++;
    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;
}
```