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

```asm
<MIDWT>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %esi,-0x6c(%rbp)
  mov    %edx,-0x70(%rbp)
  mov    %rcx,-0x78(%rbp)
  mov    %r8d,-0x7c(%rbp)
  mov    %r9d,-0x80(%rbp)
  mov    -0x70(%rbp),%edx
  mov    -0x6c(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x70(%rbp),%edx
  mov    -0x6c(%rbp),%eax
  cmp    %eax,%edx
  cmovl  %eax,%edx
  mov    -0x7c(%rbp),%eax
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %ecx,%eax
  sar    %eax
  add    %edx,%eax
  sub    $0x1,%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x70(%rbp),%edx
  mov    -0x6c(%rbp),%eax
  cmp    %eax,%edx
  cmovl  %eax,%edx
  mov    -0x7c(%rbp),%eax
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %ecx,%eax
  sar    %eax
  add    %edx,%eax
  sub    $0x1,%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x7c(%rbp),%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x7c(%rbp),%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpl   $0x1,-0x70(%rbp)
  jne    L28
  mov    -0x6c(%rbp),%eax
  mov    %eax,-0x70(%rbp)
  movl   $0x1,-0x6c(%rbp)
L28:
  movq   $0x0,-0x30(%rbp)
  jmp    L104
L73:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x78(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x7c(%rbp),%eax
  cltq
  sub    -0x30(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x1,-0x30(%rbp)
L104:
  mov    -0x7c(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jl     L73
  movq   $0x1,-0x30(%rbp)
  jmp    L137
L224:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movq   D3(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x2,-0x30(%rbp)
L137:
  mov    -0x7c(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jle    L224
  mov    -0x7c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x40(%rbp)
  mov    -0x7c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  sub    $0x1,%eax
  mov    %eax,-0x3c(%rbp)
  movl   $0x1,-0x44(%rbp)
  movq   $0x1,-0x30(%rbp)
  jmp    L131
L208:
  shll   -0x44(%rbp)
  addq   $0x1,-0x30(%rbp)
L131:
  mov    -0x80(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jl     L208
  cmpl   $0x1,-0x6c(%rbp)
  jle    L75
  mov    -0x6c(%rbp),%eax
  cltd
  idivl  -0x44(%rbp)
  mov    %eax,-0x54(%rbp)
  jmp    L23
L75:
  movl   $0x1,-0x54(%rbp)
L23:
  mov    -0x70(%rbp),%eax
  cltd
  idivl  -0x44(%rbp)
  mov    %eax,-0x50(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L84
L130:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x68(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x1,-0x30(%rbp)
L84:
  mov    -0x6c(%rbp),%eax
  imul   -0x70(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jl     L130
  mov    -0x80(%rbp),%eax
  mov    %eax,-0x58(%rbp)
  jmp    L32
L83:
  mov    -0x54(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x38(%rbp)
  mov    -0x50(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x1,-0x6c(%rbp)
  jle    L80
  movl   $0x0,-0x48(%rbp)
  jmp    L9
L147:
  mov    -0x38(%rbp),%eax
  mov    %eax,-0x4c(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L146
L43:
  mov    -0x6c(%rbp),%eax
  imul   -0x48(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rax,%rdx
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x6c(%rbp),%eax
  imul   -0x48(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x4c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4c(%rbp)
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rax,%rdx
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x1,-0x30(%rbp)
L146:
  mov    -0x38(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jl     L43
  mov    -0x3c(%rbp),%r8d
  mov    -0x40(%rbp),%edi
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x38(%rbp),%esi
  mov    -0x28(%rbp),%rax
  push   -0x18(%rbp)
  push   -0x20(%rbp)
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <bpsconv@plt>
  add    $0x10,%rsp
  movq   $0x0,-0x30(%rbp)
  jmp    L29
L122:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x6c(%rbp),%eax
  imul   -0x48(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x68(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x1,-0x30(%rbp)
L29:
  mov    -0x54(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jl     L122
  addl   $0x1,-0x48(%rbp)
L9:
  mov    -0x48(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L147
L80:
  movl   $0x0,-0x4c(%rbp)
  jmp    L192
L18:
  mov    -0x34(%rbp),%eax
  mov    %eax,-0x48(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L125
L27:
  mov    -0x6c(%rbp),%eax
  cltq
  imul   -0x30(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x4c(%rbp),%eax
  cltq
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rax,%rdx
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x48(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x48(%rbp)
  imul   -0x6c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rax,%rdx
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x1,-0x30(%rbp)
L125:
  mov    -0x34(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jl     L27
  mov    -0x3c(%rbp),%r8d
  mov    -0x40(%rbp),%edi
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x34(%rbp),%esi
  mov    -0x28(%rbp),%rax
  push   -0x18(%rbp)
  push   -0x20(%rbp)
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <bpsconv@plt>
  add    $0x10,%rsp
  movq   $0x0,-0x30(%rbp)
  jmp    L26
L152:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x6c(%rbp),%eax
  cltq
  imul   -0x30(%rbp),%rax
  mov    %rax,%rcx
  mov    -0x4c(%rbp),%eax
  cltq
  add    %rcx,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x68(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addq   $0x1,-0x30(%rbp)
L26:
  mov    -0x50(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jl     L152
  addl   $0x1,-0x4c(%rbp)
L192:
  mov    -0x4c(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L18
  cmpl   $0x1,-0x6c(%rbp)
  jne    L194
  movl   $0x1,-0x54(%rbp)
  jmp    L187
L194:
  shll   -0x54(%rbp)
L187:
  shll   -0x50(%rbp)
  subl   $0x1,-0x58(%rbp)
L32:
  cmpl   $0x0,-0x58(%rbp)
  jg     L83
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D3
type_infered: 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);
}
```