// File: /workspace/github_c_makefile_star2_O1/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 0x1bb15(%rip), %rax     # 0x29aa0
cmpq %r13, %rax
jae 0xdfc4
testq %rax, %rax
je 0xdfa1
movq 0x1bb0c(%rip), %rdi     # 0x29aa8
callq 0x2260
movq %r13, 0x1baf8(%rip)     # 0x29aa0
shlq $0x2, %r13
movq %r13, %rdi
callq 0x22a0
movq %rax, 0x1baed(%rip)     # 0x29aa8
testq %rax, %rax
je 0xe260
testl %r12d, %r12d
je 0xe085
testl %r15d, %r15d
jle 0xe211
movl %r15d, %eax
movq %rax, 0x8(%rsp)
xorl %r13d, %r13d
leaq 0x4482(%rip), %rbp      # 0x1246a
xorl %r15d, %r15d
movl 0x1baa7(%rip), %edi     # 0x29a98
movq 0x10(%rsp), %rax
addl (%rax,%r13,4), %edi
leaq 0x20(%rsp), %rsi
callq 0xde61
movl %eax, %r12d
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
jle 0xe03d
leal (%r15,%r12), %eax
incl %eax
cmpl %ecx, %eax
jle 0xe03d
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 0xe01e
movl $0x3, %r15d
movl $0x20, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x20(%rsp), %al
testb %al, %al
je 0xe06c
leaq 0x21(%rsp), %r14
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb (%r14), %al
incq %r14
testb %al, %al
jne 0xe057
addl %r12d, %r15d
incl %r15d
incq %r13
cmpq 0x8(%rsp), %r13
jne 0xdfeb
jmp 0xe211
testl %r15d, %r15d
jle 0xe09f
movq 0x1ba17(%rip), %rdi     # 0x29aa8
movl %r15d, %edx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2120
testl %r15d, %r15d
jle 0xe22c
movl %r15d, %ecx
xorl %r14d, %r14d
leaq 0x43b5(%rip), %r15      # 0x1246a
xorl %ebp, %ebp
movq %rcx, 0x18(%rsp)
movq 0x1b9e5(%rip), %rax     # 0x29aa8
cmpl $0x0, (%rax,%r14,4)
jne 0xe201
movq 0x10(%rsp), %rax
movl (%rax,%r14,4), %eax
cmpq %rax, %r14
je 0xe201
movl 0x1b9b2(%rip), %edi     # 0x29a98
addl %r14d, %edi
leaq 0x20(%rsp), %rsi
callq 0xde61
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
movq %rax, 0x8(%rsp)
jle 0xe130
cmpl $0x4, %ebp
jl 0xe130
leal 0x4(%rbp,%rax,2), %eax
cmpl %ecx, %eax
jle 0xe130
movb $0xa, %al
xorl %r12d, %r12d
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x1(%r12,%r15), %al
incq %r12
cmpq $0x4, %r12
jne 0xe112
movl $0x3, %ebp
movl $0x28, %edi
movq %rbx, %rsi
callq 0x23d0
movl %r14d, %r13d
movb 0x20(%rsp), %al
testb %al, %al
je 0xe163
leaq 0x21(%rsp), %r12
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb (%r12), %al
incq %r12
testb %al, %al
jne 0xe14d
movq 0x8(%rsp), %rax
addl %eax, %ebp
incl %ebp
movslq %r13d, %rax
movq 0x10(%rsp), %rcx
movl (%rcx,%rax,4), %r13d
movq 0x1b929(%rip), %rcx     # 0x29aa8
movl $0x1, (%rcx,%rax,4)
cmpq %r13, %r14
je 0xe1e4
movl 0x1b907(%rip), %edi     # 0x29a98
addl %r13d, %edi
leaq 0x20(%rsp), %rsi
callq 0xde61
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
movq %rax, 0x8(%rsp)
jle 0xe1d7
addl %ebp, %eax
addl $0x2, %eax
cmpl %ecx, %eax
jle 0xe1d7
movb $0xa, %al
xorl %r12d, %r12d
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x1(%r12,%r15), %al
incq %r12
cmpq $0x4, %r12
jne 0xe1b9
movl $0x3, %ebp
movl $0x20, %edi
movq %rbx, %rsi
callq 0x23d0
cmpq %r13, %r14
jne 0xe140
movl $0x29, %edi
movq %rbx, %rsi
callq 0x23d0
incl %ebp
movq 0x18(%rsp), %rcx
incq %r14
cmpq %rcx, %r14
jne 0xe0bc
testl %ebp, %ebp
je 0xe22c
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 0x4237(%rip), %r15      # 0x1246f
movsbl %al, %edi
movq %rbx, %rsi
callq 0x23d0
movb 0x1(%r14,%r15), %al
incq %r14
cmpq $0x4, %r14
jne 0xe238
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x25bd