user: Translate the below assembly code into C programming language:

```asm
<MIDWT>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %rdi,0x58(%rsp)
  mov    %esi,0x60(%rsp)
  mov    %edx,%r14d
  mov    %rcx,%r13
  mov    %r8d,%ebp
  mov    %r9d,0x84(%rsp)
  mov    0xd0(%rsp),%rbx
  cmp    %esi,%edx
  cmovge %edx,%esi
  mov    %esi,%r12d
  mov    $0x8,%esi
  mov    %r12d,%edi
  call   <calloc@plt>
  mov    %rax,0x18(%rsp)
  mov    %ebp,%eax
  shr    $0x1f,%eax
  add    %ebp,%eax
  sar    %eax
  mov    %eax,%r15d
  lea    -0x1(%r12,%rax,1),%r12d
  mov    $0x8,%esi
  mov    %r12d,%edi
  call   <calloc@plt>
  mov    %rax,0x20(%rsp)
  mov    $0x8,%esi
  mov    %r12d,%edi
  call   <calloc@plt>
  mov    %rax,0x30(%rsp)
  mov    $0x8,%esi
  mov    %ebp,%edi
  call   <calloc@plt>
  mov    %rax,0x38(%rsp)
  mov    $0x8,%esi
  mov    %ebp,%edi
  call   <calloc@plt>
  mov    %rax,0x28(%rsp)
  cmp    $0x1,%r14d
  je     L309
L289:
  test   %ebp,%ebp
  jle    L64
  movslq %ebp,%rdi
  lea    0x0(,%rdi,8),%rcx
  lea    0x0(%r13,%rcx,1),%rdx
  mov    0x38(%rsp),%r10
  add    %r10,%rcx
  mov    %r10,%rax
  sub    %r10,%r13
  mov    0x28(%rsp),%rsi
  sub    %r10,%rsi
L162:
  movsd  0x0(%r13,%rax,1),%xmm0
  movsd  %xmm0,(%rax)
  movsd  -0x8(%rdx),%xmm0
  movsd  %xmm0,(%rsi,%rax,1)
  add    $0x8,%rax
  sub    $0x8,%rdx
  cmp    %rcx,%rax
  jne    L162
  mov    0x28(%rsp),%rsi
  lea    0x8(%rsi),%rax
  lea    -0x8(,%rdi,8),%rdx
  and    $0xfffffffffffffff0,%rdx
  lea    0x18(%rsi,%rdx,1),%rdx
  movq   D3(%rip),%xmm1
L345:
  movsd  (%rax),%xmm0
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L345
L64:
  lea    -0x1(%rbp),%eax
  mov    %eax,0x44(%rsp)
  lea    -0x1(%r15),%eax
  mov    %eax,0x50(%rsp)
  mov    0x84(%rsp),%eax
  movslq %eax,%rdx
  cmp    $0x1,%eax
  jle    L38
  mov    $0x1,%ecx
  mov    $0x1,%eax
L45:
  add    %ecx,%ecx
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L45
L158:
  movl   $0x1,0x40(%rsp)
  mov    0x60(%rsp),%eax
  cmp    $0x1,%eax
  jle    L54
  cltd
  idiv   %ecx
  mov    %eax,0x40(%rsp)
L54:
  mov    %r14d,%eax
  cltd
  idiv   %ecx
  mov    %eax,0x14(%rsp)
  mov    %r14d,%edx
  imul   0x60(%rsp),%edx
  movslq %edx,%rdx
  test   %rdx,%rdx
  jle    L142
  mov    $0x0,%eax
  mov    0x58(%rsp),%rcx
L57:
  movsd  (%rbx,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L57
L142:
  cmpl   $0x0,0x84(%rsp)
  jle    L18
  lea    -0x1(%r15),%eax
  cltq
  mov    0x20(%rsp),%rdi
  lea    (%rdi,%rax,8),%rax
  mov    %rax,0x48(%rsp)
  movslq %r15d,%rax
  mov    %rax,0x70(%rsp)
  neg    %rax
  shl    $0x3,%rax
  mov    %rax,0x88(%rsp)
  mov    0x60(%rsp),%esi
  movslq %esi,%rax
  shl    $0x3,%rax
  mov    %rax,0x8(%rsp)
  lea    -0x8(%rdi),%rax
  mov    %rax,0x78(%rsp)
  mov    0x30(%rsp),%r12
  sub    %rdi,%r12
  mov    %esi,0x80(%rsp)
  jmp    L169
L309:
  mov    0x60(%rsp),%eax
  mov    %r14d,0x60(%rsp)
  mov    %eax,%r14d
  jmp    L289
L38:
  mov    $0x1,%ecx
  jmp    L158
L322:
  test   %edi,%edi
  jle    L10
  mov    0x40(%rsp),%esi
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  sar    %eax
  mov    %eax,0x64(%rsp)
  cltq
  mov    %rax,0x68(%rsp)
  mov    0x70(%rsp),%rdi
  add    %rax,%rdi
  mov    %rdi,%rax
  mov    0x78(%rsp),%rdi
  lea    (%rdi,%rax,8),%rbp
  movslq %esi,%rax
  mov    0x18(%rsp),%rsi
  lea    (%rsi,%rax,8),%rbx
  mov    $0x0,%r13d
  mov    $0x0,%r14d
  mov    0x88(%rsp),%r15
  sub    0x20(%rsp),%r15
  jmp    L126
L124:
  movslq %r13d,%rax
  lea    (%r15,%rax,8),%rcx
  mov    0x58(%rsp),%rdi
  add    %rdi,%rcx
  add    0x68(%rsp),%rax
  lea    (%r15,%rax,8),%rdx
  add    %rdi,%rdx
  mov    0x48(%rsp),%rax
L248:
  movsd  0x8(%rcx,%rax,1),%xmm0
  movsd  %xmm0,(%rax)
  movsd  0x8(%rdx,%rax,1),%xmm0
  movsd  %xmm0,(%r12,%rax,1)
  add    $0x8,%rax
  cmp    %rbp,%rax
  jne    L248
L132:
  push   0x30(%rsp)
  push   0x28(%rsp)
  mov    0x60(%rsp),%r9d
  mov    0x54(%rsp),%r8d
  mov    0x38(%rsp),%rcx
  mov    0x48(%rsp),%rdx
  mov    0x74(%rsp),%esi
  mov    0x28(%rsp),%rdi
  call   <bpsconv@plt>
  add    $0x10,%rsp
  cmpl   $0x0,0x40(%rsp)
  jle    L26
  movslq %r13d,%rax
  mov    0x58(%rsp),%rsi
  lea    (%rsi,%rax,8),%rdx
  mov    0x18(%rsp),%rax
  sub    %rax,%rdx
L114:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    %rbx,%rax
  jne    L114
L26:
  add    $0x1,%r14d
  add    0x80(%rsp),%r13d
  cmp    0x14(%rsp),%r14d
  je     L10
L126:
  cmpl   $0x1,0x40(%rsp)
  jg     L124
  jmp    L132
L168:
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  movsd  (%rdx,%rbx,8),%xmm0
  movsd  %xmm0,(%r12,%rax,1)
  add    0x8(%rsp),%rdx
  add    $0x8,%rax
  cmp    %rax,%r13
  jne    L168
L209:
  push   0x30(%rsp)
  push   0x28(%rsp)
  mov    0x60(%rsp),%r9d
  mov    0x54(%rsp),%r8d
  mov    0x38(%rsp),%rcx
  mov    0x48(%rsp),%rdx
  mov    0x64(%rsp),%esi
  mov    0x28(%rsp),%rdi
  call   <bpsconv@plt>
  add    $0x10,%rsp
  cmpl   $0x0,0x14(%rsp)
  jle    L269
  mov    %r14,%rdx
  mov    0x18(%rsp),%rax
L251:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  add    $0x8,%rax
  add    0x8(%rsp),%rdx
  cmp    %rbp,%rax
  jne    L251
L269:
  add    $0x1,%r15
  add    $0x8,%r14
  cmp    %r15d,0x40(%rsp)
  jle    L35
L84:
  mov    0x48(%rsp),%rax
  mov    %r14,%rdx
  cmpl   $0x1,0x14(%rsp)
  jg     L168
  jmp    L209
L35:
  cmpl   $0x1,0x60(%rsp)
  je     L98
L280:
  shll   0x40(%rsp)
L27:
  shll   0x14(%rsp)
  subl   $0x1,0x84(%rsp)
  je     L18
L169:
  mov    0x14(%rsp),%edi
  mov    %edi,%eax
  shr    $0x1f,%eax
  add    %edi,%eax
  sar    %eax
  mov    %eax,0x54(%rsp)
  cmpl   $0x1,0x60(%rsp)
  jg     L322
  cmpl   $0x0,0x40(%rsp)
  jle    L35
L279:
  mov    0x58(%rsp),%r14
  mov    0x54(%rsp),%edi
  movslq %edi,%rax
  add    0x70(%rsp),%rax
  mov    0x78(%rsp),%rsi
  lea    (%rsi,%rax,8),%r13
  mov    0x60(%rsp),%ebx
  imul   %edi,%ebx
  movslq %ebx,%rbx
  movslq 0x14(%rsp),%rax
  mov    0x18(%rsp),%rsi
  lea    (%rsi,%rax,8),%rbp
  mov    $0x0,%r15d
  jmp    L84
L98:
  mov    0x60(%rsp),%eax
  mov    %eax,0x40(%rsp)
  jmp    L27
L18:
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L10:
  cmpl   $0x0,0x40(%rsp)
  jg     L279
  jmp    L280
```

