// File: /workspace/github_c_makefile_star2_O2/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 %ecx, 0xc(%rsp)
movl %edx, %r14d
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
movq %r8, %r13
movslq %r8d, %r12
movq 0x1c2e3(%rip), %rax     # 0x29ac0
cmpq %r12, %rax
jae 0xd816
testq %rax, %rax
je 0xd7f3
movq 0x1c2da(%rip), %rdi     # 0x29ac8
callq 0x2280
movq %r12, 0x1c2c6(%rip)     # 0x29ac0
shlq $0x2, %r12
movq %r12, %rdi
callq 0x22d0
movq %rax, 0x1c2bb(%rip)     # 0x29ac8
testq %rax, %rax
je 0xda13
testl %r14d, %r14d
je 0xd895
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
leaq 0x20(%rsp), %r14
xorl %ebp, %ebp
cmpq %r15, %r13
je 0xd9dd
movl 0x1c27d(%rip), %edi     # 0x29ab8
movq 0x10(%rsp), %rax
addl (%rax,%r15,4), %edi
movq %r14, %rsi
callq 0xd6e5
movl %eax, %r12d
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0xd875
leal (%r12,%rbp), %eax
incl %eax
cmpl %ecx, %eax
jle 0xd875
movq %rbx, %rdi
leaq 0x3bdf(%rip), %rsi      # 0x1144a
callq 0xd6bf
pushq $0x3
popq %rax
movl %eax, %ebp
pushq $0x20
popq %rdi
movq %rbx, %rsi
callq 0x2410
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd6bf
addl %r12d, %ebp
incl %ebp
incq %r15
jmp 0xd82c
movq 0x1c22c(%rip), %rax     # 0x29ac8
movl %r13d, %ecx
testl %ecx, %ecx
jle 0xd8ad
andl $0x0, -0x4(%rax,%rcx,4)
decq %rcx
jmp 0xd89f
xorl %ebp, %ebp
testl %r13d, %r13d
cmovlel %ebp, %r13d
movq %r13, 0x18(%rsp)
leaq 0x20(%rsp), %r14
xorl %r12d, %r12d
cmpq 0x18(%rsp), %rbp
je 0xd9d8
movq 0x1c1f3(%rip), %rax     # 0x29ac8
cmpl $0x0, (%rax,%rbp,4)
jne 0xd9d0
movq 0x10(%rsp), %rax
movl (%rax,%rbp,4), %eax
cmpq %rax, %rbp
je 0xd9d0
movl 0x1c1c2(%rip), %edi     # 0x29ab8
addl %ebp, %edi
movq %r14, %rsi
callq 0xd6e5
movl %eax, %r13d
movl 0xc(%rsp), %edx
testl %edx, %edx
jle 0xd927
cmpl $0x4, %r12d
jl 0xd927
leal (%r12,%r13,2), %ecx
addl $0x4, %ecx
pushq $0x28
popq %r14
movl %ebp, %r15d
movl %ebp, %eax
cmpl %edx, %ecx
jg 0xd92f
jmp 0xd947
pushq $0x28
popq %r14
movl %ebp, %eax
jmp 0xd947
movq %rbx, %rdi
leaq 0x3b11(%rip), %rsi      # 0x1144a
callq 0xd6bf
movl %r15d, %eax
pushq $0x3
popq %rcx
movl %ecx, %r12d
movl %eax, %r15d
movl %r14d, %edi
movq %rbx, %rsi
callq 0x2410
movq %rbx, %rdi
leaq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0xd6bf
addl %r13d, %r12d
incl %r12d
movslq %r15d, %rax
movq 0x10(%rsp), %rcx
movl (%rcx,%rax,4), %r15d
movq 0x1c14a(%rip), %rcx     # 0x29ac8
movl $0x1, (%rcx,%rax,4)
cmpq %r15, %rbp
je 0xd9c2
movl 0x1c128(%rip), %edi     # 0x29ab8
addl %r15d, %edi
movq %r14, %rsi
callq 0xd6e5
movl %eax, %r13d
pushq $0x20
popq %rdx
movl %edx, %r14d
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jle 0xd94a
leal (%r12,%r13), %eax
addl $0x2, %eax
movl %edx, %r14d
cmpl %ecx, %eax
jle 0xd94a
movl %edx, %r14d
jmp 0xd92f
pushq $0x29
popq %rdi
movq %rbx, %rsi
callq 0x2410
incl %r12d
incq %rbp
jmp 0xd8c3
testl %r12d, %r12d
je 0xd9f6
pushq $0xa
popq %rdi
movq %rbx, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2410
leaq 0x3a52(%rip), %rsi      # 0x1144f
movq %rbx, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd6bf
leaq 0x3a26(%rip), %rdi      # 0x11440
callq 0xda1f