user: 请从给定的汇编指令推导出C源代码：

```asm
<build_map>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L41
  mov    %rsi,%rbx
  mov    D39(%rip),%rsi
  mov    %rdi,%r12
  test   %rsi,%rsi
  je     L119
  movslq D29(%rip),%rbp
  mov    %rbp,%rdx
  call   <strncmp@plt>
  test   %eax,%eax
  je     L37
L119:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    $0x5,%edi
  lea    0x1(%rax),%r13d
  xor    %eax,%eax
  mov    %r13d,%esi
  call   <mem@plt>
  movslq %eax,%rbp
  test   %ebp,%ebp
  je     L41
  mov    %r13d,%esi
  mov    $0x6,%edi
  xor    %eax,%eax
  call   <mem@plt>
  movslq %eax,%r13
  mov    %r13,D17(%rip)
  test   %eax,%eax
  je     L41
  movb   $0x0,0x0(%r13)
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
  movzbl 0x1(%rbp),%eax
  lea    0x1(%rbp),%rdx
  test   %al,%al
  je     L41
  xor    %esi,%esi
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  xor    %r13d,%r13d
  jmp    L112
  nopw   0x0(%rax,%rax,1)
L28:
  cmp    $0x2d,%al
  jne    L120
  movslq %ecx,%rax
  add    $0x1,%ecx
  movb   $0x5c,0x0(%rbp,%rax,1)
L120:
  movzbl (%rdx),%edx
  movslq %ecx,%rax
  xor    %esi,%esi
  add    $0x1,%ecx
  mov    %dl,0x0(%rbp,%rax,1)
  mov    %r12,%rdx
L229:
  movzbl (%rdx),%eax
  test   %al,%al
  je     L41
L112:
  lea    0x1(%rdx),%r12
  test   %esi,%esi
  jne    L28
  cmp    $0x5c,%al
  je     L249
  movslq %ecx,%rdi
  add    %rbp,%rdi
  cmp    $0x7d,%al
  je     L237
  mov    %r12,%rdx
  mov    %al,(%rdi)
  add    $0x1,%ecx
  movzbl (%rdx),%eax
  test   %al,%al
  jne    L112
  nopl   (%rax)
L41:
  xor    %r12d,%r12d
L124:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L37:
  add    $0x8,%rsp
  add    %rbp,%r12
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L249:
  mov    %r12,%rdx
  mov    $0x1,%esi
  jmp    L229
  nopw   0x0(%rax,%rax,1)
L237:
  test   %r8d,%r8d
  jne    L89
  movb   $0x0,(%rdi)
  movzbl 0x1(%rdx),%eax
  add    $0x1,%ecx
  cmp    $0x9,%al
  je     L128
  cmp    $0x20,%al
  jne    L14
  nopw   0x0(%rax,%rax,1)
L128:
  movzbl 0x1(%r12),%eax
  add    $0x1,%r12
  cmp    $0x20,%al
  je     L128
  cmp    $0x9,%al
  je     L128
L14:
  cmp    $0x7b,%al
  jne    L41
  movslq %ecx,%r13
  lea    0x1(%r12),%rdx
  xor    %esi,%esi
  mov    $0x1,%r8d
  add    %rbp,%r13
  jmp    L229
L89:
  mov    %r12,%rax
  movb   $0x0,(%rdi)
  sub    %rbp,%rax
  mov    %eax,D17(%rip)
  xor    %eax,%eax
  nop
L160:
  mov    %al,(%rbx,%rax,1)
  add    $0x1,%rax
  cmp    $0x100,%rax
  jne    L160
  xor    %esi,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <nextch@plt>
  mov    $0x1,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <nextch@plt>
  jmp    L87
  nopl   0x0(%rax)
L248:
  mov    $0x1,%esi
  xor    %edi,%edi
  xor    %eax,%eax
  movsbq %bpl,%rbp
  call   <nextch@plt>
  mov    %al,(%rbx,%rbp,1)
L87:
  xor    %esi,%esi
  xor    %edi,%edi
  xor    %eax,%eax
  call   <nextch@plt>
  mov    %eax,%ebp
  test   %al,%al
  jne    L248
  jmp    L124
```

assistant: ```c
char *build_map(s, map)
char *s;
char *map;
{
  char *in;
  char *out;
  char *str;
  char *tmp;
  char c;
  int i = 0;
  int range_count = 0;
  int seenbs = 0;
  static char *last = 0;
  static int last_len;
  out = 0;
  if (!s) {
    return 0;
  }
  if (last && !strncmp(s, last, last_len)) {
    return s + last_len;
  } else {
    int len = strlen(s) + 1;
    if (!(str = mem(5, len)) || !(last = mem(6, len))) {
      return 0;
    }
    str[0] = last[0] = '\0';
    strcat(str, s);
    strcat(last, s);
  }
  tmp = str + 1;
  in = str;
  while (*tmp) {
    if (seenbs) {
      if (*tmp == '-') {
        str[i++] = '\\';
      }
      str[i++] = *tmp++;
      seenbs = 0;
    } else {
      if (*tmp == '\\') {
        seenbs = 1;
        tmp++;
      } else if (*tmp == '}') {
        if (!range_count) {
          range_count = 1;
          str[i++] = '\0';
          tmp++;
          while (*tmp == ' ' || *tmp == '\t') {
            tmp++;
          }
          if (*tmp != '{') {
            return 0;
          }
          out = str + i;
          tmp++;
        } else {
          str[i++] = '\0';
          tmp++;
          range_count = 2;
          break;
        }
      } else {
        str[i++] = *tmp++;
      }
    }
  }
  if (range_count != 2) {
    return 0;
  }
  last_len = tmp - str;
  for (i = 0; i < 1 << 8; i++) {
    map[i] = i;
  }
  (void)nextch(in, 0);
  (void)nextch(out, 1);
  while ((c = nextch((char *)0, 0))) {
    map[(int)c] = nextch((char *)0, 1);
  }
  return tmp;
}
```