tool_calls: name: disassemble_data
arguments: tag: D3
datatype: byte[8]

tool: {"D3": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

assistant: ```c
void MIDWT(double *x, int m, int n, double *h, int lh, int L, double *y) {
  double *g0, *g1, *ydummyl, *ydummyh, *xdummy;
  long i, j;
  int actual_L, actual_m, actual_n, r_o_a, c_o_a, ir, ic, lhm1, lhhm1, sample_f;
  xdummy = (double *)calloc((m > n ? m : n), sizeof(double));
  ydummyl = (double *)calloc((m > n ? m : n) + lh / 2 - 1, sizeof(double));
  ydummyh = (double *)calloc((m > n ? m : n) + lh / 2 - 1, sizeof(double));
  g0 = (double *)calloc(lh, sizeof(double));
  g1 = (double *)calloc(lh, sizeof(double));
  if (n == 1) {
    n = m;
    m = 1;
  }
  for (i = 0; i < lh; i++) {
    g0[i] = h[i];
    g1[i] = h[lh - i - 1];
  }
  for (i = 1; i <= lh; i += 2)
    g1[i] = -g1[i];
  lhm1 = lh - 1;
  lhhm1 = lh / 2 - 1;
  sample_f = 1;
  for (i = 1; i < L; i++)
    sample_f = sample_f * 2;
  if (m > 1)
    actual_m = m / sample_f;
  else
    actual_m = 1;
  actual_n = n / sample_f;
  for (i = 0; i < (m * n); i++)
    x[i] = y[i];
  for (actual_L = L; actual_L >= 1; actual_L--) {
    r_o_a = actual_m / 2;
    c_o_a = actual_n / 2;
    if (m > 1) {
      for (ic = 0; ic < actual_n; ic++) {
        ir = r_o_a;
        for (i = 0; i < r_o_a; i++) {
          ydummyl[i + lhhm1] = (*(x + (m * (ic) + i)));
          ydummyh[i + lhhm1] = (*(x + (m * (ic) + ir++)));
        }
        bpsconv(xdummy, r_o_a, g0, g1, lhm1, lhhm1, ydummyl, ydummyh);
        for (i = 0; i < actual_m; i++)
          (*(x + (m * (ic) + i))) = xdummy[i];
      }
    }
    for (ir = 0; ir < actual_m; ir++) {
      ic = c_o_a;
      for (i = 0; i < c_o_a; i++) {
        ydummyl[i + lhhm1] = (*(x + (m * (i) + ir)));
        ydummyh[i + lhhm1] = (*(x + (m * (ic++) + ir)));
      }
      bpsconv(xdummy, c_o_a, g0, g1, lhm1, lhhm1, ydummyl, ydummyh);
      for (i = 0; i < actual_n; i++)
        (*(x + (m * (i) + ir))) = xdummy[i];
    }
    if (m == 1)
      actual_m = 1;
    else
      actual_m = actual_m * 2;
    actual_n = actual_n * 2;
  }
  free(xdummy);
  free(ydummyl);
  free(ydummyh);
  free(g0);
  free(g1);
}
```