// File: /workspace/github_c_makefile_star2_O2/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, %rcx
xorl %eax, %eax
testl %r8d, %r8d
movl $0x0, %r9d
cmovgl %r8d, %r9d
cmpq %rax, %r9
je 0xaba2
movb (%rsi,%rax), %r10b
movb %r10b, (%rdi,%rax)
incq %rax
jmp 0xab90
addq %rdi, %rcx
testl %edx, %edx
je 0xac62
movl 0x237a51(%rip), %eax    # 0x242604
pushq $0x2
popq %r9
cltd
idivl %r9d
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
cmpq %rdx, %rax
je 0xabcf
movl %edx, (%rsp,%rdx,4)
incq %rdx
jmp 0xabc2
movslq %r8d, %r8
cmpb $0x0, (%rsi,%r8)
jne 0xaca8
addq %r8, %rsi
pushq $-0x1
popq %rdx
cmpb $-0x1, 0x1(%rsi,%rdx)
leaq 0x1(%rdx), %rdx
jne 0xabe3
movzbl -0x1(%rsi,%rdx), %eax
movl %eax, (%rsp)
andl $0x0, (%rsp,%rax,4)
leaq (%rsi,%rdx), %rax
addq %r8, %rdi
movq %rdx, %r8
subq $0x1, %r8
jb 0xac4f
movzbl -0x1(%rsi,%rdx), %edx
movb (%rsp,%rdx,4), %dl
movb %dl, (%rdi)
incq %rdi
movq %r8, %rdx
jmp 0xac04
xorl %r8d, %r8d
movq %rax, %rdx
movq %r8, %rsi
cmpb $-0x1, 0x1(%rdx)
leaq 0x1(%rdx), %rdx
leaq 0x1(%r8), %r8
jne 0xac22
jmp 0xac47
movzbl (%rax,%rsi), %r8d
movb (%rsp,%r8,4), %r8b
movb %r8b, (%rdi)
incq %rdi
decq %rsi
testq %rsi, %rsi
jne 0xac35
movq %rdx, %rax
movb $-0x1, (%rdi)
incq %rdi
cmpq %rcx, %rdi
jb 0xac1c
addq $0x2e8, %rsp            # imm = 0x2E8
retq
movslq %r8d, %rax
addq %rax, %rdi
addq %rsi, %rax
decq %rax
cmpq %rcx, %rdi
jae 0xac5a
xorl %r8d, %r8d
movq %rax, %rdx
movq %r8, %rsi
cmpb $-0x1, 0x1(%rdx)
leaq 0x1(%rdx), %rdx
leaq 0x1(%r8), %r8
jne 0xac79
jmp 0xac97
movb (%rax,%rsi), %r8b
movb %r8b, -0x1(%rdi)
decq %rsi
incq %rdi
testq %rsi, %rsi
jne 0xac8c
movb $-0x1, -0x1(%rdi)
movq %rdx, %rax
jmp 0xac6e
movq 0x19349(%rip), %rax     # 0x23ff8
movq (%rax), %rcx
leaq 0x13888(%rip), %rdi     # 0x1e541
pushq $0x3c
popq %rsi
pushq $0x1
popq %rdx
callq 0x10c0
pushq $0x1
popq %rdi
callq 0x10b0