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

```asm
<ezxml_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rbp,%r14
  sub    $0x38,%rsp
  mov    %rdi,0x8(%rsp)
  movsbl (%rdi),%edi
  mov    %rsi,0x10(%rsp)
  mov    %edx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %dil,%dil
  je     L423
  nopl   0x0(%rax)
L127:
  lea    0x1(%rbp),%rbx
  cmp    $0xd,%dil
  jne    L187
  nopw   0x0(%rax,%rax,1)
L13:
  movzbl (%rbx),%eax
  movb   $0xa,-0x1(%rbx)
  mov    %rbx,%rbp
  cmp    $0xa,%al
  je     L80
  add    $0x1,%rbx
  cmp    $0xd,%al
  je     L13
L187:
  movzbl 0x1(%rbp),%edi
  test   %dil,%dil
  je     L365
L438:
  mov    %rbx,%rbp
  jmp    L127
  nopl   0x0(%rax)
L80:
  mov    %rbx,%rdi
  add    $0x1,%rbx
  call   <strlen@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    %eax,%edx
  call   <memmove@plt>
  cmpb   $0xd,0x0(%rbp)
  je     L13
  movzbl 0x1(%rbp),%edi
  test   %dil,%dil
  jne    L438
  nopl   0x0(%rax,%rax,1)
L365:
  mov    0x8(%rsp),%rax
  movsbl (%rax),%edi
  mov    %rax,%r14
L423:
  mov    0x18(%rsp),%eax
  mov    %r12d,%ecx
  mov    %r14,(%rsp)
  lea    D10(%rip),%r15
  cmp    $0x20,%al
  sete   %dl
  cmp    $0x2a,%al
  sete   %al
  or     %eax,%edx
  movabs $0x44100000000,%rax
  shr    %cl,%rax
  mov    %dl,0x1e(%rsp)
  and    $0x1,%eax
  mov    %al,0x1f(%rsp)
  jmp    L4
  nopl   0x0(%rax,%rax,1)
L130:
  add    $0x1,%r14
L70:
  movsbl (%r14),%edi
L4:
  test   %dil,%dil
  je     L385
  cmp    $0x26,%dil
  je     L216
  cmp    $0x25,%r12b
  jne    L324
  cmp    $0x25,%dil
  je     L538
L324:
  call   <isspace@plt>
  test   %rax,%rax
  je     L130
  movzbl (%r14),%edi
L216:
  test   %dil,%dil
  je     L385
  cmp    $0x63,%r12b
  je     L130
L538:
  mov    $0x2,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L275
  cmpb   $0x78,0x2(%r14)
  lea    0x20(%rsp),%rsi
  je     L254
  lea    0x2(%r14),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %rax,%rsi
L463:
  lea    0x1(%r14),%rdi
  test   %rsi,%rsi
  je     L380
  mov    0x20(%rsp),%rax
  cmpb   $0x3b,(%rax)
  jne    L380
  cmp    $0x7f,%rsi
  jg     L166
  mov    %sil,(%r14)
  mov    %rdi,%r14
L148:
  mov    $0x3b,%esi
  mov    %r14,%rdi
  call   <strchr@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %r14,%rdi
  mov    $0x3b,%esi
  mov    %eax,%r13d
  call   <strchr@plt>
  mov    %r13d,%edx
  mov    %r14,%rdi
  lea    0x1(%rax),%rsi
  call   <memmove@plt>
  jmp    L70
  nopl   0x0(%rax)
L275:
  movsbl (%r14),%edi
  cmp    $0x26,%dil
  je     L195
  cmp    $0x25,%dil
  jne    L213
  cmp    $0x25,%r12b
  je     L347
L213:
  cmpb   $0x0,0x1e(%rsp)
  lea    0x1(%r14),%rbx
  je     L410
  call   <isspace@plt>
  test   %rax,%rax
  je     L410
  movb   $0x20,(%r14)
  mov    %rbx,%r14
  jmp    L70
  nop
L380:
  mov    %rdi,%r14
  jmp    L70
  nopl   0x0(%rax,%rax,1)
L385:
  cmpb   $0x2a,0x18(%rsp)
  je     L226
L458:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L86
  mov    (%rsp),%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L410:
  mov    %rbx,%r14
  jmp    L70
L195:
  cmp    $0x2a,%r12b
  ja     L213
  cmpb   $0x0,0x1f(%rsp)
  je     L213
L347:
  mov    0x10(%rsp),%rbx
  lea    0x1(%r14),%r13
  xor    %ebp,%ebp
  mov    (%rbx),%rdi
  test   %rdi,%rdi
  jne    L84
  jmp    L318
  nopl   0x0(%rax)
L421:
  mov    0x10(%rbx),%rdi
  add    $0x10,%rbx
  add    $0x2,%rbp
  test   %rdi,%rdi
  je     L318
L84:
  call   <strlen@plt>
  mov    (%rbx),%rsi
  mov    %r13,%rdi
  mov    %eax,%edx
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L421
  add    $0x1,%rbp
  cmpq   $0x0,(%rbx)
  je     L318
  mov    0x10(%rsp),%rax
  lea    (%rax,%rbp,8),%rbx
  mov    (%rbx),%rdi
  call   <strlen@plt>
  mov    %r14,%rdi
  mov    $0x3b,%esi
  movslq %eax,%r13
  call   <strchr@plt>
  lea    -0x1(%r13),%rdx
  mov    %rax,0x20(%rsp)
  mov    %rax,%rdi
  sub    %r14,%rax
  cmp    %rax,%rdx
  jg     L209
L376:
  call   <strlen@plt>
  lea    (%r14,%r13,1),%rdi
  mov    %eax,%edx
  mov    0x20(%rsp),%rax
  lea    0x1(%rax),%rsi
  call   <memmove@plt>
  mov    (%rbx),%rsi
  mov    %r13,%rdx
  mov    %r14,%rdi
  call   <strncpy@plt>
  jmp    L70
L254:
  lea    0x3(%r14),%rdi
  mov    $0x10,%edx
  call   <strtol@plt>
  mov    %rax,%rsi
  jmp    L463
L318:
  mov    %r13,%r14
  jmp    L70
L226:
  mov    (%rsp),%rbx
  cmpb   $0x0,(%rbx)
  je     L193
  lea    D15(%rip),%r12
  nopl   (%rax)
L355:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strspn@plt>
  test   %rax,%rax
  je     L228
  jmp    L371
  nopw   0x0(%rax,%rax,1)
L248:
  add    $0x1,%rbx
L228:
  testb  $0xdf,(%rbx)
  jne    L248
  mov    %rbx,%rax
  add    $0x1,%rbx
  cmpb   $0x0,0x1(%rax)
  jne    L355
L295:
  cmp    %rax,(%rsp)
  ja     L458
  cmpb   $0x20,-0x1(%rbx)
  jne    L458
  movb   $0x0,-0x1(%rbx)
  jmp    L458
  nopl   0x0(%rax,%rax,1)
L371:
  lea    (%rbx,%rax,1),%rbp
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  lea    0x1(%rax),%edx
  call   <memmove@plt>
  jmp    L228
L166:
  mov    %rsi,%rax
  nop
L374:
  mov    %rax,%rdx
  mov    %rbx,%rcx
  add    $0x1,%rbx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  jne    L374
  sub    $0x1,%rcx
  mov    %rsi,%rbx
  movabs $0x6666666666666667,%rdx
  mov    %rcx,%rax
  sar    $0x3f,%rcx
  imul   %rdx
  mov    %rdx,%rax
  mov    $0xff,%edx
  sar    %rax
  sub    %rcx,%rax
  mov    $0x7,%ecx
  sub    %eax,%ecx
  shl    %cl,%edx
  lea    (%rax,%rax,2),%ecx
  add    %ecx,%ecx
  sar    %cl,%rbx
  or     %ebx,%edx
  mov    %dl,(%r14)
  test   %rax,%rax
  je     L521
  lea    -0x3(%rax,%rax,2),%ecx
  lea    0x1(%r14,%rax,1),%r14
  add    %ecx,%ecx
  nopl   0x0(%rax)
L395:
  mov    %rsi,%rax
  add    $0x1,%rdi
  sar    %cl,%rax
  sub    $0x6,%ecx
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,-0x1(%rdi)
  cmp    %r14,%rdi
  jne    L395
  jmp    L148
L209:
  sub    (%rsp),%r14
  call   <strlen@plt>
  lea    0x0(%r13,%r14,1),%rbp
  mov    0x8(%rsp),%rcx
  movslq %eax,%rsi
  add    %rbp,%rsi
  cmp    %rcx,(%rsp)
  je     L455
  mov    (%rsp),%rdi
  call   <realloc@plt>
  mov    %rax,(%rsp)
L137:
  add    (%rsp),%r14
  mov    $0x3b,%esi
  mov    %r14,%rdi
  call   <strchr@plt>
  mov    %rax,0x20(%rsp)
  mov    %rax,%rdi
  jmp    L376
L455:
  mov    %rsi,%rdi
  call   <malloc@plt>
  mov    (%rsp),%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    %rax,(%rsp)
  jmp    L137
L193:
  lea    -0x1(%rbx),%rax
  jmp    L295
L521:
  mov    %rdi,%r14
  jmp    L148
L86:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D10
data_type: string
name: read_data
arguments: tag: D15
data_type: string

tool: D10: &#

tool: D15:  

assistant: ```c
char *ezxml_decode(char *s, char **ent, char t) {
  char *e, *r = s, *m = s;
  long b, c, d, l;
  for (; *s; s++) {
    while (*s == '\r') {
      *(s++) = '\n';
      if (*s == '\n')
        memmove(s, (s + 1), strlen(s));
    }
  }
  for (s = r;;) {
    while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace(*s))
      s++;
    if (!*s)
      break;
    else if (t != 'c' && !strncmp(s, "&#", 2)) {
      if (s[2] == 'x')
        c = strtol(s + 3, &e, 16);
      else
        c = strtol(s + 2, &e, 10);
      if (!c || *e != ';') {
        s++;
        continue;
      }
      if (c < 0x80)
        *(s++) = (char)c;
      else {
        for (b = 0, d = c; d; d /= 2)
          b++;
        b = (b - 2) / 5;
        *(s++) = (char)((0xFF << (7 - b)) | (c >> (6 * b)));
        while (b)
          *(s++) = 0x80 | ((c >> (6 * --b)) & 0x3F);
      }
      memmove(s, strchr(s, ';') + 1, strlen(strchr(s, ';')));
    } else if ((*s == '&' && (t == '&' || t == ' ' || t == '*')) || (*s == '%' && t == '%')) {
      for (b = 0; ent[b] && strncmp(s + 1, ent[b], strlen(ent[b])); b += 2)
        ;
      if (ent[b++]) {
        if ((c = strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) {
          l = (d = (s - r)) + c + strlen(e);
          r = (r == m) ? strcpy((char *)malloc(l), r) : (char *)realloc(r, l);
          e = strchr((s = r + d), ';');
        }
        memmove(s + c, e + 1, strlen(e));
        strncpy(s, ent[b], c);
      } else
        s++;
    } else if ((t == ' ' || t == '*') && isspace(*s))
      *(s++) = ' ';
    else
      s++;
  }
  if (t == '*') {
    for (s = r; *s; s++) {
      if ((l = strspn(s, " ")))
        memmove(s, s + l, strlen(s + l) + 1);
      while (*s && *s != ' ')
        s++;
    }
    if (--s >= r && *s == ' ')
      *s = '\0';
  }
  return r;
}
```