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

```asm
<ffmkky>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  mov    (%r8),%eax
  movl   $0xffffffff,0x1c(%rsp)
  test   %eax,%eax
  jg     L482
  movb   $0x0,(%rcx)
  cmpb   $0x20,(%rdi)
  mov    %rdi,%r13
  mov    %rsi,%r14
  movb   $0x0,0x20(%rsp)
  mov    %rcx,%rbp
  mov    %r8,%r12
  jne    L173
  lea    0x1(%rdi),%rax
  nopl   0x0(%rax,%rax,1)
L345:
  mov    %rax,%rsi
  add    $0x1,%rax
  cmpb   $0x20,-0x1(%rax)
  je     L345
L231:
  lea    0x20(%rsp),%r15
  mov    $0x47,%edx
  mov    %r15,%rdi
  call   <strncat@plt>
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %rax,(%rsp)
  call   <strlen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L461
  lea    0x1c(%rsp),%rsi
  mov    %r13,%rdi
  call   <fftkey@plt>
  test   %rax,%rax
  jle    L542
L154:
  mov    $0x3d,%esi
  mov    %r15,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L424
  movzbl 0x20(%rsp),%eax
  cmp    $0x48,%al
  je     L565
L302:
  cmp    $0x68,%al
  je     L612
L139:
  lea    D53(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
L10:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    (%rsp),%rax
  lea    0xc(%rbx,%rax,1),%rax
  cmp    $0x50,%rax
  jbe    L232
  lea    D20(%rip),%rsi
  mov    %rbp,%rdi
  add    $0xb,%rbx
  call   <strcat@plt>
L484:
  cmpq   $0x0,(%rsp)
  je     L313
  cmpb   $0x27,(%r14)
  je     L167
L573:
  mov    (%rsp),%rax
  add    %rbx,%rax
  cmp    $0x50,%rax
  ja     L135
  mov    $0x1e,%edx
  mov    $0x50,%r8d
  sub    %ebx,%r8d
  cmp    %rdx,%rax
  cmovae %rax,%rdx
  mov    %r8d,%r15d
  mov    %rdx,%r13
  cmp    $0x1d,%rax
  jbe    L524
  mov    %r8d,%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strncat@plt>
  cmpq   $0x0,0x8(%rsp)
  je     L94
L319:
  cmp    $0x4c,%r13
  jbe    L39
  nopl   0x0(%rax,%rax,1)
L94:
  mov    (%r12),%eax
L482:
  mov    0x68(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L254
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L461:
  lea    -0x1(%r15,%rax,1),%rbx
  cmpb   $0x20,(%rbx)
  jne    L258
  nopw   0x0(%rax,%rax,1)
L124:
  movb   $0x0,(%rbx)
  sub    $0x1,%rbx
  cmpb   $0x20,(%rbx)
  je     L124
L258:
  sub    %r15,%rbx
  add    $0x1,%rbx
  cmp    $0x8,%rbx
  ja     L154
  lea    0x1c(%rsp),%rsi
  mov    %r13,%rdi
  call   <fftkey@plt>
  test   %rax,%rax
  jg     L154
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  cmp    $0x8,%rbx
  jne    L110
  nopl   0x0(%rax,%rax,1)
L64:
  mov    $0x203d,%ecx
  cmpq   $0x0,(%rsp)
  movb   $0x0,0xa(%rbp)
  mov    %cx,0x8(%rbp)
  je     L58
  cmpb   $0x27,(%r14)
  mov    $0xa,%ebx
  jne    L573
  mov    $0x46,%edx
  mov    $0xa,%ebx
  jmp    L527
  nop
L313:
  cmp    $0xa,%rbx
  jne    L94
L58:
  cmpq   $0x0,0x8(%rsp)
  movb   $0x20,0x8(%rbp)
  je     L94
  mov    0x8(%rsp),%rsi
  mov    $0x46,%edx
  mov    %rbp,%rdi
  call   <strncat@plt>
  jmp    L94
  nopl   0x0(%rax)
L232:
  lea    D6(%rip),%rsi
  mov    %rbp,%rdi
  add    $0xc,%rbx
  call   <strcat@plt>
  jmp    L484
L167:
  cmp    $0x4d,%rbx
  ja     L135
  mov    $0x50,%edx
  sub    %ebx,%edx
L527:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strncat@plt>
  add    (%rsp),%rbx
  mov    $0x50,%edx
  cmp    %rdx,%rbx
  cmovbe %rbx,%rdx
  mov    %rdx,%r13
  cmp    $0x4f,%rbx
  ja     L402
  mov    0x8(%rsp),%rax
  test   %rax,%rax
  je     L94
  cmpb   $0x0,(%rax)
  je     L319
  cmp    $0x1d,%rbx
  ja     L319
  movabs $0x2020202020202020,%rcx
  mov    $0x1e,%eax
  sub    %rdx,%rax
  lea    0x1(%rdx),%rdx
  cmp    $0x1e,%rdx
  mov    $0x1,%edx
  cmova  %rdx,%rax
  lea    0x0(%rbp,%r13,1),%rdx
  cmp    $0x8,%rax
  jae    L633
  test   $0x4,%al
  jne    L103
  test   %rax,%rax
  je     L239
  movb   $0x20,(%rdx)
  test   $0x2,%al
  jne    L499
L239:
  movb   $0x0,0x1e(%rbp)
  mov    $0x1e,%r13d
  xchg   %ax,%ax
L39:
  mov    0x8(%rsp),%rax
  cmpb   $0x0,(%rax)
  je     L94
  mov    %rbp,%rdi
  lea    D31(%rip),%rsi
  call   <strcat@plt>
  mov    0x8(%rsp),%rsi
  mov    $0x4d,%edx
  mov    %rbp,%rdi
  sub    %r13d,%edx
  call   <strncat@plt>
  jmp    L94
  nopw   0x0(%rax,%rax,1)
L542:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
L110:
  movabs $0x2020202020202020,%rcx
  mov    $0x8,%eax
  sub    %rbx,%rax
  add    %rbp,%rbx
  cmp    $0x8,%eax
  jae    L148
  test   $0x4,%al
  jne    L639
  test   %eax,%eax
  je     L64
  movb   $0x20,(%rbx)
  test   $0x2,%al
  je     L64
  mov    %eax,%eax
  mov    $0x2020,%edx
  mov    %dx,-0x2(%rbx,%rax,1)
  jmp    L64
  nopl   (%rax)
L173:
  mov    %rdi,%rsi
  jmp    L231
L424:
  lea    D66(%rip),%rdi
  call   <ffpmsg@plt>
  mov    %r15,%rdi
  call   <ffpmsg@plt>
  movl   $0xcf,(%r12)
  mov    $0xcf,%eax
  jmp    L482
  cs nopw 0x0(%rax,%rax,1)
L612:
  mov    $0x9,%edx
  lea    D23(%rip),%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L139
L594:
  sub    $0x9,%rbx
  jmp    L10
L402:
  cmpq   $0x0,0x8(%rsp)
  movb   $0x27,0x4f(%rbp)
  jne    L319
  jmp    L94
L148:
  lea    0x8(%rbx),%rsi
  mov    %eax,%edx
  mov    %rcx,(%rbx)
  and    $0xfffffffffffffff8,%rsi
  mov    %rcx,-0x8(%rbx,%rdx,1)
  sub    %rsi,%rbx
  add    %ebx,%eax
  and    $0xfffffff8,%eax
  cmp    $0x8,%eax
  jb     L64
  and    $0xfffffff8,%eax
  xor    %edx,%edx
L181:
  mov    %edx,%edi
  add    $0x8,%edx
  mov    %rcx,(%rsi,%rdi,1)
  cmp    %eax,%edx
  jb     L181
  jmp    L64
L524:
  mov    $0x1e,%edx
  sub    (%rsp),%edx
  lea    D64(%rip),%rsi
  mov    %rbp,%rdi
  sub    %ebx,%edx
  call   <strncat@plt>
  mov    %r15d,%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strncat@plt>
  cmpq   $0x0,0x8(%rsp)
  jne    L39
  jmp    L94
L565:
  mov    $0x9,%edx
  lea    D53(%rip),%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L594
  movzbl 0x20(%rsp),%eax
  jmp    L302
L135:
  lea    D57(%rip),%rdi
  call   <ffpmsg@plt>
  mov    %r13,%rdi
  call   <ffpmsg@plt>
  mov    %r14,%rdi
  call   <ffpmsg@plt>
  movl   $0xcf,(%r12)
  mov    $0xcf,%eax
  jmp    L482
L633:
  lea    0x8(%rdx),%rsi
  mov    %rcx,(%rdx)
  and    $0xfffffffffffffff8,%rsi
  mov    %rcx,-0x8(%rdx,%rax,1)
  sub    %rsi,%rdx
  add    %rdx,%rax
  and    $0xfffffffffffffff8,%rax
  cmp    $0x8,%rax
  jb     L239
  and    $0xfffffffffffffff8,%rax
  xor    %edx,%edx
L509:
  mov    %rcx,(%rsi,%rdx,1)
  add    $0x8,%rdx
  cmp    %rax,%rdx
  jb     L509
  jmp    L239
L639:
  mov    %eax,%eax
  movl   $0x20202020,(%rbx)
  movl   $0x20202020,-0x4(%rbx,%rax,1)
  jmp    L64
L103:
  movl   $0x20202020,(%rdx)
  movl   $0x20202020,-0x4(%rdx,%rax,1)
  jmp    L239
L254:
  call   <__stack_chk_fail@plt>
L499:
  movw   $0x2020,-0x2(%rdx,%rax,1)
  jmp    L239
```

