// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/plantri.c
// Function: write_code_as_sparse6
static void
write_code_as_sparse6(FILE *f, unsigned char code[])
 
/* Write a graph represented in planar_code to a file in sparse6 format.
   The imbedding is lost but the vertex numbering is the same.  This
   does not use any global variables and works to 255 vertices. */

{
    register unsigned char *pin,*pout;
    unsigned char s6[20+2*MAXE+2*MAXF];
    int n,nb,i,j,lastj,x,k,r,rr,topbit;
    int loopcount;

    pin = code;
    n = *pin++;
    pout = s6;
    *pout++ = ':';

    if (n <= 62)
        *pout++ = 63 + n;
    else
    {
        *pout++ = 63 + 63;
        *pout++ = 63 + 0;
        *pout++ = 63 + (n >> 6);
        *pout++ = 63 + (n & 0x3F);
    }

    for (i = n-1, nb = 0; i != 0 ; i >>= 1, ++nb) {}
    topbit = 1 << (nb-1);
    k = 6;
    x = 0;

    lastj = 0;
    for (j = 0; j < n; ++j)
    {
	loopcount = 0;   /* The input code shows loops once from each end,
                            but we want each loop just once in sparse6. */
        while ((i = *pin++) != 0)
        {
	    --i;
            if (i < j || (i == j && ((++loopcount)&1)))
            {
                if (j == lastj)
                {
                    x <<= 1;
                    if (--k == 0)
                    {
                        *pout++ = 63 + x;
                        k = 6;
                        x = 0;
                    }
                }
                else
                {
                    x = (x << 1) | 1;
                    if (--k == 0)
                    {
                        *pout++ = 63 + x;
                        k = 6;
                        x = 0;
                    }
                    if (j > lastj+1)
                    {
                        for (r = 0, rr = j; r < nb; ++r, rr <<= 1)
                        {
                            if (rr & topbit) x = (x << 1) | 1;
                            else             x <<= 1;
                            if (--k == 0)
                            {
                                *pout++ = 63 + x;
                                k = 6;
                                x = 0;
                            }
                        }
                        x <<= 1;
                        if (--k == 0)
                        {
                            *pout++ = 63 + x;
                            k = 6;
                            x = 0;
                        }
                    }
                    lastj = j;
                }
                for (r = 0, rr = i; r < nb; ++r, rr <<= 1)
                {
                    if (rr & topbit) x = (x << 1) | 1;
                    else             x <<= 1;
                    if (--k == 0)
                    {
                        *pout++ = 63 + x;
                        k = 6;
                        x = 0;
                    }
                }
            }
        }
    }

    if (k != 6) *pout++ = 63 + ((x << k) | ((1 << k) - 1));

    *pout++ = '\n';
    k = pout - s6;

    if (fwrite(s6,sizeof(unsigned char),(size_t)k,f) != k)
    {
        fprintf(stderr,">E %s: fwrite() failed\n",cmdname);
        perror(">E ");
        exit(1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
movl %eax, -0x424(%rbp)
leaq -0x420(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x3a, (%rax)
cmpl $0x3e, -0x424(%rbp)
jg 0xbb07
movl -0x424(%rbp), %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
jmp 0xbb69
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x7e, (%rax)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x3f, (%rax)
movl -0x424(%rbp), %eax
sarl $0x6, %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl -0x424(%rbp), %eax
andl $0x3f, %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl -0x424(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x42c(%rbp)
movl $0x0, -0x428(%rbp)
cmpl $0x0, -0x42c(%rbp)
je 0xbbac
jmp 0xbb8d
movl -0x42c(%rbp), %eax
sarl %eax
movl %eax, -0x42c(%rbp)
movl -0x428(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x428(%rbp)
jmp 0xbb82
movl -0x428(%rbp), %ecx
subl $0x1, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x448(%rbp)
movl $0x6, -0x43c(%rbp)
movl $0x0, -0x438(%rbp)
movl $0x0, -0x434(%rbp)
movl $0x0, -0x430(%rbp)
movl -0x430(%rbp), %eax
cmpl -0x424(%rbp), %eax
jge 0xbf43
movl $0x0, -0x44c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %eax
movl %eax, -0x42c(%rbp)
cmpl $0x0, %eax
je 0xbf2d
movl -0x42c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x42c(%rbp)
movl -0x42c(%rbp), %eax
cmpl -0x430(%rbp), %eax
jl 0xbc71
movl -0x42c(%rbp), %eax
cmpl -0x430(%rbp), %eax
jne 0xbf28
movl -0x44c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44c(%rbp)
andl $0x1, %eax
cmpl $0x0, %eax
je 0xbf28
movl -0x430(%rbp), %eax
cmpl -0x434(%rbp), %eax
jne 0xbcd6
movl -0x438(%rbp), %eax
shll %eax
movl %eax, -0x438(%rbp)
movl -0x43c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x43c(%rbp)
cmpl $0x0, %eax
jne 0xbcd1
movl -0x438(%rbp), %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl $0x6, -0x43c(%rbp)
movl $0x0, -0x438(%rbp)
jmp 0xbe64
movl -0x438(%rbp), %eax
shll %eax
orl $0x1, %eax
movl %eax, -0x438(%rbp)
movl -0x43c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x43c(%rbp)
cmpl $0x0, %eax
jne 0xbd2b
movl -0x438(%rbp), %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl $0x6, -0x43c(%rbp)
movl $0x0, -0x438(%rbp)
movl -0x430(%rbp), %eax
movl -0x434(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0xbe58
movl $0x0, -0x440(%rbp)
movl -0x430(%rbp), %eax
movl %eax, -0x444(%rbp)
movl -0x440(%rbp), %eax
cmpl -0x428(%rbp), %eax
jge 0xbe04
movl -0x444(%rbp), %eax
andl -0x448(%rbp), %eax
cmpl $0x0, %eax
je 0xbd8e
movl -0x438(%rbp), %eax
shll %eax
orl $0x1, %eax
movl %eax, -0x438(%rbp)
jmp 0xbd9c
movl -0x438(%rbp), %eax
shll %eax
movl %eax, -0x438(%rbp)
movl -0x43c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x43c(%rbp)
cmpl $0x0, %eax
jne 0xbde0
movl -0x438(%rbp), %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl $0x6, -0x43c(%rbp)
movl $0x0, -0x438(%rbp)
jmp 0xbde2
movl -0x440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x440(%rbp)
movl -0x444(%rbp), %eax
shll %eax
movl %eax, -0x444(%rbp)
jmp 0xbd58
movl -0x438(%rbp), %eax
shll %eax
movl %eax, -0x438(%rbp)
movl -0x43c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x43c(%rbp)
cmpl $0x0, %eax
jne 0xbe56
movl -0x438(%rbp), %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl $0x6, -0x43c(%rbp)
movl $0x0, -0x438(%rbp)
jmp 0xbe58
movl -0x430(%rbp), %eax
movl %eax, -0x434(%rbp)
movl $0x0, -0x440(%rbp)
movl -0x42c(%rbp), %eax
movl %eax, -0x444(%rbp)
movl -0x440(%rbp), %eax
cmpl -0x428(%rbp), %eax
jge 0xbf26
movl -0x444(%rbp), %eax
andl -0x448(%rbp), %eax
cmpl $0x0, %eax
je 0xbeb0
movl -0x438(%rbp), %eax
shll %eax
orl $0x1, %eax
movl %eax, -0x438(%rbp)
jmp 0xbebe
movl -0x438(%rbp), %eax
shll %eax
movl %eax, -0x438(%rbp)
movl -0x43c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x43c(%rbp)
cmpl $0x0, %eax
jne 0xbf02
movl -0x438(%rbp), %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movl $0x6, -0x43c(%rbp)
movl $0x0, -0x438(%rbp)
jmp 0xbf04
movl -0x440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x440(%rbp)
movl -0x444(%rbp), %eax
shll %eax
movl %eax, -0x444(%rbp)
jmp 0xbe7a
jmp 0xbf28
jmp 0xbc06
jmp 0xbf2f
movl -0x430(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x430(%rbp)
jmp 0xbbea
cmpl $0x6, -0x43c(%rbp)
je 0xbf84
movl -0x438(%rbp), %eax
movl -0x43c(%rbp), %ecx
shll %cl, %eax
movl -0x43c(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
orl %ecx, %eax
addl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0xa, (%rax)
movq -0x20(%rbp), %rax
leaq -0x420(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x43c(%rbp)
leaq -0x420(%rbp), %rdi
movslq -0x43c(%rbp), %rdx
movq -0x8(%rbp), %rcx
movl $0x1, %esi
callq 0x10d0
movslq -0x43c(%rbp), %rcx
cmpq %rcx, %rax
je 0xc007
movq 0x3001f(%rip), %rax     # 0x3bff8
movq (%rax), %rdi
movq 0x300dd(%rip), %rdx     # 0x3c0c0
leaq 0x2c426(%rip), %rsi     # 0x38410
movb $0x0, %al
callq 0x1060
leaq 0x2c3ac(%rip), %rdi     # 0x383a4
callq 0x10a0
movl $0x1, %edi
callq 0x10c0
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq