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

```asm
<read_image>:
  endbr64
  push   %r15
  lea    D87(%rip),%rsi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  lea    D1(%rip),%rdi
  push   %rbx
  sub    $0x98,%rsp
  mov    %rdx,0x8(%rsp)
  mov    %rcx,0x10(%rsp)
  mov    %r8,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L65
L43:
  lea    0x30(%rsp),%r12
  lea    D32(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  mov    %r12,%rdx
  call   <fscanf@plt>
  lea    D36(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L87
L73:
  mov    %r13,%rdx
  mov    $0x50,%esi
  mov    %r12,%rdi
  call   <fgets@plt>
  mov    %r13,%rdx
  mov    $0x50,%esi
  mov    %r12,%rdi
  call   <fgets@plt>
  lea    0x24(%rsp),%rcx
  mov    %r13,%rdi
  xor    %eax,%eax
  lea    0x28(%rsp),%rdx
  lea    D62(%rip),%rsi
  call   <fscanf@plt>
  lea    0x2c(%rsp),%rdx
  mov    %r13,%rdi
  xor    %eax,%eax
  lea    D58(%rip),%rbx
  mov    %rbx,%rsi
  call   <fscanf@plt>
  mov    0x28(%rsp),%edx
  mov    0x24(%rsp),%esi
  xor    %eax,%eax
  lea    D34(%rip),%rdi
  call   <printf@plt>
  mov    0x24(%rsp),%edx
  test   %edx,%edx
  jle    L68
  xor    %r12d,%r12d
  nop
L46:
  mov    0x28(%rsp),%eax
  mov    %rbp,%r15
  xor    %r14d,%r14d
  test   %eax,%eax
  jle    L26
  xchg   %ax,%ax
L54:
  mov    %r15,%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  add    $0x1,%r14d
  add    $0x4,%r15
  cmp    %r14d,0x28(%rsp)
  jg     L54
L26:
  add    $0x1,%r12d
  add    $0xebc,%rbp
  cmp    %r12d,0x24(%rsp)
  jg     L46
L68:
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    0x24(%rsp),%eax
  mov    0x8(%rsp),%rcx
  mov    %eax,(%rcx)
  mov    0x28(%rsp),%eax
  mov    0x10(%rsp),%rcx
  mov    %eax,(%rcx)
  mov    0x2c(%rsp),%eax
  mov    0x18(%rsp),%rcx
  mov    %eax,(%rcx)
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L60
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L87:
  lea    D42(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L73
L65:
  lea    D70(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L43
L60:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D87
datatype: string
name: disassemble_data
arguments: data_tag: D1
datatype: string
name: disassemble_data
arguments: data_tag: D32
datatype: string
name: disassemble_data
arguments: data_tag: D36
datatype: string
name: disassemble_data
arguments: data_tag: D62
datatype: string
name: disassemble_data
arguments: data_tag: D58
datatype: string
name: disassemble_data
arguments: data_tag: D34
datatype: string
name: disassemble_data
arguments: data_tag: D42
datatype: string
name: disassemble_data
arguments: data_tag: D70
datatype: string

tool: D87: r

tool: D1: logo.pgm

tool: D32: %s

tool: D36: P2

tool: D62: %d%d

tool: D58: %d

tool: D34: image reading ... h = %d w = %d


tool: D42: the image format must be P2

tool: D70: file open error

assistant: ```c
void read_image(int image[827][943], char file_name[], int *p_h, int *p_w, int *p_levels) {
  FILE *fin;
  int i, j, h, w, levels;
  char buffer[80];
  fin = fopen("logo.pgm", "r");
  if (fin == NULL) {
    printf("file open error\n");
    exit(-1);
  }
  fscanf(fin, "%s", buffer);
  if (strcmp(buffer, "P2")) {
    printf("the image format must be P2\n");
    exit(-1);
  }
  fgets(buffer, 80, fin);
  fgets(buffer, 80, fin);
  fscanf(fin, "%d%d", &w, &h);
  fscanf(fin, "%d", &levels);
  printf("image reading ... h = %d w = %d\n", h, w);
  for (i = 0; i < h; i++)
    for (j = 0; j < w; j++)
      fscanf(fin, "%d", &image[i][j]);
  fclose(fin);
  *p_h = h;
  *p_w = w;
  *p_levels = levels;
  return;
}
```