user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x3c000(%rsp),%r11
L95:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L95
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x3c008(%rsp)
  xor    %eax,%eax
  mov    %rsi,%rbx
  cmp    $0x2,%edi
  jle    L5
  mov    0x8(%rsi),%rdi
  call   <atoi@plt>
  mov    0x10(%rbx),%rdi
  mov    %eax,%r14d
  mov    %eax,0x5c(%rsp)
  call   <atoi@plt>
  or     %eax,%r14d
  mov    %eax,%r15d
  js     L166
  cmpl   $0x14,0x5c(%rsp)
  jg     L52
  cmp    $0x14,%eax
  jg     L52
L65:
  mov    0x5c(%rsp),%ecx
  mov    $0x15,%edx
  mov    %r15d,%r8d
  xor    %eax,%eax
  mov    $0x15,%esi
  lea    D94(%rip),%rdi
  lea    0x70(%rsp),%r12
  call   <printf@plt>
  lea    D35(%rip),%rdi
  call   <puts@plt>
  mov    $0xa8,%edi
  call   <malloc@plt>
  mov    $0xdc8,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  lea    D310(%rip),%rdi
  mov    %rax,0x68(%rsp)
  call   <puts@plt>
  movapd D53(%rip),%xmm0
  mov    D151(%rip),%rax
  mov    %r12,0x48(%rsp)
  movdqa D85(%rip),%xmm2
  movdqa D212(%rip),%xmm5
  lea    0x390(%rsp),%rdx
  movups %xmm0,0x0(%rbp)
  movapd D145(%rip),%xmm0
  movapd D255(%rip),%xmm4
  movapd D88(%rip),%xmm3
  mov    %rax,0xa0(%rbp)
  mov    %r12,%rax
  movups %xmm0,0x10(%rbp)
  movapd D316(%rip),%xmm0
  movups %xmm0,0x20(%rbp)
  movapd D193(%rip),%xmm0
  movups %xmm0,0x30(%rbp)
  movapd D124(%rip),%xmm0
  movups %xmm0,0x40(%rbp)
  movapd D234(%rip),%xmm0
  movups %xmm0,0x50(%rbp)
  movapd D71(%rip),%xmm0
  movups %xmm0,0x60(%rbp)
  movapd D295(%rip),%xmm0
  movups %xmm0,0x70(%rbp)
  movapd D118(%rip),%xmm0
  movups %xmm0,0x80(%rbp)
  movapd D194(%rip),%xmm0
  movups %xmm0,0x90(%rbp)
L59:
  movdqa %xmm2,%xmm0
  add    $0x20,%rax
  paddd  %xmm5,%xmm2
  cvtdq2pd %xmm0,%xmm1
  mulpd  %xmm4,%xmm1
  pshufd $0xee,%xmm0,%xmm0
  cvtdq2pd %xmm0,%xmm0
  mulpd  %xmm4,%xmm0
  addpd  %xmm3,%xmm1
  addpd  %xmm3,%xmm0
  movaps %xmm1,-0x20(%rax)
  movaps %xmm0,-0x10(%rax)
  cmp    %rax,%rdx
  jne    L59
  mov    D151(%rip),%rax
  mov    %rbp,0x10(%rsp)
  movq   $0x0,0x8(%rsp)
  mov    %rax,0x390(%rsp)
  mov    %r12,0x20(%rsp)
  mov    %r15d,0x18(%rsp)
  mov    0x68(%rsp),%r15
L175:
  mov    0x8(%rsp),%rcx
  mov    0x10(%rsp),%rax
  xor    %r12d,%r12d
  mov    %ecx,%r14d
  mov    %rax,%rbx
  lea    (%rax,%rcx,8),%r13
L165:
  mov    %r12d,%edx
  mov    $0x15,%ecx
  mov    $0x15,%esi
  mov    %r14d,%edi
  call   <index_2D_to_1D@plt>
  movsd  (%rbx),%xmm1
  movsd  0x0(%r13),%xmm0
  add    $0x1,%r12d
  cltq
  add    $0x8,%rbx
  lea    (%r15,%rax,8),%rbp
  call   <xyn@plt>
  movsd  %xmm0,0x0(%rbp)
  cmp    $0x15,%r12d
  jne    L165
  addq   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%rax
  cmp    $0x15,%rax
  jne    L175
  mov    0x10(%rsp),%rbp
  mov    0x20(%rsp),%r12
  xor    %r13d,%r13d
  mov    0x18(%rsp),%r15d
  mov    %rbp,0x8(%rsp)
  mov    %r12,%r14
