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

```asm
<ezxml_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  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     L213
  nopl   (%rax)
L399:
  lea    0x1(%r12),%rbx
  cmp    $0xd,%dil
  je     L363
  jmp    L596
  nopl   (%rax)
L107:
  add    $0x1,%rbx
  cmpb   $0xd,(%r12)
  jne    L596
L363:
  cmpb   $0xa,(%rbx)
  movb   $0xa,-0x1(%rbx)
  mov    %rbx,%r12
  jne    L107
  mov    %rbx,%rdi
  add    $0x1,%rbx
  call   <strlen@plt>
  mov    %rbx,%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  call   <memmove@plt>
  cmpb   $0xd,(%r12)
  je     L363
  nopw   0x0(%rax,%rax,1)
L596:
  movzbl 0x1(%r12),%edi
  test   %dil,%dil
  je     L164
  mov    %rbx,%r12
  jmp    L399
L164:
  mov    0x8(%rsp),%rax
  movsbl (%rax),%edi
L213:
  mov    %ebp,%ecx
  mov    0x8(%rsp),%r14
  movabs $0x44100000000,%rax
  lea    D17(%rip),%r15
  shr    %cl,%rax
  and    $0x1,%eax
  mov    %r14,(%rsp)
  mov    %al,0x1f(%rsp)
  jmp    L554
L220:
  add    $0x1,%r14
L199:
  movsbl (%r14),%edi
L554:
  test   %dil,%dil
  je     L442
  cmp    $0x26,%dil
  je     L323
  cmp    $0x25,%bpl
  jne    L582
  cmp    $0x25,%dil
  je     L608
L582:
  call   <isspace@plt>
  test   %rax,%rax
  je     L220
  movzbl (%r14),%edi
L323:
  test   %dil,%dil
  je     L442
  cmp    $0x63,%bpl
  je     L220
L608:
  mov    $0x2,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L459
  cmpb   $0x78,0x2(%r14)
  lea    0x20(%rsp),%rsi
  je     L424
  lea    0x2(%r14),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %rax,%rsi
L126:
  lea    0x1(%r14),%rdi
  test   %rsi,%rsi
  je     L171
  mov    0x20(%rsp),%rax
  cmpb   $0x3b,(%rax)
  jne    L171
  cmp    $0x7f,%rsi
  jg     L335
  mov    %sil,(%r14)
  mov    %rdi,%r14
L131:
  mov    $0x3b,%esi
  mov    %r14,%rdi
  call   <strchr@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %r14,%rdi
  mov    $0x3b,%esi
  mov    %eax,%r12d
  call   <strchr@plt>
  mov    %r12d,%edx
  mov    %r14,%rdi
  lea    0x1(%rax),%rsi
  call   <memmove@plt>
  jmp    L199
  nopl   0x0(%rax)
L459:
  movsbl (%r14),%edi
  cmp    $0x26,%dil
  je     L125
  cmp    $0x25,%dil
  jne    L27
  cmp    $0x25,%bpl
  je     L136
L27:
  lea    0x1(%r14),%rbx
  cmp    $0x20,%bpl
  je     L251
  cmp    $0x2a,%bpl
  jne    L381
L251:
  call   <isspace@plt>
  test   %rax,%rax
  je     L381
  movb   $0x20,(%r14)
  mov    %rbx,%r14
  jmp    L199
  nopl   0x0(%rax)
L171:
  mov    %rdi,%r14
  jmp    L199
  nopl   0x0(%rax,%rax,1)
L442:
  cmpb   $0x2a,0x18(%rsp)
  je     L447
L255:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  mov    (%rsp),%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L381:
  mov    %rbx,%r14
  jmp    L199
L125:
  cmp    $0x2a,%bpl
  ja     L220
  cmpb   $0x0,0x1f(%rsp)
  je     L27
L136:
  mov    0x10(%rsp),%rbx
  lea    0x1(%r14),%r13
  xor    %r12d,%r12d
  mov    (%rbx),%rdi
  test   %rdi,%rdi
  jne    L252
  jmp    L50
  xchg   %ax,%ax
L59:
  mov    0x10(%rbx),%rdi
  add    $0x10,%rbx
  add    $0x2,%r12
  test   %rdi,%rdi
  je     L50
L252:
  call   <strlen@plt>
  mov    (%rbx),%rsi
  mov    %r13,%rdi
  mov    %eax,%edx
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L59
  add    $0x1,%r12
  cmpq   $0x0,(%rbx)
  je     L50
  mov    0x10(%rsp),%rax
  lea    (%rax,%r12,8),%rbx
  mov    (%rbx),%rdi
  call   <strlen@plt>
  mov    %r14,%rdi
  mov    $0x3b,%esi
  movslq %eax,%r12
  call   <strchr@plt>
  lea    -0x1(%r12),%rdx
  mov    %rax,0x20(%rsp)
  mov    %rax,%rdi
  sub    %r14,%rax
  cmp    %rax,%rdx
  jg     L122
L339:
  call   <strlen@plt>
  lea    (%r14,%r12,1),%rdi
  mov    %eax,%edx
  mov    0x20(%rsp),%rax
  lea    0x1(%rax),%rsi
  call   <memmove@plt>
  mov    (%rbx),%rsi
  mov    %r12,%rdx
  mov    %r14,%rdi
  call   <strncpy@plt>
  jmp    L199
L424:
  lea    0x3(%r14),%rdi
  mov    $0x10,%edx
  call   <strtol@plt>
  mov    %rax,%rsi
  jmp    L126
L50:
  mov    %r13,%r14
  jmp    L199
L447:
  mov    (%rsp),%rbx
  cmpb   $0x0,(%rbx)
  je     L487
  lea    D9(%rip),%r12
  xchg   %ax,%ax
L353:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strspn@plt>
  test   %rax,%rax
  je     L300
  jmp    L425
  nopw   0x0(%rax,%rax,1)
L413:
  add    $0x1,%rbx
L300:
  testb  $0xdf,(%rbx)
  jne    L413
  mov    %rbx,%rax
  add    $0x1,%rbx
  cmpb   $0x0,0x1(%rax)
  jne    L353
L583:
  cmp    %rax,(%rsp)
  ja     L255
  cmpb   $0x20,-0x1(%rbx)
  jne    L255
  movb   $0x0,-0x1(%rbx)
  jmp    L255
  nopl   0x0(%rax,%rax,1)
L425:
  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    L300
L335:
  mov    %rsi,%rax
  nop
L464:
  mov    %rax,%rdx
  mov    %rbx,%rcx
  add    $0x1,%rbx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  jne    L464
  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     L128
  lea    -0x3(%rax,%rax,2),%ecx
  lea    0x1(%r14,%rax,1),%r14
  add    %ecx,%ecx
  nopl   0x0(%rax)
L38:
  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    L38
  jmp    L131
L122:
  sub    (%rsp),%r14
  call   <strlen@plt>
  lea    (%r12,%r14,1),%r13
  mov    0x8(%rsp),%rcx
  movslq %eax,%rsi
  add    %r13,%rsi
  cmp    %rcx,(%rsp)
  je     L119
  mov    (%rsp),%rdi
  call   <realloc@plt>
  mov    %rax,(%rsp)
L358:
  add    (%rsp),%r14
  mov    $0x3b,%esi
  mov    %r14,%rdi
  call   <strchr@plt>
  mov    %rax,0x20(%rsp)
  mov    %rax,%rdi
  jmp    L339
L119:
  mov    %rsi,%rdi
  call   <malloc@plt>
  mov    (%rsp),%rsi
  mov    %eax,%edi
  call   <strcpy@plt>
  mov    %rax,(%rsp)
  jmp    L358
L487:
  mov    (%rsp),%rbx
  lea    -0x1(%rbx),%rax
  jmp    L583
L128:
  mov    %rdi,%r14
  jmp    L131
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D17
type_infered: string
name: read_data
arguments: data_label: D9
type_infered: string

tool: D17: &#

tool: D9:  

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++) = c;
      else {
        for (b = 0, d = c; d; d /= 2)
          b++;
        b = (b - 2) / 5;
        *(s++) = (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(malloc(l), r) : 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;
}
```