user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<scaleGNdir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %rdx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    %r8,-0x30(%rbp)
  movsd  D31(%rip),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  imul   -0x18(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  movl   $0x1,-0x10(%rbp)
  jmp    L65
L20:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jle    L78
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x10(%rbp),%eax
  shl    $0x2,%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movsd  D58(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  comisd %xmm1,%xmm0
  jbe    L35
  mov    -0x10(%rbp),%eax
  shl    $0x2,%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D58(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  mov    -0x8(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <MIN@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L78
L35:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x10(%rbp),%eax
  shl    $0x2,%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movsd  D49(%rip),%xmm1
  mulsd  %xmm2,%xmm1
  comisd %xmm1,%xmm0
  jbe    L78
  mov    -0x10(%rbp),%eax
  shl    $0x2,%eax
  cltq
  add    $0x3,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D49(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  mov    -0x8(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <MIN@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
L78:
  addl   $0x1,-0x10(%rbp)
L65:
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x10(%rbp)
  jl     L20
  movsd  -0x8(%rbp),%xmm0
  movq   D39(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L18
L63:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x10(%rbp)
L18:
  mov    -0xc(%rbp),%eax
  sub    $0x4,%eax
  add    %eax,%eax
  cmp    %eax,-0x10(%rbp)
  jl     L63
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D31
type: f64
name: read_data
arguments: data_tag: D58
type: byte[8]
name: read_data
arguments: data_tag: D49
type: f64
name: read_data
arguments: data_tag: D39
type: byte[8]

tool: D31: 1

tool: {"D58": [0xcd,0xcc,0xcc,0xcc,0xcc,0xcc,0xec,0xbf]}

tool: D49: 9

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

assistant: ```c
void scaleGNdir(int ncp, int kcp, int *matInds, double *cp, double *gnDir) {
  int ii, numCP;
  double alpha = 1.0;
  numCP = ncp * kcp;
  for (ii = 1; ii <= (numCP - 2); ii++) {
    if (matInds[ii] < numCP) {
      if (gnDir[2 * matInds[ii] + 1] < -0.9 * cp[4 * ii + 3]) {
        alpha = MIN(alpha, -0.9 * cp[4 * ii + 3] / gnDir[2 * matInds[ii] + 1]);
      } else if (gnDir[2 * matInds[ii] + 1] > 9.0 * cp[4 * ii + 3]) {
        alpha = MIN(alpha, 9.0 * cp[4 * ii + 3] / gnDir[2 * matInds[ii] + 1]);
      }
    }
  }
  alpha = -alpha;
  for (ii = 0; ii < 2 * (numCP - 4); ii++) {
    gnDir[ii] = alpha * gnDir[ii];
  }
  return;
}
```