// File: /workspace/github_c_makefile_star2_O3/ComplexNetworks-DCC-FCUP[P]gtrieScanner/nauty/nautil.c
// Function: writeperm
void
writeperm(FILE *f, permutation *perm, boolean cartesian, int linelength, int n)
{
	int i,k,l,curlen,intlen;
	char s[30];

#if !MAXN
	DYNALLOC1(permutation,workperm,workperm_sz,n,"writeperm");
#endif

    /* CONDNL(x) writes end-of-line and 3 spaces if x characters
       won't fit on the current line. */
#define CONDNL(x) if (linelength>0 && curlen+(x)>linelength)\
	          {putstring(f,"\n   ");curlen=3;}

	curlen = 0;
	if (cartesian)
	{
	    for (i = 0; i < n; ++i)
	    {
	        intlen = itos(perm[i]+labelorg,s);
	        CONDNL(intlen+1);
	        PUTC(' ',f);
	        putstring(f,s);
	        curlen += intlen + 1;
	    }
	    PUTC('\n',f);
	}
	else
	{
	    for (i = n; --i >= 0;) workperm[i] = 0;

	    for (i = 0; i < n; ++i)
	    {
	        if (workperm[i] == 0 && perm[i] != i)
	        {
	            l = i;
	            intlen = itos(l+labelorg,s);
	            if (curlen > 3) CONDNL(2*intlen+4);
	            PUTC('(',f);
	            do
	            {
	                putstring(f,s);
	                curlen += intlen + 1;
	                k = l;
	                l = perm[l];
	                workperm[k] = 1;
	                if (l != i)
	                {
	                    intlen = itos(l+labelorg,s);
	                    CONDNL(intlen+2);
	                    PUTC(' ',f);
	                }
	            }
	            while (l != i);
	            PUTC(')',f);
	            ++curlen;
	        }
	    }

	    if (curlen == 0) putstring(f,"(1)\n");
	    else             PUTC('\n',f);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %r15d
movl %ecx, 0x4(%rsp)
movl %edx, %r12d
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
movslq %r8d, %r13
movq 0x1b8fe(%rip), %rax     # 0x29aa0
cmpq %r13, %rax
jae 0xe1db
testq %rax, %rax
je 0xe1b8
movq 0x1b8f5(%rip), %rdi     # 0x29aa8
callq 0x2260
movq %r13, 0x1b8e1(%rip)     # 0x29aa0
shlq $0x2, %r13
movq %r13, %rdi
callq 0x22a0
movq %rax, 0x1b8d6(%rip)     # 0x29aa8
testq %rax, %rax
je 0xe477
testl %r12d, %r12d
je 0xe29c
testl %r15d, %r15d
jle 0xe428
movl %r15d, %eax
movq %rax, 0x8(%rsp)
xorl %r13d, %r13d
leaq 0x427b(%rip), %rbp      # 0x1247a
xorl %r15d, %r15d
movl 0x1b890(%rip), %edi     # 0x29a98
movq 0x10(%rsp), %rax
addl (%rax,%r13,4), %edi
leaq 0x20(%rsp), %rsi
callq 0xe079
movl %eax, %r12d
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
jle 0xe254
leal (%r15,%r12), %eax
incl %eax
cmpl %ecx, %eax
jle 0xe254
movb $0xa, %al
xorl %r14d, %r14d
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x1(%r14,%rbp), %al
incq %r14
cmpq $0x4, %r14
jne 0xe235
movl $0x3, %r15d
movl $0x20, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x20(%rsp), %al
testb %al, %al
je 0xe283
leaq 0x21(%rsp), %r14
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb (%r14), %al
incq %r14
testb %al, %al
jne 0xe26e
addl %r12d, %r15d
incl %r15d
incq %r13
cmpq 0x8(%rsp), %r13
jne 0xe202
jmp 0xe428
testl %r15d, %r15d
jle 0xe443
movq 0x1b7fc(%rip), %r12     # 0x29aa8
movl %r15d, %r15d
leaq (,%r15,4), %rdx
xorl %r13d, %r13d
movq %r12, %rdi
xorl %esi, %esi
callq 0x2120
leaq 0x41af(%rip), %r14      # 0x1247a
xorl %ebp, %ebp
movq %r15, 0x18(%rsp)
cmpl $0x0, (%r12,%r13,4)
jne 0xe418
movq 0x10(%rsp), %rax
movl (%rax,%r13,4), %eax
cmpq %rax, %r13
je 0xe418
movl %r13d, %r15d
movl 0x1b7a0(%rip), %edi     # 0x29a98
addl %r13d, %edi
leaq 0x20(%rsp), %rsi
callq 0xe079
movl %eax, %r12d
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
movq %r13, 0x8(%rsp)
jle 0xe346
cmpl $0x4, %ebp
jl 0xe346
leal 0x4(%rbp,%r12,2), %eax
cmpl %ecx, %eax
jle 0xe346
movb $0xa, %al
xorl %r13d, %r13d
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x1(%r13,%r14), %al
incq %r13
cmpq $0x4, %r13
jne 0xe328
movl $0x3, %ebp
movl $0x28, %r13d
movl %r13d, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x20(%rsp), %al
testb %al, %al
je 0xe37a
leaq 0x21(%rsp), %r13
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb (%r13), %al
incq %r13
testb %al, %al
jne 0xe364
addl %r12d, %ebp
incl %ebp
movslq %r15d, %rax
movq 0x10(%rsp), %rcx
movl (%rcx,%rax,4), %r15d
movq 0x1b716(%rip), %rcx     # 0x29aa8
movl $0x1, (%rcx,%rax,4)
movq 0x8(%rsp), %r13
cmpq %r15, %r13
je 0xe3fd
movl 0x1b6ef(%rip), %edi     # 0x29a98
addl %r15d, %edi
leaq 0x20(%rsp), %rsi
callq 0xe079
movl %eax, %r12d
movl $0x20, %r13d
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
jle 0xe34c
leal (%r12,%rbp), %eax
addl $0x2, %eax
cmpl %ecx, %eax
jle 0xe34c
movb $0xa, %al
xorl %ebp, %ebp
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x1(%rbp,%r14), %al
incq %rbp
cmpq $0x4, %rbp
jne 0xe3da
movl $0x3, %ebp
jmp 0xe34c
movl $0x29, %edi
movq %rbx, %rsi
callq 0x23d0
incl %ebp
movq 0x1b695(%rip), %r12     # 0x29aa8
movq 0x18(%rsp), %r15
incq %r13
cmpq %r15, %r13
jne 0xe2d2
testl %ebp, %ebp
je 0xe443
movl $0xa, %edi
movq %rbx, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x23d0
movb $0x28, %al
xorl %r14d, %r14d
leaq 0x4030(%rip), %r15      # 0x1247f
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x1(%r14,%r15), %al
incq %r14
cmpq $0x4, %r14
jne 0xe44f
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x25bd