// File: jstaursky[P]hutch/src/Sleigh/slghpattern.cc
// Function: InstructionPattern::doAnd(Pattern const*, int) const
Pattern *InstructionPattern::doAnd(const Pattern *b,int4 sa) const

{
  if (b->numDisjoint()>0)
    return b->doAnd(this,-sa);

  const CombinePattern *b2 = dynamic_cast<const CombinePattern *>(b);
  if (b2 != (const CombinePattern *)0)
    return b->doAnd(this,-sa);

  const ContextPattern *b3 = dynamic_cast<const ContextPattern *>(b);
  if (b3 != (const ContextPattern *)0) {
    InstructionPattern *newpat = (InstructionPattern *)simplifyClone();
    if (sa < 0)
      newpat->shiftInstruction(-sa);
    return new CombinePattern((ContextPattern *)b3->simplifyClone(),newpat);
  }
  const InstructionPattern *b4 = (const InstructionPattern *)b;

  PatternBlock *respattern;
  if (sa < 0) {
    PatternBlock *a = maskvalue->clone();
    a->shift(-sa);
    respattern = a->intersect(b4->maskvalue);
    delete a;
  }
  else {
    PatternBlock *c = b4->maskvalue->clone();
    c->shift(sa);
    respattern = maskvalue->intersect(c);
    delete c;
  }
  return new InstructionPattern(respattern);
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movl %edx, 0x9c(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xa0(%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
cmpl $0x0, %eax
jle 0x1375a7
movq 0x48(%rsp), %rsi
movq 0xa0(%rsp), %rdi
xorl %edx, %edx
subl 0x9c(%rsp), %edx
movq (%rdi), %rax
callq *0x28(%rax)
movq %rax, 0xb0(%rsp)
jmp 0x13785d
movq 0xa0(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x1375dd
movq 0x40(%rsp), %rdi
movq 0x906e2(%rip), %rsi     # 0x1c7ca8
movq 0x90753(%rip), %rdx     # 0x1c7d20
xorl %eax, %eax
movl %eax, %ecx
callq 0xd99a0
movq %rax, 0x38(%rsp)
jmp 0x1375e6
xorl %eax, %eax
movq %rax, 0x38(%rsp)
jmp 0x1375e6
movq 0x38(%rsp), %rax
movq %rax, 0x90(%rsp)
cmpq $0x0, 0x90(%rsp)
je 0x137627
movq 0x48(%rsp), %rsi
movq 0xa0(%rsp), %rdi
xorl %edx, %edx
subl 0x9c(%rsp), %edx
movq (%rdi), %rax
callq *0x28(%rax)
movq %rax, 0xb0(%rsp)
jmp 0x13785d
movq 0xa0(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x13765d
movq 0x30(%rsp), %rdi
movq 0x90662(%rip), %rsi     # 0x1c7ca8
movq 0x90513(%rip), %rdx     # 0x1c7b60
xorl %eax, %eax
movl %eax, %ecx
callq 0xd99a0
movq %rax, 0x28(%rsp)
jmp 0x137666
xorl %eax, %eax
movq %rax, 0x28(%rsp)
jmp 0x137666
movq 0x28(%rsp), %rax
movq %rax, 0x88(%rsp)
cmpq $0x0, 0x88(%rsp)
je 0x13772a
movq 0x48(%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq %rax, 0x80(%rsp)
cmpl $0x0, 0x9c(%rsp)
jge 0x1376b6
movq 0x80(%rsp), %rdi
xorl %esi, %esi
subl 0x9c(%rsp), %esi
movq (%rdi), %rax
callq *0x18(%rax)
movl $0x18, %edi
callq 0xd8380
movq %rax, 0x18(%rsp)
movq 0x88(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x20(%rsp)
jmp 0x1376dd
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq 0x80(%rsp), %rdx
callq 0xddac0
jmp 0x1376f6
movq 0x18(%rsp), %rax
movq %rax, 0xb0(%rsp)
jmp 0x13785d
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
movl $0x18, %esi
callq 0xd8620
jmp 0x13786d
movq 0xa0(%rsp), %rax
movq %rax, 0x68(%rsp)
cmpl $0x0, 0x9c(%rsp)
jge 0x1377aa
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xd1ee0
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdi
xorl %esi, %esi
subl 0x9c(%rsp), %esi
callq 0xdd720
movq 0x58(%rsp), %rdi
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0xdb440
movq %rax, 0x60(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x1377a8
movq 0x10(%rsp), %rdi
callq 0xd2d60
movq 0x10(%rsp), %rdi
movl $0x38, %esi
callq 0xd8620
jmp 0x137811
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xd1ee0
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
movl 0x9c(%rsp), %esi
callq 0xdd720
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x50(%rsp), %rsi
callq 0xdb440
movq %rax, 0x60(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x13780f
movq 0x8(%rsp), %rdi
callq 0xd2d60
movq 0x8(%rsp), %rdi
movl $0x38, %esi
callq 0xd8620
jmp 0x137811
movl $0x10, %edi
callq 0xd8380
movq %rax, %rdi
movq %rdi, %rax
movq %rax, (%rsp)
movq 0x60(%rsp), %rsi
callq 0xd6d10
jmp 0x137831
movq (%rsp), %rax
movq %rax, 0xb0(%rsp)
jmp 0x13785d
movq (%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
movl $0x10, %esi
callq 0xd8620
jmp 0x13786d
movq 0xb0(%rsp), %rax
addq $0xb8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0xe0be0
nopw (%rax,%rax)