user: Demonstrate the C code that generates the assembly output below:

```asm
<detcoef2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %rdx,%rbp
  mov    %r8,%r13
  mov    %r9d,%r12d
  lea    0x0(,%r9,4),%r15d
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,%r14
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    %rax,%r8
  mov    0x8(%rsp),%rcx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12d,%edi
  call   <matrix_locate@plt>
  lea    D3(%rip),%rsi
  mov    0x58(%rsp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L75
  mov    %r12d,%eax
  sub    0x50(%rsp),%eax
  cltq
  mov    (%r14,%rax,4),%edi
L62:
  sub    0x50(%rsp),%r12d
  lea    0x2(%r12,%r12,1),%eax
  cltq
  lea    0x0(%r13,%rax,4),%r8
  cmpl   $0x0,(%r8)
  jle    L8
  lea    0x4(%r13,%rax,4),%r9
  mov    $0x0,%esi
  jmp    L71
L75:
  lea    D29(%rip),%rsi
  mov    0x58(%rsp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L52
  mov    %r12d,%eax
  sub    0x50(%rsp),%eax
  cltq
  mov    0x8(%rsp),%rdi
  mov    (%rdi,%rax,4),%edi
  jmp    L62
L52:
  lea    D11(%rip),%rsi
  mov    0x58(%rsp),%rdi
  call   <strcmp@plt>
  mov    $0x0,%edi
  test   %rax,%rax
  jne    L62
  mov    %r12d,%eax
  sub    0x50(%rsp),%eax
  cltq
  mov    (%r15,%rax,4),%edi
  jmp    L62
L73:
  imul   %esi,%eax
  lea    (%rcx,%rdi,1),%edx
  add    %eax,%edx
  movslq %edx,%rdx
  movsd  (%rbx,%rdx,8),%xmm0
  add    %ecx,%eax
  cltq
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%ecx
  mov    (%r9),%eax
  cmp    %ecx,%eax
  jg     L73
L29:
  add    $0x1,%esi
  cmp    %esi,(%r8)
  jle    L8
L71:
  mov    (%r9),%eax
  mov    $0x0,%ecx
  test   %eax,%eax
  jg     L73
  jmp    L29
L8:
  mov    %r14,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D3
datatype: string
name: disassemble_data
arguments: data_label: D29
datatype: string
name: disassemble_data
arguments: data_label: D11
datatype: string

tool: D3: h

tool: D29: v

tool: D11: 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 = 0;
  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];
  } else if (strcmp(coefType, "v") == 0) {
    sta = pV[stride - level];
  } else 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;
}
```