user: What is the c source code of the assembly code below?

```asm
<qfits_card_build>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x398,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x388(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L50
  mov    %rsi,%r12
  test   %rsi,%rsi
  je     L50
  mov    $0x20,%esi
  mov    %rdx,%rbp
  mov    $0x50,%edx
  mov    %rdi,%rbx
  mov    %rcx,%r13
  call   <memset@plt>
  lea    D24(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L218
  lea    D20(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L85
  lea    D15(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L361
L85:
  xor    %eax,%eax
  mov    %r12,%rdx
  lea    D27(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  test   %rbp,%rbp
  je     L50
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    0x388(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L131
  mov    $0x48,%edx
  lea    0x8(%rbx),%rdi
  mov    %rbp,%rsi
  cmp    %edx,%eax
  cmovle %eax,%edx
  add    $0x398,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1110 <strncpy@plt>
  nopl   (%rax)
L218:
  movl   $0x444e45,(%rbx)
  xchg   %ax,%ax
L50:
  mov    0x388(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L131
  add    $0x398,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L361:
  mov    $0x8,%edx
  lea    D47(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L85
  test   %rbp,%rbp
  je     L166
  mov    %rbp,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jg     L242
L166:
  movb   $0x0,(%rsp)
  mov    %rsp,%r14
L80:
  lea    0x120(%rsp),%r15
  test   %r13,%r13
  je     L120
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <strcpy@plt>
L370:
  mov    $0x8,%edx
  lea    D115(%rip),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L322
  mov    %r14,%rdi
  call   <qfits_is_int@plt>
  test   %rax,%rax
  jne    L217
  mov    %r14,%rdi
  call   <qfits_is_float@plt>
  test   %rax,%rax
  jne    L217
  mov    %r14,%rdi
  call   <qfits_is_boolean@plt>
  test   %rax,%rax
  jne    L217
  mov    %r14,%rdi
  mov    $0x1,%ebp
  call   <qfits_is_complex@plt>
  test   %rax,%rax
  jne    L217
L23:
  cmpb   $0x0,(%rsp)
  jne    L243
  test   %ebp,%ebp
  mov    %r15,%rcx
  lea    0x180(%rsp),%rbp
  mov    %r12,%rdx
  je     L294
  lea    D39(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  nopw   0x0(%rax,%rax,1)
L51:
  mov    $0x50,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x50(%rbx)
  jmp    L50
  nopl   0x0(%rax)
L322:
  mov    %r14,%rdi
  call   <qfits_is_int@plt>
  test   %rax,%rax
  jne    L269
  mov    %r14,%rdi
  call   <qfits_is_float@plt>
  test   %rax,%rax
  jne    L269
  mov    %r14,%rdi
  call   <qfits_is_boolean@plt>
  test   %rax,%rax
  jne    L269
  mov    %r14,%rdi
  xor    %ebp,%ebp
  call   <qfits_is_complex@plt>
  test   %rax,%rax
  je     L23
  nopw   0x0(%rax,%rax,1)
L269:
  lea    0x180(%rsp),%rbp
  mov    %r15,%r8
  mov    %r14,%rcx
  xor    %eax,%eax
  mov    %r12,%rdx
  lea    D93(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  jmp    L51
  nopw   0x0(%rax,%rax,1)
L217:
  lea    0x180(%rsp),%rbp
  mov    %r15,%r8
  mov    %r14,%rcx
  xor    %eax,%eax
  mov    %r12,%rdx
  lea    D11(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  jmp    L51
  nopw   0x0(%rax,%rax,1)
L120:
  lea    D7(%rip),%rsi
  mov    %r15,%rdi
  call   <strcpy@plt>
  jmp    L370
L242:
  mov    %rsp,%r14
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <strcpy@plt>
  jmp    L80
L243:
  lea    0xc0(%rsp),%r13
  mov    $0x51,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    %r14,%rdi
  call   <qfits_pretty_string@plt>
  lea    0x60(%rsp),%rdi
  mov    %rax,%rsi
  call   <strcpy@plt>
  movzbl 0x60(%rsp),%eax
  lea    0x61(%rsp),%rcx
  xor    %edx,%edx
  test   %al,%al
  je     L97
  nopl   0x0(%rax,%rax,1)
L215:
  cmp    $0x27,%al
  je     L61
  movslq %edx,%rsi
  add    $0x1,%rcx
  add    $0x1,%edx
  mov    %al,0xc0(%rsp,%rsi,1)
  movzbl -0x1(%rcx),%eax
  test   %al,%al
  jne    L215
L97:
  test   %ebp,%ebp
  je     L196
  lea    0x180(%rsp),%rbp
  mov    %r12,%rdx
  mov    %r15,%r8
  xor    %eax,%eax
  mov    %r13,%rcx
  lea    D86(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  add    %eax,%r12d
  cmp    $0x4c,%r12d
  jle    L51
  movb   $0x27,0x1cf(%rsp)
  jmp    L51
  nopl   0x0(%rax)
L61:
  movslq %edx,%rax
  add    $0x1,%rcx
  movb   $0x27,0xc0(%rsp,%rax,1)
  lea    0x1(%rdx),%eax
  add    $0x2,%edx
  cltq
  movb   $0x27,0xc0(%rsp,%rax,1)
  movzbl -0x1(%rcx),%eax
  test   %al,%al
  jne    L215
  jmp    L97
L196:
  lea    0x180(%rsp),%rbp
  mov    %r15,%r8
  mov    %r13,%rcx
  xor    %eax,%eax
  mov    %r12,%rdx
  lea    D14(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  jmp    L51
L294:
  lea    D110(%rip),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L51
L131:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D24
datatype: string
name: read_data
arguments: label: D20
datatype: string
name: read_data
arguments: label: D15
datatype: string
name: read_data
arguments: label: D27
datatype: string
name: read_data
arguments: label: D47
datatype: string
name: read_data
arguments: label: D115
datatype: string
name: read_data
arguments: label: D39
datatype: string
name: read_data
arguments: label: D93
datatype: string
name: read_data
arguments: label: D11
datatype: string
name: read_data
arguments: label: D7
datatype: string
name: read_data
arguments: label: D86
datatype: string
name: read_data
arguments: label: D14
datatype: string
name: read_data
arguments: label: D110
datatype: string

tool: D24: END

tool: D20: HISTORY

tool: D15: COMMENT

tool: D27: %s 

tool: D47:         

tool: D115: HIERARCH

tool: D39: %-29s=                    / %s

tool: D93: %-8.8s= %20s / %-48s

tool: D11: %-29s= %s / %s

tool: D7: no comment

tool: D86: %-29s= '%s' / %s

tool: D14: %-8.8s= '%-8s' / %s

tool: D110: %-8.8s=                      / %-48s

assistant: ```c
void qfits_card_build(char *line, const char *key, const char *val, const char *com) {
  int len;
  int hierarch = 0;
  char cval[81];
  char cval2[81];
  char cval_q[81];
  char ccom[81];
  char safe_line[512];
  int i, j;
  if (line == NULL || key == NULL)
    return;
  memset(line, ' ', 80);
  if (key == NULL)
    return;
  if (!strcmp(key, "END")) {
    sprintf(line, "END");
    return;
  }
  if (!strcmp(key, "HISTORY") || !strcmp(key, "COMMENT") || !strncmp(key, "        ", 8)) {
    sprintf(line, "%s ", key);
    if (val == NULL)
      return;
    len = strlen(val);
    if (len > 72)
      len = 72;
    strncpy(line + 8, val, len);
    return;
  }
  if (val == NULL)
    cval[0] = (char)0;
  else if (strlen(val) < 1)
    cval[0] = (char)0;
  else
    strcpy(cval, val);
  if (com == NULL)
    strcpy(ccom, "no comment");
  else
    strcpy(ccom, com);
  if (!strncmp(key, "HIERARCH", 8))
    hierarch++;
  if (qfits_is_int(cval) || qfits_is_float(cval) || qfits_is_boolean(cval) || qfits_is_complex(cval)) {
    if (hierarch)
      sprintf(safe_line, "%-29s= %s / %s", key, cval, ccom);
    else
      sprintf(safe_line, "%-8.8s= %20s / %-48s", key, cval, ccom);
    strncpy(line, safe_line, 80);
    line[80] = (char)0;
    return;
  }
  if (cval[0] == 0) {
    if (hierarch) {
      sprintf(safe_line, "%-29s=                    / %s", key, ccom);
    } else {
      sprintf(safe_line, "%-8.8s=                      / %-48s", key, ccom);
    }
    strncpy(line, safe_line, 80);
    line[80] = (char)0;
    return;
  }
  memset(cval_q, 0, 81);
  strcpy(cval2, qfits_pretty_string(cval));
  j = 0;
  i = 0;
  while (cval2[i] != (char)0) {
    if (cval2[i] == '\'') {
      cval_q[j] = '\'';
      j++;
      cval_q[j] = '\'';
    } else {
      cval_q[j] = cval2[i];
    }
    i++;
    j++;
  }
  if (hierarch) {
    sprintf(safe_line, "%-29s= '%s' / %s", key, cval_q, ccom);
    if (strlen(key) + strlen(cval_q) + 3 >= 80)
      safe_line[79] = '\'';
  } else {
    sprintf(safe_line, "%-8.8s= '%-8s' / %s", key, cval_q, ccom);
  }
  strncpy(line, safe_line, 80);
  line[80] = (char)0;
  return;
}
```