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

```asm
<mime_parse_content_type>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbp
  mov    %rsi,0x8(%rsp)
  mov    %rdx,%r15
  mov    %rcx,0x10(%rsp)
  mov    %r8,0x18(%rsp)
  mov    %r9,(%rsp)
  mov    0x68(%rsp),%r14
  mov    0x78(%rsp),%r13
  mov    $0x2f,%esi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  cmove  %rbp,%rbx
  mov    %rbx,%r12
  sub    %rbp,%r12
  lea    -0x1(%r15),%rax
  cmp    %r15,%r12
  cmovae %rax,%r12
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    0x8(%rsp),%r15
  mov    %r15,%rdi
  call   <strncpy@plt>
  movb   $0x0,(%r15,%r12,1)
  lea    0x1(%rbx),%r12
  lea    D18(%rip),%rsi
  mov    %r12,%rdi
  call   <strspn@plt>
  mov    %rax,%rbp
  mov    0x18(%rsp),%rdx
  lea    -0x1(%rdx),%rax
  cmp    %rdx,%rbp
  cmovae %rax,%rbp
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    0x10(%rsp),%r15
  mov    %r15,%rdi
  call   <strncpy@plt>
  movb   $0x0,(%r15,%rbp,1)
  mov    $0x3b,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  mov    %rax,%rbp
  lea    D15(%rip),%r15
  test   %rax,%rax
  jne    L99
L201:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L175:
  add    $0x1,%rbx
L209:
  movsbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L175
  cmpb   $0x0,(%rbx)
  je     L201
  lea    0x1(%rbx),%r12
  mov    $0x3b,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L149
L125:
  mov    $0x3d,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L201
  mov    %eax,%esi
  sub    %ebx,%esi
  mov    %rbx,%rdi
  call   <strndupa@plt>
  mov    %rax,%rbx
  mov    %rbp,%rsi
  sub    %r12,%rsi
  sub    $0x1,%esi
  lea    0x1(%r12),%rdi
  call   <strndupa@plt>
  mov    %rax,%r12
  mov    %rax,%rdi
  call   <rtrim@plt>
  cmpb   $0x22,(%r12)
  je     L17
L47:
  test   %r13,%r13
  je     L133
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  je     L145
L133:
  test   %r14,%r14
  je     L57
  lea    D35(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  je     L174
L57:
  lea    D2(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  je     L188
L128:
  test   %rbp,%rbp
  je     L201
L99:
  cmpb   $0x0,0x0(%rbp)
  je     L201
  lea    0x1(%rbp),%rbx
  jmp    L209
L149:
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  mov    %rax,%rbp
  jmp    L125
L17:
  mov    %r12,%rdi
  call   <strlen@plt>
  cltq
  cmpb   $0x22,-0x1(%r12,%rax,1)
  jne    L47
  mov    %r12,%rdi
  call   <strlen@plt>
  cltq
  movb   $0x0,-0x1(%r12,%rax,1)
  add    $0x1,%r12
  jmp    L47
L145:
  mov    0x80(%rsp),%rdx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  mov    0x80(%rsp),%rax
  movb   $0x0,-0x1(%r13,%rax,1)
  jmp    L128
L174:
  mov    $0x2f,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L29
  mov    $0x2f,%esi
  mov    %r12,%rdi
  call   <strrchr@plt>
  lea    0x1(%rax),%rsi
  mov    0x70(%rsp),%rdx
  mov    %r14,%rdi
  call   <strncpy@plt>
L166:
  mov    0x70(%rsp),%rax
  movb   $0x0,-0x1(%r14,%rax,1)
  jmp    L128
L29:
  mov    0x70(%rsp),%rdx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <strncpy@plt>
  jmp    L166
L188:
  mov    0x60(%rsp),%rdx
  mov    %r12,%rsi
  mov    (%rsp),%rbx
  mov    %rbx,%rdi
  call   <strncpy@plt>
  mov    0x60(%rsp),%rcx
  movb   $0x0,-0x1(%rbx,%rcx,1)
  jmp    L128
```

tool_calls: name: parse_data
arguments: label: D18
data_type: string
name: parse_data
arguments: label: D15
data_type: string
name: parse_data
arguments: label: D35
data_type: string
name: parse_data
arguments: label: D2
data_type: string

tool: D18: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-

tool: D15: boundary

tool: D35: name

tool: D2: charset

assistant: ```c
void mime_parse_content_type(const char *cts, char *type, size_t type_size, char *subtype, size_t subtype_size, char *charset, size_t charset_size, char *filename, size_t filename_size, char *part_delimiter, size_t part_delimiter_size) {
  const char *type_delim = strchr(cts, '/');
  size_t type_len;
  if (!type_delim)
    type_delim = cts;
  type_len = type_delim - cts;
  if (type_len >= type_size)
    type_len = type_size - 1;
  strncpy(type, cts, type_len);
  type[type_len] = 0;
  size_t subtype_len = strspn(type_delim + 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-");
  if (subtype_len >= subtype_size)
    subtype_len = subtype_size - 1;
  strncpy(subtype, type_delim + 1, subtype_len);
  subtype[subtype_len] = 0;
  char *arg = strchr(type_delim, ';');
  while (arg && *arg) {
    char *arg_end;
    ++arg;
    while (isspace(*arg))
      ++arg;
    if (!*arg)
      break;
    arg_end = strchr(arg + 1, ';');
    if (!arg_end)
      arg_end = strchr(arg + 1, 0);
    char *arg_delim = strchr(arg, '=');
    if (!arg_delim)
      break;
    char *key = strndupa(arg, arg_delim - arg);
    char *value = strndupa(arg_delim + 1, arg_end - arg_delim - 1);
    rtrim(value);
    if (value[0] == '"' && value[strlen(value) - 1] == '"') {
      value[strlen(value) - 1] = 0;
      ++value;
    }
    if (part_delimiter && !strcasecmp(key, "boundary")) {
      strncpy(part_delimiter, value, part_delimiter_size);
      part_delimiter[part_delimiter_size - 1] = 0;
    } else if (filename && !strcasecmp(key, "name")) {
      if (strchr(value, '/'))
        strncpy(filename, strrchr(value, '/') + 1, filename_size);
      else
        strncpy(filename, value, filename_size);
      filename[filename_size - 1] = 0;
    } else if (!strcasecmp(key, "charset")) {
      strncpy(charset, value, charset_size);
      charset[charset_size - 1] = 0;
    }
    arg = arg_end;
  }
}
```