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

```asm
<ezxml_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%r15
  mov    %rsi,0x10(%rsp)
  mov    %edx,0x1c(%rsp)
  mov    %edx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  mov    %rdi,%rbx
  cmpb   $0x0,(%rdi)
  jne    L445
L554:
  mov    %r15,0x8(%rsp)
  mov    %r15,%rbx
  movabs $0x44100000000,%rax
  mov    %r12d,%ecx
  shr    %cl,%rax
  and    $0x1,%eax
  mov    %rax,0x20(%rsp)
  jmp    L96
L409:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    0x1(%rbx),%rsi
  mov    %rbx,%rdi
  call   <memmove@plt>
L584:
  cmpb   $0xd,(%rbx)
  jne    L131
L207:
  add    $0x1,%rbx
  movb   $0xa,-0x1(%rbx)
  cmpb   $0xa,(%rbx)
  jne    L584
  jmp    L409
L131:
  lea    0x1(%rbx),%rax
  cmpb   $0x0,0x1(%rbx)
  je     L554
  mov    %rax,%rbx
L445:
  cmpb   $0xd,(%rbx)
  je     L207
  jmp    L131
L239:
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L559
  cmp    $0x63,%r12b
  jne    L356
L440:
  cmp    $0x20,%r12b
  je     L89
  cmp    $0x2a,%r12b
  je     L89
L545:
  add    $0x1,%rbx
L96:
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L239
  cmp    $0x26,%dil
  je     L239
  cmp    $0x25,%r12b
  jne    L98
  cmp    $0x25,%dil
  je     L356
L98:
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L239
  add    $0x1,%rbx
  jmp    L96
L356:
  mov    $0x2,%edx
  lea    D19(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L496
  cmpb   $0x78,0x2(%rbx)
  je     L159
  lea    0x30(%rsp),%rsi
  lea    0x2(%rbx),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %rax,%rsi
L343:
  test   %rsi,%rsi
  je     L299
  mov    0x30(%rsp),%rax
  cmpb   $0x3b,(%rax)
  jne    L299
  cmp    $0x7f,%rsi
  jg     L533
  mov    %sil,(%rbx)
  lea    0x1(%rbx),%rbx
L325:
  mov    $0x3b,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebp
  mov    $0x3b,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  lea    0x1(%rax),%rsi
  mov    %ebp,%edx
  mov    %rbx,%rdi
  call   <memmove@plt>
  jmp    L96
L159:
  lea    0x30(%rsp),%rsi
  lea    0x3(%rbx),%rdi
  mov    $0x10,%edx
  call   <strtol@plt>
  mov    %rax,%rsi
  jmp    L343
L299:
  add    $0x1,%rbx
  jmp    L96
L533:
  mov    %rsi,%rdx
L95:
  mov    %rbp,%rcx
  add    $0x1,%rbp
  mov    %rdx,%rax
  shr    $0x3f,%rax
  add    %rdx,%rax
  sar    %rax
  mov    %rax,%rdx
  jne    L95
  sub    $0x1,%rcx
  movabs $0x6666666666666667,%rdx
  mov    %rcx,%rax
  imul   %rdx
  sar    %rdx
  sar    $0x3f,%rcx
  sub    %rcx,%rdx
  mov    %rdx,%rdi
  lea    0x1(%rbx),%r9
  mov    $0x7,%ecx
  sub    %edx,%ecx
  mov    $0xff,%eax
  shl    %cl,%eax
  lea    (%rdx,%rdx,2),%ecx
  add    %ecx,%ecx
  mov    %rsi,%rdx
  sar    %cl,%rdx
  or     %edx,%eax
  mov    %al,(%rbx)
  test   %rdi,%rdi
  je     L544
  lea    -0x3(%rdi,%rdi,2),%ecx
  add    %ecx,%ecx
  lea    0x1(%rbx,%rdi,1),%r8
  mov    %r9,%rdx
L243:
  add    $0x1,%rdx
  mov    %rsi,%rax
  sar    %cl,%rax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,-0x1(%rdx)
  sub    $0x6,%ecx
  cmp    %rdx,%r8
  jne    L243
  lea    (%r9,%rdi,1),%rbx
  jmp    L325
L544:
  mov    %r9,%rbx
  jmp    L325
L496:
  movzbl (%rbx),%edi
  cmp    $0x26,%dil
  je     L36
  cmp    $0x25,%r12b
  jne    L440
  cmp    $0x25,%dil
  jne    L440
L256:
  mov    0x10(%rsp),%rbp
  mov    0x0(%rbp),%rdi
  mov    $0x0,%r13d
  lea    0x1(%rbx),%r14
  test   %rdi,%rdi
  je     L233
L184:
  call   <strlen@plt>
  mov    %eax,%edx
  mov    0x0(%rbp),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L360
  add    $0x2,%r13
  add    $0x10,%rbp
  mov    0x0(%rbp),%rdi
  test   %rdi,%rdi
  jne    L184
L233:
  add    $0x1,%rbx
  jmp    L96
L36:
  cmp    $0x2a,%r12b
  ja     L440
  cmpq   $0x0,0x20(%rsp)
  je     L440
  jmp    L256
L360:
  add    $0x1,%r13
  cmpq   $0x0,0x0(%rbp)
  je     L233
  mov    0x10(%rsp),%rax
  lea    (%rax,%r13,8),%rbp
  mov    0x0(%rbp),%rdi
  call   <strlen@plt>
  mov    %eax,%r14d
  movslq %eax,%r13
  mov    $0x3b,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  mov    %rax,%rdi
  mov    %rax,0x30(%rsp)
  lea    -0x1(%r13),%rdx
  sub    %rbx,%rax
  cmp    %rax,%rdx
  jg     L27
L182:
  mov    0x30(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    0x30(%rsp),%rax
  lea    0x1(%rax),%rsi
  movslq %r14d,%rdi
  add    %rbx,%rdi
  call   <memmove@plt>
  mov    %r13,%rdx
  mov    0x0(%rbp),%rsi
  mov    %rbx,%rdi
  call   <strncpy@plt>
  jmp    L96
L27:
  sub    0x8(%rsp),%rbx
  lea    0x0(%r13,%rbx,1),%rcx
  mov    %rcx,0x28(%rsp)
  call   <strlen@plt>
  movslq %eax,%rsi
  add    0x28(%rsp),%rsi
  cmp    %r15,0x8(%rsp)
  je     L368
  mov    0x8(%rsp),%rdi
  call   <realloc@plt>
  mov    %rax,0x8(%rsp)
L41:
  add    0x8(%rsp),%rbx
  mov    $0x3b,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  mov    %rax,0x30(%rsp)
  jmp    L182
L368:
  mov    %rsi,%rdi
  call   <malloc@plt>
  mov    %eax,%edi
  mov    0x8(%rsp),%rsi
  call   <strcpy@plt>
  mov    %rax,0x8(%rsp)
  jmp    L41
L89:
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L545
  movb   $0x20,(%rbx)
  lea    0x1(%rbx),%rbx
  jmp    L96
L559:
  cmpb   $0x2a,0x1c(%rsp)
  je     L596
L6:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L224
  mov    0x8(%rsp),%rax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L596:
  mov    0x8(%rsp),%rbx
  cmpb   $0x0,(%rbx)
  je     L170
  lea    D5(%rip),%r12
  jmp    L173
L35:
  testb  $0xdf,(%rbx)
  je     L259
L336:
  add    $0x1,%rbx
  testb  $0xdf,(%rbx)
  jne    L336
  mov    %rbx,%rax
L165:
  lea    0x1(%rax),%rbx
  cmpb   $0x0,0x1(%rax)
  je     L354
L173:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strspn@plt>
  test   %rax,%rax
  je     L35
  lea    (%rbx,%rax,1),%rbp
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <memmove@plt>
  jmp    L35
L259:
  mov    %rbx,%rax
  jmp    L165
L170:
  mov    0x8(%rsp),%rbx
L354:
  lea    -0x1(%rbx),%rax
  cmp    %rax,0x8(%rsp)
  ja     L6
  cmpb   $0x20,-0x1(%rbx)
  jne    L6
  movb   $0x0,-0x1(%rbx)
  jmp    L6
L224:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D19
datatype: string
name: disassemble_data
arguments: data_tag: D5
datatype: string

tool: D19: &#

tool: D5:  

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((unsigned char)*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(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((unsigned char)*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;
}
```