L169:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L14:
  mov    %ebp,%edx
  mov    $0x65,%ecx
  mov    $0x65,%esi
  mov    %r13d,%edi
  call   <index_2D_to_1D@plt>
  movsd  (%r12,%rbp,8),%xmm1
  movsd  (%r14),%xmm0
  add    $0x1,%rbp
  movslq %eax,%rbx
  call   <xyn@plt>
  movsd  %xmm0,0x3a0(%rsp,%rbx,8)
  cmp    $0x65,%rbp
  jne    L14
  add    $0x1,%r13d
  add    $0x8,%r14
  cmp    $0x65,%r13d
  jne    L169
  mov    0x8(%rsp),%rbp
  lea    D190(%rip),%rdi
  xor    %r14d,%r14d
  call   <puts@plt>
  pxor   %xmm5,%xmm5
  mov    %r12,0x50(%rsp)
  mov    %r12,0x60(%rsp)
  mov    0x68(%rsp),%r12
  movapd %xmm5,%xmm4
  mov    %rbp,%r13
  movsd  %xmm5,0x20(%rsp)
  movsd  %xmm5,0x8(%rsp)
  movsd  %xmm5,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
L91:
  xor    %ebp,%ebp
L119:
  mov    %ebp,%edx
  mov    $0x65,%ecx
  mov    $0x65,%esi
  mov    %r14d,%edi
  movsd  %xmm4,0x40(%rsp)
  call   <index_2D_to_1D@plt>
  sub    $0x8,%rsp
  mov    %r13,%r8
  mov    %r13,%rdx
  movslq %eax,%rbx
  mov    0x68(%rsp),%rax
  mov    $0x15,%ecx
  mov    %r15d,%esi
  mov    $0x15,%r9d
  movsd  (%rax,%rbp,8),%xmm1
  mov    0x58(%rsp),%rax
  add    $0x1,%rbp
  movsd  (%rax),%xmm2
  push   %r12
  mov    0x6c(%rsp),%edi
  movapd %xmm2,%xmm0
  movsd  %xmm1,0x48(%rsp)
  movsd  %xmm2,0x40(%rsp)
  call   <lagrange_interp_2Dfo@plt>
  mov    %r13,%rdx
  mov    %r12,%r8
  mov    $0x15,%ecx
  movsd  0x40(%rsp),%xmm2
  movsd  0x48(%rsp),%xmm1
  movsd  %xmm0,0x38(%rsp)
  mov    %r13,%rdi
  movsd  %xmm0,0x28150(%rsp,%rbx,8)
  mov    $0x15,%esi
  movapd %xmm2,%xmm0
  call   <lagrange_interp_2D@plt>
  movsd  0x38(%rsp),%xmm3
  movsd  0x3b0(%rsp,%rbx,8),%xmm1
  movapd %xmm0,%xmm2
  movsd  D151(%rip),%xmm6
  addsd  0x18(%rsp),%xmm6
  movsd  %xmm0,0x14280(%rsp,%rbx,8)
  subsd  %xmm1,%xmm3
  subsd  %xmm1,%xmm2
  movsd  %xmm6,0x18(%rsp)
  movapd %xmm3,%xmm1
  movapd %xmm3,%xmm0
  movsd  %xmm2,0x38(%rsp)
  mulsd  %xmm3,%xmm1
  addsd  0x20(%rsp),%xmm1
  movsd  %xmm1,0x20(%rsp)
  movapd %xmm2,%xmm1
  mulsd  %xmm2,%xmm1
  addsd  0x28(%rsp),%xmm1
  movsd  %xmm1,0x28(%rsp)
  movsd  0x30(%rsp),%xmm1
  call   <fmax@plt>
  movsd  0x50(%rsp),%xmm4
  movsd  0x38(%rsp),%xmm2
  movsd  %xmm0,0x30(%rsp)
  movapd %xmm4,%xmm1
  movapd %xmm2,%xmm0
  call   <fmax@plt>
  pop    %rax
  pop    %rdx
  movapd %xmm0,%xmm4
  cmp    $0x65,%rbp
  jne    L119
  add    $0x1,%r14d
  addq   $0x8,0x50(%rsp)
  cmp    $0x65,%r14d
  jne    L91
  mov    0x60(%rsp),%r12
  movsd  %xmm0,0x28(%rsp)
  mov    %r13,%rbp
  movsd  0x10(%rsp),%xmm0
  divsd  0x8(%rsp),%xmm0
  call   <sqrt@plt>
  lea    D56(%rip),%r13
  movsd  %xmm0,0x10(%rsp)
  movsd  0x18(%rsp),%xmm0
  divsd  0x8(%rsp),%xmm0
  call   <sqrt@plt>
  movsd  0x28(%rsp),%xmm4
  movsd  0x10(%rsp),%xmm3
  lea    D191(%rip),%rdi
  movsd  0x20(%rsp),%xmm2
  movapd %xmm0,%xmm1
  mov    $0x4,%eax
  movapd %xmm4,%xmm0
  call   <printf@plt>
  lea    D3(%rip),%rdi
  call   <puts@plt>
  mov    %r13,%rsi
  lea    D278(%rip),%rdi
  call   <fopen@plt>
  mov    %r13,%rsi
  lea    D122(%rip),%rdi
  lea    D186(%rip),%r13
  mov    %rax,%rbx
  mov    %rax,0x20(%rsp)
  call   <fopen@plt>
  mov    %rbx,%rcx
  mov    %r13,%rdi
  mov    $0x14,%edx
  mov    %rax,%r15
  mov    $0x1,%esi
  mov    %rax,0x30(%rsp)
  call   <fwrite@plt>
  mov    %r15,%rcx
  mov    %r13,%rdi
  mov    $0x14,%edx
  lea    D301(%rip),%r13
  mov    $0x1,%esi
  call   <fwrite@plt>
  mov    %r13,%rsi
  mov    %rbx,%rdi
  mov    $0x65,%edx
  xor    %eax,%eax
  xor    %ebx,%ebx
  call   <fprintf@plt>
  mov    %r13,%rsi
  mov    $0x65,%edx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D147(%rip),%r13
  call   <fprintf@plt>
  mov    %rbp,0x38(%rsp)
  mov    %r12,0x28(%rsp)
