// File: jstaursky[P]hutch/src/Sleigh/slghpattern.cc
// Function: OrPattern::simplifyClone() const
Pattern *OrPattern::simplifyClone(void) const

{				// Look for alwaysTrue eliminate alwaysFalse
  vector<DisjointPattern *>::const_iterator iter;

  for(iter=orlist.begin();iter!=orlist.end();++iter) // Look for alwaysTrue
    if ((*iter)->alwaysTrue())
      return new InstructionPattern(true);

  vector<DisjointPattern *> newlist;
  for(iter=orlist.begin();iter!=orlist.end();++iter) // Look for alwaysFalse
    if (!(*iter)->alwaysFalse())
      newlist.push_back((DisjointPattern *)(*iter)->simplifyClone());
  
  if (newlist.empty())
    return new InstructionPattern(false);
  else if (newlist.size() == 1)
    return newlist[0];
  return new OrPattern(newlist);
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x90(%rsp), %rdi
callq 0xe0480
movq 0x30(%rsp), %rdi
addq $0x8, %rdi
callq 0xe0c70
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x30(%rsp), %rdi
addq $0x8, %rdi
callq 0xd1e10
movq %rax, 0x80(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xe2bc0
testb $0x1, %al
jne 0x139bf3
jmp 0x139c78
leaq 0x90(%rsp), %rdi
callq 0xd1260
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x50(%rax)
testb $0x1, %al
jne 0x139c0f
jmp 0x139c64
movl $0x10, %edi
callq 0xd8380
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x28(%rsp)
movl $0x1, %esi
callq 0xdbad0
jmp 0x139c30
movq 0x28(%rsp), %rax
movq %rax, 0xa0(%rsp)
jmp 0x139e6d
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
movl $0x10, %esi
callq 0xd8620
jmp 0x139e7d
jmp 0x139c66
leaq 0x90(%rsp), %rdi
callq 0xe2a00
jmp 0x139bbf
leaq 0x58(%rsp), %rdi
callq 0xd3170
movq 0x30(%rsp), %rdi
addq $0x8, %rdi
callq 0xe0c70
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x30(%rsp), %rdi
addq $0x8, %rdi
callq 0xd1e10
movq %rax, 0x48(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xe2bc0
testb $0x1, %al
jne 0x139cd0
jmp 0x139d5d
leaq 0x90(%rsp), %rdi
callq 0xd1260
movq (%rax), %rdi
movq (%rdi), %rax
movq 0x58(%rax), %rax
callq *%rax
movb %al, 0x27(%rsp)
jmp 0x139cef
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x139d49
jmp 0x139cf9
leaq 0x90(%rsp), %rdi
callq 0xd1260
movq (%rax), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x18(%rsp)
jmp 0x139d19
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xe0080
jmp 0x139d34
jmp 0x139d49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x139e61
jmp 0x139d4b
leaq 0x90(%rsp), %rdi
callq 0xe2a00
jmp 0x139ca2
leaq 0x58(%rsp), %rdi
callq 0xdd4b0
testb $0x1, %al
jne 0x139d6d
jmp 0x139dc8
movl $0x10, %edi
callq 0xd8380
movq %rax, 0x10(%rsp)
jmp 0x139d7e
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0xdbad0
jmp 0x139d8c
movq 0x10(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl $0x1, 0x3c(%rsp)
jmp 0x139e55
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
movl $0x10, %esi
callq 0xd8620
jmp 0x139e61
leaq 0x58(%rsp), %rdi
callq 0xdf0f0
cmpq $0x1, %rax
jne 0x139dfb
leaq 0x58(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xdcc50
movq (%rax), %rax
movq %rax, 0xa0(%rsp)
movl $0x1, 0x3c(%rsp)
jmp 0x139e55
jmp 0x139dfd
movl $0x20, %edi
callq 0xd8380
movq %rax, 0x8(%rsp)
jmp 0x139e0e
movq 0x8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xe0f50
jmp 0x139e1f
movq 0x8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl $0x1, 0x3c(%rsp)
jmp 0x139e55
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
movl $0x20, %esi
callq 0xd8620
jmp 0x139e61
leaq 0x58(%rsp), %rdi
callq 0xddf80
jmp 0x139e6d
leaq 0x58(%rsp), %rdi
callq 0xddf80
jmp 0x139e7d
movq 0xa0(%rsp), %rax
addq $0xa8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0xe0be0
nopw (%rax,%rax)