// File: /workspace/github_c_makefile_star2_O1/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 0xb9b1
movl %r8d, %r9d
xorl %r10d, %r10d
movb (%rsi,%r10), %r11b
movb %r11b, (%rdi,%r10)
incq %r10
cmpq %r10, %r9
jne 0xb9a1
addq %rdi, %rax
testl %edx, %edx
je 0xba82
movl 0x238c52(%rip), %ecx    # 0x244614
cmpl $0x2, %ecx
jl 0xb9d6
shrl %ecx
xorl %edx, %edx
movl %edx, (%rsp,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0xb9cb
movslq %r8d, %rdx
cmpb $0x0, (%rsi,%rdx)
jne 0xbadb
addq %rdx, %rsi
movq $-0x1, %rcx
cmpb $-0x1, 0x1(%rsi,%rcx)
leaq 0x1(%rcx), %rcx
jne 0xb9ed
movzbl -0x1(%rsi,%rcx), %r8d
movl %r8d, (%rsp)
movl $0x0, (%rsp,%r8,4)
addq %rdx, %rdi
testq %rcx, %rcx
je 0xba2a
movq %rcx, %rdx
movzbl -0x1(%rsi,%rdx), %r8d
movb (%rsp,%r8,4), %r8b
movb %r8b, (%rdi)
incq %rdi
decq %rdx
jne 0xba15
movb $-0x1, (%rdi)
incq %rdi
cmpq %rax, %rdi
jae 0xbad3
addq %rcx, %rsi
movl $0x1, %r8d
xorl %ecx, %ecx
movq %rcx, %rdx
decq %rcx
cmpb $-0x1, (%rsi,%r8)
leaq 0x1(%r8), %r8
jne 0xba44
cmpq $-0x1, %rcx
je 0xba72
negq %rdx
movzbl (%rsi,%rdx), %r8d
movb (%rsp,%r8,4), %r8b
movb %r8b, (%rdi)
incq %rdi
decq %rdx
jne 0xba5e
subq %rcx, %rsi
movb $-0x1, (%rdi)
incq %rdi
cmpq %rax, %rdi
jb 0xba3c
jmp 0xbad3
cmpl %ecx, %r8d
jge 0xbad3
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 0xba9c
cmpq $-0x1, %rdx
je 0xbac5
negq %rsi
movb (%rcx,%rsi), %r8b
movb %r8b, (%rdi)
incq %rdi
decq %rsi
jne 0xbab6
subq %rdx, %rcx
movb $-0x1, (%rdi)
incq %rdi
cmpq %rax, %rdi
jb 0xba94
addq $0x2e8, %rsp            # imm = 0x2E8
retq
callq 0x2832