// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rdi, 0x20(%rsp)
callq 0x30488
testq %rax, %rax
je 0x30a87
addq $0x8, %rax
leaq 0x31b3f(%rip), %rsi     # 0x6258b
movq %rsp, %r15
movq %r15, %rdi
movq %rax, %rdx
callq 0x11754
movq 0x20(%rsp), %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2e85a
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30a87
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xf380
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x30c8d
leaq 0x10(%rsp), %r15
movq 0x20(%rsp), %rcx
addq $0x198, %rcx            # imm = 0x198
movq %rcx, 0x30(%rsp)
xorl %r13d, %r13d
movq %rsp, %r12
movq %rbx, 0x38(%rsp)
movq (%rax,%r13,8), %rdi
testq %rdi, %rdi
je 0x30c73
movq (%rdi), %rax
movq %rdi, 0x28(%rsp)
callq *0x60(%rax)
movq %rax, %rdi
movq (%rax), %rax
movq %rdi, 0x40(%rsp)
callq *0x58(%rax)
incq %rax
movq 0x8(%r14), %rcx
subq (%r14), %rcx
sarq $0x3, %rcx
cmpq %rcx, %rax
je 0x30ba2
movq 0x28(%rsp), %rax
leaq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rbp
movq %rbp, %rdi
leaq 0x31ab6(%rip), %rsi     # 0x625c0
callq 0x11754
movq %rbp, %rdi
leaq 0x31a1c(%rip), %rsi     # 0x62535
callq 0xf780
movq %r15, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x30b3f
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x30b46
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x2d276
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x30b86
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xf380
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x30ba2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xf380
movq %r15, %r12
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x30c32
xorl %r15d, %r15d
xorl %ebx, %ebx
movq (%rax,%r15,8), %rcx
movb $0x1, %al
testq %rcx, %rcx
je 0x30c18
movl 0x48(%rcx), %ecx
testl %ebx, %ebx
je 0x30c16
cmpl %ecx, %ebx
je 0x30c18
movq %r12, (%rsp)
movq %rsp, %rbp
movq %rbp, %rdi
leaq 0x319f2(%rip), %rsi     # 0x625d0
leaq 0x31a20(%rip), %rdx     # 0x62605
callq 0x1183c
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0x2d276
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x30c12
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xf380
xorl %eax, %eax
jmp 0x30c18
movl %ecx, %ebx
testb %al, %al
je 0x30c32
incq %r15
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x30bb7
movl $0x58, %edi
callq 0xf370
movq %rax, %r15
movq 0x28(%rsp), %rbx
leaq 0x8(%rbx), %rsi
movq %rax, %rdi
movq 0x40(%rsp), %rdx
movq %r14, %rcx
callq 0x4af26
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x48118
movq 0x38(%rsp), %rbx
movq %r12, %r15
movq %rsp, %r12
incq %r13
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0x30ab5
testq %r14, %r14
je 0x30cb3
movq (%r14), %rdi
testq %rdi, %rdi
je 0x30ca6
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0xf380
movl $0x18, %esi
movq %r14, %rdi
callq 0xf380
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x30cc7
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0xf380
movl $0x18, %esi
movq %rbx, %rdi
callq 0xf380
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x30d43
jmp 0x30d55
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x30d14
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x30d14
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x30d55
movq 0x58(%rsp), %rsi
jmp 0x30d48
movq %rax, %rbx
movl $0x58, %esi
movq %r15, %rdi
jmp 0x30d4b
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x30d55
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xf380
jmp 0x30d55
movq %rax, %rbx
movq %rbx, %rdi
callq 0xf730
nop