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

```asm
<tc2fr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L86
  xor    %eax,%eax
  movb   $0x0,0x16(%rsp)
  mov    %rdi,%rbx
  mov    %ax,0x14(%rsp)
  jmp    L122
  nopl   0x0(%rax)
L65:
  add    $0x1,%rbx
L122:
  movsbl (%rbx),%edi
  call   <isspace@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L65
  xor    %ebp,%ebp
  lea    0x14(%rsp),%r14
  jmp    L151
  nopl   (%rax)
L90:
  movzbl (%rbx),%eax
  movsbl 0x1(%rbx),%edi
  mov    %al,0x14(%rsp)
  call   <isdigit@plt>
  test   %rax,%rax
  je     L125
  movzbl 0x1(%rbx),%eax
  mov    %r14,%rdi
  movb   $0x0,0x16(%rsp)
  add    $0x2,%rbx
  mov    %al,0x15(%rsp)
  call   <atoi@plt>
  mov    %eax,0x8(%rsp,%rbp,4)
L99:
  cmp    $0x2,%rbp
  je     L96
  add    $0x1,%rbp
  cmpb   $0x3a,(%rbx)
  jne    L34
  add    $0x1,%rbx
L151:
  movsbl (%rbx),%edi
  mov    %ebp,%r13d
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L90
  sub    $0x1,%r13d
L34:
  cmp    $0x1,%r13d
  je     L0
  cmp    $0x2,%r13d
  je     L96
  test   %r13d,%r13d
  je     L26
L113:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L143
  add    $0x28,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L125:
  movzbl 0x1(%rbx),%r15d
  mov    %r14,%rdi
  movb   $0x0,0x15(%rsp)
  call   <atoi@plt>
  mov    %eax,0x8(%rsp,%rbp,4)
  cmp    $0x3a,%r15b
  jne    L34
  add    $0x1,%rbx
  jmp    L99
  nopl   (%rax)
L26:
  movslq 0x8(%rsp),%r12
  cmp    $0x4a,%r12d
  jle    L113
L86:
  mov    $0xffffffffffffffff,%r12
  jmp    L113
  nopl   0x0(%rax)
L0:
  mov    0x8(%rsp),%edx
  mov    0xc(%rsp),%ecx
  cmp    $0x3b,%edx
  setg   %al
  cmp    $0x4a,%ecx
  setg   %sil
  imul   $0x4b,%edx,%r12d
  or     %esi,%eax
  add    %ecx,%r12d
  movslq %r12d,%r12
L124:
  test   %al,%al
  je     L113
  jmp    L86
  nopl   0x0(%rax,%rax,1)
L96:
  mov    0xc(%rsp),%ecx
  mov    0x10(%rsp),%edx
  cmp    $0x3b,%ecx
  setg   %al
  cmp    $0x4a,%edx
  setg   %sil
  imul   $0x3c,0x8(%rsp),%r12d
  or     %esi,%eax
  add    %ecx,%r12d
  imul   $0x4b,%r12d,%r12d
  add    %edx,%r12d
  movslq %r12d,%r12
  jmp    L124
L143:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
long tc2fr(const char *tc) {
  int minutes = 0;
  int seconds = 0;
  int frames = 0;
  long totalframes = 0;
  char tmp[2 + 1];
  int nums[3];
  int n = 0;
  int i = 0;
  int last_was_colon = 0;
  int stop = 0;
  if (tc == NULL)
    return -1;
  for (i = 0; i <= 2; i++)
    tmp[i] = '\0';
  while (isspace(*tc))
    tc++;
  for (n = 0; n < 3; n++) {
    if (n > 0) {
      if (tc[0] != ':') {
        --n;
        break;
      } else
        tc++;
    }
    for (i = 0; i < 2; i++) {
      if (isdigit(tc[i])) {
        tmp[i] = tc[i];
        last_was_colon = 0;
      } else if (tc[i] == ':') {
        if (i == 0)
          stop = 1;
        break;
      } else {
        stop = 1;
        break;
      }
    }
    if (i != 0) {
      tmp[i] = '\0';
      nums[n] = atoi(tmp);
      tc = &tc[i];
    } else
      --n;
    if (stop)
      break;
  }
  if (n == 3)
    --n;
  frames = seconds = minutes = 0;
  switch (n) {
  case 0:
    frames = nums[0];
    break;
  case 1:
    seconds = nums[0];
    frames = nums[1];
    break;
  case 2:
    minutes = nums[0];
    seconds = nums[1];
    frames = nums[2];
    break;
  }
  totalframes = ((60 * minutes) + seconds) * 75 + frames;
  if (seconds > 59 || frames > 74)
    return -1;
  return totalframes;
}
```