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

```asm
<a2b_ord2>:
  endbr64
  push   %r15
  mov    %esi,%r15d
  push   %r14
  push   %r13
  push   %r12
  lea    0x1(%rdi),%r12d
  push   %rbp
  lea    0x2(%rdi),%ebp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x68,%rsp
  mov    0xa0(%rsp),%rax
  mov    0xc0(%rsp),%esi
  mov    %rcx,0x38(%rsp)
  mov    0xb0(%rsp),%r14d
  mov    0xc8(%rsp),%ecx
  mov    %edi,0x18(%rsp)
  lea    0x0(,%rbp,8),%edi
  mov    %rax,0x50(%rsp)
  mov    0xb8(%rsp),%eax
  mov    %esi,0x58(%rsp)
  mov    0xa8(%rsp),%r13
  mov    %r8,0x40(%rsp)
  mov    %r9,0x48(%rsp)
  mov    %r14d,0x5c(%rsp)
  mov    %ecx,0x28(%rsp)
  mov    %eax,0x1c(%rsp)
  call   <malloc@plt>
  lea    0x10(,%r15,8),%edi
  mov    %r15d,0x2c(%rsp)
  mov    %rax,0x20(%rsp)
  call   <malloc@plt>
  test   %r14d,%r14d
  mov    0x18(%rsp),%edi
  mov    0x2c(%rsp),%r11d
  mov    %rax,0x8(%rsp)
  mov    0x1c(%rsp),%eax
  setne  %r14b
  setne  %r15b
  movzbl %r14b,%r14d
  test   %eax,%eax
  mov    0x58(%rsp),%eax
  cmove  %r12d,%edi
  test   %eax,%eax
  setne  %al
  setne  0x30(%rsp)
  cmpl   $0x1,0x28(%rsp)
  mov    %edi,%esi
  movzbl %al,%eax
  adc    $0x0,%r11d
  mov    %eax,0x14(%rsp)
  cmp    %eax,%r11d
  jle    L146
  mov    %eax,%r8d
  mov    %eax,%r10d
  movsd  D91(%rip),%xmm1
  mov    %eax,%r9d
  imul   %ebp,%r8d
  imul   %r12d,%r10d
  nopl   (%rax)
L268:
  add    $0x1,%r9d
  cmp    %r14d,%esi
  jle    L364
  movslq %r8d,%rdx
  add    %ebp,%r8d
  movslq %r10d,%rdi
  movzbl %r15b,%eax
  lea    (%rbx,%rdx,8),%rcx
  movslq %r8d,%rdx
  lea    0x0(%r13,%rdi,8),%rdi
  lea    (%rbx,%rdx,8),%rdx
  nopw   0x0(%rax,%rax,1)
L77:
  movsd  (%rcx,%rax,8),%xmm0
  addsd  0x8(%rcx,%rax,8),%xmm0
  addsd  (%rdx,%rax,8),%xmm0
  addsd  0x8(%rdx,%rax,8),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L77
  add    %r12d,%r10d
  cmp    %r9d,%r11d
  jne    L268
L146:
  test   %r15b,%r15b
  je     L298
  cmpb   $0x0,0x30(%rsp)
  je     L298
  movslq 0x18(%rsp),%rax
  movsd  0x10(%rbx,%rax,8),%xmm0
  addsd  0x18(%rbx,%rax,8),%xmm0
  addsd  0x8(%rbx),%xmm0
  mulsd  D45(%rip),%xmm0
  movsd  %xmm0,0x0(%r13)
L298:
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  setne  %al
  je     L36
  cmpb   $0x0,0x30(%rsp)
  je     L36
  movslq 0x18(%rsp),%rcx
  lea    0x0(%rbp,%rcx,1),%edx
  movslq %edx,%rdx
  movsd  (%rbx,%rdx,8),%xmm0
  lea    0x0(%rbp,%r12,1),%edx
  addsd  (%rbx,%rcx,8),%xmm0
  movslq %edx,%rdx
  addsd  (%rbx,%rdx,8),%xmm0
  mulsd  D45(%rip),%xmm0
  movsd  %xmm0,0x0(%r13,%rcx,8)
L36:
  mov    0x28(%rsp),%r10d
  test   %r10d,%r10d
  setne  %cl
  test   %al,%al
  je     L357
  test   %cl,%cl
  je     L198
  mov    0x2c(%rsp),%edi
  mov    0x18(%rsp),%r10d
  mov    %edi,%eax
  imul   %ebp,%eax
  mov    %eax,%edx
  lea    (%rax,%r10,1),%r8d
  sub    %edi,%edx
  lea    (%rax,%r12,1),%edi
  add    %ebp,%eax
  movslq %r8d,%r8
  add    %r10d,%eax
  movslq %edi,%rdi
  movsd  (%rbx,%r8,8),%xmm0
  add    %r10d,%edx
  cltq
  addsd  (%rbx,%rdi,8),%xmm0
  movslq %edx,%rdx
  addsd  (%rbx,%rax,8),%xmm0
  mulsd  D45(%rip),%xmm0
  movsd  %xmm0,0x0(%r13,%rdx,8)
L357:
  test   %cl,%cl
  je     L198
  test   %r15b,%r15b
  je     L198
  mov    0x2c(%rsp),%edi
  mov    %edi,%eax
  imul   %ebp,%eax
  movslq %eax,%rcx
  mov    %eax,%edx
  add    %ebp,%eax
  cltq
  movsd  (%rbx,%rcx,8),%xmm0
  addsd  0x8(%rbx,%rcx,8),%xmm0
  sub    %edi,%edx
  addsd  0x8(%rbx,%rax,8),%xmm0
  mulsd  D45(%rip),%xmm0
  movslq %edx,%rdx
  movsd  %xmm0,0x0(%r13,%rdx,8)
L176:
  cmp    0x14(%rsp),%r11d
  jl     L177
  mov    0x14(%rsp),%ecx
  mov    %r11d,%edi
  movzbl 0x30(%rsp),%r9d
  movslq %ebp,%r10
  movsd  D50(%rip),%xmm1
  lea    0x0(,%r10,8),%r8
  mov    %ecx,%eax
  sub    %ecx,%edi
  mov    0x8(%rsp),%rcx
  imul   %ebp,%eax
  add    %r9,%rdi
  add    $0x8,%rcx
  lea    (%rcx,%rdi,8),%rdi
  cltq
  lea    (%rbx,%rax,8),%rdx
  mov    0x8(%rsp),%rax
  lea    (%rax,%r9,8),%rax
  nop
L308:
  movsd  (%rdx),%xmm0
  addsd  0x8(%rdx),%xmm0
  add    $0x8,%rax
  add    %r8,%rdx
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rax)
  cmp    %rax,%rdi
  jne    L308
  cmp    0x14(%rsp),%r11d
  jle    L177
  mov    0x14(%rsp),%r8d
  mov    0x8(%rsp),%rax
  movslq %r12d,%rdi
  movsd  D127(%rip),%xmm2
  shl    $0x3,%rdi
  mov    %r8d,%edx
  lea    (%rax,%r9,8),%rax
  imul   %r12d,%edx
  movslq %edx,%rdx
  lea    0x0(%r13,%rdx,8),%rdx
  mov    %rdx,0x30(%rsp)
  mov    %r11d,%edx
  sub    %r8d,%edx
  mov    %edx,%r8d
  mov    0x30(%rsp),%rdx
  sub    $0x1,%r8d
  add    %r9,%r8
  lea    (%rcx,%r8,8),%r8
  mov    0x38(%rsp),%rcx
  sub    0x8(%rsp),%rcx
  nopl   (%rax)
L373:
  movsd  (%rcx,%rax,1),%xmm3
  movsd  (%rax),%xmm4
  movapd %xmm2,%xmm0
  add    $0x8,%rax
  mulsd  %xmm3,%xmm4
  subsd  %xmm3,%xmm0
  mulsd  (%rax),%xmm0
  addsd  %xmm4,%xmm0
  movsd  %xmm0,(%rdx)
  add    %rdi,%rdx
  cmp    %rax,%r8
  jne    L373
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  je     L13
L84:
  mov    0x14(%rsp),%edx
  movslq 0x18(%rsp),%r8
  lea    0x0(,%r10,8),%rdi
  mov    0x8(%rsp),%rcx
  mov    %edx,%eax
  imul   %ebp,%eax
  lea    (%rcx,%r9,8),%rcx
  cltq
  add    %r8,%rax
  lea    (%rbx,%rax,8),%rax
  nopl   0x0(%rax)
L147:
  movsd  (%rax),%xmm0
  addsd  0x8(%rax),%xmm0
  add    $0x1,%edx
  add    %rdi,%rax
  add    $0x8,%rcx
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rcx)
  cmp    %edx,%r11d
  jge    L147
  cmp    0x14(%rsp),%r11d
  jle    L13
  mov    0x14(%rsp),%edi
  mov    0x8(%rsp),%r10
  movslq %r12d,%rdx
  movsd  D127(%rip),%xmm2
  shl    $0x3,%rdx
  mov    %edi,%ecx
  sub    %edi,%r11d
  lea    (%r10,%r9,8),%rax
  imul   %r12d,%ecx
  lea    -0x1(%r11),%edi
  add    %r9,%rdi
  movslq %ecx,%rcx
  add    %r8,%rcx
  lea    0x8(%r10,%rdi,8),%r8
  mov    0x40(%rsp),%rdi
  lea    0x0(%r13,%rcx,8),%rcx
  sub    %r10,%rdi
  nopl   0x0(%rax)
L68:
  movsd  (%rdi,%rax,1),%xmm1
  movsd  (%rax),%xmm3
  movapd %xmm2,%xmm0
  add    $0x8,%rax
  mulsd  %xmm1,%xmm3
  subsd  %xmm1,%xmm0
  mulsd  (%rax),%xmm0
  addsd  %xmm3,%xmm0
  movsd  %xmm0,(%rcx)
  add    %rdx,%rcx
  cmp    %rax,%r8
  jne    L68
L13:
  mov    0x58(%rsp),%edi
  test   %edi,%edi
  je     L230
  cmp    %r14d,%esi
  jl     L230
  mov    0x20(%rsp),%r10
  mov    %esi,%edx
  movzbl %r15b,%edi
  mov    %rbx,%r9
  sub    %r14d,%edx
  movsd  D50(%rip),%xmm1
  add    %rdi,%rdx
  lea    0x8(%r10),%r8
  lea    (%r10,%rdi,8),%rax
  sub    %r10,%r9
  lea    (%r8,%rdx,8),%rcx
  movslq 0x18(%rsp),%rdx
  lea    (%rbx,%rdx,8),%rdx
  sub    %r10,%rdx
  nopl   0x0(%rax)
L135:
  movsd  (%r9,%rax,1),%xmm0
  addsd  0x10(%rdx,%rax,1),%xmm0
  add    $0x8,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rax)
  cmp    %rax,%rcx
  jne    L135
  cmp    %r14d,%esi
  jle    L230
  mov    %esi,%edx
  mov    0x20(%rsp),%rcx
  movsd  D127(%rip),%xmm2
  sub    %r14d,%edx
  sub    $0x1,%edx
  lea    (%rcx,%rdi,8),%rax
  add    %rdi,%rdx
  lea    (%r8,%rdx,8),%r9
  mov    0x48(%rsp),%r8
  mov    %r13,%rdx
  sub    %rcx,%rdx
  sub    %rcx,%r8
  mov    %rdx,%rcx
L218:
  movsd  (%r8,%rax,1),%xmm3
  movsd  (%rax),%xmm4
  mov    %rax,%rdx
  movapd %xmm2,%xmm0
  add    $0x8,%rax
  mulsd  %xmm3,%xmm4
  subsd  %xmm3,%xmm0
  mulsd  (%rax),%xmm0
  addsd  %xmm4,%xmm0
  movsd  %xmm0,(%rcx,%rdx,1)
  cmp    %rax,%r9
  jne    L218
  mov    0x28(%rsp),%edx
  test   %edx,%edx
  je     L235
L258:
  mov    0x2c(%rsp),%ecx
  mov    0x20(%rsp),%r15
  imul   %ebp,%ecx
  lea    (%r15,%rdi,8),%rax
  movslq %ecx,%rdx
  add    %ebp,%ecx
  movslq %ecx,%rcx
  lea    (%rbx,%rdx,8),%rdx
  lea    (%rbx,%rcx,8),%r8
  sub    %r15,%rdx
  mov    %r14d,%ecx
  sub    %r15,%r8
  nopl   0x0(%rax)
L317:
  movsd  (%rdx,%rax,1),%xmm0
  addsd  (%r8,%rax,1),%xmm0
  add    $0x1,%ecx
  add    $0x8,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rax)
  cmp    %ecx,%esi
  jge    L317
  cmp    %r14d,%esi
  jle    L235
  sub    %r14d,%esi
  imul   0x2c(%rsp),%r12d
  mov    0x20(%rsp),%rbx
  lea    -0x1(%rsi),%edx
  mov    0x50(%rsp),%rsi
  movsd  D127(%rip),%xmm2
  add    %rdi,%rdx
  lea    (%rbx,%rdi,8),%rax
  lea    0x8(%rbx,%rdx,8),%rdi
  movslq %r12d,%rdx
  sub    %rbx,%rsi
  lea    0x0(%r13,%rdx,8),%rcx
  sub    %rbx,%rcx
  nopl   0x0(%rax)
L339:
  movsd  (%rsi,%rax,1),%xmm1
  movsd  (%rax),%xmm3
  mov    %rax,%rdx
  movapd %xmm2,%xmm0
  add    $0x8,%rax
  mulsd  %xmm1,%xmm3
  subsd  %xmm1,%xmm0
  mulsd  (%rax),%xmm0
  addsd  %xmm3,%xmm0
  movsd  %xmm0,(%rcx,%rdx,1)
  cmp    %rdi,%rax
  jne    L339
L235:
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <free@plt>
L198:
  mov    0x5c(%rsp),%r9d
  test   %r9d,%r9d
  jne    L176
L177:
  mov    0x1c(%rsp),%r8d
  test   %r8d,%r8d
  je     L13
  cmp    0x14(%rsp),%r11d
  jl     L13
  movzbl 0x30(%rsp),%r9d
  movsd  D50(%rip),%xmm1
  movslq %ebp,%r10
  jmp    L84
L230:
  mov    0x28(%rsp),%ecx
  test   %ecx,%ecx
  je     L235
  movsd  D50(%rip),%xmm1
  movzbl %r15b,%edi
  cmp    %r14d,%esi
  jge    L258
  jmp    L235
  nopl   0x0(%rax)
L364:
  add    %ebp,%r8d
  add    %r12d,%r10d
  cmp    %r9d,%r11d
  jne    L268
  jmp    L146
```

