user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<canonical_perm_ext>:
  endbr64
  push   %r15
  mov    %r9,%r15
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  lea    0x0(,%r12,4),%ebx
  sub    $0x98,%rsp
  mov    0xd8(%rsp),%rax
  mov    %edx,0x3c(%rsp)
  mov    %rcx,0x30(%rsp)
  mov    %rax,0x40(%rsp)
  mov    0xe8(%rsp),%rax
  mov    %r8d,0x20(%rsp)
  mov    %rax,0x48(%rsp)
  mov    0xf8(%rsp),%rax
  mov    %rdi,0x10(%rsp)
  mov    %rax,0x50(%rsp)
  mov    0x108(%rsp),%rax
  mov    %rax,0x58(%rsp)
  mov    0x110(%rsp),%rax
  mov    %rax,0x60(%rsp)
  mov    0x120(%rsp),%rax
  mov    %rax,0x68(%rsp)
  mov    0x130(%rsp),%rax
  mov    %rax,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  mov    0xe0(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %ebx,%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    %ebx,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  mov    %ebx,%edi
  mov    %rax,0x18(%rsp)
  call   <malloc@plt>
  mov    %ebx,%edi
  mov    %rax,%r14
  call   <malloc@plt>
  mov    0xd0(%rsp),%ebx
  movl   $0x0,0x7c(%rsp)
  mov    %rax,0x8(%rsp)
  imul   %r12d,%ebx
  lea    0x0(,%rbx,4),%edi
  call   <malloc@plt>
  mov    0x3c(%rsp),%edx
  mov    0x20(%rsp),%r10d
  mov    %rax,0x80(%rsp)
  mov    0x30(%rsp),%r11
  test   %edx,%edx
  jne    L40
  sub    $0x8,%rsp
  mov    %r10d,%esi
  mov    %r11,%rdi
  mov    %r12d,%r8d
  lea    0x80(%rsp),%rax
  mov    %r15,%rdx
  push   %rax
  mov    0x18(%rsp),%rbx
  mov    0xe0(%rsp),%ecx
  mov    %rbx,%r9
  call   <nonstable_points@plt>
  mov    %r14,%r9
  mov    %r12d,%r8d
  mov    %r15,%rdx
  lea    0x8c(%rsp),%rax
  mov    %rbx,%rdi
  push   %rax
  lea    0x8c(%rsp),%rax
  mov    %rax,0x38(%rsp)
  push   %rax
  lea    0xa0(%rsp),%rax
  push   %rax
  lea    0x98(%rsp),%rax
  push   %rax
  mov    0x100(%rsp),%ecx
  mov    0xa8(%rsp),%esi
  call   <schreier_sims@plt>
  add    $0x30,%rsp
L42:
  mov    0x10(%rsp),%rdi
  mov    %r12d,%edx
  mov    %rbp,%rsi
  call   <inverse@plt>
  mov    0xe0(%rsp),%edx
  test   %edx,%edx
  jle    L5
  mov    0xe0(%rsp),%eax
  mov    %r13,0x30(%rsp)
  mov    %r13,%r15
  lea    0x0(%r13,%rax,4),%rcx
  mov    0x40(%rsp),%rax
  mov    %rcx,%rbx
  sub    %r13,%rax
  mov    %rax,%r13
  nopw   0x0(%rax,%rax,1)
L4:
  mov    0x0(%r13,%r15,1),%edi
  mov    %r12d,%edx
  mov    %rbp,%rsi
  add    $0x4,%r15
  call   <onpoints@plt>
  mov    %eax,-0x4(%r15)
  cmp    %rbx,%r15
  jne    L4
  mov    0x30(%rsp),%r13
L5:
  sub    $0x8,%rsp
  mov    %r14,%rdx
  mov    %r12d,%esi
  push   %rbp
  mov    0xf0(%rsp),%eax
  push   %rax
  push   %r13
  mov    0x40(%rsp),%r9
  mov    0xa0(%rsp),%r8
  mov    0x90(%rsp),%ecx
  mov    0x30(%rsp),%rdi
  call   <coset_rep@plt>
  add    $0x20,%rsp
  mov    0x100(%rsp),%eax
  add    0x128(%rsp),%eax
  jne    L69
  mov    0x28(%rsp),%rsi
  mov    %r12d,%edx
  mov    %rbp,%rdi
  call   <copy_list@plt>
L34:
  mov    %r13,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x80(%rsp),%rdi
  call   <free@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L40:
  mov    %r10d,%edx
  mov    %r11,%rdi
  mov    %r14,%rsi
  mov    %r10d,0x20(%rsp)
  call   <copy_list@plt>
  mov    0x20(%rsp),%r10d
  mov    %ebx,%edx
  mov    %r15,%rdi
  mov    0x80(%rsp),%rsi
  mov    %r10d,0x70(%rsp)
  call   <copy_list@plt>
  mov    0xd0(%rsp),%eax
  mov    %eax,0x74(%rsp)
  lea    0x74(%rsp),%rax
  mov    %rax,0x20(%rsp)
  jmp    L42
  nopl   0x0(%rax)
L69:
  sub    $0x8,%rsp
  mov    $0x1,%r8d
  mov    %r13,%rdx
  mov    %r14,%rdi
  lea    0x80(%rsp),%rax
  push   %rax
  mov    0x18(%rsp),%rbx
  mov    0xf0(%rsp),%ecx
  mov    0x80(%rsp),%esi
  mov    %rbx,%r9
  call   <complement@plt>
  mov    0x88(%rsp),%edx
  mov    %r14,%rsi
  mov    %rbx,%rdi
  call   <copy_list@plt>
  mov    0x88(%rsp),%eax
  mov    %r12d,%r8d
  mov    %r13,%rdi
  mov    0x90(%rsp),%rdx
  mov    %eax,0x80(%rsp)
  pop    %rax
  push   0x28(%rsp)
  mov    0x84(%rsp),%ecx
  mov    %rdx,%r9
  mov    0xf0(%rsp),%esi
  call   <stabilizer@plt>
  mov    0x28(%rsp),%rbx
  mov    %r14,%rdx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  push   %rbx
  mov    0x140(%rsp),%eax
  push   %rax
  push   0x88(%rsp)
  mov    0x140(%rsp),%eax
  push   %rax
  push   0x90(%rsp)
  push   0x90(%rsp)
  mov    0x140(%rsp),%eax
  push   %rax
  push   0x98(%rsp)
  mov    0x140(%rsp),%eax
  push   %rax
  push   0xa0(%rsp)
  mov    0xd4(%rsp),%r9d
  mov    0xe0(%rsp),%r8
  mov    0xd0(%rsp),%ecx
  call   <double_coset_rep@plt>
  add    $0x60,%rsp
  mov    %r12d,%edx
  mov    %rbx,%rdi
  mov    0x28(%rsp),%rsi
  call   <copy_list@plt>
  jmp    L34
L37:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void canonical_perm_ext(int *PERM, int n, int SGSQ, int *base, int bl, int *GS, int m, int *frees, int fl, int *vds, int vdsl, int *dummies, int dl, int *mQ, int *vrs, int vrsl, int *repes, int rl, int *CPERM) {
  int i;
  int *freeps = (int *)malloc(fl * sizeof(int));
  int *PERM1 = (int *)malloc(n * sizeof(int));
  int *PERM2 = (int *)malloc(n * sizeof(int));
  int *newbase = (int *)malloc(n * sizeof(int)), newbl;
  int **newGS = NULL;
  int *pointer;
  int newm;
  int *tmpbase = (int *)malloc(n * sizeof(int)), tmpbl;
  int num = 0;
  pointer = (int *)malloc(m * n * sizeof(int));
  newGS = &pointer;
  if (!SGSQ) {
    nonstable_points(base, bl, GS, m, n, tmpbase, &tmpbl);
    schreier_sims(tmpbase, tmpbl, GS, m, n, newbase, &newbl, newGS, &newm, &num);
  } else {
    copy_list(base, newbase, bl);
    newbl = bl;
    copy_list(GS, *newGS, m * n);
    newm = m;
  }
  inverse(PERM, PERM1, n);
  for (i = 0; i < fl; i++) {
    freeps[i] = onpoints(frees[i], PERM1, n);
  }
  coset_rep(PERM, n, newbase, newbl, *newGS, &newm, freeps, fl, PERM1);
  if (dl + rl == 0) {
    copy_list(PERM1, CPERM, n);
  } else {
    complement(newbase, newbl, freeps, fl, 1, tmpbase, &tmpbl);
    copy_list(tmpbase, newbase, tmpbl);
    newbl = tmpbl;
    stabilizer(freeps, fl, *newGS, newm, n, *newGS, &newm);
    double_coset_rep(PERM1, n, newbase, newbl, *newGS, newm, vds, vdsl, dummies, dl, mQ, vrs, vrsl, repes, rl, PERM2);
    copy_list(PERM2, CPERM, n);
  }
  free(freeps);
  free(PERM1);
  free(PERM2);
  free(newbase);
  free(tmpbase);
  free(*newGS);
}
```