user: What is the c source code of the assembly code below:

```asm
<detcoef2>:
  endbr64
  push   %r15
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %r8,%r13
  push   %r12
  lea    0x0(,%r9,4),%r12d
  push   %rbp
  mov    %rdi,%rbp
  mov    %r12d,%edi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x28,%rsp
  mov    0x60(%rsp),%r10d
  mov    0x68(%rsp),%r15
  mov    %r10d,0x1c(%rsp)
  call   <malloc@plt>
  mov    %r12d,%edi
  mov    %rax,0x8(%rsp)
  call   <malloc@plt>
  mov    %r12d,%edi
  mov    %rax,(%rsp)
  call   <malloc@plt>
  mov    0x8(%rsp),%r12
  mov    %r14d,%edi
  mov    %r13,%rsi
  mov    (%rsp),%rcx
  mov    %rax,%r8
  mov    %rax,0x10(%rsp)
  mov    %r12,%rdx
  call   <matrix_locate@plt>
  lea    D28(%rip),%rsi
  mov    %r15,%rdi
  call   <strcmp@plt>
  mov    0x1c(%rsp),%r10d
  sub    %r10d,%r14d
  test   %rax,%rax
  jne    L118
  movslq %r14d,%rax
  mov    (%r12,%rax,4),%eax
  mov    %eax,0x18(%rsp)
L118:
  lea    D15(%rip),%rsi
  mov    %r15,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L17
  mov    (%rsp),%rdi
  movslq %r14d,%rax
  mov    (%rdi,%rax,4),%eax
  mov    %eax,0x18(%rsp)
L17:
  lea    D2(%rip),%rsi
  mov    %r15,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L67
  mov    0x10(%rsp),%rdi
  movslq %r14d,%rax
  mov    (%rdi,%rax,4),%eax
  mov    %eax,0x18(%rsp)
L67:
  lea    0x2(%r14,%r14,1),%eax
  cltq
  mov    0x0(%r13,%rax,4),%r14d
  test   %r14d,%r14d
  jle    L38
  mov    0x4(%r13,%rax,4),%r10d
  test   %r10d,%r10d
  jle    L38
  movslq 0x18(%rsp),%rax
  mov    %r10d,%edi
  movslq %r10d,%r11
  mov    %rbx,%rcx
  and    $0xfffffffe,%edi
  shl    $0x3,%r11
  xor    %r9d,%r9d
  lea    -0x1(%r10),%r15d
  mov    %rax,%rdx
  lea    0x0(%rbp,%rax,8),%rsi
  mov    %r10d,%eax
  mov    %r10d,%r13d
  shr    %eax
  lea    (%rdx,%rdi,1),%r12d
  xor    %edx,%edx
  lea    -0x1(%rax),%r8d
  add    $0x1,%r8
  shl    $0x4,%r8
  nopw   0x0(%rax,%rax,1)
L81:
  lea    0x8(%rsi),%rax
  cmp    %rax,%rcx
  je     L19
  xor    %eax,%eax
  cmp    $0x2,%r15d
  jbe    L19
  nopl   0x0(%rax)
L15:
  movupd (%rsi,%rax,1),%xmm1
  movups %xmm1,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %r8,%rax
  jne    L15
  cmp    %r10d,%edi
  je     L40
  lea    (%rdx,%r12,1),%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  lea    (%rdx,%rdi,1),%eax
  cltq
  movsd  %xmm0,(%rbx,%rax,8)
L40:
  add    $0x1,%r9d
  add    %r11,%rsi
  add    %r11,%rcx
  add    %r10d,%edx
  cmp    %r14d,%r9d
  jne    L81
L38:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <free@plt>
  nopw   0x0(%rax,%rax,1)
L19:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L29:
  movsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%r13
  jne    L29
  jmp    L40
```

tool_calls: name: unpack_data
arguments: tag: D28
type: string
name: unpack_data
arguments: tag: D15
type: string
name: unpack_data
arguments: tag: D2
type: string

tool: D28: h

tool: D15: v

tool: D2: d

assistant: ```c
void detcoef2(double *coef, int sigInLength, double *coefOut, int sigOutLength, int *pLen, int stride, int level, char *coefType) {
  int row, col, sta;
  int *pH, *pV, *pD;
  pH = malloc(stride * sizeof(int));
  pV = malloc(stride * sizeof(int));
  pD = malloc(stride * sizeof(int));
  matrix_locate(stride, pLen, pH, pV, pD);
  if (strcmp(coefType, "h") == 0) {
    sta = pH[stride - level];
  }
  if (strcmp(coefType, "v") == 0) {
    sta = pV[stride - level];
  }
  if (strcmp(coefType, "d") == 0) {
    sta = pD[stride - level];
  }
  for (row = 0; row < pLen[(stride - level + 1) * 2]; row++) {
    for (col = 0; col < pLen[(stride - level + 1) * 2 + 1]; col++)
      coefOut[col + row * (pLen[(stride - level + 1) * 2 + 1])] = coef[sta + col + row * (pLen[(stride - level + 1) * 2 + 1])];
  }
  free(pH);
  free(pV);
  free(pD);
  return;
}
```