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
  push   %r12
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,-0xa8(%rbp)
  mov    %rsi,-0xb0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0xa8(%rbp),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x88(%rbp)
  mov    -0xb0(%rbp),%rax
  lea    D17(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x80(%rbp)
  mov    -0x88(%rbp),%rax
  mov    %rax,%rdi
  call   <numbread@plt>
  mov    %rax,-0x78(%rbp)
  mov    -0x88(%rbp),%rax
  mov    %rax,%rdi
  call   <numbread@plt>
  mov    %rax,-0x70(%rbp)
  mov    -0x88(%rbp),%rax
  mov    %rax,%rdi
  call   <numbread@plt>
  mov    %rax,-0x68(%rbp)
  mov    -0x78(%rbp),%rax
  imul   -0x70(%rbp),%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x60(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x58(%rbp)
  mov    %rax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  mov    %rax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  lea    0x0(,%rax,8),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L50:
  cmp    %rdx,%rsp
  je     L42
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L50
L42:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L21
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L21:
  mov    %rsp,%rax
  add    $0x7,%rax
  shr    $0x3,%rax
  shl    $0x3,%rax
  mov    %rax,-0x50(%rbp)
  movq   $0x0,-0x90(%rbp)
  jmp    L126
L7:
  mov    -0x50(%rbp),%rax
  mov    -0x90(%rbp),%rdx
  movq   $0x0,(%rax,%rdx,8)
  addq   $0x1,-0x90(%rbp)
L126:
  mov    -0x78(%rbp),%rax
  imul   -0x70(%rbp),%rax
  cmp    %rax,-0x90(%rbp)
  jl     L7
  movq   $0x0,-0x98(%rbp)
  jmp    L62
L114:
  movq   $0x0,-0x90(%rbp)
  jmp    L45
L66:
  mov    -0x88(%rbp),%rax
  mov    %rax,%rdi
  call   <numbread@plt>
  mov    %rax,-0x48(%rbp)
  mov    -0x88(%rbp),%rax
  mov    %rax,%rdi
  call   <numbread@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x98(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jge    L113
  mov    -0x48(%rbp),%rax
  cmp    -0x78(%rbp),%rax
  jge    L113
  mov    -0x50(%rbp),%r8
  mov    -0x78(%rbp),%rdi
  mov    -0x70(%rbp),%rcx
  mov    -0x40(%rbp),%rdx
  mov    -0x48(%rbp),%rsi
  mov    -0x98(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <arrayadd@plt>
L113:
  addq   $0x1,-0x90(%rbp)
L45:
  mov    -0x90(%rbp),%rax
  cmp    -0x68(%rbp),%rax
  jl     L66
  addq   $0x1,-0x98(%rbp)
L62:
  mov    -0x78(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x98(%rbp)
  jl     L114
  mov    -0x78(%rbp),%rax
  imul   -0x70(%rbp),%rax
  sub    -0x70(%rbp),%rax
  mov    %rax,-0x90(%rbp)
  jmp    L11
L74:
  mov    -0x50(%rbp),%rax
  mov    -0x90(%rbp),%rdx
  mov    (%rax,%rdx,8),%rdx
  mov    -0x80(%rbp),%rax
  lea    D21(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  addq   $0x1,-0x90(%rbp)
L11:
  mov    -0x78(%rbp),%rax
  imul   -0x70(%rbp),%rax
  cmp    %rax,-0x90(%rbp)
  jl     L74
  mov    -0x80(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  mov    -0x88(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x80(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    %rbx,%rsp
  nop
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L63
  call   <__stack_chk_fail@plt>
L63:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: label: D6
type_infered: string
name: retrieve_data
arguments: label: D17
type_infered: string
name: retrieve_data
arguments: label: D21
type_infered: string

tool: D6: r

tool: D17: w

tool: D21: %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);
}
```