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

```asm
<compute_all_permutations>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x1,-0x1c(%rbp)
  jmp    L123
L79:
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x1c(%rbp)
L123:
  mov    -0x1c(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L79
  movl   $0x1,-0x18(%rbp)
  jmp    L165
L54:
  movl   $0x0,-0x14(%rbp)
  jmp    L93
L51:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x14(%rbp),%ecx
  mov    -0x24(%rbp),%edx
  add    %ecx,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x14(%rbp)
L93:
  mov    -0x14(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L51
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  sub    $0x2,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L153
L68:
  cmpl   $0x0,-0x10(%rbp)
  je     L37
  subl   $0x1,-0x10(%rbp)
L153:
  cmpl   $0x0,-0x10(%rbp)
  js     L151
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L68
L151:
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L35
L168:
  cmpl   $0x0,-0xc(%rbp)
  js     L77
  subl   $0x1,-0xc(%rbp)
L35:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L168
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L126
L120:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  addl   $0x1,-0x14(%rbp)
  subl   $0x1,-0xc(%rbp)
L126:
  mov    -0x14(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L120
  addl   $0x1,-0x18(%rbp)
L165:
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <factorial@plt>
  cmp    %eax,-0x18(%rbp)
  jl     L54
  jmp    L114
L37:
  nop
  jmp    L114
L77:
  nop
L114:
  leave
  ret
```

assistant: ```c
void compute_all_permutations(int n, int *res) {
  int i;
  int *curr = res;
  for (i = 1; i <= n; i++) {
    res[i - 1] = i;
  }
  int found = 1;
  while (found < factorial(n)) {
    int k;
    for (k = 0; k < n; k++) {
      curr[k + n] = curr[k];
    }
    curr += n;
    int j;
    for (j = n - 2; j >= 0 && curr[j] >= curr[j + 1]; j--) {
      if (j == 0) {
        return;
      }
    }
    int l;
    for (l = n - 1; curr[j] >= curr[l]; l--) {
      if (l < 0) {
        return;
      }
    }
    swap(&curr[j], &curr[l]);
    for (k = j + 1, l = n - 1; k < l;) {
      swap(&curr[k], &curr[l]);
      k++;
      l--;
    }
    found++;
  }
}
```