// File: /workspace/github_cpp_makefile_star2_O1/jstaursky[P]hutch/src/Sleigh/slghsymbol.cc
// Function: Constructor::orderOperands()
void Constructor::orderOperands(void)

{
  OperandSymbol *sym;
  vector<OperandSymbol *> patternorder;
  vector<OperandSymbol *> newops; // New order of the operands
  int4 lastsize;

  pateq->operandOrder(this,patternorder);
  for(int4 i=0;i<operands.size();++i) { // Make sure patternorder contains all operands
    sym = operands[i];
    if (!sym->isMarked()) {
      patternorder.push_back(sym);
      sym->setMark();		// Make sure all operands are marked
    }
  }
  do {
    lastsize = newops.size();
    for(int4 i=0;i<patternorder.size();++i) {
      sym = patternorder[i];
      if (!sym->isMarked()) continue; // "unmarked" means it is already in newops
      if (sym->isOffsetIrrelevant()) continue; // expression Operands come last
      if ((sym->offsetbase == -1)||(!operands[sym->offsetbase]->isMarked())) {
	newops.push_back(sym);
	sym->clearMark();
      }
    }
  } while(newops.size() != lastsize);
  for(int4 i=0;i<patternorder.size();++i) { // Tack on expression Operands
    sym = patternorder[i];
    if (sym->isOffsetIrrelevant()) {
      newops.push_back(sym);
      sym->clearMark();
    }
  }

  if (newops.size() != operands.size())
    throw SleighError("Circular offset dependency between operands");


  for(int4 i=0;i<newops.size();++i) { // Fix up operand indices
    newops[i]->hand = i;
    newops[i]->localexp->changeIndex(i);
  }
  vector<int4> handmap;		// Create index translation map
  for(int4 i=0;i<operands.size();++i)
    handmap.push_back(operands[i]->hand);

				// Fix up offsetbase
  for(int4 i=0;i<newops.size();++i) {
    sym = newops[i];
    if (sym->offsetbase == -1) continue;
    sym->offsetbase = handmap[sym->offsetbase];
  }

  if (templ != (ConstructTpl *)0) // Fix up templates
    templ->changeHandleIndex(handmap);
  for(int4 i=0;i<namedtempl.size();++i) {
    ConstructTpl *ntempl = namedtempl[i];
    if (ntempl != (ConstructTpl *)0)
      ntempl->changeHandleIndex(handmap);
  }

				// Fix up printpiece operand refs
  for(int4 i=0;i<printpiece.size();++i) {
    if (printpiece[i][0] == '\n') {
      int4 index = printpiece[i][1]-'A';
      index = handmap[index];
      printpiece[i][1] = 'A'+index;
    }
  }
  operands = newops;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x30(%rsp), %rdx
movq %rax, 0x10(%rdx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdx)
movq %rax, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq 0x10(%rdi), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x20(%rax)
movq 0x18(%rbx), %rax
cmpq %rax, 0x20(%rbx)
je 0x6aaa1
xorl %r12d, %r12d
leaq 0x30(%rsp), %r14
leaq 0x8(%rsp), %r15
movq (%rax,%r12,8), %rax
movq %rax, 0x8(%rsp)
testb $0x8, 0x58(%rax)
jne 0x6aa8a
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x6aa76
movq %rax, (%rsi)
addq $0x8, 0x38(%rsp)
jmp 0x6aa81
movq %r14, %rdi
movq %r15, %rdx
callq 0x41b90
movq 0x8(%rsp), %rax
orl $0x8, 0x58(%rax)
incq %r12
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x6aa50
leaq 0x18(%rbx), %r14
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x6ab36
xorl %ebp, %ebp
movq (%rax,%rbp,8), %rax
movq %rax, 0x8(%rsp)
movl 0x58(%rax), %ecx
andl $0xa, %ecx
cmpl $0x8, %ecx
jne 0x6ab1d
movslq 0x34(%rax), %rcx
cmpq $-0x1, %rcx
je 0x6aaf2
movq (%r14), %rdx
movq (%rdx,%rcx,8), %rcx
testb $0x8, 0x58(%rcx)
jne 0x6ab1d
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x6ab09
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x6ab14
movq %r15, %rdi
movq %r12, %rdx
callq 0x41b90
movq 0x8(%rsp), %rax
andl $-0x9, 0x58(%rax)
incq %rbp
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
ja 0x6aac7
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
shrq $0x3, %r13
movslq %r13d, %rcx
cmpq %rcx, %rax
jne 0x6aaaf
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x6abc0
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
movq (%rax,%r13,8), %rax
movq %rax, 0x8(%rsp)
testb $0x2, 0x58(%rax)
je 0x6aba7
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x6ab93
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x6ab9e
movq %r15, %rdi
movq %r12, %rdx
callq 0x41b90
movq 0x8(%rsp), %rax
andl $-0x9, 0x58(%rax)
incq %r13
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0x6ab6d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
movq %rdx, %rcx
subq %rax, %rcx
movq 0x20(%rbx), %rsi
subq 0x18(%rbx), %rsi
cmpq %rsi, %rcx
jne 0x6adae
cmpq %rax, %rdx
je 0x6ac0a
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
movl %edx, 0x3c(%rsi)
movq 0x40(%rsi), %rsi
movl %edx, 0xc(%rsi)
incq %rdx
cmpq %rdx, %rcx
jne 0x6abf4
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x18(%rbx), %rax
cmpq %rax, 0x20(%rbx)
je 0x6ac6f
xorl %r12d, %r12d
leaq 0x50(%rsp), %r15
movq (%rax,%r12,8), %rdx
addq $0x3c, %rdx
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x6ac50
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rsp)
jmp 0x6ac58
movq %r15, %rdi
callq 0x3f860
incq %r12
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x6ac2d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
je 0x6acb4
sarq $0x3, %rcx
movq 0x50(%rsp), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %esi, %esi
movq (%rax,%rsi,8), %rdi
movq %rdi, 0x8(%rsp)
movslq 0x34(%rdi), %r8
cmpq $-0x1, %r8
je 0x6acac
movl (%rdx,%r8,4), %r8d
movl %r8d, 0x34(%rdi)
incq %rsi
cmpq %rsi, %rcx
jne 0x6ac91
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x6acc7
leaq 0x50(%rsp), %rsi
callq 0x41100
movq 0x68(%rbx), %rax
cmpq %rax, 0x70(%rbx)
je 0x6ad01
xorl %r12d, %r12d
leaq 0x50(%rsp), %r15
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x6acea
movq %r15, %rsi
callq 0x41100
incq %r12
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
ja 0x6acd9
movq 0x30(%rbx), %rdx
cmpq %rdx, 0x38(%rbx)
je 0x6ad4d
xorl %eax, %eax
xorl %ecx, %ecx
movq (%rdx,%rax), %rdx
cmpb $0xa, (%rdx)
jne 0x6ad32
movsbq 0x1(%rdx), %rsi
movq 0x50(%rsp), %rdi
movb -0x104(%rdi,%rsi,4), %sil
addb $0x41, %sil
movb %sil, 0x1(%rdx)
incq %rcx
movq 0x30(%rbx), %rdx
movq 0x38(%rbx), %rsi
subq %rdx, %rsi
sarq $0x5, %rsi
addq $0x20, %rax
cmpq %rcx, %rsi
ja 0x6ad0f
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x40340
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x6ad71
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6ad88
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x6ad9f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x3fb00
movq %rax, %r14
leaq 0x60(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1677b(%rip), %rsi     # 0x81546
leaq 0x1679f(%rip), %rdx     # 0x81571
leaq 0x50(%rsp), %rdi
callq 0x3f8a0
movb $0x1, %bpl
leaq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x3f890
xorl %ebp, %ebp
movq 0x3809b(%rip), %rsi     # 0xa2e90
movq 0x37e3c(%rip), %rdx     # 0xa2c38
movq %r14, %rdi
callq 0x41d60
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x6ae26
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x40870
jmp 0x6ae26
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x6ae5e
movq %r14, %rdi
callq 0x40080
jmp 0x6ae5e
jmp 0x6ae5b
jmp 0x6ae3f
jmp 0x6ae5b
jmp 0x6ae5b
jmp 0x6ae3f
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x6ae5e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
jmp 0x6ae5e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6ae75
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x6ae8c
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x40870
movq %rbx, %rdi
callq 0x41f00