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

```asm
<xml_parse_doc>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  mov    %r8,%r14
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  movslq %esi,%rbx
  lea    0x1(%rbx),%edi
  sub    $0x28,%rsp
  call   <xml_malloc@plt>
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %rax,%r13
  mov    %rax,%rdi
  call   <memcpy@plt>
  movb   $0x0,0x0(%r13,%rbx,1)
  test   %rbp,%rbp
  je     L40
  test   %r14,%r14
  jne    L75
  test   %rbp,%rbp
  je     L40
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  lea    0x4(%rbx,%rax,1),%edi
  call   <xml_malloc@plt>
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D48(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%r15
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  lea    0x5(%rbx,%rax,1),%edi
  call   <xml_malloc@plt>
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D37(%rip),%rsi
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
L52:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  lea    0x5(%rbx,%rax,1),%edi
  call   <xml_malloc@plt>
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D94(%rip),%rsi
  mov    %rax,%rbx
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
L68:
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  mov    %rax,0x10(%rsp)
  je     L79
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    0x10(%rsp),%r8
  mov    %rbx,%rsi
  cltq
  add    %rax,%r8
  mov    %r8,%rdi
  mov    %r8,0x10(%rsp)
  call   <strstr@plt>
  mov    0x10(%rsp),%r8
  test   %rax,%rax
  je     L36
  mov    %r12,%rsi
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    %r8,0x10(%rsp)
  mov    %rax,0x18(%rsp)
  call   <xml_new_element@plt>
  mov    0x18(%rsp),%rcx
  mov    0x10(%rsp),%r8
  mov    %rax,%rdx
  mov    %rax,%r12
  mov    %ecx,%esi
  mov    %r8,%rdi
  sub    %r8d,%esi
  call   <_xml_parse_doc@plt>
L45:
  mov    %r15,%rdi
  call   <xml_free@plt>
  mov    %rbx,%rdi
  call   <xml_free@plt>
  mov    0x8(%rsp),%rdi
  call   <xml_free@plt>
  mov    %r13,%rdi
  call   <xml_free@plt>
  add    $0x28,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L75:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %r14,%rdi
  lea    (%rax,%rbx,2),%ebx
  call   <strlen@plt>
  lea    0xe(%rbx,%rax,1),%edi
  call   <xml_malloc@plt>
  mov    %r14,%r9
  mov    %rbp,%r8
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D12(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%r15
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %r14,%rdi
  lea    (%rax,%rbx,2),%ebx
  call   <strlen@plt>
  lea    0xf(%rbx,%rax,1),%edi
  call   <xml_malloc@plt>
  mov    %r14,%r9
  mov    %rbp,%r8
  mov    %r12,%rcx
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  xor    %eax,%eax
  mov    %rbp,%rdx
  lea    D14(%rip),%rsi
  call   <sprintf@plt>
  jmp    L52
  nopl   0x0(%rax,%rax,1)
L79:
  mov    0x8(%rsp),%rsi
  mov    %r13,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L36
  mov    %r12,%rsi
  mov    %r14,%rdx
  mov    %rbp,%rdi
  call   <xml_new_element@plt>
  mov    %rax,%r12
  jmp    L45
  nopl   0x0(%rax)
L40:
  mov    %r12,%rdi
  test   %r14,%r14
  je     L3
  call   <strlen@plt>
  mov    %r14,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  lea    0xc(%rbx,%rax,1),%edi
  call   <xml_malloc@plt>
  mov    %r14,%rcx
  mov    %r12,%rdx
  lea    D25(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%r15
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r14,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  lea    0xd(%rbx,%rax,1),%edi
  call   <xml_malloc@plt>
  mov    %r14,%rcx
  mov    %r12,%rdx
  lea    D10(%rip),%rsi
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
L113:
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    0x4(%rax),%edi
  call   <xml_malloc@plt>
  mov    %r12,%rdx
  lea    D71(%rip),%rsi
  mov    %rax,%rbx
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L68
  nopl   0x0(%rax)
L36:
  xor    %r12d,%r12d
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L3:
  call   <strlen@plt>
  lea    0x3(%rax),%edi
  call   <xml_malloc@plt>
  mov    %r12,%rdx
  lea    D98(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%r15
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    0x4(%rax),%edi
  call   <xml_malloc@plt>
  mov    %r12,%rdx
  lea    D93(%rip),%rsi
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L113
```

