user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<parse_metadata>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %r8,-0x58(%rbp)
  mov    %r9d,-0x50(%rbp)
  mov    -0x40(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  lea    D6(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtok_r@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L3
  mov    $0x1,%eax
  jmp    L13
L3:
  mov    -0x58(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x48(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x20(%rbp),%rax
  mov    $0x3d,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L40
  mov    -0x18(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x4c(%rbp),%eax
  sub    $0x1,%eax
  cltq
  cmp    %rax,%rdx
  cmovle %rdx,%rax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x48(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x24(%rbp),%edx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    %ebx,%eax
  sub    %edx,%eax
  cmp    %eax,-0x50(%rbp)
  jge    L20
  mov    -0x50(%rbp),%eax
  sub    $0x1,%eax
  jmp    L17
L20:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    %ebx,%eax
  sub    %edx,%eax
  sub    $0x1,%eax
L17:
  mov    %eax,-0x24(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0x24(%rbp),%edx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x24(%rbp),%edx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L40:
  mov    $0x0,%eax
L13:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D6
type_guessed: string

tool: D6: ;

assistant: ```c
int parse_metadata(char *metadata, char **metadata_saveptr, char *attribute, int attribute_size, char *value, int value_size) {
  char *attribute_string;
  char *attribute_value_delim;
  unsigned int bytes_to_copy;
  attribute_string = strtok_r(metadata, (";"), metadata_saveptr);
  if (attribute_string == NULL)
    return (1);
  attribute[0] = value[0] = '\0';
  if ((attribute_value_delim = strchr(attribute_string, ('='))) != NULL) {
    bytes_to_copy = ((((attribute_value_delim - attribute_string)) > (attribute_size - 1)) ? (attribute_size - 1) : ((attribute_value_delim - attribute_string)));
    strncpy(attribute, attribute_string, bytes_to_copy);
    attribute[bytes_to_copy] = '\0';
    bytes_to_copy = (((strlen(attribute_string) - strlen(attribute) - 1) > (value_size - 1)) ? (value_size - 1) : (strlen(attribute_string) - strlen(attribute) - 1));
    strncpy(value, attribute_value_delim + 1, bytes_to_copy);
    value[bytes_to_copy] = '\0';
  }
  return (0);
}
```