tool_calls: name: extract_symbolic_data
arguments: tag: D53
type: string
name: extract_symbolic_data
arguments: tag: D20
type: string
name: extract_symbolic_data
arguments: tag: D6
type: string
name: extract_symbolic_data
arguments: tag: D31
type: string
name: extract_symbolic_data
arguments: tag: D66
type: string
name: extract_symbolic_data
arguments: tag: D23
type: string
name: extract_symbolic_data
arguments: tag: D64
type: string
name: extract_symbolic_data
arguments: tag: D57
type: string

tool: D53: HIERARCH 

tool: D20: = 

tool: D6:  = 

tool: D31:  / 

tool: D66: Illegal keyword name; contains an equals sign (=)

tool: D23: hierarch 

tool: D64:                     

tool: D57: The following keyword + value is too long to fit on a card:

assistant: ```c
int ffmkky(const char *keyname, char *value, const char *comm, char *card, int *status) {
  size_t namelen, len, ii;
  char tmpname[72], *cptr;
  int tstatus = -1, nblank = 0;
  if (*status > 0)
    return (*status);
  *tmpname = '\0';
  *card = '\0';
  while (*(keyname + nblank) == ' ')
    nblank++;
  strncat(tmpname, keyname + nblank, 72 - 1);
  len = strlen(value);
  namelen = strlen(tmpname);
  if (namelen) {
    cptr = tmpname + namelen - 1;
    while (*cptr == ' ') {
      *cptr = '\0';
      cptr--;
    }
    namelen = cptr - tmpname + 1;
  }
  if (namelen <= 8 && (fftkey(keyname, &tstatus) <= 0)) {
    strcat(card, tmpname);
    for (ii = namelen; ii < 8; ii++)
      card[ii] = ' ';
    card[8] = '=';
    card[9] = ' ';
    card[10] = '\0';
    namelen = 10;
  } else {
    if (strchr(tmpname, '=')) {
      ffpmsg("Illegal keyword name; contains an equals sign (=)");
      ffpmsg(tmpname);
      return (*status = 207);
    }
    if (((tmpname)[0] < ("HIERARCH ")[0] ? -1 : (tmpname)[0] > ("HIERARCH ")[0] ? 1 : strncmp((tmpname), ("HIERARCH "), (9))) && ((tmpname)[0] < ("hierarch ")[0] ? -1 : (tmpname)[0] > ("hierarch ")[0] ? 1 : strncmp((tmpname), ("hierarch "), (9))))
      strcat(card, "HIERARCH ");
    else
      namelen -= 9;
    strcat(card, tmpname);
    if (namelen + 12 + len > 80) {
      strcat(card, "= ");
      namelen += 11;
    } else {
      strcat(card, " = ");
      namelen += 12;
    }
  }
  if (len > 0) {
    if (value[0] == '\'') {
      if (namelen > 77) {
        ffpmsg("The following keyword + value is too long to fit on a card:");
        ffpmsg(keyname);
        ffpmsg(value);
        return (*status = 207);
      }
      strncat(card, value, 80 - namelen);
      len = ((80) < (namelen + len) ? (80) : (namelen + len));
      if (len == 80) {
        card[79] = '\'';
      }
      if (comm) {
        if (comm[0] != 0) {
          if (len < 30) {
            for (ii = len; ii < 30; ii++)
              card[ii] = ' ';
            card[30] = '\0';
            len = 30;
          }
        }
      }
    } else {
      if (namelen + len > 80) {
        ffpmsg("The following keyword + value is too long to fit on a card:");
        ffpmsg(keyname);
        ffpmsg(value);
        return (*status = 207);
      } else if (namelen + len < 30) {
        strncat(card, "                    ", 30 - (namelen + len));
      }
      strncat(card, value, 80 - namelen);
      len = ((80) < (namelen + len) ? (80) : (namelen + len));
      len = ((30) > (len) ? (30) : (len));
    }
    if (comm) {
      if ((len < 77) && (strlen(comm) > 0)) {
        strcat(card, " / ");
        strncat(card, comm, 77 - len);
      }
    }
  } else {
    if (namelen == 10) {
      card[8] = ' ';
      if (comm) {
        strncat(card, comm, 80 - namelen);
      }
    }
  }
  return (*status);
}
```