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

```asm
<readNames>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  call   <rewind@plt>
  mov    D20(%rip),%rbp
  xor    %eax,%eax
  jmp    L173
  nopl   0x0(%rax,%rax,1)
L76:
  cmp    $0x2c,%eax
  sete   %al
  movzbl %al,%eax
  add    (%r12),%eax
L173:
  mov    %eax,(%r12)
  mov    %rbx,%rdi
  call   <fgetc@plt>
  cmp    %eax,0x0(%rbp)
  jne    L76
  mov    %rbx,%rdi
  call   <ftell@plt>
  xor    %edi,%edi
  test   %eax,%eax
  setg   %dil
  add    (%r12),%edi
  mov    %edi,(%r12)
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L150
  mov    %rbx,%rdi
  call   <rewind@plt>
  mov    (%r12),%eax
  test   %eax,%eax
  jle    L150
  mov    $0xffffffff,%ebp
  mov    $0xffffffff,%r15d
  xor    %r14d,%r14d
  jmp    L137
  nopl   0x0(%rax,%rax,1)
L17:
  cmp    $0x2c,%eax
  je     L115
  mov    %rbx,%rdi
  call   <feof@plt>
  test   %rax,%rax
  je     L88
L115:
  sub    %r15d,%ebp
  mov    $0x1,%esi
  lea    0x1(%rbp),%edi
  call   <calloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L109
  mov    D29(%rip),%rax
  mov    %r15d,%esi
  mov    %rbx,%rdi
  mov    (%rax),%edx
  call   <fseek@plt>
  test   %rax,%rax
  jne    L170
  mov    %rbx,%rcx
  mov    %ebp,%edx
  mov    $0x1,%esi
  mov    %r13,%rdi
  call   <fread@plt>
  cmp    %ebp,%eax
  jl     L170
  mov    D5(%rip),%rax
  mov    $0x2,%esi
  mov    %rbx,%rdi
  mov    (%rax),%edx
  call   <fseek@plt>
  test   %rax,%rax
  jne    L170
  mov    0x8(%rsp),%rcx
  movslq %r14d,%rax
  add    $0x1,%r14d
  mov    $0xffffffff,%ebp
  mov    $0xffffffff,%r15d
  mov    %r13,(%rcx,%rax,8)
L88:
  cmp    %r14d,(%r12)
  jle    L150
L137:
  mov    %rbx,%rdi
  call   <fgetc@plt>
  cmp    $0x22,%eax
  jne    L17
  cmp    $0xffffffff,%r15d
  je     L107
  cmp    $0xffffffff,%ebp
  jne    L88
  mov    %rbx,%rdi
  call   <ftell@plt>
  lea    -0x1(%rax),%ebp
  cmp    %r14d,(%r12)
  jg     L137
L150:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L107:
  mov    %rbx,%rdi
  call   <ftell@plt>
  mov    %eax,%r15d
  jmp    L88
  nopl   (%rax)
L170:
  mov    (%r12),%esi
  mov    0x8(%rsp),%rdi
  call   <freeNames@plt>
  mov    %r13,%rdi
  call   <free@plt>
  movq   $0x0,0x8(%rsp)
  jmp    L150
L109:
  mov    (%r12),%esi
  mov    0x8(%rsp),%rdi
  call   <freeNames@plt>
  movq   $0x0,0x8(%rsp)
  jmp    L150
```

assistant: ```c
char **readNames(FILE *f, int *count) {
  rewind(f);
  *count = 0;
  int c;
  for (; (c = fgetc(f)) != EOF; (*count) += (c == ','))
    ;
  (*count) += (ftell(f) > 0);
  char **names = malloc(sizeof(*names) * (*count));
  if (names == NULL) {
    return NULL;
  }
  rewind(f);
  int i = 0, start = -1, end = -1;
  while (i < *count) {
    c = fgetc(f);
    if (c == '"') {
      if (start == -1) {
        start = ftell(f);
      } else if (end == -1) {
        end = ftell(f) - 1;
      }
    } else if (c == ',' || feof(f)) {
      int length = end - start;
      char *name = calloc(length + 1, 1);
      if (name == NULL) {
        freeNames(names, *count);
        return NULL;
      }
      if (fseek(f, start, SEEK_SET) != 0 || fread(name, 1, length, f) < length || fseek(f, 2, SEEK_CUR) != 0) {
        freeNames(names, *count);
        free(name);
        return NULL;
      }
      names[i++] = name;
      start = end = -1;
    }
  }
  return names;
}
```