#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ complement(int *, int, int *, int, int, int *, int *);
int /*<<< orphan*/ copy_list(int *, int *, int);
int /*<<< orphan*/ coset_rep(int *, int, int *, int, int *, int *, int *, int,
                             int *);
int /*<<< orphan*/ double_coset_rep(int *, int, int *, int, int *, int, int *,
                                    int, int *, int, int *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ inverse(int *, int *, int);
scalar_t__ malloc(int);
int maxim(int *, int);
int /*<<< orphan*/ nonstable_points(int *, int, int *, int, int, int *, int *);
int onpoints(int, int *, int);
int /*<<< orphan*/ range(int *, int);
int /*<<< orphan*/ schreier_sims(int *, int, int *, int, int, int *, int *,
                                 int **, int *, int *);
int /*<<< orphan*/ stabilizer(int *, int, int *, int, int, int *, int *);
void canonical_perm(int *perm, int SGSQ, int *base, int bl, int *GS, int m,
                    int n, int *freeps, int fl, int *dummyps, int dl,
                    int *dummysetlabels, int ob, int metricQ, int *cperm) {
  int i;
  int *newfreeps = (int *)malloc(fl * sizeof(int));
  int *iperm = (int *)malloc(n * sizeof(int));
  int *perm1 = (int *)malloc(n * sizeof(int));
  int *hperm = (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 *dummies = (int *)malloc(2 * dl * sizeof(int));
  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;
  }
  if ((newbl != 0) && (ob)) {
    range(newbase, newbl = maxim(newbase, newbl));
  }
  copy_list(freeps, newfreeps, fl);
  coset_rep(perm, n, newbase, newbl, *newGS, &newm, newfreeps, fl, perm1);
  if (dl == 0) {
    copy_list(perm1, cperm, n);
  } else {
    complement(newbase, newbl, newfreeps, fl, 1, tmpbase, &tmpbl);
    copy_list(tmpbase, newbase, tmpbl);
    newbl = tmpbl;
    stabilizer(newfreeps, fl, *newGS, newm, n, *newGS, &newm);
    inverse(perm, iperm, n);
    for (i = 0; i < 2 * dl; i++) {
      dummies[i] = onpoints(dummyps[i], iperm, n);
    }
    double_coset_rep(perm1, n, newbase, newbl, *newGS, newm, dummies, dl,
                     dummysetlabels, metricQ, perm2);
    copy_list(perm2, cperm, n);
  }
  free(newfreeps);
  free(iperm);
  free(perm1);
  free(hperm);
  free(perm2);
  free(newbase);
  free(tmpbase);
  free(dummies);
  free(*newGS);
}


x86 assembly (clang, -O0):
<canonical_perm>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xd0,%rsp
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9d,-0x3c(%rbp)
movslq 0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq 0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq 0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq 0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x60(%rbp)
movslq 0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x68(%rbp)
movslq 0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x70(%rbp)
movq   $0x0,-0x80(%rbp)
movslq 0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    0x30(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0x3c(%rbp),%eax
imul   0x10(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x88(%rbp)
lea    -0x88(%rbp),%rax
mov    %rax,-0x80(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    136f <canonical_perm+0x19f>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    -0x98(%rbp),%r9
lea    -0x9c(%rbp),%rax
mov    %rax,(%rsp)
call   10a0 <nonstable_points@plt>
mov    -0x98(%rbp),%rdi
mov    -0x9c(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    -0x70(%rbp),%r9
mov    -0x80(%rbp),%r11
lea    -0x74(%rbp),%rbx
lea    -0x8c(%rbp),%r10
lea    -0xac(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1070 <schreier_sims@plt>
jmp    13a5 <canonical_perm+0x1d5>
mov    -0x28(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   10e0 <copy_list@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x80(%rbp),%rax
mov    (%rax),%rsi
mov    -0x3c(%rbp),%edx
imul   0x10(%rbp),%edx
call   10e0 <copy_list@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
cmpl   $0x0,-0x74(%rbp)
je     13e1 <canonical_perm+0x211>
cmpl   $0x0,0x40(%rbp)
je     13e1 <canonical_perm+0x211>
mov    -0x70(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
call   1040 <maxim@plt>
mov    -0xb8(%rbp),%rdi
mov    %eax,%esi
mov    %esi,-0x74(%rbp)
call   10b0 <range@plt>
mov    0x18(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    0x20(%rbp),%edx
call   10e0 <copy_list@plt>
mov    -0x18(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x70(%rbp),%rdx
mov    -0x74(%rbp),%ecx
mov    -0x80(%rbp),%rax
mov    (%rax),%r8
mov    -0x48(%rbp),%r11
mov    0x20(%rbp),%r10d
mov    -0x58(%rbp),%rax
lea    -0x8c(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1080 <coset_rep@plt>
cmpl   $0x0,0x30(%rbp)
jne    144b <canonical_perm+0x27b>
mov    -0x58(%rbp),%rdi
mov    0x50(%rbp),%rsi
mov    0x10(%rbp),%edx
call   10e0 <copy_list@plt>
jmp    157f <canonical_perm+0x3af>
mov    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    0x20(%rbp),%ecx
mov    -0x98(%rbp),%r9
mov    $0x1,%r8d
lea    -0x9c(%rbp),%rax
mov    %rax,(%rsp)
call   1060 <complement@plt>
mov    -0x98(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x9c(%rbp),%edx
call   10e0 <copy_list@plt>
mov    -0x9c(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x48(%rbp),%rdi
mov    0x20(%rbp),%esi
mov    -0x80(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    -0x80(%rbp),%rax
mov    (%rax),%r9
lea    -0x8c(%rbp),%rax
mov    %rax,(%rsp)
call   10d0 <stabilizer@plt>
mov    -0x18(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    0x10(%rbp),%edx
call   10c0 <inverse@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    0x30(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1521 <canonical_perm+0x351>
mov    0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x50(%rbp),%rsi
mov    0x10(%rbp),%edx
call   10f0 <onpoints@plt>
mov    %eax,%edx
mov    -0xa8(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    14db <canonical_perm+0x30b>
mov    -0x58(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x70(%rbp),%rdx
mov    -0x74(%rbp),%ecx
mov    -0x80(%rbp),%rax
mov    (%rax),%r8
mov    -0x8c(%rbp),%r9d
mov    -0xa8(%rbp),%r14
mov    0x30(%rbp),%ebx
mov    0x38(%rbp),%r11
mov    0x48(%rbp),%r10d
mov    -0x68(%rbp),%rax
mov    %r14,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1030 <double_coset_rep@plt>
mov    -0x68(%rbp),%rdi
mov    0x50(%rbp),%rsi
mov    0x10(%rbp),%edx
call   10e0 <copy_list@plt>
mov    -0x48(%rbp),%rdi
call   1050 <free@plt>
mov    -0x50(%rbp),%rdi
call   1050 <free@plt>
mov    -0x58(%rbp),%rdi
call   1050 <free@plt>
mov    -0x60(%rbp),%rdi
call   1050 <free@plt>
mov    -0x68(%rbp),%rdi
call   1050 <free@plt>
mov    -0x70(%rbp),%rdi
call   1050 <free@plt>
mov    -0x98(%rbp),%rdi
call   1050 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1050 <free@plt>
mov    -0x80(%rbp),%rax
mov    (%rax),%rdi
call   1050 <free@plt>
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<canonical_perm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9d,0x24(%rsp)
mov    %r8,0x40(%rsp)
mov    %ecx,0x30(%rsp)
mov    %rdx,0x38(%rsp)
mov    %esi,0x18(%rsp)
mov    %rdi,0x50(%rsp)
mov    0xd0(%rsp),%r12d
mov    0xc0(%rsp),%eax
mov    0xb0(%rsp),%r15d
lea    0x0(,%rax,4),%edi
call   1090 <malloc@plt>
mov    %rax,0x68(%rsp)
lea    0x0(,%r15,4),%ebp
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%r13
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x60(%rsp)
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x70(%rsp)
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
lea    0x0(,%r12,8),%edi
call   1090 <malloc@plt>
mov    %rax,%r12
movl   $0x0,0x34(%rsp)
imul   0x24(%rsp),%r15d
lea    0x0(,%r15,4),%edi
call   1090 <malloc@plt>
mov    %rax,0x28(%rsp)
cmpl   $0x0,0x18(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r14,0x58(%rsp)
je     12e3 <canonical_perm+0x113>
mov    %rax,%rbp
mov    0x38(%rsp),%rdi
mov    %rbx,%rsi
mov    0x30(%rsp),%ebx
mov    %ebx,%edx
call   10e0 <copy_list@plt>
mov    %ebx,0xc(%rsp)
mov    0x40(%rsp),%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   10e0 <copy_list@plt>
mov    0x24(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %ebx,%esi
jmp    1359 <canonical_perm+0x189>
sub    $0x8,%rsp
lea    0x1c(%rsp),%r10
mov    0x40(%rsp),%rdi
mov    0x38(%rsp),%esi
mov    0x48(%rsp),%r15
mov    %r15,%rdx
mov    0x2c(%rsp),%ebp
mov    %ebp,%ecx
mov    0xb8(%rsp),%eax
mov    %rax,%r8
mov    %r14,%r9
push   %r10
call   10a0 <nonstable_points@plt>
add    $0x10,%rsp
mov    0x14(%rsp),%esi
lea    0x34(%rsp),%rax
lea    0x10(%rsp),%r11
lea    0x28(%rsp),%r10
mov    %r14,%rdi
mov    %r15,%rdx
mov    %ebp,%ecx
mov    0xb0(%rsp),%r8d
mov    %rbx,%r9
push   %rax
push   %r11
push   %r10
lea    0x24(%rsp),%rax
push   %rax
call   1070 <schreier_sims@plt>
add    $0x20,%rsp
mov    0xc(%rsp),%esi
mov    0xb8(%rsp),%rbx
cmpl   $0x0,0xe0(%rsp)
mov    0x68(%rsp),%r15
mov    0x50(%rsp),%r14
mov    0xc0(%rsp),%eax
je     13a2 <canonical_perm+0x1d2>
test   %esi,%esi
je     13a2 <canonical_perm+0x1d2>
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <maxim@plt>
mov    %eax,0xc(%rsp)
mov    %rbp,%rdi
mov    %eax,%esi
call   10b0 <range@plt>
mov    0xc0(%rsp),%eax
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rax,%rbx
mov    %ebx,%edx
call   10e0 <copy_list@plt>
mov    0xc(%rsp),%ecx
mov    0x28(%rsp),%r8
sub    $0x8,%rsp
lea    0x18(%rsp),%r9
mov    %r14,%rdi
mov    0xb8(%rsp),%eax
mov    %rax,%rsi
mov    0x20(%rsp),%rdx
mov    0x68(%rsp),%rbp
push   %rbp
push   %rbx
push   %r15
call   1080 <coset_rep@plt>
add    $0x20,%rsp
mov    0xd0(%rsp),%eax
test   %eax,%eax
je     1520 <canonical_perm+0x350>
mov    0xc(%rsp),%esi
sub    $0x8,%rsp
lea    0x1c(%rsp),%rax
mov    $0x1,%r14d
mov    0x20(%rsp),%rdi
mov    %r15,%rdx
mov    %ebx,%ecx
mov    $0x1,%r8d
mov    0x60(%rsp),%rbp
mov    %rbp,%r9
push   %rax
call   1060 <complement@plt>
add    $0x10,%rsp
mov    0x14(%rsp),%edx
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
call   10e0 <copy_list@plt>
mov    0x14(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x28(%rsp),%rdx
mov    0x10(%rsp),%ecx
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebx,%esi
mov    0xb8(%rsp),%ebx
mov    %ebx,%r8d
mov    %rdx,%r9
lea    0x18(%rsp),%rax
push   %rax
call   10d0 <stabilizer@plt>
add    $0x10,%rsp
mov    0x50(%rsp),%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   10c0 <inverse@plt>
mov    0xd0(%rsp),%eax
test   %eax,%eax
jle    14cc <canonical_perm+0x2fc>
mov    0xc8(%rsp),%rbp
mov    0xd0(%rsp),%eax
add    %eax,%eax
cmp    $0x2,%eax
cmovge %eax,%r14d
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%r15,4),%edi
mov    %r13,%rsi
mov    %ebx,%edx
call   10f0 <onpoints@plt>
mov    %eax,(%r12,%r15,4)
add    $0x1,%r15
cmp    %r15,%r14
jne    14b0 <canonical_perm+0x2e0>
mov    0xc(%rsp),%ecx
mov    0x28(%rsp),%r8
mov    0x10(%rsp),%r9d
sub    $0x8,%rsp
mov    0x68(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%esi
mov    0x20(%rsp),%rdx
mov    0x50(%rsp),%r14
push   %r14
mov    0xf8(%rsp),%eax
push   %rax
push   0xf0(%rsp)
mov    0xf0(%rsp),%eax
push   %rax
push   %r12
call   1030 <double_coset_rep@plt>
add    $0x30,%rsp
mov    %r14,%rdi
mov    0x68(%rsp),%r15
jmp    152f <canonical_perm+0x35f>
mov    %rbp,%rdi
mov    0x48(%rsp),%r14
mov    0xb0(%rsp),%ebx
mov    0xf0(%rsp),%rsi
mov    %ebx,%edx
call   10e0 <copy_list@plt>
mov    %r15,%rdi
call   1050 <free@plt>
mov    %r13,%rdi
call   1050 <free@plt>
mov    %rbp,%rdi
call   1050 <free@plt>
mov    0x70(%rsp),%rdi
call   1050 <free@plt>
mov    %r14,%rdi
call   1050 <free@plt>
mov    0x18(%rsp),%rdi
call   1050 <free@plt>
mov    0x58(%rsp),%rdi
call   1050 <free@plt>
mov    %r12,%rdi
call   1050 <free@plt>
mov    0x28(%rsp),%rdi
call   1050 <free@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @canonical_perm(i32* %0, i32 %1, i32* %2, i32 %3, i32* %4, i32 %5, i32 %6, i32* %7, i32 %8, i32* %9, i32 %10, i32* %11, i32 %12, i32 %13, i32* %14) {
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32*
%19 = alloca i32
%20 = alloca i32*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32*
%24 = alloca i32
%25 = alloca i32*
%26 = alloca i32
%27 = alloca i32*
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32*
%31 = alloca i32
%32 = alloca i32*
%33 = alloca i32*
%34 = alloca i32*
%35 = alloca i32*
%36 = alloca i32*
%37 = alloca i32*
%38 = alloca i32
%39 = alloca i32**
%40 = alloca i32*
%41 = alloca i32
%42 = alloca i32*
%43 = alloca i32
%44 = alloca i32*
%45 = alloca i32
store i32* %0, i32** %16
store i32 %1, i32* %17
store i32* %2, i32** %18
store i32 %3, i32* %19
store i32* %4, i32** %20
store i32 %5, i32* %21
store i32 %6, i32* %22
store i32* %7, i32** %23
store i32 %8, i32* %24
store i32* %9, i32** %25
store i32 %10, i32* %26
store i32* %11, i32** %27
store i32 %12, i32* %28
store i32 %13, i32* %29
store i32* %14, i32** %30
%46 = load i32, i32* %24
%47 = sext i32 %46 to i64
%48 = mul i64 %47, 4
%49 = trunc i64 %48 to i32
%50 = call i64 @malloc(i32 %49)
%51 = inttoptr i64 %50 to i32*
store i32* %51, i32** %32
%52 = load i32, i32* %22
%53 = sext i32 %52 to i64
%54 = mul i64 %53, 4
%55 = trunc i64 %54 to i32
%56 = call i64 @malloc(i32 %55)
%57 = inttoptr i64 %56 to i32*
store i32* %57, i32** %33
%58 = load i32, i32* %22
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 4
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to i32*
store i32* %63, i32** %34
%64 = load i32, i32* %22
%65 = sext i32 %64 to i64
%66 = mul i64 %65, 4
%67 = trunc i64 %66 to i32
%68 = call i64 @malloc(i32 %67)
%69 = inttoptr i64 %68 to i32*
store i32* %69, i32** %35
%70 = load i32, i32* %22
%71 = sext i32 %70 to i64
%72 = mul i64 %71, 4
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to i32*
store i32* %75, i32** %36
%76 = load i32, i32* %22
%77 = sext i32 %76 to i64
%78 = mul i64 %77, 4
%79 = trunc i64 %78 to i32
%80 = call i64 @malloc(i32 %79)
%81 = inttoptr i64 %80 to i32*
store i32* %81, i32** %37
store i32** null, i32*** %39
%82 = load i32, i32* %22
%83 = sext i32 %82 to i64
%84 = mul i64 %83, 4
%85 = trunc i64 %84 to i32
%86 = call i64 @malloc(i32 %85)
%87 = inttoptr i64 %86 to i32*
store i32* %87, i32** %42
%88 = load i32, i32* %26
%89 = mul nsw i32 2, %88
%90 = sext i32 %89 to i64
%91 = mul i64 %90, 4
%92 = trunc i64 %91 to i32
%93 = call i64 @malloc(i32 %92)
%94 = inttoptr i64 %93 to i32*
store i32* %94, i32** %44
store i32 0, i32* %45
%95 = load i32, i32* %21
%96 = load i32, i32* %22
%97 = mul nsw i32 %95, %96
%98 = sext i32 %97 to i64
%99 = mul i64 %98, 4
%100 = trunc i64 %99 to i32
%101 = call i64 @malloc(i32 %100)
%102 = inttoptr i64 %101 to i32*
store i32* %102, i32** %40
store i32** %40, i32*** %39
%103 = load i32, i32* %17
%104 = icmp ne i32 %103, 0
br i1 %104, label %121, label %105
105: ; preds = %15
%106 = load i32*, i32** %18
%107 = load i32, i32* %19
%108 = load i32*, i32** %20
%109 = load i32, i32* %21
%110 = load i32, i32* %22
%111 = load i32*, i32** %42
%112 = call i32 @nonstable_points(i32* %106, i32 %107, i32* %108, i32 %109, i32 %110, i32* %111, i32* %43)
%113 = load i32*, i32** %42
%114 = load i32, i32* %43
%115 = load i32*, i32** %20
%116 = load i32, i32* %21
%117 = load i32, i32* %22
%118 = load i32*, i32** %37
%119 = load i32**, i32*** %39
%120 = call i32 @schreier_sims(i32* %113, i32 %114, i32* %115, i32 %116, i32 %117, i32* %118, i32* %38, i32** %119, i32* %41, i32* %45)
br label %135
121: ; preds = %15
%122 = load i32*, i32** %18
%123 = load i32*, i32** %37
%124 = load i32, i32* %19
%125 = call i32 @copy_list(i32* %122, i32* %123, i32 %124)
%126 = load i32, i32* %19
store i32 %126, i32* %38
%127 = load i32*, i32** %20
%128 = load i32**, i32*** %39
%129 = load i32*, i32** %128
%130 = load i32, i32* %21
%131 = load i32, i32* %22
%132 = mul nsw i32 %130, %131
%133 = call i32 @copy_list(i32* %127, i32* %129, i32 %132)
%134 = load i32, i32* %21
store i32 %134, i32* %41
br label %135
135: ; preds = %121, %105
%136 = load i32, i32* %38
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %147
138: ; preds = %135
%139 = load i32, i32* %28
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %147
141: ; preds = %138
%142 = load i32*, i32** %37
%143 = load i32*, i32** %37
%144 = load i32, i32* %38
%145 = call i32 @maxim(i32* %143, i32 %144)
store i32 %145, i32* %38
%146 = call i32 @range(i32* %142, i32 %145)
br label %147
147: ; preds = %141, %138, %135
%148 = load i32*, i32** %23
%149 = load i32*, i32** %32
%150 = load i32, i32* %24
%151 = call i32 @copy_list(i32* %148, i32* %149, i32 %150)
%152 = load i32*, i32** %16
%153 = load i32, i32* %22
%154 = load i32*, i32** %37
%155 = load i32, i32* %38
%156 = load i32**, i32*** %39
%157 = load i32*, i32** %156
%158 = load i32*, i32** %32
%159 = load i32, i32* %24
%160 = load i32*, i32** %34
%161 = call i32 @coset_rep(i32* %152, i32 %153, i32* %154, i32 %155, i32* %157, i32* %41, i32* %158, i32 %159, i32* %160)
%162 = load i32, i32* %26
%163 = icmp eq i32 %162, 0
br i1 %163, label %164, label %169
164: ; preds = %147
%165 = load i32*, i32** %34
%166 = load i32*, i32** %30
%167 = load i32, i32* %22
%168 = call i32 @copy_list(i32* %165, i32* %166, i32 %167)
br label %233
169: ; preds = %147
%170 = load i32*, i32** %37
%171 = load i32, i32* %38
%172 = load i32*, i32** %32
%173 = load i32, i32* %24
%174 = load i32*, i32** %42
%175 = call i32 @complement(i32* %170, i32 %171, i32* %172, i32 %173, i32 1, i32* %174, i32* %43)
%176 = load i32*, i32** %42
%177 = load i32*, i32** %37
%178 = load i32, i32* %43
%179 = call i32 @copy_list(i32* %176, i32* %177, i32 %178)
%180 = load i32, i32* %43
store i32 %180, i32* %38
%181 = load i32*, i32** %32
%182 = load i32, i32* %24
%183 = load i32**, i32*** %39
%184 = load i32*, i32** %183
%185 = load i32, i32* %41
%186 = load i32, i32* %22
%187 = load i32**, i32*** %39
%188 = load i32*, i32** %187
%189 = call i32 @stabilizer(i32* %181, i32 %182, i32* %184, i32 %185, i32 %186, i32* %188, i32* %41)
%190 = load i32*, i32** %16
%191 = load i32*, i32** %33
%192 = load i32, i32* %22
%193 = call i32 @inverse(i32* %190, i32* %191, i32 %192)
store i32 0, i32* %31
br label %194
194: ; preds = %212, %169
%195 = load i32, i32* %31
%196 = load i32, i32* %26
%197 = mul nsw i32 2, %196
%198 = icmp slt i32 %195, %197
br i1 %198, label %199, label %215
199: ; preds = %194
%200 = load i32*, i32** %25
%201 = load i32, i32* %31
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds i32, i32* %200, i64 %202
%204 = load i32, i32* %203
%205 = load i32*, i32** %33
%206 = load i32, i32* %22
%207 = call i32 @onpoints(i32 %204, i32* %205, i32 %206)
%208 = load i32*, i32** %44
%209 = load i32, i32* %31
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i32, i32* %208, i64 %210
store i32 %207, i32* %211
br label %212
212: ; preds = %199
%213 = load i32, i32* %31
%214 = add nsw i32 %213, 1
store i32 %214, i32* %31
br label %194
215: ; preds = %194
%216 = load i32*, i32** %34
%217 = load i32, i32* %22
%218 = load i32*, i32** %37
%219 = load i32, i32* %38
%220 = load i32**, i32*** %39
%221 = load i32*, i32** %220
%222 = load i32, i32* %41
%223 = load i32*, i32** %44
%224 = load i32, i32* %26
%225 = load i32*, i32** %27
%226 = load i32, i32* %29
%227 = load i32*, i32** %36
%228 = call i32 @double_coset_rep(i32* %216, i32 %217, i32* %218, i32 %219, i32* %221, i32 %222, i32* %223, i32 %224, i32* %225, i32 %226, i32* %227)
%229 = load i32*, i32** %36
%230 = load i32*, i32** %30
%231 = load i32, i32* %22
%232 = call i32 @copy_list(i32* %229, i32* %230, i32 %231)
br label %233
233: ; preds = %215, %164
%234 = load i32*, i32** %32
%235 = call i32 @free(i32* %234)
%236 = load i32*, i32** %33
%237 = call i32 @free(i32* %236)
%238 = load i32*, i32** %34
%239 = call i32 @free(i32* %238)
%240 = load i32*, i32** %35
%241 = call i32 @free(i32* %240)
%242 = load i32*, i32** %36
%243 = call i32 @free(i32* %242)
%244 = load i32*, i32** %37
%245 = call i32 @free(i32* %244)
%246 = load i32*, i32** %42
%247 = call i32 @free(i32* %246)
%248 = load i32*, i32** %44
%249 = call i32 @free(i32* %248)
%250 = load i32**, i32*** %39
%251 = load i32*, i32** %250
%252 = call i32 @free(i32* %251)
ret void
}

LLVM IR (-O2):
define void @canonical_perm(i32* %0, i32 %1, i32* %2, i32 %3, i32* %4, i32 %5, i32 %6, i32* %7, i32 %8, i32* nocapture %9, i32 %10, i32* %11, i32 %12, i32 %13, i32* %14) {
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = shl i32 %8, 2
%22 = tail call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i32*
%24 = shl i32 %6, 2
%25 = tail call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to i32*
%27 = tail call i64 @malloc(i32 %24)
%28 = inttoptr i64 %27 to i32*
%29 = tail call i64 @malloc(i32 %24)
%30 = tail call i64 @malloc(i32 %24)
%31 = inttoptr i64 %30 to i32*
%32 = tail call i64 @malloc(i32 %24)
%33 = inttoptr i64 %32 to i32*
%34 = bitcast i32* %16 to i8*
%35 = bitcast i32** %17 to i8*
%36 = bitcast i32* %18 to i8*
%37 = tail call i64 @malloc(i32 %24)
%38 = inttoptr i64 %37 to i32*
%39 = bitcast i32* %19 to i8*
%40 = shl i32 %10, 1
%41 = shl i32 %10, 3
%42 = tail call i64 @malloc(i32 %41)
%43 = inttoptr i64 %42 to i32*
%44 = bitcast i32* %20 to i8*
store i32 0, i32* %20
%45 = mul nsw i32 %6, %5
%46 = shl i32 %45, 2
%47 = tail call i64 @malloc(i32 %46)
%48 = inttoptr i64 %47 to i32*
store i32* %48, i32** %17
%49 = icmp eq i32 %1, 0
br i1 %49, label %50, label %55
50: ; preds = %15
%51 = call i32 @nonstable_points(i32* %2, i32 %3, i32* %4, i32 %5, i32 %6, i32* %38, i32* %19)
%52 = load i32, i32* %19
%53 = call i32 @schreier_sims(i32* %38, i32 %52, i32* %4, i32 %5, i32 %6, i32* %33, i32* %16, i32** %17, i32* %18, i32* %20)
%54 = load i32, i32* %16
br label %58
55: ; preds = %15
%56 = tail call i32 @copy_list(i32* %2, i32* %33, i32 %3)
store i32 %3, i32* %16
%57 = tail call i32 @copy_list(i32* %4, i32* %48, i32 %45)
store i32 %5, i32* %18
br label %58
58: ; preds = %55, %50
%59 = phi i32 [ %3, %55 ], [ %54, %50 ]
%60 = icmp ne i32 %59, 0
%61 = icmp ne i32 %12, 0
%62 = and i1 %61, %60
br i1 %62, label %63, label %66
63: ; preds = %58
%64 = call i32 @maxim(i32* %33, i32 %59)
store i32 %64, i32* %16
%65 = call i32 @range(i32* %33, i32 %64)
br label %66
66: ; preds = %63, %58
%67 = call i32 @copy_list(i32* %7, i32* %23, i32 %8)
%68 = load i32, i32* %16
%69 = load i32*, i32** %17
%70 = call i32 @coset_rep(i32* %0, i32 %6, i32* %33, i32 %68, i32* %69, i32* %18, i32* %23, i32 %8, i32* %28)
%71 = icmp eq i32 %10, 0
br i1 %71, label %99, label %72
72: ; preds = %66
%73 = load i32, i32* %16
%74 = call i32 @complement(i32* %33, i32 %73, i32* %23, i32 %8, i32 1, i32* %38, i32* %19)
%75 = load i32, i32* %19
%76 = call i32 @copy_list(i32* %38, i32* %33, i32 %75)
%77 = load i32, i32* %19
store i32 %77, i32* %16
%78 = load i32*, i32** %17
%79 = load i32, i32* %18
%80 = call i32 @stabilizer(i32* %23, i32 %8, i32* %78, i32 %79, i32 %6, i32* %78, i32* %18)
%81 = call i32 @inverse(i32* %0, i32* %26, i32 %6)
%82 = icmp sgt i32 %10, 0
br i1 %82, label %83, label %94
83: ; preds = %72
%84 = call i32 @llvm.smax.i32(i32 %40, i32 1)
%85 = zext i32 %84 to i64
br label %86
86: ; preds = %83, %86
%87 = phi i64 [ 0, %83 ], [ %92, %86 ]
%88 = getelementptr inbounds i32, i32* %9, i64 %87
%89 = load i32, i32* %88
%90 = call i32 @onpoints(i32 %89, i32* %26, i32 %6)
%91 = getelementptr inbounds i32, i32* %43, i64 %87
store i32 %90, i32* %91
%92 = add nuw nsw i64 %87, 1
%93 = icmp eq i64 %92, %85
br i1 %93, label %94, label %86
94: ; preds = %86, %72
%95 = load i32, i32* %16
%96 = load i32*, i32** %17
%97 = load i32, i32* %18
%98 = call i32 @double_coset_rep(i32* %28, i32 %6, i32* %33, i32 %95, i32* %96, i32 %97, i32* %43, i32 %10, i32* %11, i32 %13, i32* %31)
br label %99
99: ; preds = %66, %94
%100 = phi i32* [ %31, %94 ], [ %28, %66 ]
%101 = call i32 @copy_list(i32* %100, i32* %14, i32 %6)
%102 = inttoptr i64 %29 to i32*
%103 = call i32 @free(i32* %23)
%104 = call i32 @free(i32* %26)
%105 = call i32 @free(i32* %28)
%106 = call i32 @free(i32* %102)
%107 = call i32 @free(i32* %31)
%108 = call i32 @free(i32* %33)
%109 = call i32 @free(i32* %38)
%110 = call i32 @free(i32* %43)
%111 = load i32*, i32** %17
%112 = call i32 @free(i32* %111)
ret void
}