// File: /workspace/github_c_makefile_star2_O0/mishun[P]plantri/fullgen.c
// Function: dualcode
int dualcode( PLANMAP map )

{
/* berechnet das Dual und schreibt es als planarcode auf stdout */

int flaechenzahl, knotenzahl, codelaenge=1,i,j, nextnumber=2;
FLAECHENTYP code[(S+13)*7]; /* In main wird schon abgefangen, wenn das nicht in
			       unsigned char passt */
KANTE *startedge[S+13];
KANTE *run, *merke;
static int write_header=1;

if (write_header)
  { write_header=0;
    fprintf(stdout,">>planar_code %ce<<", my_endianness);
  }
    

knotenzahl=map[0][0].name;
code[0]=flaechenzahl= 2 + (map[0][0].name / 2);


for (i=1; i<= knotenzahl; i++) for (j=0; j<3; j++) map[i][j].dummy=0;
/* dummy gibt die Nummer der Flaeche rechts der Kante an */

belegedummies(map[1],1);
startedge[1]=map[1];

for (i=1; i<=flaechenzahl; i++)
  { merke=startedge[i]; 
    if (merke->invers->dummy) { code[codelaenge]=merke->invers->dummy;
				codelaenge++; }
    else { code[codelaenge]= nextnumber; codelaenge++;
	   startedge[nextnumber]=merke->invers;
	   belegedummies(merke->invers,nextnumber);
	   nextnumber++; }
    for (run=merke->invers->prev; run != merke; run=run->invers->prev)
      { if (run->invers->dummy) { code[codelaenge]=run->invers->dummy;
				    codelaenge++; }
        else { code[codelaenge]= nextnumber; codelaenge++;
	     startedge[nextnumber]=run->invers;
	     belegedummies(run->invers,nextnumber);
	     nextnumber++; }
      }
    code[codelaenge]=0; codelaenge++;
  }

fwrite(code,sizeof(FLAECHENTYP),codelaenge,stdout);

return(codelaenge);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x930, %rsp            # imm = 0x930
movq %rdi, -0x8(%rbp)
movl $0x1, -0x14(%rbp)
movl $0x2, -0x20(%rbp)
cmpl $0x0, 0x1a668(%rip)     # 0x1c13c
je 0x1aff
movl $0x0, 0x1a65c(%rip)     # 0x1c13c
movq 0x1a4f1(%rip), %rax     # 0x1bfd8
movq (%rax), %rdi
movsbl 0x1a64f(%rip), %edx     # 0x1c140
leaq 0x169c2(%rip), %rsi     # 0x184ba
movb $0x0, %al
callq 0x1080
movq -0x8(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movzwl 0x2(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x2, %eax
movl %eax, -0xc(%rbp)
movb %al, -0x450(%rbp)
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x10(%rbp), %eax
jg 0x1b7f
movl $0x0, -0x1c(%rbp)
cmpl $0x3, -0x1c(%rbp)
jge 0x1b72
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x90, %rcx, %rcx
addq %rcx, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1b3c
jmp 0x1b74
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1b2d
movq -0x8(%rbp), %rdi
addq $0x90, %rdi
movl $0x1, %esi
callq 0x1a50
movq -0x8(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x918(%rbp)
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jg 0x1d3f
movslq -0x18(%rbp), %rax
movq -0x920(%rbp,%rax,8), %rax
movq %rax, -0x930(%rbp)
movq -0x930(%rbp), %rax
movq 0x28(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x1c04
movq -0x930(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movb %al, %cl
movslq -0x14(%rbp), %rax
movb %cl, -0x450(%rbp,%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1c50
movl -0x20(%rbp), %eax
movb %al, %cl
movslq -0x14(%rbp), %rax
movb %cl, -0x450(%rbp,%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x930(%rbp), %rax
movq 0x28(%rax), %rcx
movslq -0x20(%rbp), %rax
movq %rcx, -0x920(%rbp,%rax,8)
movq -0x930(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x20(%rbp), %esi
callq 0x1a50
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x930(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x928(%rbp)
movq -0x928(%rbp), %rax
cmpq -0x930(%rbp), %rax
je 0x1d1c
movq -0x928(%rbp), %rax
movq 0x28(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x1cb3
movq -0x928(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movb %al, %cl
movslq -0x14(%rbp), %rax
movb %cl, -0x450(%rbp,%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1cff
movl -0x20(%rbp), %eax
movb %al, %cl
movslq -0x14(%rbp), %rax
movb %cl, -0x450(%rbp,%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x928(%rbp), %rax
movq 0x28(%rax), %rcx
movslq -0x20(%rbp), %rax
movq %rcx, -0x920(%rbp,%rax,8)
movq -0x928(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x20(%rbp), %esi
callq 0x1a50
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1d01
movq -0x928(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x928(%rbp)
jmp 0x1c66
movslq -0x14(%rbp), %rax
movb $0x0, -0x450(%rbp,%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1bac
leaq -0x450(%rbp), %rdi
movslq -0x14(%rbp), %rdx
movq 0x1a287(%rip), %rax     # 0x1bfd8
movq (%rax), %rcx
movl $0x1, %esi
callq 0x1130
movl -0x14(%rbp), %eax
addq $0x930, %rsp            # imm = 0x930
popq %rbp
retq
nopw (%rax,%rax)