user: Converte this assembly snippet into its equivalent C code:

```asm
<qfits_getkey>:
  endbr64
  test   %rdi,%rdi
  je     L29
  push   %r12
  lea    D108(%rip),%r12
  mov    $0x8,%edx
  push   %rbp
  mov    %r12,%rsi
  mov    %rdi,%rbp
  push   %rbx
  call   <strncmp@plt>
  test   %eax,%eax
  je     L28
  mov    $0x8,%edx
  lea    D22(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L2
  mov    $0x8,%edx
  lea    D14(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L73
  mov    $0x4,%edx
  lea    D95(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L11
  lea    D121(%rip),%r12
  xor    %esi,%esi
  mov    $0x51,%edx
  mov    %r12,%rdi
  call   <memset@plt>
  cmpb   $0x3d,0x0(%rbp)
  je     L131
  lea    0x1(%rbp),%rdx
  xor    %eax,%eax
  jmp    L4
  nopl   0x0(%rax)
L66:
  add    $0x1,%rdx
  cmp    $0x50,%eax
  je     L131
L4:
  mov    %eax,%ebx
  add    $0x1,%eax
  cmpb   $0x3d,(%rdx)
  jne    L66
  cmp    $0x50,%eax
  je     L131
  movslq %ebx,%rdx
  lea    -0x1(%rbx),%eax
  cmpb   $0x20,0x0(%rbp,%rdx,1)
  cltq
  je     L24
  jmp    L117
  nopl   0x0(%rax)
L79:
  sub    $0x1,%rax
  cmp    $0xfffffffffffffffe,%rax
  je     L131
L24:
  cmpb   $0x20,0x0(%rbp,%rax,1)
  mov    %eax,%ebx
  je     L79
L117:
  test   %ebx,%ebx
  jle    L131
  lea    0x1(%rbx),%edx
  add    $0x2,%ebx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strncpy@plt>
  movslq %ebx,%rbx
  lea    D121(%rip),%rax
  movb   $0x0,(%r12,%rbx,1)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L28:
  lea    D121(%rip),%rbx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rax
L87:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L2:
  lea    D121(%rip),%rbx
  lea    D8(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L11:
  lea    D121(%rip),%rbx
  lea    D37(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rax
  jmp    L87
  nopl   0x0(%rax,%rax,1)
L131:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L73:
  lea    D121(%rip),%rbx
  lea    D85(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L29:
  xor    %eax,%eax
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D108
datatype: string
name: disassemble_data
arguments: tag: D22
datatype: string
name: disassemble_data
arguments: tag: D14
datatype: string
name: disassemble_data
arguments: tag: D95
datatype: string
name: disassemble_data
arguments: tag: D8
datatype: string
name: disassemble_data
arguments: tag: D37
datatype: string
name: disassemble_data
arguments: tag: D85
datatype: string

tool: D108:         

tool: D22: HISTORY 

tool: D14: COMMENT 

tool: D95: END 

tool: D8: HISTORY

tool: D37: END

tool: D85: COMMENT

assistant: ```c
char *qfits_getkey(const char *line) {
  static char key[81];
  int i;
  if (line == NULL) {
    return NULL;
  }
  if (!strncmp(line, "        ", 8)) {
    strcpy(key, "        ");
    return key;
  }
  if (!strncmp(line, "HISTORY ", 8)) {
    strcpy(key, "HISTORY");
    return key;
  }
  if (!strncmp(line, "COMMENT ", 8)) {
    strcpy(key, "COMMENT");
    return key;
  }
  if (!strncmp(line, "END ", 4)) {
    strcpy(key, "END");
    return key;
  }
  memset(key, 0, 81);
  i = 0;
  while (line[i] != '=' && i < 80)
    i++;
  if (i >= 80) {
    return NULL;
  }
  i--;
  while (line[i] == ' ' && i >= 0)
    i--;
  if (i <= 0) {
    return NULL;
  }
  i++;
  strncpy(key, line, i);
  key[i + 1] = (char)0;
  return key;
}
```