// File: /workspace/github_c_makefile_star2_O3/mishun[P]plantri/fullgen.c
// Function: berechne_sequenz
void berechne_sequenz(SEQUENZ *sq, SEQUENZ altsq, int start,int f_ecke)
/* berechnet die neue sequenz startend bei der Kante start */
/* geht fest davon aus, dass 2 mal nach innen hintereinander nicht vorkommt */
/* zwei der Kanten-Eintraege koennen noch nicht belegt werden (die ersten beiden) */
/* start ist der laufindex */
{
int i, j, k, laenge,alt_laenge;
int *sequenz; 
int puffer[13];
char *kan;
KANTE **sqkanten;
KANTE *kpuffer[13];


sequenz=sq->sequenz;
kan=sq->k_marks;
sqkanten=sq->kanten;

alt_laenge=altsq.laenge;
sq->laenge= alt_laenge-f_ecke;
laenge=sq->laenge;

for (i=0; i<alt_laenge; i++) { puffer[i]=puffer[i+alt_laenge]=altsq.sequenz[i];
			       kpuffer[i]=kpuffer[i+alt_laenge]=altsq.kanten[i]; }

if (puffer[start]==0) { fprintf(stderr,"Berechne_sequenz should not be called for 0-gaps ! \n");
                        exit(5); }

if (f_ecke==0)
  { if (laenge==1) sequenz[0]=puffer[0]+1;
    else 
    if (laenge==2)
         { if (puffer[start]>1) { sequenz[0]=puffer[start]-1; sequenz[1]=puffer[start+1]+2; }
	      else { sequenz[1]=0; sequenz[0]=puffer[start+1]+2; }
	 }
    else /* d.h. laenge > 2 */
      { if (puffer[start]>1)
	  {
	    sequenz[0]= puffer[start]-1;
	    sequenz[1]= puffer[start+1]+1;
	    sequenz[laenge-1]=puffer[start+laenge-1]+1;
	    sqkanten[laenge-1]=kpuffer[start+laenge-1];
	    for (j=2; j<laenge-1; j++) { sequenz[j]=puffer[start+j];
					 sqkanten[j]=kpuffer[start+j]; }
	  }
	else /* d.h. die luecke hat laenge 1 */
	  {
	    sequenz[laenge-1]= 0;
	    sequenz[0]= puffer[start+1]+1;
	    sequenz[laenge-2]=puffer[start+laenge-1]+1;
	    sqkanten[laenge-2]=kpuffer[start+laenge-1];
	    for (j=1; j<laenge-2; j++) { sequenz[j]=puffer[start+j+1];
					 sqkanten[j]=kpuffer[start+j+1]; }
	  }
      } /* ende laenge > 2 */
  } /* ende 0 Fuenfecke */

else
if (f_ecke==1)
  { if (laenge==0) sequenz[0]=puffer[0]+1;
    else
    if (laenge==1) sequenz[0]=puffer[0]+puffer[1]+1;
    else 
    if (laenge==2)
          { sequenz[0]=puffer[start] + puffer[start+1]; sequenz[1]=puffer[start+2]+1;
	    sqkanten[1]=kpuffer[start+2];}
    else /* d.h. laenge > 2 */
      { sequenz[0]= puffer[start]+puffer[start+1];
	sequenz[laenge-1]=puffer[start+laenge]+1;
	sqkanten[laenge-1]=kpuffer[start+laenge];
	for (j=1; j<laenge-1; j++) { sequenz[j]=puffer[start+j+1];
				     sqkanten[j]=kpuffer[start+j+1]; }
      }
  } /* ende 1 Fuenfecke */

else /* d.h. f_ecke==2 */
  { if (laenge==0) sequenz[0]=puffer[0]+puffer[1]+1;
    else { fprintf(stderr,"ERROR: Two 5-gons not leading to 0-Sequence !\n");
	   exit(6); }
  } /* ende 2 Fuenfecke */

if (sequenz[0]==0) /* nur im Fall eines einzelnen 6-Ecks moeglich */
  { puffer[0]=sequenz[0];
    for (i=0; i<laenge-1; i++) sequenz[i]=sequenz[i+1]; sequenz[laenge-1]=puffer[0];
    for (i=1; i<laenge-1; i++) sqkanten[i]=sqkanten[i+1]; }



if (laenge==0) { sequenz[1]=leer; kan[0]=1; return; }

sequenz[laenge]=leer;

kan[0]=sequenz_kanonisch(sequenz);

for (i=1; i < laenge; i++)
  { for (j=i, k=0; j<laenge; j++, k++) puffer[k]=sequenz[j];
    for (j=0; j<i; j++, k++) puffer[k]=sequenz[j];
    puffer[k]=leer;
    kan[i]=sequenz_kanonisch(puffer);
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movslq 0x110(%rsp), %r12
movl %r12d, %r13d
subl %edx, %r13d
movl %r13d, (%rdi)
testq %r12, %r12
jle 0x4e73
movl %edx, %ebp
movq %rdi, %r15
leaq 0x110(%rsp), %rax
leaq 0x4(%rdi), %rcx
movq %rcx, 0x8(%rsp)
leaq (%rsp,%r12,8), %rcx
addq $0x70, %rcx
leaq (,%r12,4), %rdx
leaq (%rsp,%r12,4), %rdi
addq $0x10, %rdi
xorl %r8d, %r8d
movl 0x4(%rax,%r8), %r9d
movl %r9d, (%rdi,%r8)
movl %r9d, 0x10(%rsp,%r8)
movq 0x20(%rax,%r8,2), %r9
movq %r9, (%rcx,%r8,2)
movq %r9, 0x70(%rsp,%r8,2)
addq $0x4, %r8
cmpq %r8, %rdx
jne 0x49e4
movslq %esi, %rax
movl 0x10(%rsp,%rax,4), %ecx
testl %ecx, %ecx
je 0x4e73
cmpl $0x1, %ebp
je 0x4abd
testl %ebp, %ebp
jne 0x4acb
cmpl $0x2, %r13d
je 0x4b64
cmpl $0x1, %r13d
je 0x4ac3
cmpl $0x2, %ecx
jl 0x4bcf
decl %ecx
movl %ecx, 0x4(%r15)
movl 0x14(%rsp,%rax,4), %ecx
incl %ecx
movl %ecx, 0x8(%r15)
leal -0x1(%r13), %ecx
leal (%rsi,%r13), %edx
decl %edx
movslq %edx, %rdx
movl 0x10(%rsp,%rdx,4), %esi
incl %esi
movslq %ecx, %rdi
movl %esi, 0x4(%r15,%rdi,4)
movq 0x70(%rsp,%rdx,8), %rdx
movq %rdx, 0x20(%r15,%rdi,8)
cmpl $0x4, %r13d
jl 0x4c3d
movl %ecx, %ecx
leaq (%rsp,%rax,4), %rdx
addq $0x18, %rdx
leaq (%rsp,%rax,8), %rax
addq $0x80, %rax
addq $-0x2, %rcx
xorl %esi, %esi
movl (%rdx,%rsi,4), %edi
movl %edi, 0xc(%r15,%rsi,4)
movq (%rax,%rsi,8), %rdi
movq %rdi, 0x30(%r15,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x4a9f
jmp 0x4c3d
cmpl $0x1, %r12d
jne 0x4aec
movl 0x10(%rsp), %eax
incl %eax
jmp 0x4ae0
cmpl %ebp, %r12d
jne 0x4e78
movl 0x10(%rsp), %eax
movl 0x14(%rsp), %ecx
addl %ecx, %eax
incl %eax
movq 0x8(%rsp), %rcx
movl %eax, (%rcx)
jmp 0x4c44
cmpl $0x2, %r13d
je 0x4baf
cmpl $0x1, %r13d
je 0x4ad4
leal 0x1(%rsi), %eax
cltq
addl 0x10(%rsp,%rax,4), %ecx
movl %ecx, 0x4(%r15)
leal (%rsi,%r13), %eax
cltq
movl 0x10(%rsp,%rax,4), %ecx
incl %ecx
movslq %r13d, %rdx
movl %ecx, (%r15,%rdx,4)
movq 0x70(%rsp,%rax,8), %rax
movq %rax, 0x18(%r15,%rdx,8)
cmpl $0x3, %r13d
jl 0x4c3d
leal -0x1(%r13), %eax
movl %eax, %eax
addl $0x2, %esi
decq %rax
xorl %ecx, %ecx
leal (%rsi,%rcx), %edx
movslq %edx, %rdx
movl 0x10(%rsp,%rdx,4), %edi
movl %edi, 0x8(%r15,%rcx,4)
movq 0x70(%rsp,%rdx,8), %rdx
movq %rdx, 0x28(%r15,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x4b3e
jmp 0x4c3d
incl %esi
movslq %esi, %rax
cmpl $0x2, %ecx
jl 0x4b84
decl %ecx
movl %ecx, 0x4(%r15)
movl 0x10(%rsp,%rax,4), %eax
addl $0x2, %eax
movl %eax, 0x8(%r15)
jmp 0x4c3d
movl $0x0, 0x8(%r15)
movl 0x10(%rsp,%rax,4), %eax
addl $0x2, %eax
movl %eax, 0x4(%r15)
jne 0x4cb1
movl $0x0, 0x10(%rsp)
movl $0x1, %ebx
jmp 0x4c5a
addl 0x14(%rsp,%rax,4), %ecx
movl %ecx, 0x4(%r15)
movl 0x18(%rsp,%rax,4), %ecx
incl %ecx
movl %ecx, 0x8(%r15)
movq 0x80(%rsp,%rax,8), %rax
movq %rax, 0x28(%r15)
jmp 0x4c3d
movslq %r13d, %rax
movl $0x0, (%r15,%rax,4)
leal 0x1(%rsi), %ecx
movslq %ecx, %rcx
movl 0x10(%rsp,%rcx,4), %ecx
incl %ecx
movl %ecx, 0x4(%r15)
leal (%rsi,%r13), %ecx
decl %ecx
movslq %ecx, %rcx
movl 0x10(%rsp,%rcx,4), %edx
incl %edx
movl %edx, -0x4(%r15,%rax,4)
movq 0x70(%rsp,%rcx,8), %rcx
movq %rcx, 0x10(%r15,%rax,8)
cmpl $0x4, %r13d
jl 0x4c3d
leal -0x2(%r13), %eax
movl %eax, %eax
addl $0x2, %esi
decq %rax
xorl %ecx, %ecx
leal (%rsi,%rcx), %edx
movslq %edx, %rdx
movl 0x10(%rsp,%rdx,4), %edi
movl %edi, 0x8(%r15,%rcx,4)
movq 0x70(%rsp,%rdx,8), %rdx
movq %rdx, 0x28(%r15,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x4c1c
movq 0x8(%rsp), %rax
movl (%rax), %eax
testl %eax, %eax
jne 0x4cb1
movl $0x0, 0x10(%rsp)
leal -0x1(%r13), %ebx
cmpl $0x1, %r13d
jle 0x4ca2
leaq 0x8(%r15), %rsi
movl %ebx, %r14d
leaq (,%r14,4), %rdx
movq 0x8(%rsp), %rdi
callq 0x1100
movl $0x0, 0x4(%r15,%r14,4)
cmpl $0x3, %r13d
jb 0x4cb1
leaq 0x28(%r15), %rdi
leaq 0x30(%r15), %rsi
cmpl $0x3, %ebx
movl $0x2, %edx
cmovael %ebx, %edx
decl %edx
shlq $0x3, %rdx
callq 0x1100
jmp 0x4cb1
movslq %ebx, %rax
movq 0x8(%rsp), %rcx
movl $0x0, (%rcx,%rax,4)
cmpl %ebp, %r12d
jne 0x4cc8
movl $0xfffe, 0x8(%r15)      # imm = 0xFFFE
movb $0x1, 0x58(%r15)
jmp 0x4e61
movq %rbp, 0x48(%rsp)
movslq %r13d, %rbp
movl $0xfffe, 0x4(%r15,%rbp,4) # imm = 0xFFFE
movq 0x8(%rsp), %rdi
callq 0x48b3
movq %r15, 0x50(%rsp)
movb %al, 0x58(%r15)
cmpl $0x2, %r13d
jl 0x4e61
leal -0x2(%r12), %eax
movl %eax, 0x44(%rsp)
movq 0x48(%rsp), %rax
notl %eax
addl %r12d, %eax
movq %rax, 0x60(%rsp)
movq 0x50(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x58(%rsp)
movl $0x1, %r15d
movl $0x2, %r14d
xorl %r12d, %r12d
leaq 0x10(%rsp), %r13
movq %r14, %rbx
andq $-0x2, %rbx
leaq 0x4(,%r12,4), %rax
movq %rax, 0x68(%rsp)
movq 0x58(%rsp), %rax
leaq (%rax,%r12,4), %rsi
movq 0x48(%rsp), %rax
addl %r12d, %eax
movl 0x44(%rsp), %ecx
subl %eax, %ecx
leaq 0x4(,%rcx,4), %rdx
movq %r13, %rdi
callq 0x10d0
xorl %r13d, %r13d
leaq (%r15,%r13), %rax
incq %rax
incq %r13
cmpq %rbp, %rax
jl 0x4d6e
leaq (%rsp,%r13,4), %rdi
addq $0x10, %rdi
movq 0x8(%rsp), %rsi
movq 0x68(%rsp), %rdx
callq 0x10d0
leaq -0x1(%r15), %rax
movq %r13, %xmm0
movq %rax, %xmm1
pshufd $0x44, %xmm1, %xmm2     # xmm2 = xmm1[0,1,0,1]
movl $0x2, %eax
pcmpeqd %xmm3, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm3, %xmm0
leaq (%rbx,%rax), %rcx
addq $-0x2, %rcx
addq $-0x2, %rax
cmpq $0x2, %rcx
jne 0x4db0
negq %rax
movq %rax, %xmm3
pshufd $0x44, %xmm3, %xmm3     # xmm3 = xmm3[0,1,0,1]
por 0xb231(%rip), %xmm3     # 0x10010
movdqa 0xb239(%rip), %xmm4     # 0x10020
pxor %xmm4, %xmm2
pxor %xmm4, %xmm3
movdqa %xmm3, %xmm4
pcmpgtd %xmm2, %xmm4
pshufd $0xa0, %xmm4, %xmm5     # xmm5 = xmm4[0,0,2,2]
pcmpeqd %xmm2, %xmm3
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
pand %xmm5, %xmm2
pshufd $0xf5, %xmm4, %xmm3     # xmm3 = xmm4[1,1,3,3]
por %xmm2, %xmm3
pand %xmm3, %xmm1
pandn %xmm0, %xmm3
por %xmm1, %xmm3
pshufd $0xee, %xmm3, %xmm0     # xmm0 = xmm3[2,3,2,3]
paddq %xmm3, %xmm0
movq %xmm0, %rax
movl %eax, %eax
movl $0xfffe, 0x10(%rsp,%rax,4) # imm = 0xFFFE
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x48b3
movq 0x50(%rsp), %rcx
movb %al, 0x58(%rcx,%r15)
incq %r15
incq %r12
incq %r14
cmpq 0x60(%rsp), %r12
jne 0x4d30
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1502
callq 0x14dd