// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
cmpq 0x2058b(%rip), %rax     # 0x3d530
jbe 0x1cff0
cmpq $0x0, 0x20581(%rip)     # 0x3d530
je 0x1cfbd
movq 0x20580(%rip), %rdi     # 0x3d538
callq 0x3320
movslq -0x1c(%rbp), %rax
movq %rax, 0x20568(%rip)     # 0x3d530
movslq -0x1c(%rbp), %rdi
shlq $0x2, %rdi
callq 0x3370
movq %rax, 0x2055c(%rip)     # 0x3d538
cmpq $0x0, %rax
jne 0x1cfee
leaq 0x3e4a(%rip), %rdi      # 0x20e33
callq 0x1d260
jmp 0x1cff0
movl $0x0, -0x2c(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x1d0a2
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1d08f
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %edi
addl 0x20507(%rip), %edi     # 0x3d528
leaq -0x50(%rbp), %rsi
callq 0x1cd70
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x1d05a
movl -0x2c(%rbp), %eax
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
addl %ecx, %eax
cmpl -0x18(%rbp), %eax
jle 0x1d05a
movq -0x8(%rbp), %rdi
leaq 0x3def(%rip), %rsi      # 0x20e3d
callq 0x1cd30
movl $0x3, -0x2c(%rbp)
movq -0x8(%rbp), %rsi
movl $0x20, %edi
callq 0x34c0
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1cd30
movl -0x30(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1d008
movq -0x8(%rbp), %rsi
movl $0xa, %edi
callq 0x34c0
jmp 0x1d25a
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, %eax
jl 0x1d0ca
movq 0x2047b(%rip), %rax     # 0x3d538
movslq -0x20(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x1d0a8
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1d232
movq 0x20454(%rip), %rax     # 0x3d538
movslq -0x20(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x1d222
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x20(%rbp), %eax
je 0x1d222
movl -0x20(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %edi
addl 0x20413(%rip), %edi     # 0x3d528
leaq -0x50(%rbp), %rsi
callq 0x1cd70
movl %eax, -0x30(%rbp)
cmpl $0x3, -0x2c(%rbp)
jle 0x1d158
cmpl $0x0, -0x18(%rbp)
jle 0x1d156
movl -0x2c(%rbp), %eax
movl -0x30(%rbp), %ecx
shll %ecx
addl $0x4, %ecx
addl %ecx, %eax
cmpl -0x18(%rbp), %eax
jle 0x1d156
movq -0x8(%rbp), %rdi
leaq 0x3cf3(%rip), %rsi      # 0x20e3d
callq 0x1cd30
movl $0x3, -0x2c(%rbp)
jmp 0x1d158
movq -0x8(%rbp), %rsi
movl $0x28, %edi
callq 0x34c0
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1cd30
movl -0x30(%rbp), %eax
addl $0x1, %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movq 0x2039e(%rip), %rax     # 0x3d538
movslq -0x24(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x1d1fd
movl -0x28(%rbp), %edi
addl 0x20372(%rip), %edi     # 0x3d528
leaq -0x50(%rbp), %rsi
callq 0x1cd70
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x1d1ef
movl -0x2c(%rbp), %eax
movl -0x30(%rbp), %ecx
addl $0x2, %ecx
addl %ecx, %eax
cmpl -0x18(%rbp), %eax
jle 0x1d1ef
movq -0x8(%rbp), %rdi
leaq 0x3c5a(%rip), %rsi      # 0x20e3d
callq 0x1cd30
movl $0x3, -0x2c(%rbp)
movq -0x8(%rbp), %rsi
movl $0x20, %edi
callq 0x34c0
jmp 0x1d1ff
movl -0x28(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x1d166
movq -0x8(%rbp), %rsi
movl $0x29, %edi
callq 0x34c0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1d224
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1d0d1
cmpl $0x0, -0x2c(%rbp)
jne 0x1d24a
movq -0x8(%rbp), %rdi
leaq 0x3bff(%rip), %rsi      # 0x20e42
callq 0x1cd30
jmp 0x1d258
movq -0x8(%rbp), %rsi
movl $0xa, %edi
callq 0x34c0
jmp 0x1d25a
addq $0x50, %rsp
popq %rbp
retq