// File: /workspace/github_c_makefile_star2_O1/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, 0x11343(%rip)     # 0x15194
je 0x3e5b
movq %rbx, %rdi
callq 0x3b0b
movl 0x145eb(%rip), %eax     # 0x1844c
cmpq $0x8, %rax
ja 0x4492
leaq 0xc192(%rip), %rcx      # 0x10004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpb $0x0, 0x11313(%rip)     # 0x15195
je 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d3
testb %al, %al
jne 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x1459d(%rip), %rdi     # 0x18450
leaq 0xc3e4(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
jne 0x43ea
callq 0x144f
cmpb $0x0, 0x112c1(%rip)     # 0x15195
je 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d3
testb %al, %al
jne 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x1454b(%rip), %rdi     # 0x18450
leaq 0xc392(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
jne 0x43ea
callq 0x13af
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d3
testb %al, %al
je 0x430a
movb $-0xc, %r15b
leaq 0x14ef6(%rip), %rbx     # 0x18e34
leal 0xc(%r15), %eax
movzbl %al, %r13d
movb 0x10(%rsp,%r13), %al
incb %r15b
cmpb (%r13,%rbx), %al
je 0x3f3e
leaq 0x132c4(%rip), %rax     # 0x17220
movq (%rax,%r14,8), %rsi
leal 0xb(%r15), %r12d
movsbl %r12b, %ebp
movl %ebp, %edi
callq 0x1090
leaq (%rsp,%r13), %rdi
addq $0x10, %rdi
movl $0xc, %edx
subq %r13, %rdx
leaq 0x1329a(%rip), %rax     # 0x17220
movq (%rax,%r14,8), %rcx
movl $0x1, %esi
callq 0x1180
cmpb $0xb, %bpl
ja 0x4480
movzbl %r12b, %eax
addq %rax, %rbx
leaq (%rsp,%rax), %rsi
addq $0x10, %rsi
negb %r15b
movzbl %r15b, %edx
incq %rdx
movq %rbx, %rdi
callq 0x10d0
jmp 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x37e4
testb %al, %al
je 0x433a
movl %r14d, %ebx
shll $0x5, %ebx
leaq 0x14e5a(%rip), %r15     # 0x18e40
addq %r15, %rbx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x3cfe
leaq 0x196e3(%rip), %rax     # 0x1d6e0
movq (%rax,%r14,8), %rax
movslq 0x1a900(%rip), %rcx     # 0x1e908
cqto
idivq %rcx
testq %rdx, %rdx
jne 0x4480
leaq 0x1a8f3(%rip), %r12     # 0x1e910
movq (%r12,%r14,8), %rax
movq (%rax), %rax
leaq 0x8(%rsp), %rdx
movq %rax, (%rdx)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3d7e
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movb (%rcx,%rax), %cl
movq (%r12,%r14,8), %rdx
movq (%rdx), %rdx
movb %cl, (%rdx,%rax)
incq %rax
cmpq $0xc, %rax
jne 0x4039
movq %rbx, %rdi
callq 0x3e02
shll $0x5, %r14d
movb $0x0, (%r14,%r15)
jmp 0x4480
movq %rbx, %rdi
callq 0x302c
cmpb $0x0, 0x1111c(%rip)     # 0x15195
je 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d3
testb %al, %al
jne 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x143a6(%rip), %rdi     # 0x18450
leaq 0xc1ed(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
jne 0x43ea
callq 0x1337
cmpb $0x0, 0x110ca(%rip)     # 0x15195
je 0x4153
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d3
testb %al, %al
jne 0x4153
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x14358(%rip), %rdi     # 0x18450
leaq 0xc19f(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
je 0x449c
movq %rax, %r15
cmpb $0x0, 0x14331(%rip)     # 0x18448
jne 0x4136
movb $0x1, 0x14328(%rip)     # 0x18448
leaq 0xc163(%rip), %rsi      # 0x1028a
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 0x339d
movl %eax, %ebx
movl %r14d, %r14d
leaq 0x130b4(%rip), %r15     # 0x17220
movq (%r15,%r14,8), %rax
movq 0x10e61(%rip), %rcx     # 0x14fd8
movq (%rcx), %rdi
cmpq %rdi, %rax
je 0x4441
leaq 0x14396(%rip), %rcx     # 0x18520
cmpl $0x0, (%rcx,%r14,4)
je 0x446a
leaq (%rcx,%r14,4), %rcx
movq %rax, %rdi
jmp 0x4451
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x13069(%rip), %r15     # 0x17220
movq (%r15,%r14,8), %rax
movq 0x10e16(%rip), %rcx     # 0x14fd8
movq (%rcx), %rdi
cmpq %rdi, %rax
je 0x436a
leaq 0x1434b(%rip), %rcx     # 0x18520
cmpl $0x0, (%rcx,%r14,4)
je 0x4393
leaq (%rcx,%r14,4), %rcx
movq %rax, %rdi
jmp 0x437a
movq 0x10de5(%rip), %rax     # 0x14fd8
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x2f19
cmpb $0x0, 0x10f90(%rip)     # 0x15195
je 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d3
testb %al, %al
jne 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x1421a(%rip), %rdi     # 0x18450
leaq 0xc061(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
jne 0x43ea
callq 0x135f
cmpb $0x0, 0x10f3e(%rip)     # 0x15195
je 0x42df
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d3
testb %al, %al
jne 0x42df
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x141cc(%rip), %rdi     # 0x18450
leaq 0xc013(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
je 0x44a1
movq %rax, %r15
cmpb $0x0, 0x141a5(%rip)     # 0x18448
jne 0x42c2
movb $0x1, 0x1419c(%rip)     # 0x18448
leaq 0xbfd7(%rip), %rsi      # 0x1028a
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 0x31e4
movslq %eax, %rdx
leaq 0x12f27(%rip), %rax     # 0x17220
movq (%rax,%r14,8), %rcx
movl $0x1, %esi
movq %r15, %rdi
jmp 0x447b
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x14130(%rip), %rdi     # 0x18450
leaq 0xbf77(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
jne 0x43ea
callq 0x13ff
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x14100(%rip), %rdi     # 0x18450
leaq 0xbf47(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
jne 0x43ea
callq 0x13d7
cmpl $0x0, 0x10def(%rip)     # 0x15160
je 0x4393
leaq 0x10de6(%rip), %rcx     # 0x15160
movl $0x0, (%rcx)
leaq 0xbf03(%rip), %rsi      # 0x1028a
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 0x34d3
testb %al, %al
jne 0x4480
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x339d
movl %eax, %ebp
leaq 0x1407b(%rip), %rdi     # 0x18450
leaq 0xbec2(%rip), %rsi      # 0x1029e
callq 0x1120
testq %rax, %rax
je 0x4497
movq %rax, %rbx
cmpb $0x0, 0x14054(%rip)     # 0x18448
jne 0x4413
movb $0x1, 0x1404b(%rip)     # 0x18448
leaq 0xbe86(%rip), %rsi      # 0x1028a
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, 0x10d18(%rip)     # 0x15160
je 0x446a
leaq 0x10d0f(%rip), %rcx     # 0x15160
movl $0x0, (%rcx)
leaq 0xbe2c(%rip), %rsi      # 0x1028a
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