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

```asm
<journey>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  lea    D9(%rip),%rsi
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <fopen@plt>
  lea    D1(%rip),%rsi
  mov    %r13,%rdi
  mov    %rax,%r12
  call   <fopen@plt>
  mov    %r12,%rdi
  mov    %rax,-0x68(%rbp)
  call   <numbread@plt>
  mov    %r12,%rdi
  mov    %rax,%r14
  call   <numbread@plt>
  mov    %r12,%rdi
  mov    %rax,%rbx
  mov    %rax,-0x50(%rbp)
  call   <numbread@plt>
  imul   %r14,%rbx
  mov    %rsp,%rsi
  mov    %rax,-0x48(%rbp)
  lea    0x0(,%rbx,8),%rdx
  mov    %rbx,-0x70(%rbp)
  lea    0xf(%rdx),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L86
L30:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L30
L86:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  jne    L12
L73:
  mov    %rsp,%rdi
  cmpq   $0x0,-0x70(%rbp)
  mov    %rdi,-0x58(%rbp)
  jle    L9
  xor    %esi,%esi
  call   <memset@plt>
L9:
  lea    -0x1(%r14),%rax
  mov    %rax,-0x60(%rbp)
  test   %rax,%rax
  jle    L133
  xor    %r13d,%r13d
  cmpq   $0x0,-0x48(%rbp)
  jle    L133
  xchg   %ax,%ax
L103:
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L66:
  mov    %r12,%rdi
  call   <numbread@plt>
  mov    %r12,%rdi
  mov    %rax,%r15
  call   <numbread@plt>
  cmp    %r13,%r15
  jle    L68
  cmp    %r15,%r14
  jle    L68
  mov    -0x58(%rbp),%r9
  mov    -0x50(%rbp),%rcx
  mov    %r14,%r8
  mov    %rax,%rdx
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <arrayadd@plt>
L68:
  add    $0x1,%rbx
  cmp    %rbx,-0x48(%rbp)
  jne    L66
  add    $0x1,%r13
  cmp    -0x60(%rbp),%r13
  jne    L103
L133:
  mov    -0x70(%rbp),%r15
  mov    %r15,%r13
  sub    -0x50(%rbp),%r13
  cmp    %r13,%r15
  jle    L70
  mov    %r12,-0x48(%rbp)
  mov    -0x68(%rbp),%r14
  mov    %r13,%r12
  lea    D8(%rip),%rbx
  mov    -0x58(%rbp),%r13
  nopl   0x0(%rax,%rax,1)
L98:
  mov    0x0(%r13,%r12,8),%rdx
  mov    %rbx,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x1,%r12
  call   <fprintf@plt>
  cmp    %r12,%r15
  jne    L98
  mov    -0x48(%rbp),%r12
L70:
  mov    -0x68(%rbp),%rbx
  mov    $0xa,%edi
  mov    %rbx,%rsi
  call   <fputc@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L12:
  orq    $0x0,-0x8(%rsp,%rcx,1)
  jmp    L73
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D9
type_guessed: string
name: unpack_data
arguments: label: D1
type_guessed: string
name: unpack_data
arguments: label: D8
type_guessed: string

tool: D9: r

tool: D1: w

tool: D8: %ld 

assistant: ```c
void journey(char *inputfilename, char *outputfilename) {
  FILE *inputfile;
  FILE *outputfile;
  inputfile = fopen(inputfilename, "r");
  outputfile = fopen(outputfilename, "w");
  long n = numbread(inputfile);
  long m = numbread(inputfile);
  long h = numbread(inputfile);
  long i, j, k, o;
  long consty = n * m;
  long a[consty];
  for (o = 0; o < n * m; o++) {
    a[o] = 0;
  }
  for (i = 0; i < n - 1; i++) {
    for (o = 0; o < h; o++) {
      j = numbread(inputfile);
      k = numbread(inputfile);
      if ((i < j) && (j < n)) {
        arrayadd(i, j, k, m, n, a);
      }
    }
  }
  for (o = n * m - m; o < n * m; o++) {
    fprintf(outputfile, "%ld ", a[o]);
  }
  fprintf(outputfile, "\n");
  fclose(inputfile);
  fclose(outputfile);
}
```