user: 请从给定的汇编指令推导出C源代码：

```asm
<pcapack_scale>:
  endbr64
  test   %edx,%edx
  je     L399
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  test   %ecx,%ecx
  je     L31
  mov    %edx,%ebx
  test   %edi,%edi
  je     L16
  test   %esi,%esi
  je     L252
  pxor   %xmm0,%xmm0
  movsd  D24(%rip),%xmm4
  cvtsi2sd %edx,%xmm0
  movapd %xmm4,%xmm5
  subsd  %xmm4,%xmm0
  divsd  %xmm0,%xmm5
  test   %ecx,%ecx
  jle    L31
  mov    %edx,%eax
  mov    %edx,%r14d
  xor    %ebp,%ebp
  xor    %r13d,%r13d
  shr    %eax
  and    $0xfffffffe,%r14d
  pxor   %xmm6,%xmm6
  lea    -0x1(%rax),%r15d
  add    $0x1,%r15
  shl    $0x4,%r15
  nopl   0x0(%rax,%rax,1)
L42:
  movapd %xmm6,%xmm0
  movapd %xmm6,%xmm2
  test   %ebx,%ebx
  jle    L139
  movslq %ebp,%rax
  movapd %xmm6,%xmm0
  movapd %xmm6,%xmm2
  mov    %ebx,%ecx
  lea    (%r8,%rax,8),%rdx
  xor    %eax,%eax
  nop
L277:
  pxor   %xmm3,%xmm3
  movsd  (%rdx,%rax,8),%xmm1
  cvtsi2sd %eax,%xmm3
  add    $0x1,%rax
  movapd %xmm1,%xmm7
  subsd  %xmm2,%xmm7
  addsd  %xmm4,%xmm3
  movapd %xmm7,%xmm8
  divsd  %xmm3,%xmm8
  addsd  %xmm8,%xmm2
  subsd  %xmm2,%xmm1
  mulsd  %xmm7,%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rax,%rcx
  jne    L277
L139:
  mulsd  %xmm5,%xmm0
  ucomisd %xmm0,%xmm6
  ja     L240
  sqrtsd %xmm0,%xmm0
L272:
  test   %ebx,%ebx
  jle    L307
  cmp    $0x1,%ebx
  je     L340
  movslq %ebp,%rax
  movapd %xmm2,%xmm7
  movapd %xmm0,%xmm3
  lea    (%r8,%rax,8),%rax
  unpcklpd %xmm7,%xmm7
  unpcklpd %xmm3,%xmm3
  lea    (%r15,%rax,1),%rdx
  nopl   0x0(%rax,%rax,1)
L151:
  movupd (%rax),%xmm1
  add    $0x10,%rax
  subpd  %xmm7,%xmm1
  divpd  %xmm3,%xmm1
  movups %xmm1,-0x10(%rax)
  cmp    %rax,%rdx
  jne    L151
  mov    %r14d,%eax
  cmp    %r14d,%ebx
  je     L307
L275:
  add    %ebp,%eax
  cltq
  lea    (%r8,%rax,8),%rax
  movsd  (%rax),%xmm1
  subsd  %xmm2,%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
L307:
  add    $0x1,%r13d
  add    %ebx,%ebp
  cmp    %r13d,%r12d
  jne    L42
L31:
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L340:
  xor    %eax,%eax
  jmp    L275
L16:
  test   %esi,%esi
  je     L31
  pxor   %xmm0,%xmm0
  movsd  D24(%rip),%xmm2
  cvtsi2sd %ebx,%xmm0
  subsd  %xmm2,%xmm0
  divsd  %xmm0,%xmm2
  test   %r12d,%r12d
  jle    L31
  mov    %ebx,%eax
  mov    %ebx,%r14d
  xor    %r13d,%r13d
  xor    %ebp,%ebp
  shr    %eax
  and    $0xfffffffe,%r14d
  pxor   %xmm6,%xmm6
  lea    -0x1(%rax),%r15d
  shl    $0x4,%r15
  nopw   0x0(%rax,%rax,1)
L362:
  movapd %xmm6,%xmm0
  test   %ebx,%ebx
  jle    L257
  cmp    $0x1,%ebx
  je     L161
  movslq %ebp,%rax
  movapd %xmm2,%xmm4
  movapd %xmm6,%xmm0
  lea    (%r8,%rax,8),%rax
  unpcklpd %xmm4,%xmm4
  lea    0x10(%rax,%r15,1),%rdx
  nopl   0x0(%rax)
L429:
  movupd (%rax),%xmm1
  add    $0x10,%rax
  mulpd  %xmm1,%xmm1
  mulpd  %xmm4,%xmm1
  addsd  %xmm1,%xmm0
  unpckhpd %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rdx,%rax
  jne    L429
  mov    %r14d,%eax
  cmp    %r14d,%ebx
  je     L234
L58:
  add    %ebp,%eax
  cltq
  movsd  (%r8,%rax,8),%xmm1
  mulsd  %xmm1,%xmm1
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm0
L234:
  ucomisd %xmm0,%xmm6
  ja     L44
L257:
  sqrtsd %xmm0,%xmm0
  test   %ebx,%ebx
  jle    L241
L239:
  cmp    $0x1,%ebx
  je     L377
  movslq %ebp,%rax
  movapd %xmm0,%xmm3
  lea    (%r8,%rax,8),%rax
  unpcklpd %xmm3,%xmm3
  lea    0x10(%rax,%r15,1),%rdx
  cs nopw 0x0(%rax,%rax,1)
L118:
  movupd (%rax),%xmm1
  add    $0x10,%rax
  divpd  %xmm3,%xmm1
  movups %xmm1,-0x10(%rax)
  cmp    %rdx,%rax
  jne    L118
  mov    %r14d,%eax
  cmp    %r14d,%ebx
  je     L241
L314:
  add    %ebp,%eax
  cltq
  lea    (%r8,%rax,8),%rax
  movsd  (%rax),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
L241:
  add    $0x1,%r13d
  add    %ebx,%ebp
  cmp    %r13d,%r12d
  jne    L362
  jmp    L31
L399:
  xor    %eax,%eax
  ret
L252:
  test   %edi,%edi
  je     L16
  pxor   %xmm0,%xmm0
  movsd  D24(%rip),%xmm3
  cvtsi2sd %edx,%xmm0
  divsd  %xmm0,%xmm3
  test   %ecx,%ecx
  jle    L31
  mov    %edx,%eax
  mov    %edx,%esi
  movapd %xmm3,%xmm4
  xor    %edx,%edx
  shr    %eax
  and    $0xfffffffe,%esi
  unpcklpd %xmm4,%xmm4
  xor    %ecx,%ecx
  sub    $0x1,%eax
  shl    $0x4,%rax
  lea    0x10(%rax),%rdi
  nopl   0x0(%rax)
L61:
  test   %ebx,%ebx
  jle    L285
  cmp    $0x1,%ebx
  je     L416
  movslq %edx,%r9
  pxor   %xmm0,%xmm0
  lea    (%r8,%r9,8),%rax
  lea    (%rdi,%rax,1),%r10
L174:
  movupd (%rax),%xmm1
  add    $0x10,%rax
  mulpd  %xmm4,%xmm1
  addsd  %xmm1,%xmm0
  unpckhpd %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  cmp    %r10,%rax
  jne    L174
  mov    %esi,%eax
  cmp    %esi,%ebx
  je     L41
L347:
  add    %edx,%eax
  cltq
  movsd  (%r8,%rax,8),%xmm1
  mulsd  %xmm3,%xmm1
  addsd  %xmm1,%xmm0
  cmp    $0x1,%ebx
  je     L136
  movslq %edx,%r9
L41:
  movapd %xmm0,%xmm2
  lea    (%r8,%r9,8),%rax
  unpcklpd %xmm2,%xmm2
  lea    (%rdi,%rax,1),%r9
  nopl   (%rax)
L141:
  movupd (%rax),%xmm1
  add    $0x10,%rax
  subpd  %xmm2,%xmm1
  movups %xmm1,-0x10(%rax)
  cmp    %r9,%rax
  jne    L141
  mov    %esi,%eax
  cmp    %esi,%ebx
  je     L285
L421:
  add    %edx,%eax
  cltq
  lea    (%r8,%rax,8),%rax
  movsd  (%rax),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
L285:
  add    $0x1,%ecx
  add    %ebx,%edx
  cmp    %ecx,%r12d
  jne    L61
  jmp    L31
  nopw   0x0(%rax,%rax,1)
L136:
  xor    %eax,%eax
  jmp    L421
L416:
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  jmp    L347
L377:
  xor    %eax,%eax
  jmp    L314
L161:
  xor    %eax,%eax
  movapd %xmm6,%xmm0
  jmp    L58
L240:
  mov    %r8,0x10(%rsp)
  movsd  %xmm6,0x18(%rsp)
  movsd  %xmm2,0x8(%rsp)
  movsd  %xmm5,(%rsp)
  call   <sqrt@plt>
  movsd  0x18(%rsp),%xmm6
  mov    0x10(%rsp),%r8
  mov    D24(%rip),%rax
  movsd  0x8(%rsp),%xmm2
  movsd  (%rsp),%xmm5
  movq   %rax,%xmm4
  jmp    L272
L44:
  mov    %r8,0x8(%rsp)
  movsd  %xmm6,0x10(%rsp)
  movsd  %xmm2,(%rsp)
  call   <sqrt@plt>
  movsd  (%rsp),%xmm2
  mov    0x8(%rsp),%r8
  movsd  0x10(%rsp),%xmm6
  jmp    L239
```

