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

```asm
<xml_parse_doc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %esi,-0x5c(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %r8,-0x78(%rbp)
  movq   $0x0,-0x48(%rbp)
  mov    -0x5c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x5c(%rbp),%edx
  mov    -0x58(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  cmpq   $0x0,-0x68(%rbp)
  je     L119
  cmpq   $0x0,-0x78(%rbp)
  je     L119
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    (%rax,%rax,1),%ebx
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,%ebx
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0xe,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x78(%rbp),%rdi
  mov    -0x68(%rbp),%rsi
  mov    -0x70(%rbp),%rcx
  mov    -0x68(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdi,%r9
  mov    %rsi,%r8
  lea    D68(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    (%rax,%rax,1),%ebx
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,%ebx
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0xf,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x78(%rbp),%rdi
  mov    -0x68(%rbp),%rsi
  mov    -0x70(%rbp),%rcx
  mov    -0x68(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdi,%r9
  mov    %rsi,%r8
  lea    D69(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L55
L119:
  cmpq   $0x0,-0x68(%rbp)
  je     L1
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x4,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x70(%rbp),%rcx
  mov    -0x68(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  lea    D65(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x5,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x70(%rbp),%rcx
  mov    -0x68(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  lea    D36(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L55
L1:
  cmpq   $0x0,-0x78(%rbp)
  je     L70
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0xc,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x78(%rbp),%rcx
  mov    -0x70(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  lea    D37(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0xd,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x78(%rbp),%rcx
  mov    -0x70(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  lea    D13(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L55
L70:
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x3,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x70(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  lea    D58(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x4,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x70(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  lea    D61(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L55:
  cmpq   $0x0,-0x68(%rbp)
  je     L86
  mov    -0x68(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x5,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x70(%rbp),%rcx
  mov    -0x68(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  lea    D74(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L66
L86:
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x4,%eax
  mov    %eax,%edi
  call   <xml_malloc@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x70(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  lea    D48(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L66:
  mov    -0x40(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L49
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x20(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L82
  mov    -0x18(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %eax,-0x4c(%rbp)
  mov    -0x78(%rbp),%rdx
  mov    -0x70(%rbp),%rcx
  mov    -0x68(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <xml_new_element@plt>
  mov    %rax,-0x48(%rbp)
  mov    -0x48(%rbp),%rdx
  mov    -0x4c(%rbp),%ecx
  mov    -0x20(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <_xml_parse_doc@plt>
  jmp    L82
L49:
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L82
  mov    -0x78(%rbp),%rdx
  mov    -0x70(%rbp),%rcx
  mov    -0x68(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <xml_new_element@plt>
  mov    %rax,-0x48(%rbp)
L82:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <xml_free@plt>
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <xml_free@plt>
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <xml_free@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <xml_free@plt>
  mov    -0x48(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D68
data_type: string
name: retrieve_data
arguments: data_tag: D69
data_type: string
name: retrieve_data
arguments: data_tag: D65
data_type: string
name: retrieve_data
arguments: data_tag: D36
data_type: string
name: retrieve_data
arguments: data_tag: D37
data_type: string
name: retrieve_data
arguments: data_tag: D13
data_type: string
name: retrieve_data
arguments: data_tag: D58
data_type: string
name: retrieve_data
arguments: data_tag: D61
data_type: string
name: retrieve_data
arguments: data_tag: D74
data_type: string
name: retrieve_data
arguments: data_tag: D48
data_type: string

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

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

tool: D65: <%s:%s>

tool: D36: <%s:%s/>

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

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

tool: D58: <%s>

tool: D61: <%s/>

tool: D74: </%s:%s>

tool: D48: </%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;
}
```