// File: jstaursky[P]hutch/src/Sleigh/slgh_compile.cc
// Function: SleighCompile::contextMod(std::vector<ContextChange*, std::allocator<ContextChange*>>*, ContextSymbol*, PatternExpression*)
bool SleighCompile::contextMod(vector<ContextChange *> *vec,ContextSymbol *sym,PatternExpression *pe)

{ // A temporary change to a context variable (within the parsing of a single instruction)
  // Because we are in the middle of parsing, the "inst_next" value has not been computed yet
  // So we check to make sure the value expression doesn't use this symbol
  vector<const PatternValue *> vallist;
  pe->listValues(vallist);
  for(uint4 i=0;i<vallist.size();++i)
    if (dynamic_cast<const EndInstructionValue *>(vallist[i]) != (const EndInstructionValue *)0)
      return false;
  // Otherwise we generate a "temporary" change to context instruction  (ContextOp)
  ContextField *field = (ContextField *)sym->getPatternValue();
  ContextOp *op = new ContextOp(field->getStartBit(),field->getEndBit(),pe);
  vec->push_back(op);
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x6c380
movq -0x78(%rbp), %rsi
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x65ceb
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq %rax, -0x80(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6c3a0
movq %rax, %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
jae 0x65da0
movl -0x50(%rbp), %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x6c3c0
movq (%rax), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x65d68
movq -0x88(%rbp), %rdi
leaq 0xc9baa(%rip), %rsi     # 0x12f8e8
leaq 0xc9bbb(%rip), %rdx     # 0x12f900
xorl %eax, %eax
movl %eax, %ecx
callq 0x11530
movq %rax, -0x90(%rbp)
jmp 0x65d73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x65e79
xorl %eax, %eax
movq %rax, -0x90(%rbp)
jmp 0x65d73
movq -0x90(%rbp), %rax
cmpq $0x0, %rax
je 0x65d90
movb $0x0, -0x1(%rbp)
movl $0x1, -0x54(%rbp)
jmp 0x65e62
jmp 0x65d92
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x65cf2
movq -0x20(%rbp), %rdi
movq (%rdi), %rax
movq 0x60(%rax), %rax
callq *%rax
movq %rax, -0x98(%rbp)
jmp 0x65db6
movq -0x98(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x20, %edi
callq 0x11440
movq %rax, -0xa0(%rbp)
jmp 0x65dd4
movq -0x60(%rbp), %rdi
callq 0x57870
movl %eax, -0xa4(%rbp)
jmp 0x65de5
movq -0x60(%rbp), %rdi
callq 0x57890
movl %eax, -0xa8(%rbp)
jmp 0x65df6
movl -0xa8(%rbp), %edx
movl -0xa4(%rbp), %esi
movq -0xa0(%rbp), %rdi
movq -0x28(%rbp), %rcx
callq 0xb0900
jmp 0x65e14
movq -0xa0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x6a480
jmp 0x65e36
movb $0x1, -0x1(%rbp)
movl $0x1, -0x54(%rbp)
jmp 0x65e62
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x20, %esi
callq 0x11450
jmp 0x65e79
leaq -0x40(%rbp), %rdi
callq 0x6c3e0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x6c3e0
movq -0x48(%rbp), %rdi
callq 0x118b0
nopl (%rax,%rax)