L104:
  xor    %ebp,%ebp
  nopl   0x0(%rax)
L85:
  mov    %ebp,%edx
  mov    $0x65,%ecx
  mov    $0x65,%esi
  mov    %ebx,%edi
  call   <index_2D_to_1D@plt>
  mov    %ebp,%ecx
  mov    %ebx,%edx
  mov    %r13,%rsi
  movslq %eax,%r14
  mov    0x28(%rsp),%rax
  mov    %r15,%rdi
  movsd  0x3a0(%rsp,%r14,8),%xmm2
  movsd  0x28140(%rsp,%r14,8),%xmm3
  movsd  (%rax,%rbp,8),%xmm1
  mov    0x48(%rsp),%rax
  movsd  %xmm2,0x18(%rsp)
  movsd  (%rax),%xmm0
  mov    $0x4,%eax
  movsd  %xmm1,0x10(%rsp)
  movsd  %xmm0,0x8(%rsp)
  call   <fprintf@plt>
  movsd  0x18(%rsp),%xmm2
  mov    %ebp,%ecx
  mov    %ebx,%edx
  movsd  0x10(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm0
  mov    %r13,%rsi
  mov    $0x4,%eax
  movsd  0x14270(%rsp,%r14,8),%xmm3
  mov    0x20(%rsp),%rdi
  add    $0x1,%rbp
  call   <fprintf@plt>
  cmp    $0x65,%rbp
  jne    L85
  add    $0x1,%ebx
  addq   $0x8,0x48(%rsp)
  cmp    $0x65,%ebx
  jne    L104
  mov    0x30(%rsp),%rdi
  mov    0x38(%rsp),%rbp
  call   <fclose@plt>
  mov    0x20(%rsp),%rdi
  call   <fclose@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x68(%rsp),%rdi
  call   <free@plt>
  xor    %eax,%eax
L172:
  mov    0x3c008(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L38
  add    $0x3c018,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L5:
  mov    (%rsi),%rsi
  lea    D305(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L172
L166:
  lea    D307(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L172
L52:
  mov    $0x14,%esi
  lea    D78(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L65
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D94
datatype: string
name: retrieve_data
arguments: data_label: D35
datatype: string
name: retrieve_data
arguments: data_label: D310
datatype: string
name: retrieve_data
arguments: data_label: D53
datatype: f32[4]
name: retrieve_data
arguments: data_label: D151
datatype: f64
name: retrieve_data
arguments: data_label: D85
datatype: f32[4]
name: retrieve_data
arguments: data_label: D212
datatype: byte[16]
name: retrieve_data
arguments: data_label: D145
datatype: byte[16]
name: retrieve_data
arguments: data_label: D255
datatype: byte[16]
name: retrieve_data
arguments: data_label: D88
datatype: f32[4]
name: retrieve_data
arguments: data_label: D316
datatype: byte[16]
name: retrieve_data
arguments: data_label: D193
datatype: byte[16]
name: retrieve_data
arguments: data_label: D124
datatype: byte[16]
name: retrieve_data
arguments: data_label: D234
datatype: f32[4]
name: retrieve_data
arguments: data_label: D71
datatype: byte[16]
name: retrieve_data
arguments: data_label: D295
datatype: byte[16]
name: retrieve_data
arguments: data_label: D118
datatype: byte[16]
name: retrieve_data
arguments: data_label: D194
datatype: byte[16]
name: retrieve_data
arguments: data_label: D190
datatype: string
name: retrieve_data
arguments: data_label: D56
datatype: string
name: retrieve_data
arguments: data_label: D191
datatype: string
name: retrieve_data
arguments: data_label: D3
datatype: string
name: retrieve_data
arguments: data_label: D278
datatype: string
name: retrieve_data
arguments: data_label: D122
datatype: string
name: retrieve_data
arguments: data_label: D186
datatype: string
name: retrieve_data
arguments: data_label: D301
datatype: string
name: retrieve_data
arguments: data_label: D147
datatype: string
name: retrieve_data
arguments: data_label: D305
datatype: string
name: retrieve_data
arguments: data_label: D307
datatype: string
name: retrieve_data
arguments: data_label: D78
datatype: string

tool: D94: We compare to the analytic function
x^4 - y^4 + 0.5*(x*y)**4
on the domain [-1,1]x[-1,1].
For FULL Lagrange polynomials of order:
	%d in x
	%d in y
and FIXED ORDER Lagrange polynomials of order:
	%d in x
	%d in y


tool: D35: Preparing grids.

tool: D310: Writing to grids.

tool: {"D53": [0.0,-1.875,-107374184.0,-1.8499999046325684]}

tool: D151: 1

tool: {"D85": [0.0,1.401298464324817e-45,2.802596928649634e-45,4.203895392974451e-45]}

tool: {"D212": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D145": [0x9a,0x99,0x99,0x99,0x99,0x99,0xe9,0xbf,0x66,0x66,0x66,0x66,0x66,0x66,0xe6,0xbf]}

tool: {"D255": [0x7b,0x14,0xae,0x47,0xe1,0x7a,0x94,0x3f,0x7b,0x14,0xae,0x47,0xe1,0x7a,0x94,0x3f]}

tool: {"D88": [0.0,-1.875,0.0,-1.875]}

tool: {"D316": [0x33,0x33,0x33,0x33,0x33,0x33,0xe3,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xbf]}

tool: {"D193": [0x98,0x99,0x99,0x99,0x99,0x99,0xd9,0xbf,0x32,0x33,0x33,0x33,0x33,0x33,0xd3,0xbf]}

tool: {"D124": [0x98,0x99,0x99,0x99,0x99,0x99,0xc9,0xbf,0x98,0x99,0x99,0x99,0x99,0x99,0xb9,0xbf]}

tool: {"D234": [0.0,0.0,-1.5881877858437718e-23,1.4499999284744263]}

tool: {"D71": [0xa0,0x99,0x99,0x99,0x99,0x99,0xc9,0x3f,0x34,0x33,0x33,0x33,0x33,0x33,0xd3,0x3f]}

tool: {"D295": [0x9c,0x99,0x99,0x99,0x99,0x99,0xd9,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D118": [0x34,0x33,0x33,0x33,0x33,0x33,0xe3,0x3f,0x68,0x66,0x66,0x66,0x66,0x66,0xe6,0x3f]}

tool: {"D194": [0x9a,0x99,0x99,0x99,0x99,0x99,0xe9,0x3f,0xce,0xcc,0xcc,0xcc,0xcc,0xcc,0xec,0x3f]}

tool: D190: Interpolating.

tool: D56: w

tool: D191: 	Max error = %lf
	L2 error = %lf
	Max error fixed order %lf
	L2 error fixed order %lf


tool: D3: Creating output files.

tool: D278: test_full.out

tool: D122: test_fo.out

tool: D186: #i	j	x	y	z	z_interp


tool: D301: #NX = NY = %d


tool: D147: %d	%d	%lf	%lf	%lf	%lf


tool: D305: usage %s order_x order_y


tool: D307: Interpolation order must be at least 0

tool: D78: Interpolation order can be no greater than %d


assistant: ```c
int main(int argc, char *argv[]) {
  int iflat;
  int nz_coarse = 21 * 21;
  double *x_coarse;
  double *z_coarse;
  double x_fine[101];
  double z_fine[101 * 101];
  double z_interp_full[101 * 101];
  double z_interp_fo[101 * 101];
  double error_fo, error_full;
  double l2_error_fo = 0.;
  double l2_error_full = 0.;
  double l2_error_denom = 0.;
  double max_error_full = 0.;
  double max_error_fo = 0.;
  if (argc < 3) {
    printf("usage %s order_x order_y\n", argv[0]);
    return 1;
  }
  int order_x = atoi(argv[1]);
  int order_y = atoi(argv[2]);
  if (order_x < 0 || order_y < 0) {
    printf("Interpolation order must be at least 0\n");
    return 1;
  }
  if (order_x >= 21 || order_y >= 21) {
    printf("Interpolation order can be no greater than %d\n", 21 - 1);
  }
  printf("We compare to the analytic function\n"
         "x^4 - y^4 + 0.5*(x*y)**4\n"
         "on the domain [-1,1]x[-1,1].\n"
         "For FULL Lagrange polynomials of order:\n"
         "\t%d in x\n\t%d in y\n"
         "and FIXED ORDER Lagrange polynomials of order:\n"
         "\t%d in x\n\t%d in y\n",
         21, 21, order_x, order_y);
  printf("Preparing grids.\n");
  x_coarse = (double *)malloc(sizeof(double) * 21);
  z_coarse = (double *)malloc(sizeof(double) * nz_coarse);
  printf("Writing to grids.\n");
  for (int i = 0; i < 21; i++) {
    x_coarse[i] = -1.0 + (1.0 - -1.0) / (21 - 1) * i;
  }
  for (int i = 0; i < 101; i++) {
    x_fine[i] = -1.0 + (1.0 - -1.0) / (101 - 1) * i;
  }
  for (int i = 0; i < 21; i++) {
    for (int j = 0; j < 21; j++) {
      iflat = index_2D_to_1D(i, 21, j, 21);
      z_coarse[iflat] = xyn(x_coarse[i], x_coarse[j]);
    }
  }
  for (int i = 0; i < 101; i++) {
    for (int j = 0; j < 101; j++) {
      iflat = index_2D_to_1D(i, 101, j, 101);
      z_fine[iflat] = xyn(x_fine[i], x_fine[j]);
    }
  }
  printf("Interpolating.\n");
  for (int i = 0; i < 101; i++) {
    for (int j = 0; j < 101; j++) {
      iflat = index_2D_to_1D(i, 101, j, 101);
      z_interp_fo[iflat] = lagrange_interp_2Dfo(x_fine[i], x_fine[j], order_x, order_y, x_coarse, 21, x_coarse, 21, z_coarse);
      z_interp_full[iflat] = lagrange_interp_2D(x_fine[i], x_fine[j], x_coarse, 21, x_coarse, 21, z_coarse);
      error_fo = z_interp_fo[iflat] - z_fine[iflat];
      error_full = z_interp_full[iflat] - z_fine[iflat];
      l2_error_fo += error_fo * error_fo;
      l2_error_full += error_full * error_full;
      l2_error_denom += 1. * 1.;
      max_error_fo = fmax(error_fo, max_error_fo);
      max_error_full = fmax(error_full, max_error_full);
    }
  }
  l2_error_fo = sqrt(l2_error_fo / l2_error_denom);
  l2_error_full = sqrt(l2_error_full / l2_error_denom);
  printf("\tMax error = %lf\n\tL2 error = %lf\n"
         "\tMax error fixed order %lf\n"
         "\tL2 error fixed order %lf\n",
         max_error_full, l2_error_full, max_error_fo, l2_error_fo);
  printf("Creating output files.\n");
  FILE *fp_full;
  FILE *fp_fo;
  fp_full = fopen("test_full.out", "w");
  fp_fo = fopen("test_fo.out", "w");
  fprintf(fp_full, "#i\tj\tx\ty\tz\tz_interp\n");
  fprintf(fp_fo, "#i\tj\tx\ty\tz\tz_interp\n");
  fprintf(fp_full, "#NX = NY = %d\n", 101);
  fprintf(fp_fo, "#NX = NY = %d\n", 101);
  for (int i = 0; i < 101; i++) {
    for (int j = 0; j < 101; j++) {
      iflat = index_2D_to_1D(i, 101, j, 101);
      fprintf(fp_fo, "%d\t%d\t%lf\t%lf\t%lf\t%lf\n", i, j, x_fine[i], x_fine[j], z_fine[iflat], z_interp_fo[iflat]);
      fprintf(fp_full, "%d\t%d\t%lf\t%lf\t%lf\t%lf\n", i, j, x_fine[i], x_fine[j], z_fine[iflat], z_interp_full[iflat]);
    }
  }
  fclose(fp_fo);
  fclose(fp_full);
  free(x_coarse);
  free(z_coarse);
  return 0;
}
```