// File: /workspace/github_c_makefile_star2_O2/mishun[P]plantri/fullgen.c
// Function: codiereplanar
void codiereplanar( PLANMAP map )
{
/* Codiert die Einbettung, schreibt sie in das entsprechende file oder
   auf stdout und gibt die laenge des codes zurueck */
int zaehler,knotenzahl;
FLAECHENTYP codeF[2*(81+8*S)];
FLAECHENTYP  *codeFPZ, i;
FILE *fil2;
BOOL test;
static int write_nospiheader=1;

knotenzahl=map[0][0].name;

if (spistat) spiralstatistic(map);

switch(codenumber)
  {
  case 0: {
           if (spiralcheck)
	     { test=spiralcode(map,codeF); 
	       if (!test)
		 { zaehler=longcode(map,codeF);
		   fil2=fopen(no_spiral_filename,"ab");
		if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		                  exit(1); }
		if (write_nospiheader)
		  { write_nospiheader=0;
		  fprintf(fil2,">>planar_code %ce<<", my_endianness);
		  }
		   fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		   fclose(fil2);
		 }
	     }
	   break; }
  case 1: { 
           if (spiralcheck)
	     { test=spiralcode(map,codeF); 
	       if (!test)
		 { zaehler=longcode(map,codeF);
		   fil2=fopen(no_spiral_filename,"ab");
		   if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		   exit(1); }
		   if (write_nospiheader)
		     { write_nospiheader=0;
		     fprintf(fil2,">>planar_code %ce<<", my_endianness);
		     }
		   fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		   fclose(fil2);
		 }
	     }
            zaehler=longcode(map,codeF);
	    if (fil[knotenzahl]==stdout) 
	      { if (write_header_stdout) 
		         { write_header_stdout=0;
		           fprintf(stdout,">>planar_code %ce<<", my_endianness);
			 }
	      }
	    else
	      { if (write_header_fil[knotenzahl]) 
		         { write_header_fil[knotenzahl]=0;
		           fprintf(fil[knotenzahl],">>planar_code %ce<<", my_endianness);
			 }
	      }
	    fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil[knotenzahl]);
	    break; }
  case 2: { test=spiralcode(map,codeF);
	    if (test) { for (i=0; codeF[i]==last_code[i]; i++);
			fwrite(&i,sizeof(FLAECHENTYP),1,fil[knotenzahl]);
	                fwrite(codeF+i,sizeof(FLAECHENTYP),12-i,fil[knotenzahl]);
		        for ( ; i<12; i++) last_code[i]=codeF[i];}
	    else
	      { zaehler=longcode(map,codeF);
		fil2=fopen(no_spiral_filename,"ab");
		if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		exit(1); }
		if (write_nospiheader)
		  { write_nospiheader=0;
		  fprintf(fil2,">>planar_code %ce<<", my_endianness);
		  }
		fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		fclose(fil2);
	      }
	    break; }
  case 3: { 
            test=minspiralcode(map,codeF);
	    if (test) { in_liste(codeF,codeliste+knotenzahl);
			if (graphenzahl[knotenzahl]%((long long int)listenlaenge)==0)
			  {
			  codeFPZ = *(lastcode[knotenzahl]);
			  ausgabe(codeliste+(knotenzahl),knotenzahl,&codeFPZ);
			  for (i=0; i<12; i++) (*(lastcode[knotenzahl]))[i]= codeFPZ[i];
			  listeleer(codeliste+(knotenzahl));
			  (codeliste[knotenzahl].code)[0]=0;
			}
		      }
	    else
	      { zaehler=longcode(map,codeF);
		fil2=fopen(no_spiral_filename,"ab");
		if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		exit(1); }
		if (write_nospiheader)
		  { write_nospiheader=0;
		  fprintf(fil2,">>planar_code %ce<<", my_endianness);
		  }
		fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		fclose(fil2);
	      }
	    break; }
  case 4: {
            if (spiralcheck)
	      { test=spiralcode(map,codeF); 
		if (!test)
		  { zaehler=longcode(map,codeF);
		    fil2=fopen(no_spiral_filename,"ab");
		   if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		   exit(1); }
		   if (write_nospiheader)
		     { write_nospiheader=0;
		     fprintf(fil2,">>planar_code %ce<<", my_endianness);
		     }
		    fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		    fclose(fil2);
		  }
	      }
	    break; }
  case 5: { 
            zaehler=longcode(map,codeF);
	    if (fil[knotenzahl]==stdout) 
	      { if (write_header_stdout) 
		         { write_header_stdout=0;
		           fprintf(stdout,">>planar_code %ce<<", my_endianness);
			 }
	      }
	    else
	      if (write_header_fil[knotenzahl]) 
		         { write_header_fil[knotenzahl]=0;
		           fprintf(fil[knotenzahl],">>planar_code %ce<<", my_endianness);
			 }
	    fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil[knotenzahl]);
            test=spiralcode(map,codeF); 
	    if (!test)
	      { zaehler=longcode(map,codeF);
		fil2=fopen(no_spiral_filename,"ab");
		if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		exit(1); }
		if (write_nospiheader)
		  { write_nospiheader=0;
		  fprintf(fil2,">>planar_code %ce<<", my_endianness);
		  }
		fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		fclose(fil2);
	      }
	    break; }

  case 6: { vegacode(stdout,map); 
            if (spiralcheck)
	      { test=spiralcode(map,codeF); 
		if (!test)
		  { zaehler=longcode(map,codeF);
		    fil2=fopen(no_spiral_filename,"ab");
		   if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		   exit(1); }
		   if (write_nospiheader)
		     { write_nospiheader=0;
		     fprintf(fil2,">>planar_code %ce<<", my_endianness);
		     }
		    fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		    fclose(fil2);
		  }
	      }
	    break; }

  case 7: { dualcode(map); 
            if (spiralcheck)
	      { test=spiralcode(map,codeF); 
		if (!test)
		  { zaehler=longcode(map,codeF);
		    fil2=fopen(no_spiral_filename,"ab");
		    if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
		    exit(1); }
		    if (write_nospiheader)
		      { write_nospiheader=0;
		      fprintf(fil2,">>planar_code %ce<<", my_endianness);
		      }
		    fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
		    fclose(fil2);
		  }
	      }
	    break; }

  case 8: {
           if (spiralcheck)
             { test=spiralcode(map,codeF);
               if (!test)
                 { zaehler=longcode(map,codeF);
                   fil2=fopen(no_spiral_filename,"ab");
                   if (fil2==NULL) { fprintf(stderr,"Can't open %s\n",no_spiral_filename);
                   exit(1); }
                   if (write_nospiheader)
                     { write_nospiheader=0;
                     fprintf(fil2,">>planar_code %ce<<", my_endianness);
                     }
                   fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil2);
                   fclose(fil2);
                 }
             }
            zaehler=sparse6code(map,codeF);
            fwrite(codeF,sizeof(FLAECHENTYP),zaehler,fil[knotenzahl]);
            break; }

  default: { fprintf(stderr,"Dangerous error in switch (codiereplanar) ! \n"); exit(3); }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x978, %rsp            # imm = 0x978
