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

```asm
<zipc_xml_unescape>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x26,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L124
  mov    %rax,%rbx
  movzbl (%rax),%eax
  test   %al,%al
  je     L157
  mov    %rbx,%rbp
  lea    D12(%rip),%r13
  lea    D1(%rip),%r14
  lea    D24(%rip),%r15
  jmp    L6
L251:
  mov    $0x3,%edx
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L69
  add    $0x4,%rbx
  movb   $0x3c,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  jmp    L199
L69:
  mov    $0x3,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L8
  add    $0x4,%rbx
  movb   $0x3e,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  jmp    L199
L8:
  mov    $0x5,%edx
  lea    D39(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L160
  add    $0x6,%rbx
  movb   $0x22,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  jmp    L199
L160:
  mov    $0x5,%edx
  lea    D0(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L220
  add    $0x6,%rbx
  movb   $0x27,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  jmp    L199
L220:
  cmpb   $0x23,0x1(%rbx)
  je     L173
  movb   $0x26,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  mov    %r12,%rbx
  jmp    L199
L173:
  lea    0x2(%rbx),%r12
  cmpb   $0x78,0x2(%rbx)
  je     L183
  mov    $0xa,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <strtol@plt>
L24:
  cmp    $0x7f,%eax
  jg     L125
  mov    %al,0x0(%rbp)
  lea    0x1(%rbp),%rbp
L142:
  mov    $0x3b,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  lea    0x1(%rax),%rbx
  jmp    L199
L183:
  mov    $0x10,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <strtol@plt>
  jmp    L24
L125:
  cmp    $0x7ff,%eax
  jg     L237
  mov    %eax,%edx
  sar    $0x6,%edx
  or     $0xffffffc0,%edx
  mov    %dl,0x0(%rbp)
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,0x1(%rbp)
  lea    0x2(%rbp),%rbp
  jmp    L142
L237:
  cmp    $0xffff,%eax
  jg     L95
  mov    %eax,%edx
  sar    $0xc,%edx
  or     $0xffffffe0,%edx
  mov    %dl,0x0(%rbp)
  mov    %eax,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0xffffff80,%edx
  mov    %dl,0x1(%rbp)
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,0x2(%rbp)
  lea    0x3(%rbp),%rbp
  jmp    L142
L95:
  mov    %eax,%edx
  sar    $0x12,%edx
  or     $0xfffffff0,%edx
  mov    %dl,0x0(%rbp)
  mov    %eax,%edx
  sar    $0xc,%edx
  and    $0x3f,%edx
  or     $0xffffff80,%edx
  mov    %dl,0x1(%rbp)
  mov    %eax,%edx
  sar    $0x6,%edx
  and    $0x3f,%edx
  or     $0xffffff80,%edx
  mov    %dl,0x2(%rbp)
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,0x3(%rbp)
  lea    0x4(%rbp),%rbp
  jmp    L142
L46:
  movzbl (%rbx),%eax
  mov    %al,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  lea    0x1(%rbx),%rbx
L199:
  movzbl (%rbx),%eax
  test   %al,%al
  je     L96
L6:
  cmp    $0x26,%al
  jne    L46
  lea    0x1(%rbx),%r12
  mov    $0x3b,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L46
  mov    $0x4,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L251
  add    $0x5,%rbx
  movb   $0x26,0x0(%rbp)
  lea    0x1(%rbp),%rbp
  jmp    L199
L157:
  mov    %rbx,%rbp
L96:
  movb   $0x0,0x0(%rbp)
L124:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D12
type_guessed: string
name: parse_data
arguments: tag: D1
type_guessed: string
name: parse_data
arguments: tag: D24
type_guessed: string
name: parse_data
arguments: tag: D39
type_guessed: string
name: parse_data
arguments: tag: D0
type_guessed: string

tool: D12: amp;

tool: D1: lt;

tool: D24: gt;

tool: D39: quot;

tool: D0: apos;

assistant: ```c
void zipc_xml_unescape(char *buffer) {
  char *inptr, *outptr;
  if ((inptr = strchr(buffer, '&')) == NULL)
    return;
  for (outptr = inptr; *inptr;) {
    if (*inptr == '&' && strchr(inptr + 1, ';')) {
      inptr++;
      if (!strncmp(inptr, "amp;", 4)) {
        inptr += 4;
        *outptr++ = '&';
      } else if (!strncmp(inptr, "lt;", 3)) {
        inptr += 3;
        *outptr++ = '<';
      } else if (!strncmp(inptr, "gt;", 3)) {
        inptr += 3;
        *outptr++ = '>';
      } else if (!strncmp(inptr, "quot;", 5)) {
        inptr += 5;
        *outptr++ = '\"';
      } else if (!strncmp(inptr, "apos;", 5)) {
        inptr += 5;
        *outptr++ = '\'';
      } else if (*inptr == '#') {
        int ch;
        inptr++;
        if (*inptr == 'x')
          ch = (int)strtol(inptr, NULL, 16);
        else
          ch = (int)strtol(inptr, NULL, 10);
        if (ch < 0x80) {
          *outptr++ = ch;
        } else if (ch < 0x800) {
          *outptr++ = 0xc0 | (ch >> 6);
          *outptr++ = 0x80 | (ch & 0x3f);
        } else if (ch < 0x10000) {
          *outptr++ = 0xe0 | (ch >> 12);
          *outptr++ = 0x80 | ((ch >> 6) & 0x3f);
          *outptr++ = 0x80 | (ch & 0x3f);
        } else {
          *outptr++ = 0xf0 | (ch >> 18);
          *outptr++ = 0x80 | ((ch >> 12) & 0x3f);
          *outptr++ = 0x80 | ((ch >> 6) & 0x3f);
          *outptr++ = 0x80 | (ch & 0x3f);
        }
        inptr = strchr(inptr, ';') + 1;
      } else {
        *outptr++ = '&';
      }
    } else {
      *outptr++ = *inptr++;
    }
  }
  *outptr = '\0';
}
```