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

```asm
<spack_trans>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,-0x20(%rsp)
  mov    %rcx,-0x18(%rsp)
  test   %edi,%edi
  jle    L109
  movslq %edi,%rbx
  xor    %r8d,%r8d
  mov    %rsi,%r9
  shl    $0x3,%rbx
  lea    0x1(%r8),%ebp
  lea    0x8(%rdx),%rsi
  lea    0x8(%rbx),%r11
  lea    (%rdx,%rbx,1),%r10
  lea    (%rdx,%r11,1),%rcx
  cmp    %ebp,%edi
  je     L153
  nopl   (%rax)
L148:
  mov    %r10,%rax
  mov    %rsi,%rdx
  xchg   %ax,%ax
L159:
  movsd  (%rax),%xmm0
  movsd  (%rdx),%xmm1
  add    $0x8,%rax
  movsd  %xmm1,-0x8(%rax)
  movsd  %xmm0,(%rdx)
  add    %rbx,%rdx
  cmp    %rcx,%rax
  jne    L159
  mov    %ebp,%r8d
  add    %rbx,%r10
  add    $0x8,%rsi
  add    %r11,%rcx
  lea    0x1(%r8),%ebp
  cmp    %ebp,%edi
  jne    L148
L153:
  mov    %ebp,-0x4(%rsp)
  mov    $0x8,%r10d
  xor    %r13d,%r13d
  xor    %r15d,%r15d
  pxor   %xmm2,%xmm2
  cs nopw 0x0(%rax,%rax,1)
L89:
  mov    %r15d,%r14d
  add    $0x1,%r15d
  mov    -0x18(%rsp),%rdi
  xor    %r12d,%r12d
  mov    %r15d,%eax
  imul   %r14d,%eax
  lea    (%rdi,%r13,1),%rbp
  mov    -0x20(%rsp),%rdi
  add    $0x8,%r13
  mov    %rdi,-0x10(%rsp)
  sar    %eax
  movslq %eax,%rdx
  add    %r14d,%eax
  mov    %eax,-0x8(%rsp)
  lea    (%r9,%rdx,8),%r11
  nopl   0x0(%rax,%rax,1)
L94:
  xor    %eax,%eax
  movapd %xmm2,%xmm0
  cs nopw 0x0(%rax,%rax,1)
L32:
  movsd  (%r11,%rax,1),%xmm1
  mulsd  (%rdi,%rax,1),%xmm1
  add    $0x8,%rax
  addsd  %xmm1,%xmm0
  cmp    %rax,%r10
  jne    L32
  mov    -0x8(%rsp),%edx
  lea    (%rdi,%r13,1),%rcx
  cmp    %r14d,%r8d
  jle    L161
  mov    %r15d,%eax
  nopl   0x0(%rax,%rax,1)
L40:
  add    %eax,%edx
  add    $0x8,%rcx
  movslq %edx,%rsi
  movsd  (%r9,%rsi,8),%xmm1
  mulsd  -0x8(%rcx),%xmm1
  mov    %eax,%esi
  add    $0x1,%eax
  addsd  %xmm1,%xmm0
  cmp    %esi,%r8d
  jne    L40
L161:
  movsd  %xmm0,0x0(%rbp)
  lea    0x1(%r12),%eax
  add    %rbx,%rbp
  add    %rbx,%rdi
  cmp    %r12d,%r8d
  je     L156
  mov    %eax,%r12d
  jmp    L94
L109:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L156:
  add    $0x8,%r10
  cmp    %r14d,%r8d
  jne    L89
  movslq -0x4(%rsp),%rsi
  mov    -0x20(%rsp),%rcx
  xor    %r10d,%r10d
  lea    0x8(%r9),%r11
  mov    -0x18(%rsp),%rbp
  nopl   0x0(%rax,%rax,1)
L25:
  lea    0x1(%r10),%eax
  mov    %rbp,%rdx
  imul   %r10d,%eax
  sar    %eax
  cltq
  lea    (%r9,%rax,8),%rdi
  add    %r10,%rax
  lea    (%r11,%rax,8),%r12
  nopw   0x0(%rax,%rax,1)
L53:
  xor    %eax,%eax
  movapd %xmm2,%xmm1
  xchg   %ax,%ax
L147:
  movsd  (%rcx,%rax,8),%xmm0
  mulsd  (%rdx,%rax,8),%xmm0
  add    $0x1,%rax
  addsd  %xmm0,%xmm1
  cmp    %rax,%rsi
  jne    L147
  movsd  %xmm1,(%rdi)
  add    $0x8,%rdi
  add    %rbx,%rdx
  cmp    %rdi,%r12
  jne    L53
  add    $0x1,%r10
  add    %rbx,%rcx
  cmp    %r10,%rsi
  jne    L25
  mov    -0x20(%rsp),%rsi
  mov    -0x10(%rsp),%r9
  xor    %edi,%edi
  nop
L99:
  movslq %edi,%rcx
  mov    %r9,%rax
  mov    %rsi,%rdx
  lea    (%r9,%rcx,8),%rcx
  test   %edi,%edi
  je     L166
  nopl   0x0(%rax)
L165:
  movsd  (%rax),%xmm0
  movsd  (%rdx),%xmm1
  add    $0x8,%rax
  movsd  %xmm1,-0x8(%rax)
  movsd  %xmm0,(%rdx)
  add    %rbx,%rdx
  cmp    %rcx,%rax
  jne    L165
L166:
  lea    0x1(%rdi),%eax
  add    %rbx,%r9
  add    $0x8,%rsi
  cmp    %edi,%r8d
  je     L109
  mov    %eax,%edi
  jmp    L99
```

assistant: ```c
void spack_trans(int n, double *a, double *z, double *tmp) {
  register int i, j, k;
  int ij, ik, ii;
  double s, *zij, *zji, *zjk, *zik, *zi, *tjk;
  for (i = 0; i < n; i++) {
    zij = z + i * n;
    zji = z + i;
    for (j = 0; j < i; j++) {
      s = (*(zij));
      (*zij++) = (*zji);
      (*zji) = s;
      zji += n;
    }
  }
  for (i = 0; i < n; i++) {
    ii = i * (i + 1) / 2;
    for (j = 0; j < n; j++) {
      zjk = z + j * n;
      ik = ii;
      s = 0.0;
      for (k = 0; k <= i; ik++, k++) {
        s += a[ik] * (*zjk++);
      }
      --ik;
      for (k = (i + 1); k < n; k++) {
        ik = ik + k;
        s += a[ik] * (*zjk++);
      }
      (*(tmp + j * n + i)) = s;
    }
  }
  for (i = 0; i < n; i++) {
    zi = z + i * n;
    ij = i * (i + 1) / 2;
    for (j = 0; j <= i; ij++, j++) {
      zik = zi;
      tjk = tmp + j * n;
      s = 0.0;
      for (k = 0; k < n; k++) {
        s += (*zik++) * (*tjk++);
      }
      a[ij] = s;
    }
  }
  for (i = 0; i < n; i++) {
    zij = z + i * n;
    zji = z + i;
    for (j = 0; j < i; j++) {
      s = (*(zij));
      (*zij++) = (*zji);
      (*zji) = s;
      zji += n;
    }
  }
  return;
}
```