// File: /workspace/github_c_makefile_star2_O3/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, 0x112f9(%rip)     # 0x15194
je 0x3ea5
movq %rbx, %rdi
callq 0x3b2c
movl 0x145a1(%rip), %eax     # 0x1844c
cmpq $0x8, %rax
ja 0x44cc
leaq 0xc1c4(%rip), %rcx      # 0x10080
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x112c9(%rip)     # 0x15195
je 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3521
testb %al, %al
jne 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x14553(%rip), %rdi     # 0x18450
leaq 0xc406(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
jne 0x4424
callq 0x144f
cmpb $0x0, 0x11277(%rip)     # 0x15195
je 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3521
testb %al, %al
jne 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x14501(%rip), %rdi     # 0x18450
leaq 0xc3b4(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
jne 0x4424
callq 0x13af
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3521
testb %al, %al
je 0x4344
movb $-0xd, %r12b
leaq 0x14eac(%rip), %rbx     # 0x18e34
leal 0xd(%r12), %eax
movzbl %al, %r13d
movb 0x10(%rsp,%r13), %al
incb %r12b
cmpb (%r13,%rbx), %al
je 0x3f88
leaq (%rsp,%r13), %r15
addq $0x10, %r15
leaq 0x13271(%rip), %rbp     # 0x17220
movq (%rbp,%r14,8), %rsi
leal 0xc(%r12), %eax
movsbl %al, %edi
callq 0x1090
movl $0xc, %edx
subq %r13, %rdx
movq (%rbp,%r14,8), %rcx
movl $0x1, %esi
movq %r15, %rdi
callq 0x1180
movl %r12d, %eax
addb $0xc, %al
jae 0x44ba
addq %r13, %rbx
negb %r12b
movzbl %r12b, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10d0
jmp 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x380a
testb %al, %al
je 0x4374
movl %r14d, %eax
shll $0x5, %eax
leaq 0x14e1e(%rip), %rbx     # 0x18e40
addq %rax, %rbx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x3d32
leaq 0x196a7(%rip), %rax     # 0x1d6e0
movq (%rax,%r14,8), %rax
movslq 0x1a8c4(%rip), %rcx     # 0x1e908
cqto
idivq %rcx
testq %rdx, %rdx
jne 0x44ba
leaq 0x1a8b7(%rip), %r12     # 0x1e910
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 0x3dbc
xorl %eax, %eax
movq (%r15), %rcx
movb (%rcx,%rax), %dl
movq (%r12,%r14,8), %rsi
movq (%rsi), %rsi
movb %dl, (%rsi,%rax)
incq %rax
cmpq $0xc, %rax
jne 0x407b
movq %rbx, %rdi
callq 0x3e4c
movb $0x0, (%rbx)
jmp 0x44ba
movq %rbx, %rdi
callq 0x2ff2
cmpb $0x0, 0x110e5(%rip)     # 0x15195
je 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3521
testb %al, %al
jne 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x1436f(%rip), %rdi     # 0x18450
leaq 0xc222(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
jne 0x4424
callq 0x1337
cmpb $0x0, 0x11093(%rip)     # 0x15195
je 0x418a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3521
testb %al, %al
jne 0x418a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x14321(%rip), %rdi     # 0x18450
leaq 0xc1d4(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
je 0x44d6
movq %rax, %r15
cmpb $0x0, 0x142fa(%rip)     # 0x18448
jne 0x416d
movb $0x1, 0x142f1(%rip)     # 0x18448
leaq 0xc198(%rip), %rsi      # 0x102f6
movq %r15, %rdi
movl $0x6c, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %rdx
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
movq %r15, %rcx
callq 0x1180
movq %r15, %rdi
callq 0x1050
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebx
movl %r14d, %r14d
leaq 0x1307d(%rip), %r15     # 0x17220
movq (%r15,%r14,8), %rax
movq 0x10e2a(%rip), %rcx     # 0x14fd8
movq (%rcx), %rdi
cmpq %rdi, %rax
je 0x447b
leaq 0x1435f(%rip), %rcx     # 0x18520
cmpl $0x0, (%rcx,%r14,4)
je 0x44a4
leaq (%rcx,%r14,4), %rcx
movq %rax, %rdi
jmp 0x448b
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x13032(%rip), %r15     # 0x17220
movq (%r15,%r14,8), %rax
movq 0x10ddf(%rip), %rcx     # 0x14fd8
movq (%rcx), %rdi
cmpq %rdi, %rax
je 0x43a4
leaq 0x14314(%rip), %rcx     # 0x18520
cmpl $0x0, (%rcx,%r14,4)
je 0x43cd
leaq (%rcx,%r14,4), %rcx
movq %rax, %rdi
jmp 0x43b4
movq 0x10dae(%rip), %rax     # 0x14fd8
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x2edf
cmpb $0x0, 0x10f59(%rip)     # 0x15195
je 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3521
testb %al, %al
jne 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x141e3(%rip), %rdi     # 0x18450
leaq 0xc096(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
jne 0x4424
callq 0x135f
cmpb $0x0, 0x10f07(%rip)     # 0x15195
je 0x4316
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x3521
testb %al, %al
jne 0x4316
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x14195(%rip), %rdi     # 0x18450
leaq 0xc048(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
je 0x44db
movq %rax, %r15
cmpb $0x0, 0x1416e(%rip)     # 0x18448
jne 0x42f9
movb $0x1, 0x14165(%rip)     # 0x18448
leaq 0xc00c(%rip), %rsi      # 0x102f6
movq %r15, %rdi
movl $0x6c, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %rdx
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
movq %r15, %rcx
callq 0x1180
movq %r15, %rdi
callq 0x1050
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3210
movslq %eax, %rdx
movl %r14d, %eax
leaq 0x12eed(%rip), %rcx     # 0x17220
movq (%rcx,%rax,8), %rcx
movl $0x1, %esi
movq %r15, %rdi
jmp 0x44b5
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x140f6(%rip), %rdi     # 0x18450
leaq 0xbfa9(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
jne 0x4424
callq 0x13ff
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x140c6(%rip), %rdi     # 0x18450
leaq 0xbf79(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
jne 0x4424
callq 0x13d7
cmpl $0x0, 0x10db5(%rip)     # 0x15160
je 0x43cd
leaq 0x10dac(%rip), %rcx     # 0x15160
movl $0x0, (%rcx)
leaq 0xbf35(%rip), %rsi      # 0x102f6
movl $0x6c, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %rdx
movq (%r15,%r14,8), %rcx
leaq 0x10(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdi
callq 0x1180
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3521
testb %al, %al
jne 0x44ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x33bc
movl %eax, %ebp
leaq 0x14041(%rip), %rdi     # 0x18450
leaq 0xbef4(%rip), %rsi      # 0x1030a
callq 0x1120
testq %rax, %rax
je 0x44d1
movq %rax, %rbx
cmpb $0x0, 0x1401a(%rip)     # 0x18448
jne 0x444d
movb $0x1, 0x14011(%rip)     # 0x18448
leaq 0xbeb8(%rip), %rsi      # 0x102f6
movq %rbx, %rdi
movl $0x6c, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %rdx
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
movq %rbx, %rcx
callq 0x1180
movq %rbx, %rdi
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1050
cmpl $0x0, 0x10cde(%rip)     # 0x15160
je 0x44a4
leaq 0x10cd5(%rip), %rcx     # 0x15160
movl $0x0, (%rcx)
leaq 0xbe5e(%rip), %rsi      # 0x102f6
movl $0x6c, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebx, %rdx
movq (%r15,%r14,8), %rcx
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x1180
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1477
callq 0x1387
callq 0x1427
callq 0x130f