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

```asm
<ffbnfm>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %r8,(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  mov    (%r8),%eax
  test   %eax,%eax
  jg     L265
  mov    %rdi,%r12
  mov    %rdx,%r13
  mov    %rcx,%r14
  test   %rsi,%rsi
  je     L553
  movl   $0x0,(%rsi)
L553:
  test   %r13,%r13
  je     L468
  movq   $0x0,0x0(%r13)
L468:
  test   %r14,%r14
  je     L220
  movq   $0x0,(%r14)
L220:
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %rax,%rax
  je     L207
  mov    $0x1,%edx
  lea    (%r12,%rax,1),%rcx
  mov    %r12,%rsi
  sub    %r12,%rdx
  jmp    L522
  nopl   0x0(%rax)
L557:
  lea    (%rdx,%rsi,1),%rdi
  add    $0x1,%rsi
  cmp    %rcx,%rsi
  je     L3
L522:
  cmpb   $0x20,(%rsi)
  je     L557
L454:
  lea    0x20(%rsp),%r15
  xor    %ebx,%ebx
  mov    %r15,%rdi
  call   <strcpy@plt>
  mov    %r15,%rdi
  call   <ffupch@plt>
  mov    %r15,%rax
  jmp    L273
  nopw   0x0(%rax,%rax,1)
L323:
  add    $0x1,%rbx
L273:
  movsbl (%rax),%edi
  mov    %rax,%rbp
  call   <isdigit@plt>
  mov    %rax,%r8
  lea    0x1(%rbp),%rax
  test   %r8,%r8
  jne    L323
  test   %rbx,%rbx
  jne    L390
  movq   $0x1,0x18(%rsp)
L249:
  movzbl 0x0(%rbp),%eax
  lea    -0x50(%rax),%edx
  cmp    $0x1,%dl
  jbe    L397
  cmp    $0x55,%al
  je     L391
  sub    $0x41,%eax
  cmp    $0x17,%al
  ja     L329
  lea    D47(%rip),%rdx
  movzbl %al,%eax
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax,%rax,1)
L391:
  movq   $0x2,0x10(%rsp)
  mov    $0x14,%eax
L66:
  mov    0x8(%rsp),%rbx
  test   %rbx,%rbx
  je     L156
  mov    %eax,(%rbx)
L156:
  test   %r13,%r13
  je     L531
  mov    0x18(%rsp),%rax
  mov    %rax,0x0(%r13)
L531:
  test   %r14,%r14
  je     L161
  mov    0x10(%rsp),%rax
  mov    %rax,(%r14)
L161:
  mov    (%rsp),%rax
  mov    (%rax),%eax
L265:
  mov    0xc8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L49
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L3:
  cmp    %rdi,%rax
  je     L207
  lea    (%r12,%rdi,1),%rsi
  jmp    L454
  cs nopw 0x0(%rax,%rax,1)
L397:
  movzbl 0x1(%rbp),%eax
  lea    0x1(%rbp),%rsi
  cmp    $0x55,%al
  je     L328
  sub    $0x41,%eax
  cmp    $0x17,%al
  ja     L329
  lea    D56(%rip),%rdx
  movzbl %al,%eax
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopw   0x0(%rax,%rax,1)
L390:
  lea    0x18(%rsp),%rdx
  lea    D38(%rip),%rsi
  mov    %r15,%rdi
  call   <sscanf@plt>
  jmp    L249
  nopl   0x0(%rax)
L328:
  movq   $0x2,0x10(%rsp)
  mov    $0xffffffec,%edx
  mov    %edx,%eax
  jmp    L66
  nopl   (%rax)
L207:
  lea    D7(%rip),%rdi
  call   <ffpmsg@plt>
  mov    (%rsp),%rax
  movl   $0x105,(%rax)
  mov    $0x105,%eax
  jmp    L265
  nopl   0x0(%rax,%rax,1)
L329:
  lea    0x70(%rsp),%rbp
  mov    %r12,%rcx
  mov    $0x51,%esi
  lea    D18(%rip),%rdx
  mov    %rbp,%rdi
  call   <snprintf@plt>
  mov    %rbp,%rdi
  call   <ffpmsg@plt>
  mov    (%rsp),%rax
  movl   $0x106,(%rax)
  mov    $0x106,%eax
  jmp    L265
  xor    %ebx,%ebx
L457:
  mov    $0x1,%ecx
  mov    $0xffffffff,%edx
  mov    $0x1,%eax
  nopl   0x0(%rax)
L437:
  mov    %rcx,0x10(%rsp)
  test   %ebx,%ebx
  je     L66
  mov    %edx,%eax
  jmp    L66
  xor    %ebx,%ebx
L252:
  mov    $0x4,%ecx
  mov    $0xffffffd8,%edx
  mov    $0x28,%eax
  jmp    L437
  xor    %ebx,%ebx
L400:
  mov    $0x1,%ecx
  mov    $0xfffffff4,%edx
  mov    $0xc,%eax
  jmp    L437
  xor    %ebx,%ebx
L261:
  mov    $0x10,%ecx
  mov    $0xffffff5d,%edx
  mov    $0xa3,%eax
  jmp    L437
  xor    %ebx,%ebx
L280:
  mov    $0x1,%ecx
  mov    $0xfffffff2,%edx
  mov    $0xe,%eax
  jmp    L437
  xor    %ebx,%ebx
L382:
  mov    $0x8,%ecx
  mov    $0xffffffaf,%edx
  mov    $0x51,%eax
  jmp    L437
  xor    %ebx,%ebx
L367:
  mov    $0x4,%ecx
  mov    $0xffffffd7,%edx
  mov    $0x29,%eax
  jmp    L437
  xor    %ebx,%ebx
L291:
  mov    $0x4,%ecx
  mov    $0xffffffd6,%edx
  mov    $0x2a,%eax
  jmp    L437
  xor    %ebx,%ebx
L505:
  mov    $0x8,%ecx
  mov    $0xffffffae,%edx
  mov    $0x52,%eax
  jmp    L437
  xor    %ebx,%ebx
L152:
  mov    $0x8,%ecx
  mov    $0xffffffad,%edx
  mov    $0x53,%eax
  jmp    L437
  xor    %ebx,%ebx
L416:
  mov    $0x1,%ecx
  mov    $0xfffffff5,%edx
  mov    $0xb,%eax
  jmp    L437
  xor    %ebx,%ebx
L198:
  movzbl 0x1(%rbp),%eax
  test   %al,%al
  je     L364
  cmp    $0x28,%al
  lea    0x10(%rsp),%rdx
  lea    D38(%rip),%rsi
  sete   %al
  movzbl %al,%eax
  lea    0x1(%rbp,%rax,1),%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L479
L364:
  mov    0x18(%rsp),%rcx
  mov    $0xfffffff0,%edx
  mov    $0x10,%eax
  jmp    L437
  movq   $0x2,0x10(%rsp)
  mov    $0x15,%eax
  jmp    L66
  mov    $0x1,%ebx
  jmp    L457
  mov    $0x1,%ebx
  jmp    L252
  mov    %rsi,%rbp
  mov    $0x1,%ebx
  jmp    L198
  mov    $0x1,%ebx
  jmp    L152
  mov    $0x1,%ebx
  jmp    L416
  mov    $0x1,%ebx
  jmp    L400
  mov    $0x1,%ebx
  jmp    L261
  mov    $0x1,%ebx
  jmp    L280
  mov    $0x1,%ebx
  jmp    L382
  mov    $0x1,%ebx
  jmp    L367
  mov    $0x1,%ebx
  jmp    L291
  mov    $0x1,%ebx
  jmp    L505
  movq   $0x2,0x10(%rsp)
  mov    $0xffffffeb,%edx
  mov    %edx,%eax
  jmp    L66
L479:
  test   %ebx,%ebx
  jne    L160
  mov    0x18(%rsp),%rax
  cmp    %rax,0x10(%rsp)
  jle    L179
  mov    %rax,0x10(%rsp)
L179:
  mov    $0x10,%eax
  jmp    L66
L160:
  mov    $0xfffffff0,%edx
  mov    %edx,%eax
  jmp    L66
L49:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D38
type_infered: string
name: disassemble_data
arguments: data_tag: D7
type_infered: string
name: disassemble_data
arguments: data_tag: D18
type_infered: string

tool: D38: %ld

tool: D7: Error: binary table TFORM code is blank (ffbnfm).

tool: D18: Illegal binary table TFORMn datatype: '%s' 

assistant: ```c
int ffbnfm(char *tform, int *dtcode, long *trepeat, long *twidth, int *status) {
  size_t ii, nchar;
  int datacode, variable, iread;
  long width, repeat;
  char *form, temp[71], message[81];
  if (*status > 0)
    return (*status);
  if (dtcode)
    *dtcode = 0;
  if (trepeat)
    *trepeat = 0;
  if (twidth)
    *twidth = 0;
  nchar = strlen(tform);
  for (ii = 0; ii < nchar; ii++) {
    if (tform[ii] != ' ')
      break;
  }
  if (ii == nchar) {
    ffpmsg("Error: binary table TFORM code is blank (ffbnfm).");
    return (*status = 261);
  }
  strcpy(temp, &tform[ii]);
  ffupch(temp);
  form = temp;
  ii = 0;
  while (isdigit((int)form[ii]))
    ii++;
  if (ii == 0)
    repeat = 1;
  else
    sscanf(form, "%ld", &repeat);
  form = form + ii;
  if (form[0] == 'P' || form[0] == 'Q') {
    variable = 1;
    form++;
  } else
    variable = 0;
  if (form[0] == 'U') {
    datacode = 20;
    width = 2;
  } else if (form[0] == 'I') {
    datacode = 21;
    width = 2;
  } else if (form[0] == 'V') {
    datacode = 40;
    width = 4;
  } else if (form[0] == 'J') {
    datacode = 41;
    width = 4;
  } else if (form[0] == 'K') {
    datacode = 81;
    width = 8;
  } else if (form[0] == 'E') {
    datacode = 42;
    width = 4;
  } else if (form[0] == 'D') {
    datacode = 82;
    width = 8;
  } else if (form[0] == 'A') {
    datacode = 16;
    iread = 0;
    if (form[1] != 0) {
      if (form[1] == '(')
        form++;
      iread = sscanf(&form[1], "%ld", &width);
    }
    if (iread != 1 || (!variable && (width > repeat)))
      width = repeat;
  } else if (form[0] == 'L') {
    datacode = 14;
    width = 1;
  } else if (form[0] == 'X') {
    datacode = 1;
    width = 1;
  } else if (form[0] == 'B') {
    datacode = 11;
    width = 1;
  } else if (form[0] == 'S') {
    datacode = 12;
    width = 1;
  } else if (form[0] == 'C') {
    datacode = 83;
    width = 8;
  } else if (form[0] == 'M') {
    datacode = 163;
    width = 16;
  } else {
    snprintf(message, 81, "Illegal binary table TFORMn datatype: \'%s\' ", tform);
    ffpmsg(message);
    return (*status = 262);
  }
  if (variable)
    datacode = datacode * (-1);
  if (dtcode)
    *dtcode = datacode;
  if (trepeat)
    *trepeat = repeat;
  if (twidth)
    *twidth = width;
  return (*status);
}
```