movq %rdi, %rbx
movzwl 0x2(%rdi), %r14d
cmpb $0x0, 0x10c84(%rip)     # 0x13174
je 0x24fa
movq %rbx, %rdi
callq 0x21ec
movl 0x13f2c(%rip), %eax     # 0x1642c
cmpq $0x8, %rax
ja 0x2976
leaq 0xbaf3(%rip), %rcx      # 0xe004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x10c54(%rip)     # 0x13175
je 0x25a1
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b8f
testb %al, %al
jne 0x25a1
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a6a
movl %eax, %ebp
leaq 0x13ee6(%rip), %rdi     # 0x16430
leaq 0xbd4d(%rip), %rsi      # 0xe29e
callq 0x10f0
testq %rax, %rax
je 0x2953
movq %rax, %r15
cmpb $0x0, 0x13ebf(%rip)     # 0x16428
jne 0x2586
movb $0x1, 0x13eb6(%rip)     # 0x16428
leaq 0xbd11(%rip), %rsi      # 0xe28a
pushq $0x6c
popq %rdx
movq %r15, %rdi
xorl %eax, %eax
callq 0x10a0
movslq %ebp, %rdx
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
movq %r15, %rcx
callq 0x1150
movq %r15, %rdi
callq 0x1050
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a6a
movl %eax, %ebx
movl %r14d, %r14d
leaq 0x12c46(%rip), %r15     # 0x15200
movq (%r15,%r14,8), %rax
movq 0x10a13(%rip), %rcx     # 0x12fd8
movq (%rcx), %rdi
cmpq %rdi, %rax
je 0x28fc
leaq 0x13f28(%rip), %rcx     # 0x16500
cmpl $0x0, (%rcx,%r14,4)
je 0x2920
leaq (%rcx,%r14,4), %rcx
movq %rax, %rdi
jmp 0x290c
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1e9f
testb %al, %al
je 0x287e
movl %r14d, %eax
shll $0x5, %eax
leaq 0x1480f(%rip), %rbx     # 0x16e20
addq %rax, %rbx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x2376
leaq 0x19098(%rip), %rax     # 0x1b6c0
movq (%rax,%r14,8), %rax
movslq 0x1a2b5(%rip), %rcx     # 0x1c8e8
cqto
idivq %rcx
testq %rdx, %rdx
jne 0x2934
leaq 0x1a2a8(%rip), %r12     # 0x1c8f0
movq (%r12,%r14,8), %rax
movq (%rax), %rax
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x2418
xorl %eax, %eax
movq (%r15), %rcx
cmpq $0xc, %rax
je 0x2946
movb (%rcx,%rax), %dl
movq (%r12,%r14,8), %rsi
movq (%rsi), %rsi
movb %dl, (%rsi,%rax)
incq %rax
jmp 0x266a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b8f
testb %al, %al
je 0x287e
movb $-0x1, %al
leaq 0x14770(%rip), %r15     # 0x16e14
incb %al
movzbl %al, %r12d
movb 0x10(%rsp,%r12), %cl
cmpb (%r12,%r15), %cl
je 0x26a4
leaq (%rsp,%r12), %rbx
addq $0x10, %rbx
leaq 0x12b3c(%rip), %r13     # 0x15200
movq (%r13,%r14,8), %rsi
movsbl %al, %edi
callq 0x1080
pushq $0xc
popq %rdx
subq %r12, %rdx
movq (%r13,%r14,8), %rcx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1150
cmpq $0xb, %r12
ja 0x2934
movb 0x10(%rsp,%r12), %al
movb %al, (%r12,%r15)
incq %r12
jmp 0x26e7
movq %rbx, %rdi
callq 0x16fa
jmp 0x2766
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a6a
movl %eax, %ebp
leaq 0x12ae1(%rip), %r15     # 0x15200
movq (%r15,%r14,8), %rax
movq 0x108ae(%rip), %rcx     # 0x12fd8
movq (%rcx), %rdi
cmpq %rdi, %rax
je 0x2830
leaq 0x13dc3(%rip), %rcx     # 0x16500
cmpl $0x0, (%rcx,%r14,4)
je 0x2854
leaq (%rcx,%r14,4), %rcx
movq %rax, %rdi
jmp 0x2840
movq 0x1087d(%rip), %rax     # 0x12fd8
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x15f1
cmpb $0x0, 0x10a08(%rip)     # 0x13175
je 0x2934
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
jmp 0x2871
cmpb $0x0, 0x109ee(%rip)     # 0x13175
je 0x2807
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b8f
testb %al, %al
jne 0x2807
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a6a
movl %eax, %ebp
leaq 0x13c80(%rip), %rdi     # 0x16430
leaq 0xbae7(%rip), %rsi      # 0xe29e
callq 0x10f0
testq %rax, %rax
je 0x2953
movq %rax, %r15
cmpb $0x0, 0x13c59(%rip)     # 0x16428
jne 0x27ec
movb $0x1, 0x13c50(%rip)     # 0x16428
leaq 0xbaab(%rip), %rsi      # 0xe28a
pushq $0x6c
popq %rdx
movq %r15, %rdi
xorl %eax, %eax
callq 0x10a0
movslq %ebp, %rdx
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
movq %r15, %rcx
callq 0x1150
movq %r15, %rdi
callq 0x1050
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x18cb
movslq %eax, %rdx
leaq 0x129df(%rip), %rax     # 0x15200
movq (%rax,%r14,8), %rcx
pushq $0x1
popq %rsi
movq %r15, %rdi
jmp 0x292f
cmpl $0x0, 0x10909(%rip)     # 0x13140
je 0x2854
leaq 0x10900(%rip), %rcx     # 0x13140
andl $0x0, (%rcx)
leaq 0xba40(%rip), %rsi      # 0xe28a
pushq $0x6c
popq %rdx
xorl %eax, %eax
callq 0x10a0
movslq %ebp, %rdx
movq (%r15,%r14,8), %rcx
leaq 0x10(%rsp), %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x1150
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1b8f
testb %al, %al
jne 0x2934
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a6a
movl %eax, %ebp
leaq 0x13b9c(%rip), %rdi     # 0x16430
leaq 0xba03(%rip), %rsi      # 0xe29e
callq 0x10f0
testq %rax, %rax
je 0x2953
movq %rax, %rbx
cmpb $0x0, 0x13b75(%rip)     # 0x16428
jne 0x28d0
movb $0x1, 0x13b6c(%rip)     # 0x16428
leaq 0xb9c7(%rip), %rsi      # 0xe28a
pushq $0x6c
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a0
movslq %ebp, %rdx
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0x1150
movq %rbx, %rdi
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1050
cmpl $0x0, 0x1083d(%rip)     # 0x13140
je 0x2920
leaq 0x10834(%rip), %rcx     # 0x13140
andl $0x0, (%rcx)
leaq 0xb974(%rip), %rsi      # 0xe28a
pushq $0x6c
popq %rdx
xorl %eax, %eax
callq 0x10a0
movslq %ebx, %rdx
movq (%r15,%r14,8), %rcx
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x1150
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x24a1
movb $0x0, (%rbx)
jmp 0x2934
movq 0x1069e(%rip), %rax     # 0x12ff8
movq (%rax), %rdi
leaq 0xb93d(%rip), %rsi      # 0xe2a1
leaq 0x13ac5(%rip), %rdx     # 0x16430
xorl %eax, %eax
callq 0x10a0
pushq $0x1
jmp 0x2994
movq 0x1067b(%rip), %rax     # 0x12ff8
movq (%rax), %rcx
leaq 0xb950(%rip), %rdi      # 0xe2d7
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1150
pushq $0x3
popq %rdi
callq 0x1140