tool_calls: name: unpack_data
arguments: label: D48
type_infered: string
name: unpack_data
arguments: label: D37
type_infered: string
name: unpack_data
arguments: label: D94
type_infered: string
name: unpack_data
arguments: label: D12
type_infered: string
name: unpack_data
arguments: label: D14
type_infered: string
name: unpack_data
arguments: label: D25
type_infered: string
name: unpack_data
arguments: label: D10
type_infered: string
name: unpack_data
arguments: label: D71
type_infered: string
name: unpack_data
arguments: label: D98
type_infered: string
name: unpack_data
arguments: label: D93
type_infered: string

tool: D48: <%s:%s>

tool: D37: <%s:%s/>

tool: D94: </%s:%s>

tool: D12: <%s:%s xmlns:%s="%s">

tool: D14: <%s:%s xmlns:%s="%s"/>

tool: D25: <%s xmlns="%s">

tool: D10: <%s xmlns="%s"/>

tool: D71: </%s>

tool: D98: <%s>

tool: D93: <%s/>

assistant: ```c
struct xml_node *xml_parse_doc(char *doc_buf, int doc_len, char *doc_prefix, char *doc_name, char *doc_uri) {
  struct xml_node *root = NULL;
  char *xml_buf, *start_tag, *end_tag, *empty_tag, *front, *rear;
  xml_buf = (char *)xml_malloc(doc_len + 1);
  memcpy(xml_buf, doc_buf, doc_len);
  xml_buf[doc_len] = '\0';
  if (doc_prefix && doc_uri) {
    start_tag = (char *)xml_malloc(2 * strlen(doc_prefix) + strlen(doc_name) + strlen(doc_uri) + 14);
    sprintf(start_tag, "<%s:%s xmlns:%s=\"%s\">", doc_prefix, doc_name, doc_prefix, doc_uri);
    empty_tag = (char *)xml_malloc(2 * strlen(doc_prefix) + strlen(doc_name) + strlen(doc_uri) + 15);
    sprintf(empty_tag, "<%s:%s xmlns:%s=\"%s\"/>", doc_prefix, doc_name, doc_prefix, doc_uri);
  } else if (doc_prefix) {
    start_tag = (char *)xml_malloc(strlen(doc_prefix) + strlen(doc_name) + 4);
    sprintf(start_tag, "<%s:%s>", doc_prefix, doc_name);
    empty_tag = (char *)xml_malloc(strlen(doc_prefix) + strlen(doc_name) + 5);
    sprintf(empty_tag, "<%s:%s/>", doc_prefix, doc_name);
  } else if (doc_uri) {
    start_tag = (char *)xml_malloc(strlen(doc_name) + strlen(doc_uri) + 12);
    sprintf(start_tag, "<%s xmlns=\"%s\">", doc_name, doc_uri);
    empty_tag = (char *)xml_malloc(strlen(doc_name) + strlen(doc_uri) + 13);
    sprintf(empty_tag, "<%s xmlns=\"%s\"/>", doc_name, doc_uri);
  } else {
    start_tag = (char *)xml_malloc(strlen(doc_name) + 3);
    sprintf(start_tag, "<%s>", doc_name);
    empty_tag = (char *)xml_malloc(strlen(doc_name) + 4);
    sprintf(empty_tag, "<%s/>", doc_name);
  }
  if (doc_prefix) {
    end_tag = (char *)xml_malloc(strlen(doc_prefix) + strlen(doc_name) + 5);
    sprintf(end_tag, "</%s:%s>", doc_prefix, doc_name);
  } else {
    end_tag = (char *)xml_malloc(strlen(doc_name) + 4);
    sprintf(end_tag, "</%s>", doc_name);
  }
  if ((front = strstr(xml_buf, start_tag)) != NULL) {
    front += strlen(start_tag);
    if ((rear = strstr(front, end_tag)) != NULL) {
      int xml_len = rear - front;
      root = xml_new_element(doc_prefix, doc_name, doc_uri);
      _xml_parse_doc(front, xml_len, root);
    }
  } else if ((front = strstr(xml_buf, empty_tag)) != NULL) {
    root = xml_new_element(doc_prefix, doc_name, doc_uri);
  }
  xml_free(start_tag);
  xml_free(end_tag);
  xml_free(empty_tag);
  xml_free(xml_buf);
  return root;
}
```