tool_calls: name: parse_data
arguments: tag: D24
type_infered: f64

tool: D24: 1

assistant: ```c
int pcapack_scale(const bool centerx, const bool scalex, const int m, const int n, double *restrict x) {
  int i, j;
  double colmean, colvar;
  double dt, tmp;
  if (m == 0 || n == 0)
    return 0;
  ;
  if (centerx && scalex) {
    tmp = 1. / ((double)m - 1);
#pragma omp parallel for private(i, j, colmean, colvar, dt) shared(x) if (m * n > OMP_MIN_SIZE)
    for (j = 0; j < n; j++) {
      colmean = 0;
      colvar = 0;

      for (i = 0; i < m; i++) {
        dt = x[i + m * j] - colmean;
        colmean += dt / ((double)i + 1);
        colvar += dt * (x[i + m * j] - colmean);
      }
      colvar = sqrt(colvar * tmp);

      for (i = 0; i < m; i++)
        x[i + m * j] = (x[i + m * j] - colmean) / colvar;
    }
  } else if (centerx) {
    const double div = 1. / ((double)m);
#pragma omp parallel for private(i, j, colmean) shared(x) if (m * n > OMP_MIN_SIZE)
    for (j = 0; j < n; j++) {
      colmean = 0;

      for (i = 0; i < m; i++)
        colmean += x[i + m * j] * div;

      for (i = 0; i < m; i++)
        x[i + m * j] -= colmean;
    }
  } else if (scalex) {
    const double div = 1. / ((double)m - 1);
#pragma omp parallel for private(i, j, colvar, tmp) shared(x) if (m * n > OMP_MIN_SIZE)
    for (j = 0; j < n; j++) {
      colvar = 0;

      for (i = 0; i < m; i++) {
        tmp = x[i + m * j];
        colvar += tmp * tmp * div;
      }
      colvar = sqrt(colvar);

      for (i = 0; i < m; i++)
        x[i + m * j] /= colvar;
    }
  }
  return 0;
}
```