user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  lea    D31(%rip),%rsi
  lea    D44(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  lea    0x7(%rsp),%rcx
  lea    0x6(%rsp),%rdx
  mov    %rax,%rdi
  lea    D40(%rip),%rsi
  mov    %rax,%r13
  xor    %eax,%eax
  call   <fscanf@plt>
  movsbl 0x7(%rsp),%edx
  movzbl 0x6(%rsp),%eax
  imul   %edx,%eax
  lea    0x0(,%rax,8),%edi
  movsbl %dil,%edi
  call   <malloc@plt>
  mov    %rax,%r14
  movsbl 0x7(%rsp),%eax
  test   %al,%al
  jle    L43
  xor    %ebx,%ebx
  lea    D76(%rip),%rbp
  nopl   (%rax)
L134:
  movsbq %bl,%rax
  mov    %rbp,%rsi
  mov    %r13,%rdi
  add    $0x1,%ebx
  lea    (%r14,%rax,8),%rdx
  xor    %eax,%eax
  call   <fscanf@plt>
  movsbl 0x7(%rsp),%eax
  cmp    %bl,%al
  jg     L134
L43:
  cmpb   $0x1,0x6(%rsp)
  mov    $0x1,%r12d
  lea    D76(%rip),%rbp
  jle    L42
  nopl   0x0(%rax)
L136:
  movsbl %r12b,%ebx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  imul   %ebx,%eax
  cltq
  lea    (%r14,%rax,8),%rdx
  xor    %eax,%eax
  call   <fscanf@plt>
  movsbl 0x7(%rsp),%eax
  cmp    $0x1,%al
  jle    L118
  mov    $0x1,%r15d
  nopl   0x0(%rax)
L95:
  imul   %ebx,%eax
  movsbq %r15b,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  cltq
  add    %rdx,%rax
  lea    (%r14,%rax,8),%rdx
  xor    %eax,%eax
  call   <fscanf@plt>
  movsbl 0x7(%rsp),%ecx
  mov    %ebx,%eax
  movsbl %r15b,%edx
  add    $0x1,%r15d
  imul   %ecx,%eax
  add    %edx,%eax
  movslq %eax,%rdx
  sub    %ecx,%eax
  cltq
  mov    -0x8(%r14,%rax,8),%rax
  add    %rax,(%r14,%rdx,8)
  movsbl 0x7(%rsp),%eax
  cmp    %r15b,%al
  jg     L95
L118:
  add    $0x1,%r12d
  cmp    %r12b,0x6(%rsp)
  jg     L136
L42:
  mov    %r13,%rdi
  call   <fclose@plt>
  movsbq 0x7(%rsp),%rax
  movsbl 0x6(%rsp),%ecx
  mov    %rax,%rsi
  lea    -0x1(%rax,%rax,1),%edx
  mov    -0x8(%r14,%rax,8),%r12
  mov    %ecx,%eax
  movsbl %sil,%r8d
  movsbl %dl,%edi
  imul   %r8d,%ecx
  cmp    %ecx,%edi
  jge    L25
  cmp    $0x1,%sil
  jne    L66
  nopl   0x0(%rax)
L125:
  movsbq %dl,%rsi
  mov    (%r14,%rsi,8),%rsi
  cmp    %rsi,%r12
  cmovl  %rsi,%r12
  add    $0x1,%edx
  movsbl %dl,%esi
  cmp    %esi,%ecx
  jg     L125
L25:
  sub    $0x1,%r8d
  imul   %r8d,%eax
  movsbl %al,%edx
  cmp    %ecx,%edx
  jge    L31
  nopl   0x0(%rax,%rax,1)
L85:
  movsbq %al,%rdx
  mov    (%r14,%rdx,8),%rdx
  cmp    %rdx,%r12
  cmovl  %rdx,%r12
  add    $0x1,%eax
  movsbl %al,%edx
  cmp    %ecx,%edx
  jl     L85
L31:
  lea    D17(%rip),%rsi
  lea    D59(%rip),%rdi
  call   <fopen@plt>
  mov    %r12,%rdx
  lea    D51(%rip),%rsi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L66:
  movsbq %dl,%rdi
  mov    (%r14,%rdi,8),%rdi
  cmp    %rdi,%r12
  cmovl  %rdi,%r12
  add    %esi,%edx
  movsbl %dl,%edi
  cmp    %ecx,%edi
  jl     L66
  jmp    L25
L33:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D31
type_infered: string
name: parse_data
arguments: data_label: D44
type_infered: string
name: parse_data
arguments: data_label: D40
type_infered: string
name: parse_data
arguments: data_label: D76
type_infered: string
name: parse_data
arguments: data_label: D17
type_infered: string
name: parse_data
arguments: data_label: D59
type_infered: string
name: parse_data
arguments: data_label: D51
type_infered: string

tool: D31: r

tool: D44: INP.TXT

tool: D40: %hhd %hhd

tool: D76: %ld

tool: D17: w

tool: D59: OUT.TXT

tool: D51: %ld


assistant: ```c
int main() {
  FILE *f = fopen("INP.TXT", "r");
  char m, n, i, j;
  long *a, r;
  fscanf(f, "%hhd %hhd", &m, &n);
  a = malloc(m * n * sizeof(long));
  for (i = 0; i < n; i++)
    fscanf(f, "%ld", a + i);
  for (i = 1; i < m; i++) {
    fscanf(f, "%ld", a + i * n);
    for (j = 1; j < n; j++) {
      fscanf(f, "%ld", a + i * n + j);
      a[i * n + j] += a[i * n + j - n - 1];
    }
  }
  fclose(f);
  r = a[n - 1];
  for (i = n * 2 - 1; i < m * n; i += n)
    if (a[i] > r)
      r = a[i];
  for (i = m * (n - 1); i < m * n; i++)
    if (a[i] > r)
      r = a[i];
  f = fopen("OUT.TXT", "w");
  fprintf(f, "%ld\n", r);
  fclose(f);
  return 0;
}
```