user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_XcursorThemeInherits>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x2008(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L134
  lea    D6(%rip),%rsi
  mov    %rsp,%rbx
  lea    D4(%rip),%r12
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L134
  nopw   0x0(%rax,%rax,1)
L207:
  mov    %rbp,%rdx
  mov    $0x2000,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L274
  mov    $0x8,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L207
  movzbl 0x8(%rsp),%edx
  lea    0x8(%rsp),%rax
  cmp    $0x20,%dl
  jne    L228
  nopl   0x0(%rax)
L109:
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  cmp    $0x20,%dl
  je     L109
L228:
  cmp    $0x3d,%dl
  jne    L207
  cmpb   $0x20,0x1(%rax)
  lea    0x1(%rax),%rbx
  jne    L138
  nopl   0x0(%rax)
L127:
  add    $0x1,%rbx
  cmpb   $0x20,(%rbx)
  je     L127
L138:
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L274
  movabs $0xf7ffeffefffff9ff,%rsi
  movzbl (%rbx),%eax
  mov    %r12,%rdx
  test   %al,%al
  je     L174
  nopw   0x0(%rax,%rax,1)
L55:
  cmp    $0x3b,%al
  jbe    L108
L119:
  cmp    %rdx,%r12
  je     L38
  movb   $0x3a,(%rdx)
  add    $0x1,%rdx
  jmp    L38
  nopw   0x0(%rax,%rax,1)
L77:
  lea    -0x9(%rax),%ecx
  cmp    $0x1,%cl
  jbe    L55
  cmp    $0x20,%al
  je     L55
L38:
  cmp    $0x3b,%al
  je     L273
  cmp    $0x2c,%al
  je     L273
  add    $0x1,%rbx
  mov    %al,(%rdx)
  add    $0x1,%rdx
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L77
L174:
  movb   $0x0,(%rdx)
L245:
  mov    %rbp,%rdi
  call   <fclose@plt>
L56:
  mov    0x2008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L186
  add    $0x2010,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L108:
  bt     %rax,%rsi
  jb     L257
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  jmp    L55
L273:
  test   %al,%al
  jne    L55
  jmp    L174
  nopl   0x0(%rax)
L134:
  xor    %r12d,%r12d
  jmp    L56
  nopl   (%rax)
L257:
  test   %al,%al
  je     L174
  jmp    L119
  nopl   0x0(%rax)
L274:
  xor    %r12d,%r12d
  jmp    L245
L186:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D6
type_guessed: string
name: read_data
arguments: data_tag: D4
type_guessed: string

tool: D6: r

tool: D4: Inherits

assistant: ```c
char *_XcursorThemeInherits(const char *full) {
  char line[8192];
  char *result = NULL;
  FILE *f;
  if (!full)
    return NULL;
  f = fopen(full, "r");
  if (f) {
    while (fgets(line, sizeof(line), f)) {
      if (!strncmp(line, "Inherits", 8)) {
        char *l = line + 8;
        char *r;
        while (*l == ' ')
          l++;
        if (*l != '=')
          continue;
        l++;
        while (*l == ' ')
          l++;
        result = malloc(strlen(l) + 1);
        if (result) {
          r = result;
          while (*l) {
            while (((*l) == ';' || (*l) == ',') || ((*l) == ' ' || (*l) == '\t' || (*l) == '\n'))
              l++;
            if (!*l)
              break;
            if (r != result)
              *r++ = ':';
            while (*l && !((*l) == ' ' || (*l) == '\t' || (*l) == '\n') && !((*l) == ';' || (*l) == ','))
              *r++ = *l++;
          }
          *r++ = '\0';
        }
        break;
      }
    }
    fclose(f);
  }
  return result;
}
```