// File: /workspace/github_cpp_makefile_star2_O2/jstaursky[P]hutch/src/Sleigh/slgh_compile.cc
// Function: SleighCompile::attachVarnodes(std::vector<SleighSymbol*, std::allocator<SleighSymbol*>>*, std::vector<SleighSymbol*, std::allocator<SleighSymbol*>>*)
void SleighCompile::attachVarnodes(vector<SleighSymbol *> *symlist,vector<SleighSymbol *> *varlist)

{
  SleighSymbol *dupsym = dedupSymbolList(symlist);
  if (dupsym != (SleighSymbol *)0)
    reportWarning("\"attach variables\" list contains duplicate entries: "+dupsym->getName(),true);
  for(int4 i=0;i<symlist->size();++i) {
    ValueSymbol *sym = (ValueSymbol *)(*symlist)[i];
    if (sym == (ValueSymbol *)0) continue;
    PatternValue *patval = sym->getPatternValue();
    if (patval->maxValue() + 1 != varlist->size()) {
      reportError("Attach varnode " + sym->getName() + " is wrong size for list", true);
    }
    int4 sz = 0;      
    for(int4 j=0;j<varlist->size();++j) {
      VarnodeSymbol *vsym = (VarnodeSymbol *)(*varlist)[j];
      if (vsym != (VarnodeSymbol *)0) {
	if (sz == 0)
	  sz = vsym->getFixedVarnode().size;
	else if (sz != vsym->getFixedVarnode().size) {
	  reportError("Attach statement contains varnodes of different sizes",true);
	  break;
	}
      }
    }
    symtab.replaceSymbol(sym,new VarnodeListSymbol(sym->getName(),patval,*varlist));
  }
  delete varlist;
  delete symlist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r14
movq %rdi, %r12
movq %rsi, 0x8(%rsp)
callq 0x2b89a
testq %rax, %rax
je 0x2bcf2
addq $0x8, %rax
leaq 0x2b8e1(%rip), %rsi     # 0x575ab
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rax, %rdx
callq 0x10cd1
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2a3a2
leaq 0x18(%rsp), %rdi
callq 0xf1a0
movq %r12, (%rsp)
leaq 0x198(%r12), %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
leaq 0x18(%rsp), %r12
movq 0x8(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
jbe 0x2be43
movq (%rax,%rbp,8), %r15
testq %r15, %r15
je 0x2be3b
movq (%r15), %rax
movq %r15, %rdi
callq *0x60(%rax)
movq %rax, %r13
movq (%rax), %rax
movq %r13, %rdi
callq *0x58(%rax)
incq %rax
movq (%r14), %rcx
movq 0x8(%r14), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rdx, %rax
je 0x2bdb7
leaq 0x8(%r15), %rdx
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
leaq 0x2b86f(%rip), %rsi     # 0x575e0
callq 0x10cd1
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x2b7d2(%rip), %rdx     # 0x57555
callq 0x2eb71
movq (%rsp), %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0x292f0
movq %r12, %rdi
callq 0xf1a0
leaq 0x38(%rsp), %rdi
callq 0xf1a0
movq (%r14), %rcx
movq 0x8(%r14), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
xorl %eax, %eax
xorl %esi, %esi
cmpq %rax, %rdx
je 0x2be08
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x2bdd8
movl 0x48(%rdi), %edi
testl %esi, %esi
je 0x2bdd6
cmpl %edi, %esi
je 0x2bdd8
jmp 0x2bddd
movl %edi, %esi
incq %rax
jmp 0x2bdbb
movq %r12, %rdi
leaq 0x2b809(%rip), %rsi     # 0x575f0
leaq 0x38(%rsp), %rdx
callq 0x10c3a
movq (%rsp), %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0x292f0
movq %r12, %rdi
callq 0xf1a0
movq %r12, %rbx
pushq $0x58
popq %rdi
callq 0xf370
movq %rax, %r12
leaq 0x8(%r15), %rsi
movq %rax, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0x42a14
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x405ee
movq %rbx, %r12
incq %rbp
jmp 0x2bd0a
testq %r14, %r14
je 0x2be50
movq %r14, %rdi
callq 0x2fa2a
pushq $0x18
popq %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xf380
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x2fa2a
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf380
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2be88
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0x2beae
movq %rax, %rbx
jmp 0x2bec3
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xf1a0
jmp 0x2bea9
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xf1a0
jmp 0x2bec3
movq %rax, %rbx
pushq $0x58
popq %rsi
movq %r12, %rdi
callq 0xf380
movq %rbx, %rdi
callq 0xf6e0
nop