user: 请将以下的汇编代码转换成C语言代码：

```asm
<read_graphics>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rsi,0x10(%rsp)
  mov    %edx,0x18(%rsp)
  mov    %ecx,%r13d
  mov    %r8d,%r15d
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    D26(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  mov    $0x0,%ebx
  test   %rax,%rax
  je     L117
L65:
  mov    %r12,%rdi
  call   <fgetc@plt>
  cmp    $0xa,%al
  sete   %al
  movzbl %al,%eax
  add    %eax,%ebx
  cmp    $0x2,%ebx
  jle    L65
  test   %r15d,%r15d
  je     L131
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  jle    L104
  mov    %eax,%ecx
  mov    %rcx,0x18(%rsp)
  cltq
  shl    $0x2,%rax
  mov    %rax,0x8(%rsp)
  mov    $0x0,%r15d
  lea    D11(%rip),%r14
  jmp    L112
L117:
  lea    D6(%rip),%rdi
  call   <printf@plt>
  jmp    L126
L131:
  cmpl   $0x0,0x18(%rsp)
  jle    L104
  movl   $0x0,0x8(%rsp)
  lea    D11(%rip),%r14
  jmp    L105
L80:
  movslq 0x8(%rsp),%rdx
  mov    0x10(%rsp),%rcx
  lea    (%rcx,%rdx,4),%rbx
  lea    -0x1(%r13),%eax
  add    %rdx,%rax
  lea    0x4(%rcx,%rax,4),%rbp
L93:
  lea    0x24(%rsp),%rdx
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <fscanf@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ssl 0x24(%rsp),%xmm0
  movss  %xmm0,(%rbx)
  add    $0x4,%rbx
  cmp    %rbx,%rbp
  jne    L93
L37:
  add    $0x1,%r15d
  add    %r13d,0x8(%rsp)
  cmp    %r15d,0x18(%rsp)
  je     L104
L105:
  test   %r13d,%r13d
  jg     L80
  jmp    L37
L6:
  lea    0x24(%rsp),%rdx
  mov    %r14,%rsi
  mov    %r12,%rdi
  call   <fscanf@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ssl 0x24(%rsp),%xmm0
  movss  %xmm0,0x0(%rbp)
  add    $0x1,%ebx
  add    0x8(%rsp),%rbp
  cmp    %ebx,%r13d
  jne    L6
L145:
  add    $0x1,%r15
  cmp    0x18(%rsp),%r15
  je     L104
L112:
  mov    0x10(%rsp),%rax
  lea    (%rax,%r15,4),%rbp
  mov    $0x0,%ebx
  test   %r13d,%r13d
  jg     L6
  jmp    L145
L104:
  mov    %r12,%rdi
  call   <fclose@plt>
L126:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L54
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L54:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D26
type: string
name: unpack_data
arguments: label: D11
type: string
name: unpack_data
arguments: label: D6
type: string

tool: D26: r

tool: D11: %d

tool: D6: The file was not opened for reading


assistant: ```c
void read_graphics(char *filename, float *input, int data_rows, int data_cols, int major) {
  FILE *fid;
  int i, j;
  char c;
  int temp;
  fid = fopen(filename, "r");
  if (fid == NULL) {
    printf("The file was not opened for reading\n");
    return;
  }
  i = 0;
  while (i < 3) {
    c = fgetc(fid);
    if (c == '\n') {
      i = i + 1;
    }
  };
  if (major == 0) {
    for (i = 0; i < data_rows; i++) {
      for (j = 0; j < data_cols; j++) {
        fscanf(fid, "%d", &temp);
        input[i * data_cols + j] = (float)temp;
      }
    }
  } else {
    for (i = 0; i < data_rows; i++) {
      for (j = 0; j < data_cols; j++) {
        fscanf(fid, "%d", &temp);
        input[j * data_rows + i] = (float)temp;
      }
    }
  }
  fclose(fid);
}
```