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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x88,%rsp
  cmp    $0x1,%edi
  je     L96
L76:
  mov    %ebp,%esi
  lea    D2(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rbx),%rdi
  call   <atoi@plt>
  mov    0x10(%rbx),%rdi
  mov    %eax,0x78(%rsp)
  call   <atoi@plt>
  mov    0x18(%rbx),%rdi
  mov    %eax,%r15d
  mov    %eax,0x2c(%rsp)
  call   <atoi@plt>
  mov    0x20(%rbx),%rdi
  mov    %r15d,%ebx
  mov    %eax,%r14d
  mov    %eax,0x70(%rsp)
  call   <atoi@plt>
  mov    %r14d,%ecx
  mov    %r15d,%edx
  lea    D13(%rip),%rdi
  movslq %eax,%r12
  mov    %eax,0x7c(%rsp)
  xor    %eax,%eax
  mov    %r12d,%esi
  call   <printf@plt>
  mov    %r15d,%eax
  mov    %r12,0x68(%rsp)
  imul   %r12d,%eax
  mov    %eax,%ebp
  mov    %eax,0x74(%rsp)
  imul   %r14d,%ebp
  shl    $0x3,%ebp
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x8(%rsp)
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x60(%rsp)
  mov    %rax,%r13
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x30(%rsp)
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x38(%rsp)
  call   <malloc@plt>
  test   %r14d,%r14d
  mov    0x8(%rsp),%r9
  mov    %rax,0x50(%rsp)
  jle    L49
  test   %ebx,%ebx
  jle    L49
  test   %r12d,%r12d
  jle    L49
  sub    %r9,%r13
  movl   $0x0,0x58(%rsp)
  lea    0x0(,%r12,8),%r14
  movl   $0x0,0x48(%rsp)
  mov    %r13,0x40(%rsp)
  mov    %r9,0x20(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L44:
  movslq 0x58(%rsp),%rax
  mov    0x68(%rsp),%rdi
  xor    %r9d,%r9d
  mov    0x20(%rsp),%rsi
  lea    0x0(,%rax,8),%rcx
  lea    (%rdi,%rax,1),%r15
  mov    0x50(%rsp),%rax
  shl    $0x3,%r15
  lea    (%rcx,%rsi,1),%rbx
  add    %rax,%rcx
  lea    (%rsi,%r15,1),%rbp
  add    %rax,%r15
  mov    %rcx,%rax
  mov    %r15,%rcx
  mov    %rax,%r15
  xchg   %ax,%ax
L62:
  mov    0x40(%rsp),%rax
  mov    0x30(%rsp),%r12
  mov    0x38(%rsp),%r13
  lea    0x0(%rbp,%rax,1),%rdi
  lea    (%rbx,%rax,1),%r8
  mov    0x20(%rsp),%rax
  sub    %rax,%r12
  sub    %rax,%r13
  lea    0x0(%rbp,%r12,1),%rsi
  lea    0x0(%rbp,%r13,1),%r10
  add    %rbx,%r12
  add    %rbx,%r13
  cmp    %rdi,%rbx
  setae  %dl
  cmp    %r8,%rbp
  setbe  %al
  or     %eax,%edx
  cmp    %rsi,%rbx
  setae  %al
  cmp    %r12,%rbp
  setbe  %r11b
  or     %r11d,%eax
  and    %edx,%eax
  cmp    %rcx,%rbx
  setae  %dl
  cmp    %r15,%rbp
  setbe  %r11b
  or     %r11d,%edx
  and    %eax,%edx
  cmp    %r10,%rbx
  setae  %al
  cmp    %r13,%rbp
  setbe  %r11b
  or     %r11d,%eax
  and    %edx,%eax
  cmp    %rsi,%r8
  setae  %dl
  cmp    %r12,%rdi
  setbe  %r11b
  or     %r11d,%edx
  and    %eax,%edx
  cmp    %r10,%r8
  setae  %al
  cmp    %r13,%rdi
  setbe  %r11b
  or     %r11d,%eax
  and    %eax,%edx
  cmp    %rcx,%r8
  mov    %edx,%r11d
  setae  %dl
  cmp    %r15,%rdi
  setbe  %al
  or     %edx,%eax
  and    %r11d,%eax
  cmp    %r10,%r12
  setae  %dl
  cmp    %r13,%rsi
  setbe  %dil
  or     %edi,%edx
  and    %eax,%edx
  cmp    %rcx,%r12
  setae  %al
  cmp    %r15,%rsi
  setbe  %sil
  or     %esi,%eax
  test   %al,%dl
  je     L60
  cmp    %rcx,%r13
  setae  %al
  cmp    %r15,%r10
  setbe  %dl
  or     %dl,%al
  je     L60
  mov    %r14,%rdx
  xor    %esi,%esi
  mov    %r15,%rdi
  mov    %rcx,0x18(%rsp)
  mov    %r9d,0x10(%rsp)
  mov    %r8,0x8(%rsp)
  call   <memset@plt>
  mov    %r14,%rdx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    %r14,%rdx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    0x8(%rsp),%rdi
  mov    %r14,%rdx
  xor    %esi,%esi
  call   <memset@plt>
  mov    %r14,%rdx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    0x10(%rsp),%r9d
  mov    0x18(%rsp),%rcx
L89:
  add    $0x1,%r9d
  add    %r14,%rbx
  add    %r14,%rbp
  add    %r14,%rcx
  add    %r14,%r15
  cmp    %r9d,0x2c(%rsp)
  jne    L62
  addl   $0x1,0x48(%rsp)
  mov    0x74(%rsp),%ebx
  mov    0x48(%rsp),%eax
  add    %ebx,0x58(%rsp)
  cmp    %eax,0x70(%rsp)
  jne    L44
  mov    0x20(%rsp),%r9
L49:
  mov    0x78(%rsp),%ebp
  lea    D84(%rip),%r15
  lea    D114(%rip),%rbx
  mov    %r9,0x58(%rsp)
  lea    D63(%rip),%r12
  mov    %r15,%rdx
  mov    %rbx,%rdi
  mov    %ebp,%esi
  lea    D56(%rip),%r13
  lea    D21(%rip),%r14
  call   <open_file@plt>
  mov    %r15,%rdx
  mov    %ebp,%esi
  mov    %r12,%rdi
  mov    %rax,0x8(%rsp)
  call   <open_file@plt>
  mov    %r15,%rdx
  mov    %ebp,%esi
  mov    %r13,%rdi
  mov    %rax,0x40(%rsp)
  call   <open_file@plt>
  mov    %r15,%rdx
  mov    %ebp,%esi
  mov    %r14,%rdi
  mov    %rax,0x20(%rsp)
  call   <open_file@plt>
  mov    %r15,%rdx
  lea    D12(%rip),%r15
  mov    %ebp,%esi
  mov    %r15,%rdi
  mov    %rax,0x10(%rsp)
  call   <open_file@plt>
  lea    D4(%rip),%rdi
  mov    %rax,0x18(%rsp)
  call   <puts@plt>
  mov    0x8(%rsp),%r8
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    0x7c(%rsp),%esi
  mov    0x38(%rsp),%rdi
  call   <read_subsample@plt>
  mov    %ebp,0x78(%rsp)
  mov    %ebp,%edx
  mov    %rbx,%rsi
  lea    D51(%rip),%rbp
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    0x40(%rsp),%r10
  mov    0x58(%rsp),%r9
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    0x7c(%rsp),%esi
  mov    %r10,%r8
  mov    %r9,%rdi
  mov    %r10,0x48(%rsp)
  mov    %r9,0x40(%rsp)
  call   <read_subsample@plt>
  mov    0x78(%rsp),%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x20(%rsp),%r8
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    0x7c(%rsp),%esi
  mov    0x60(%rsp),%rdi
  call   <read_subsample@plt>
  mov    0x78(%rsp),%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x10(%rsp),%r8
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    0x7c(%rsp),%esi
  mov    0x30(%rsp),%rdi
  call   <read_subsample@plt>
  mov    0x78(%rsp),%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x18(%rsp),%r8
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    0x7c(%rsp),%esi
  mov    0x50(%rsp),%rdi
  call   <read_subsample@plt>
  mov    0x78(%rsp),%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rdi
  call   <fclose@plt>
  mov    0x48(%rsp),%rdi
  call   <fclose@plt>
  mov    0x20(%rsp),%rdi
  call   <fclose@plt>
  mov    0x10(%rsp),%rdi
  call   <fclose@plt>
  mov    0x18(%rsp),%rdi
  call   <fclose@plt>
  mov    0x7c(%rsp),%ebp
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    0x38(%rsp),%rdi
  mov    %ebp,%esi
  call   <div_mesh@plt>
  mov    0x40(%rsp),%r9
  mov    0x70(%rsp),%ecx
  mov    %ebp,%esi
  mov    0x2c(%rsp),%edx
  mov    %r9,%rdi
  mov    %r9,0x8(%rsp)
  call   <div_mesh@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %ebp,%esi
  mov    0x60(%rsp),%rdi
  call   <div_mesh@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %ebp,%esi
  mov    0x30(%rsp),%rdi
  call   <div_mesh@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %ebp,%esi
  mov    0x50(%rsp),%rdi
  call   <div_mesh@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %rbx,%r8
  mov    0x38(%rsp),%rdi
  mov    %ebp,%esi
  call   <output@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %r12,%r8
  mov    0x8(%rsp),%rdi
  mov    %ebp,%esi
  call   <output@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %r13,%r8
  mov    0x60(%rsp),%rdi
  mov    %ebp,%esi
  call   <output@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %r14,%r8
  mov    0x30(%rsp),%rdi
  mov    %ebp,%esi
  call   <output@plt>
  mov    0x70(%rsp),%ecx
  mov    0x2c(%rsp),%edx
  mov    %r15,%r8
  mov    0x50(%rsp),%rdi
  mov    %ebp,%esi
  call   <output@plt>
  mov    0x38(%rsp),%rcx
  mov    0x70(%rsp),%edx
  mov    %ebp,%edi
  mov    0x2c(%rsp),%esi
  mov    %rbx,%r8
  mov    %ebp,%ebx
  call   <WriteBinFile@plt>
  mov    0x2c(%rsp),%ebp
  mov    %r12,%r8
  mov    %ebx,%edi
  mov    0x70(%rsp),%r12d
  mov    0x8(%rsp),%rcx
  mov    %ebp,%esi
  mov    %r12d,%edx
  call   <WriteBinFile@plt>
  mov    0x60(%rsp),%rcx
  mov    %r13,%r8
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  mov    %r12d,%r13d
  call   <WriteBinFile@plt>
  mov    0x30(%rsp),%rcx
  mov    %r14,%r8
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <WriteBinFile@plt>
  mov    0x50(%rsp),%r12
  mov    %r15,%r8
  mov    %r13d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  mov    %r12,%rcx
  call   <WriteBinFile@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x60(%rsp),%rdi
  call   <free@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    %r13d,%ecx
  mov    %ebp,%edx
  mov    %ebx,%esi
  lea    D92(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x88,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L60:
  mov    0x50(%rsp),%r10
  mov    0x38(%rsp),%r8
  mov    %r15,%rax
  mov    0x30(%rsp),%rdi
  mov    0x60(%rsp),%rsi
  mov    0x20(%rsp),%rdx
  sub    %r10,%r8
  sub    %r10,%rdi
  sub    %r10,%rsi
  sub    %r10,%rdx
  nopl   0x0(%rax)
L88:
  movq   $0x0,(%rax)
  movq   $0x0,(%r8,%rax,1)
  movq   $0x0,(%rdi,%rax,1)
  movq   $0x0,(%rsi,%rax,1)
  movq   $0x0,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    %rcx,%rax
  jne    L88
  jmp    L89
L96:
  lea    D53(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L76
```

tool_calls: name: read_data
arguments: label: D2
datatype: string
name: read_data
arguments: label: D13
datatype: string
name: read_data
arguments: label: D84
datatype: string
name: read_data
arguments: label: D114
datatype: string
name: read_data
arguments: label: D63
datatype: string
name: read_data
arguments: label: D56
datatype: string
name: read_data
arguments: label: D21
datatype: string
name: read_data
arguments: label: D12
datatype: string
name: read_data
arguments: label: D4
datatype: string
name: read_data
arguments: label: D51
datatype: string
name: read_data
arguments: label: D92
datatype: string
name: read_data
arguments: label: D53
datatype: string

tool: D2: %d


tool: D13: Your mesh will has a final size:
 nx = %d, ny = %d, nz = %d


tool: D84: r

tool: D114: Density

tool: D63: Vx

tool: D56: Vy

tool: D21: Vz

tool: D12: Energy

tool: D4: Comenzando la lectura...

tool: D51: Lectura del archivo %s%.06d.dat OK


tool: D92: Final mesh size: nx=%d, ny=%d, nz=%d


tool: D53: usage: ./div <n> <ny> <nz> <new nx dim> 

assistant: ```c
int main(int argc, char *argv[]) {
  FILE *density;
  FILE *vx;
  FILE *vy;
  FILE *vz;
  FILE *energy;
  char name[512];
  int n;
  int nx;
  int ny;
  int nz;
  int stride;
  int dim;
  int i, j, k;
  double *Vx, *Vy, *Vz;
  double *Density;
  double *Energy;
  if (argc == 1) {
    printf("usage: ./div <n> <ny> <nz> <new nx dim> \n");
    exit(1);
  }
  printf("%d\n", argc);
  n = atoi(argv[1]);
  ny = atoi(argv[2]);
  nz = atoi(argv[3]);
  nx = atoi(argv[4]);
  printf("Your mesh will has a final size:\n nx = %d, ny = %d, nz = %d\n", nx, ny, nz);
  stride = nx * ny;
  Vx = (double *)malloc(sizeof(double) * nx * ny * nz);
  Vy = (double *)malloc(sizeof(double) * nx * ny * nz);
  Vz = (double *)malloc(sizeof(double) * nx * ny * nz);
  Density = (double *)malloc(sizeof(double) * nx * ny * nz);
  Energy = (double *)malloc(sizeof(double) * nx * ny * nz);
  for (k = 0; k < nz; k++) {
    for (j = 0; j < ny; j++) {
      for (i = 0; i < nx; i++) {
        Vx[i + j * nx + k * stride] = Vy[i + j * nx + k * stride] = Vz[i + j * nx + k * stride] = Density[i + j * nx + k * stride] = Energy[i + j * nx + k * stride] = 0;
      }
    }
  }
  density = open_file("Density", n, "r");
  vx = open_file("Vx", n, "r");
  vy = open_file("Vy", n, "r");
  vz = open_file("Vz", n, "r");
  energy = open_file("Energy", n, "r");
  printf("Comenzando la lectura...\n");
  read_subsample(Density, nx, ny, nz, density);
  printf("Lectura del archivo %s%.06d.dat OK\n", "Density", n);
  read_subsample(Vx, nx, ny, nz, vx);
  printf("Lectura del archivo %s%.06d.dat OK\n", "Vx", n);
  read_subsample(Vy, nx, ny, nz, vy);
  printf("Lectura del archivo %s%.06d.dat OK\n", "Vy", n);
  read_subsample(Vz, nx, ny, nz, vz);
  printf("Lectura del archivo %s%.06d.dat OK\n", "Vz", n);
  read_subsample(Energy, nx, ny, nz, energy);
  printf("Lectura del archivo %s%.06d.dat OK\n", "Energy", n);
  fclose(density);
  fclose(vx);
  fclose(vy);
  fclose(vz);
  fclose(energy);
  div_mesh(Density, nx, ny, nz);
  div_mesh(Vx, nx, ny, nz);
  div_mesh(Vy, nx, ny, nz);
  div_mesh(Vz, nx, ny, nz);
  div_mesh(Energy, nx, ny, nz);
  output(Density, nx, ny, nz, "Density");
  output(Vx, nx, ny, nz, "Vx");
  output(Vy, nx, ny, nz, "Vy");
  output(Vz, nx, ny, nz, "Vz");
  output(Energy, nx, ny, nz, "Energy");
  WriteBinFile(nx, ny, nz, Density, "Density");
  WriteBinFile(nx, ny, nz, Vx, "Vx");
  WriteBinFile(nx, ny, nz, Vy, "Vy");
  WriteBinFile(nx, ny, nz, Vz, "Vz");
  WriteBinFile(nx, ny, nz, Energy, "Energy");
  free(Vx);
  free(Vy);
  free(Vz);
  free(Energy);
  free(Density);
  printf("Final mesh size: nx=%d, ny=%d, nz=%d\n", nx, ny, nz);
  return 1;
}
```