tool_calls: name: retrieve_data
arguments: data_tag: D91
data_type: f64
name: retrieve_data
arguments: data_tag: D45
data_type: byte[8]
name: retrieve_data
arguments: data_tag: D50
data_type: f64
name: retrieve_data
arguments: data_tag: D127
data_type: f64

tool: D91: 0.25

tool: {"D45": [0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0x3f]}

tool: D50: 0.5

tool: D127: 1

assistant: ```c
void a2b_ord2(int nx, int ny, const double *qin, const double *edge_w, const double *edge_e, const double *edge_s, const double *edge_n, double *qout, int on_west_edge, int on_east_edge, int on_south_edge, int on_north_edge) {
  int nxp, nyp, i, j;
  int istart, iend, jstart, jend;
  double *q1, *q2;
  const double r3 = 1. / 3.;
  nxp = nx + 1;
  nyp = ny + 1;
  q1 = (double *)malloc((nx + 2) * sizeof(double));
  q2 = (double *)malloc((ny + 2) * sizeof(double));
  if (on_west_edge)
    istart = 1;
  else
    istart = 0;
  if (on_east_edge)
    iend = nx;
  else
    iend = nxp;
  if (on_south_edge)
    jstart = 1;
  else
    jstart = 0;
  if (on_north_edge)
    jend = ny;
  else
    jend = nyp;
  for (j = jstart; j < jend; j++)
    for (i = istart; i < iend; i++) {
      qout[j * nxp + i] = 0.25 * (qin[j * (nx + 2) + i] + qin[j * (nx + 2) + i + 1] + qin[(j + 1) * (nx + 2) + i] + qin[(j + 1) * (nx + 2) + i + 1]);
    }
  if (on_west_edge && on_south_edge)
    qout[0] = r3 * (qin[1 * (nx + 2) + 1] + qin[1 * (nx + 2)] + qin[1]);
  if (on_east_edge && on_south_edge)
    qout[nx] = r3 * (qin[1 * (nx + 2) + nx] + qin[nx] + qin[1 * (nx + 2) + nxp]);
  if (on_east_edge && on_north_edge)
    qout[ny * nxp + nx] = r3 * (qin[ny * (nx + 2) + nx] + qin[ny * (nx + 2) + nxp] + qin[nyp * (nx + 2) + nx]);
  if (on_west_edge && on_north_edge)
    qout[ny * nxp] = r3 * (qin[ny * (nx + 2) + 1] + qin[ny * (nx + 2)] + qin[nyp * (nx + 2) + 1]);
  if (on_west_edge) {
    for (j = jstart; j <= jend; j++) {
      q2[j] = 0.5 * (qin[j * (nx + 2)] + qin[j * (nx + 2) + 1]);
    }
    for (j = jstart; j < jend; j++) {
      qout[j * nxp] = edge_w[j] * q2[j] + (1 - edge_w[j]) * q2[j + 1];
    }
  }
  if (on_east_edge) {
    for (j = jstart; j <= jend; j++) {
      q2[j] = 0.5 * (qin[j * (nx + 2) + nx] + qin[j * (nx + 2) + nxp]);
    }
    for (j = jstart; j < jend; j++) {
      qout[j * nxp + nx] = edge_e[j] * q2[j] + (1 - edge_e[j]) * q2[j + 1];
    }
  }
  if (on_south_edge) {
    for (i = istart; i <= iend; i++) {
      q1[i] = 0.5 * (qin[i] + qin[(nx + 2) + i]);
    }
    for (i = istart; i < iend; i++) {
      qout[i] = edge_s[i] * q1[i] + (1 - edge_s[i]) * q1[i + 1];
    }
  }
  if (on_north_edge) {
    for (i = istart; i <= iend; i++) {
      q1[i] = 0.5 * (qin[ny * (nx + 2) + i] + qin[nyp * (nx + 2) + i]);
    }
    for (i = istart; i < iend; i++) {
      qout[ny * nxp + i] = edge_n[i] * q1[i] + (1 - edge_n[i]) * q1[i + 1];
    }
  }
  free(q1);
  free(q2);
}
```