// File: /workspace/github_c_makefile_star2_O3/mishun[P]plantri/plantri.c
// Function: mirror_of_edgecode
static void
mirror_of_edgecode(unsigned char newcode[], unsigned char oldcode[], 
			int preserve, int totallength, int headerlength)
{
  /* copies oldcode to newcode by reversing the rotational order inside
     the lists. In case "preserve" is not 0, it is made sure that the
     face on the left hand side of edge 1 starting at the vertex corresponding
     to the first list is the same afterwards when interpreting the output
     in clockwise order both times 

     In case of "preserve" the routine relies on the first entry of oldcode
     except the vertexnumber being 1. This is guaranteed by compute_edgecode.

*/

  int i, number[MAXE/2];
  unsigned char *run,*start,*end, *last;

  last=newcode+totallength;

  for (i=0;i<headerlength;i++) newcode[i]=oldcode[i];
  
  if (!preserve)
    { newcode+=headerlength;
      start=end=oldcode+headerlength-1;
      while(newcode<last)
	{
	  for (run=end+1; *run!=255; run++);
	  end=run;
	  for (run--; run!=start; run--, newcode++) *newcode=*run;
	  *newcode=255; newcode++;
	  start=end;
	}
      return;
    }

  /* else -- do preserve the face */

  for (i=0; i<ne/2; i++) number[i]=i;
  if (oldcode[headerlength]!=0) 
    { fprintf(stderr,"Problem in mirror_of_edgecode -- read function description.\n");
      exit(1); }
  for (run=oldcode+headerlength;*run!=255;run++); 
  end=run;
  run--;
  number[0]=*run; number[*run]=0;
  newcode+=headerlength;
  for ( ; run!=(oldcode+headerlength-1); run--) { *newcode=number[*run]; newcode++; }
  *newcode=255; newcode++;
  start=end;

  while(newcode<last)
    {
      for (run=end+1; *run!=255; run++);
      end=run;
      for ( run--; run!=start; run--, newcode++) *newcode=number[*run];
      *newcode=255; newcode++;
      start=end;
    }
  return;

}

// Assembly:
subq $0x2e8, %rsp            # imm = 0x2E8
movslq %ecx, %rax
testl %r8d, %r8d
jle 0xba56
movl %r8d, %r9d
xorl %r10d, %r10d
movb (%rsi,%r10), %r11b
movb %r11b, (%rdi,%r10)
incq %r10
cmpq %r10, %r9
jne 0xba46
addq %rdi, %rax
testl %edx, %edx
je 0xbbb4
movl 0x238bad(%rip), %edx    # 0x244614
cmpl $0x2, %edx
jl 0xbb08
shrl %edx
movl %edx, %ecx
incl %ecx
andl $0x7ffffffe, %ecx       # imm = 0x7FFFFFFE
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x1464f(%rip), %xmm1    # 0x200e0
xorl %edx, %edx
movdqa 0x14655(%rip), %xmm2    # 0x200f0
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x14655(%rip), %xmm4    # 0x20100
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %r9d
notl %r9d
testb $0x1, %r9b
je 0xbae2
movl %edx, (%rsp,%rdx,4)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %r9d
testb $0x1, %r9b
je 0xbafb
leal 0x1(%rdx), %r9d
movl %r9d, 0x4(%rsp,%rdx,4)
addq $0x2, %rdx
paddq %xmm4, %xmm1
cmpq %rdx, %rcx
jne 0xbaab
movslq %r8d, %rdx
cmpb $0x0, (%rsi,%rdx)
jne 0xbc0d
addq %rdx, %rsi
movq $-0x1, %rcx
cmpb $-0x1, 0x1(%rsi,%rcx)
leaq 0x1(%rcx), %rcx
jne 0xbb1f
movzbl -0x1(%rsi,%rcx), %r8d
movl %r8d, (%rsp)
movl $0x0, (%rsp,%r8,4)
addq %rdx, %rdi
testq %rcx, %rcx
je 0xbb5c
movq %rcx, %rdx
movzbl -0x1(%rsi,%rdx), %r8d
movb (%rsp,%r8,4), %r8b
movb %r8b, (%rdi)
incq %rdi
decq %rdx
jne 0xbb47
movb $-0x1, (%rdi)
incq %rdi
cmpq %rax, %rdi
jae 0xbc05
addq %rcx, %rsi
movl $0x1, %r8d
xorl %ecx, %ecx
movq %rcx, %rdx
decq %rcx
cmpb $-0x1, (%rsi,%r8)
leaq 0x1(%r8), %r8
jne 0xbb76
cmpq $-0x1, %rcx
je 0xbba4
negq %rdx
movzbl (%rsi,%rdx), %r8d
movb (%rsp,%r8,4), %r8b
movb %r8b, (%rdi)
incq %rdi
decq %rdx
jne 0xbb90
subq %rcx, %rsi
movb $-0x1, (%rdi)
incq %rdi
cmpq %rax, %rdi
jb 0xbb6e
jmp 0xbc05
cmpl %ecx, %r8d
jge 0xbc05
movslq %r8d, %rdx
leaq (%rsi,%rdx), %rcx
decq %rcx
addq %rdx, %rdi
movl $0x1, %r8d
xorl %edx, %edx
movq %rdx, %rsi
decq %rdx
cmpb $-0x1, (%rcx,%r8)
leaq 0x1(%r8), %r8
jne 0xbbce
cmpq $-0x1, %rdx
je 0xbbf7
negq %rsi
movb (%rcx,%rsi), %r8b
movb %r8b, (%rdi)
incq %rdi
decq %rsi
jne 0xbbe8
subq %rdx, %rcx
movb $-0x1, (%rdi)
incq %rdi
cmpq %rax, %rdi
jb 0xbbc6
addq $0x2e8, %rsp            # imm = 0x2E8
retq
callq 0x27b6