// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rdx, %r14
movq %rsi, %rbp
movq %rdi, 0x28(%rsp)
callq 0x301c2
testq %rax, %rax
je 0x307c9
addq $0x8, %rax
leaq 0x31e4f(%rip), %rsi     # 0x625db
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rax, %rdx
callq 0x1170e
movq 0x28(%rsp), %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2e5f0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x307c9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
cmpq %rax, %rcx
je 0x309e1
leaq 0x18(%rsp), %r15
movq 0x28(%rsp), %rdx
addq $0x198, %rdx            # imm = 0x198
movq %rdx, 0x38(%rsp)
xorl %r12d, %r12d
movq %rbp, 0x40(%rsp)
movq %r14, 0x30(%rsp)
movq (%rax,%r12,8), %r13
testq %r13, %r13
je 0x30978
movq (%r13), %rax
movq %r13, %rdi
callq *0x60(%rax)
movq %rax, %rbp
movq (%rax), %rax
movq %rbp, %rdi
callq *0x58(%rax)
incq %rax
movq (%r14), %rcx
movq 0x8(%r14), %rsi
movq %rsi, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rdx, %rax
je 0x308fe
leaq 0x8(%r13), %rdx
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
leaq 0x31dc0(%rip), %rsi     # 0x62610
callq 0x1170e
movq %rbx, %rdi
leaq 0x31d26(%rip), %rsi     # 0x62585
callq 0xf780
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x30887
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x3088e
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x1, %edx
callq 0x2d000
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x308d1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x308ed
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xf380
movq (%r14), %rcx
movq 0x8(%r14), %rsi
movq %rsi, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rcx, %rsi
je 0x3092f
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %eax, %eax
xorl %esi, %esi
movq (%rcx,%rax,8), %rdi
testq %rdi, %rdi
je 0x30927
movl 0x48(%rdi), %edi
testl %esi, %esi
je 0x30925
cmpl %edi, %esi
je 0x30927
jmp 0x30990
movl %edi, %esi
incq %rax
cmpq %rax, %rdx
jne 0x3090f
movq %r15, %rbx
movl $0x58, %edi
callq 0xf370
movq %rax, %r15
leaq 0x8(%r13), %rsi
movq %rax, %rdi
movq %rbp, %rdx
movq 0x30(%rsp), %rcx
callq 0x4ab30
movq 0x38(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x47d36
movq 0x40(%rsp), %rbp
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
movq %rbx, %r15
movq 0x30(%rsp), %r14
incq %r12
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
ja 0x307fd
jmp 0x309e1
movq %r15, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x31c7f(%rip), %rsi     # 0x62620
leaq 0x31cad(%rip), %rdx     # 0x62655
callq 0x117f6
movq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x1, %edx
callq 0x2d000
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3092f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x3092f
testq %r14, %r14
je 0x309fa
movq (%r14), %rdi
testq %rdi, %rdi
je 0x309fa
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0xf380
movl $0x18, %esi
movq %r14, %rdi
callq 0xf380
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x30a1c
movq 0x10(%rbp), %rsi
subq %rdi, %rsi
callq 0xf380
movl $0x18, %esi
movq %rbp, %rdi
callq 0xf380
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x30a58
jmp 0x30aac
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x30aac
movq 0x18(%rsp), %rsi
jmp 0x30a97
movq %rax, %rbx
jmp 0x30aac
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x30a83
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x30a83
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x30aac
movq 0x58(%rsp), %rsi
incq %rsi
jmp 0x30aa7
movq %rax, %rbx
movl $0x58, %esi
movq %r15, %rdi
callq 0xf380
movq %rbx, %rdi
callq 0xf730