user: Please show me the C implementation that matches the assembly code listed below:

```asm
<spack_trans>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,-0x18(%rsp)
  mov    %rcx,-0x28(%rsp)
  test   %edi,%edi
  jle    L149
  movslq %edi,%rax
  mov    %edi,%ebx
  mov    %rsi,%r13
  lea    0x0(,%rax,8),%r15
  cmp    $0x1,%edi
  je     L225
  lea    0x8(%r15),%r9
  lea    (%rdx,%r15,1),%r8
  mov    $0x1,%esi
  lea    0x8(%rdx),%rdi
  lea    (%rdx,%r9,1),%rcx
  nopw   0x0(%rax,%rax,1)
L203:
  mov    %r8,%rax
  mov    %rdi,%rdx
  cs nopw 0x0(%rax,%rax,1)
L118:
  movsd  (%rax),%xmm0
  movsd  (%rdx),%xmm1
  add    $0x8,%rax
  movsd  %xmm1,-0x8(%rax)
  movsd  %xmm0,(%rdx)
  add    %r15,%rdx
  cmp    %rcx,%rax
  jne    L118
  add    $0x1,%esi
  add    %r15,%r8
  add    $0x8,%rdi
  add    %r9,%rcx
  cmp    %esi,%ebx
  jne    L203
L225:
  xor    %r11d,%r11d
  xor    %r12d,%r12d
  pxor   %xmm3,%xmm3
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L142:
  mov    %ebp,%edx
  mov    %ebp,-0x20(%rsp)
  add    $0x1,%ebp
  mov    -0x18(%rsp),%rdi
  mov    %edx,%eax
  mov    %ebp,%ecx
  xor    %r14d,%r14d
  imul   %ebp,%eax
  and    $0xfffffffe,%ecx
  mov    %rdi,-0x10(%rsp)
  mov    %ecx,-0x30(%rsp)
  mov    %eax,%esi
  mov    -0x28(%rsp),%rax
  sar    %esi
  lea    (%r11,%rax,1),%r10
  movslq %esi,%rax
  mov    %esi,-0x1c(%rsp)
  add    $0x8,%r11
  lea    0x0(%r13,%rax,8),%r9
  mov    %ebp,%eax
  shr    %eax
  lea    -0x1(%rax),%r8d
  mov    %esi,%eax
  add    %ecx,%eax
  add    $0x1,%r8
  mov    %eax,-0x2c(%rsp)
  mov    %ecx,%eax
  shl    $0x4,%r8
  shl    $0x3,%rax
  mov    %rax,-0x38(%rsp)
  lea    (%rsi,%rdx,1),%eax
  mov    %rdi,%rdx
  mov    %eax,-0x40(%rsp)
  test   %r12,%r12
  je     L106
  nopw   0x0(%rax,%rax,1)
L128:
  xor    %eax,%eax
  movapd %xmm3,%xmm0
  cs nopw 0x0(%rax,%rax,1)
L151:
  movupd (%rdi,%rax,1),%xmm2
  movupd (%r9,%rax,1),%xmm4
  add    $0x10,%rax
  mulpd  %xmm4,%xmm2
  addsd  %xmm2,%xmm0
  unpckhpd %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  cmp    %r8,%rax
  jne    L151
  mov    -0x38(%rsp),%rax
  lea    (%rdi,%rax,1),%rdx
  cmp    %ebp,-0x30(%rsp)
  je     L76
  movslq -0x2c(%rsp),%rax
L127:
  movsd  0x0(%r13,%rax,8),%xmm1
  mulsd  (%rdx),%xmm1
  addsd  %xmm1,%xmm0
L76:
  mov    -0x40(%rsp),%edx
  lea    (%r11,%rdi,1),%rcx
  cmp    %ebx,%ebp
  jge    L21
  mov    %ebp,%eax
  nopl   (%rax)
L195:
  add    %eax,%edx
  add    $0x8,%rcx
  add    $0x1,%eax
  movslq %edx,%rsi
  movsd  0x0(%r13,%rsi,8),%xmm1
  mulsd  -0x8(%rcx),%xmm1
  addsd  %xmm1,%xmm0
  cmp    %eax,%ebx
  jne    L195
L21:
  lea    0x1(%r14),%eax
  movsd  %xmm0,(%r10)
  add    %r15,%rdi
  add    %r15,%r10
  cmp    %eax,%ebx
  je     L154
  mov    %eax,%r14d
  mov    %rdi,%rdx
  test   %r12,%r12
  jne    L128
L106:
  movslq -0x1c(%rsp),%rax
  movapd %xmm3,%xmm0
  jmp    L127
  nopl   (%rax)
L154:
  add    $0x1,%r12
  cmp    %r14d,-0x20(%rsp)
  jne    L142
  mov    %eax,%edx
  mov    %eax,%r11d
  movslq %eax,%rbx
  mov    -0x10(%rsp),%r12
  shr    %edx
  and    $0xfffffffe,%r11d
  lea    0x8(%r13),%rsi
  mov    %rbx,-0x40(%rsp)
  lea    -0x1(%rdx),%edi
  mov    %r11d,%r10d
  mov    %r14d,-0x38(%rsp)
  xor    %ebx,%ebx
  add    $0x1,%rdi
  shl    $0x3,%r10
  mov    %rsi,%r14
  shl    $0x4,%rdi
  nop
L193:
  lea    0x1(%rbx),%edx
  lea    (%r12,%r10,1),%rbp
  imul   %ebx,%edx
  sar    %edx
  movslq %edx,%rdx
  lea    0x0(%r13,%rdx,8),%r8
  add    %rbx,%rdx
  lea    (%r14,%rdx,8),%r9
  mov    -0x28(%rsp),%rdx
L42:
  mov    %rdx,%rsi
  cmp    $0x1,%eax
  je     L152
  xor    %ecx,%ecx
  movapd %xmm3,%xmm0
  nopw   0x0(%rax,%rax,1)
L169:
  movupd (%rdx,%rcx,1),%xmm2
  movupd (%r12,%rcx,1),%xmm5
  add    $0x10,%rcx
  mulpd  %xmm5,%xmm2
  addsd  %xmm2,%xmm0
  unpckhpd %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  cmp    %rcx,%rdi
  jne    L169
  lea    (%rdx,%r10,1),%rsi
  mov    %rbp,%rcx
  cmp    %r11d,%eax
  je     L77
L31:
  movsd  (%rsi),%xmm1
  mulsd  (%rcx),%xmm1
  addsd  %xmm1,%xmm0
L77:
  movsd  %xmm0,(%r8)
  add    $0x8,%r8
  add    %r15,%rdx
  cmp    %r9,%r8
  jne    L42
  add    $0x1,%rbx
  add    %r15,%r12
  cmp    %rbx,-0x40(%rsp)
  jne    L193
  mov    -0x38(%rsp),%r14d
  cmp    $0x1,%eax
  je     L149
  mov    -0x18(%rsp),%rax
  mov    -0x40(%rsp),%rbx
  mov    $0x1,%esi
  lea    (%rax,%rbx,8),%rcx
  lea    0x8(%rax),%rdi
  nopl   0x0(%rax,%rax,1)
L41:
  mov    %rdi,%rdx
  xor    %eax,%eax
  nopl   (%rax)
L200:
  movsd  (%rdx),%xmm1
  movsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm1,(%rcx,%rax,8)
  add    $0x1,%rax
  movsd  %xmm0,(%rdx)
  add    %r15,%rdx
  cmp    %eax,%esi
  jg     L200
  lea    0x1(%rsi),%eax
  add    %r15,%rcx
  add    $0x8,%rdi
  cmp    %esi,%r14d
  je     L149
  mov    %eax,%esi
  jmp    L41
  nopl   0x0(%rax,%rax,1)
L152:
  mov    %r12,%rcx
  movapd %xmm3,%xmm0
  jmp    L31
L149:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

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;
}
```