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

```asm
<read_6>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%rbx
  mov    %rsi,0x8(%rsp)
  mov    %rdx,0x10(%rsp)
  mov    %rcx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  call   <fgetc@plt>
  cmp    $0x20,%al
  jne    L46
  lea    0x20(%rsp),%rsi
  mov    $0x14,%edx
  mov    %rbx,%rdi
  call   <getval@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  je     L5
  lea    0x20(%rsp),%rsi
  mov    $0x14,%edx
  mov    %rbx,%rdi
  call   <getval@plt>
  mov    %eax,%r13d
  cmp    $0xffffffff,%eax
  je     L81
  lea    0x20(%rsp),%rsi
  mov    $0x14,%edx
  mov    %rbx,%rdi
  call   <getval@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L2
  mov    %eax,%ecx
  mov    %r13d,%edx
  mov    %r12d,%esi
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12d,%eax
  imul   %r13d,%eax
  lea    (%rax,%rax,2),%r15d
  mov    %r15d,%ebp
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L55
  mov    %rbx,%rcx
  mov    %r15d,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  cmp    %r15d,%eax
  jne    L1
  mov    0x8(%rsp),%rax
  mov    %r14,(%rax)
  mov    0x10(%rsp),%rax
  mov    %r12d,(%rax)
  mov    0x18(%rsp),%rax
  mov    %r13d,(%rax)
L89:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L117
  mov    %ebp,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L46:
  lea    D57(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%ebp
  jmp    L89
L5:
  mov    $0xffffffff,%esi
  lea    D23(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12d,%ebp
  jmp    L89
L81:
  mov    $0xffffffff,%esi
  lea    D52(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r13d,%ebp
  jmp    L89
L2:
  mov    $0xffffffff,%esi
  lea    D53(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L89
L55:
  lea    D66(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%ebp
  jmp    L89
L1:
  lea    D4(%rip),%rdi
  call   <puts@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    $0xffffffff,%ebp
  jmp    L89
L117:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D31
type: string
name: extract_symbolic_data
arguments: tag: D57
type: string
name: extract_symbolic_data
arguments: tag: D23
type: string
name: extract_symbolic_data
arguments: tag: D52
type: string
name: extract_symbolic_data
arguments: tag: D53
type: string
name: extract_symbolic_data
arguments: tag: D66
type: string
name: extract_symbolic_data
arguments: tag: D4
type: string

tool: D31: Width = %d, Height = %d, Max = %d


tool: D57: Invalid File

tool: D23: Invalid Width %d


tool: D52: Invalid Height %d


tool: D53: Invalid Maximum %d


tool: D66: You are out of memory. 

tool: D4: Failed to read file.

assistant: ```c
int read_6(FILE *fp, char **image_data, int *width, int *height) {
  int arrsize;
  char *localdata;
  char rtp;
  char buff[20];
  int imgwid;
  int imght;
  int maxval;
  int idx = 0;
  rtp = fgetc(fp);
  if (rtp != ' ') {
    printf("Invalid File\n");
    return -1;
  }
  imgwid = getval(fp, buff, 20);
  if (imgwid == -1) {
    printf("Invalid Width %d\n", imgwid);
    return -1;
  }
  imght = getval(fp, buff, 20);
  if (imght == -1) {
    printf("Invalid Height %d\n", imght);
    return -1;
  }
  maxval = getval(fp, buff, 20);
  if (maxval == -1) {
    printf("Invalid Maximum %d\n", maxval);
    return -1;
  }
  printf("Width = %d, Height = %d, Max = %d\n", imgwid, imght, maxval);
  arrsize = imgwid * imght * 3;
  localdata = malloc(arrsize * sizeof(char));
  if (localdata == NULL) {
    printf("You are out of memory. \n");
    return -1;
  }
  if (fread(localdata, sizeof(char), arrsize, fp) != (arrsize * sizeof(char))) {
    printf("Failed to read file.\n");
    free(localdata);
    localdata = NULL;
    return -1;
  }
  *image_data = localdata;
  *width = imgwid;
  *height = imght;
  return arrsize;
}
```