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

```asm
<AO2MOrestore_nr8to1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  add    $0x1,%edx
  imul   %r12d,%edx
  push   %rbp
  push   %rbx
  mov    %r12d,%ebx
  imul   %r12d,%ebx
  mov    %edx,%eax
  shr    $0x1f,%eax
  sub    $0x78,%rsp
  add    %edx,%eax
  mov    %ebx,%edx
  mov    %rdi,0x18(%rsp)
  movslq %ebx,%rbp
  imul   %r12d,%edx
  sar    %eax
  mov    %rsi,0x50(%rsp)
  lea    0x0(,%rax,8),%edi
  mov    %rbp,0x60(%rsp)
  movslq %eax,%r14
  movslq %edx,%r13
  mov    %r13,0x58(%rsp)
  call   <malloc@plt>
  mov    %rax,%r15
  movslq %r12d,%rax
  mov    %rax,0x68(%rsp)
  test   %rax,%rax
  je     L60
  movq   $0x0,0x38(%rsp)
  lea    0x0(,%rbx,8),%eax
  mov    %eax,0x2c(%rsp)
  lea    0x0(,%rbp,8),%rax
  mov    %rax,(%rsp)
  lea    0x0(,%r13,8),%rax
  mov    %rax,0x30(%rsp)
  movq   $0x0,0x8(%rsp)
  nopl   (%rax)
L34:
  mov    0x8(%rsp),%rsi
  mov    0x58(%rsp),%rdx
  mov    %rsi,%rax
  mov    %rsi,0x48(%rsp)
  add    $0x1,%rsi
  imul   %rax,%rdx
  mov    %rsi,0x8(%rsp)
  mov    %rdx,0x40(%rsp)
  test   %rax,%rax
  je     L9
  cmp    %rax,%rsi
  mov    %rax,%rdi
  mov    0x38(%rsp),%r8
  mov    %r12d,0x10(%rsp)
  cmovbe %rsi,%rdi
  imul   (%rsp),%rax
  mov    0x40(%rsp),%rsi
  xor    %r9d,%r9d
  mov    %r8,%r13
  mov    %r9,%r12
  mov    %rdi,0x20(%rsp)
  mov    0x50(%rsp),%rdi
  mov    %rax,%rbx
  lea    (%rdi,%rsi,8),%rbp
  add    %rdi,%rbx
L50:
  mov    0x18(%rsp),%rdx
  mov    %r13,%rsi
  mov    %r15,%rcx
  mov    %r14,%rdi
  add    $0x1,%r12
  add    $0x1,%r13
  call   <NPdunpack_row@plt>
  mov    0x10(%rsp),%edi
  mov    %rbp,%rdx
  mov    %r15,%rsi
  mov    $0x1,%ecx
  call   <NPdunpack_tril@plt>
  mov    0x2c(%rsp),%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
  add    (%rsp),%rbp
  add    0x30(%rsp),%rbx
  cmp    0x20(%rsp),%r12
  jb     L50
  mov    %r12,%r9
  mov    %r13,%r8
  mov    0x10(%rsp),%r12d
  cmp    0x8(%rsp),%r9
  jae    L6
L68:
  mov    0x60(%rsp),%rax
  mov    0x50(%rsp),%rdi
  mov    %r8,%rbx
  mov    0x18(%rsp),%r13
  imul   %r9,%rax
  sub    %r8,%r9
  add    0x40(%rsp),%rax
  mov    %r9,0x10(%rsp)
  lea    (%rdi,%rax,8),%rbp
  nopw   0x0(%rax,%rax,1)
L24:
  mov    %rbx,%rsi
  mov    %r15,%rcx
  mov    %r13,%rdx
  mov    %r14,%rdi
  call   <NPdunpack_row@plt>
  mov    %rbp,%rdx
  mov    $0x1,%ecx
  mov    %r15,%rsi
  mov    %r12d,%edi
  add    $0x1,%rbx
  call   <NPdunpack_tril@plt>
  mov    0x10(%rsp),%rax
  add    (%rsp),%rbp
  add    %rbx,%rax
  cmp    %rax,0x8(%rsp)
  ja     L24
L6:
  mov    0x38(%rsp),%rax
  mov    0x48(%rsp),%rsi
  mov    0x8(%rsp),%rbx
  lea    0x1(%rax,%rsi,1),%rax
  mov    %rax,0x38(%rsp)
  cmp    %rbx,0x68(%rsp)
  ja     L34
L60:
  add    $0x78,%rsp
  mov    %r15,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <free@plt>
  nopl   (%rax)
L9:
  mov    0x38(%rsp),%r8
  xor    %r9d,%r9d
  jmp    L68
```

assistant: ```c
void AO2MOrestore_nr8to1(double *eri8, double *eri1, int norb) {
  size_t npair = norb * (norb + 1) / 2;
  size_t i, j, ij;
  size_t d2 = norb * norb;
  size_t d3 = norb * norb * norb;
  double *buf = malloc(sizeof(double) * npair);
  for (ij = 0, i = 0; i < norb; i++) {
    for (j = 0; j < i + 1; j++, ij++) {
      NPdunpack_row(npair, ij, eri8, buf);
      NPdunpack_tril(norb, buf, eri1 + i * d3 + j * d2, 1);
      if (i > j) {
        memcpy(eri1 + j * d3 + i * d2, eri1 + i * d3 + j * d2, sizeof(double) * norb * norb);
      }
    }
  }
  free(buf);
}
```