// File: jstaursky[P]hutch/src/Sleigh/slghpatexpress.cc
// Function: TokenPattern::doCat(TokenPattern const&) const
TokenPattern TokenPattern::doCat(const TokenPattern &tokpat) const

{				// Return Concatenation of -this- and -tokpat-
  TokenPattern res((Pattern *)0);
  int4 sa;

  res.leftellipsis = leftellipsis;
  res.rightellipsis = rightellipsis;
  res.toklist = toklist;
  if (rightellipsis||tokpat.leftellipsis) { // Check for interior ellipsis
    if (rightellipsis) {
      if (!tokpat.alwaysInstructionTrue())
	throw SleighError("Interior ellipsis in pattern");
    }
    if (tokpat.leftellipsis) {
      if (!alwaysInstructionTrue())
	throw SleighError("Interior ellipsis in pattern");
      res.leftellipsis = true;
    }
    sa = -1;
  }
  else {
    sa = 0;
    vector<Token *>::const_iterator iter;

    for(iter=toklist.begin();iter!=toklist.end();++iter)
      sa += (*iter)->getSize();
    for(iter=tokpat.toklist.begin();iter!=tokpat.toklist.end();++iter)
      res.toklist.push_back(*iter);
    res.rightellipsis = tokpat.rightellipsis;
  }
  if (res.rightellipsis && res.leftellipsis)
    throw SleighError("Double ellipsis in pattern");
  if (sa < 0)
    res.pattern = pattern->doAnd(tokpat.pattern,0);
  else
    res.pattern = pattern->doAnd(tokpat.pattern,sa);
  return res;
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x70(%rsp)
movq %rdi, %rax
movq %rax, 0x60(%rsp)
movq %rdi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
movq %rdx, 0x130(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x68(%rsp)
movb $0x0, 0x12f(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xd13e0
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdi
movb 0x20(%rsi), %al
andb $0x1, %al
movb %al, 0x20(%rdi)
movb 0x21(%rsi), %al
andb $0x1, %al
movb %al, 0x21(%rdi)
addq $0x8, %rsi
addq $0x8, %rdi
callq 0xdb420
jmp 0x127753
movq 0x68(%rsp), %rax
testb $0x1, 0x21(%rax)
jne 0x127770
movq 0x130(%rsp), %rax
testb $0x1, 0x20(%rax)
je 0x1279bc
movq 0x68(%rsp), %rax
testb $0x1, 0x21(%rax)
je 0x127897
movq 0x130(%rsp), %rdi
callq 0xdcd90
movb %al, 0x5f(%rsp)
jmp 0x127792
movb 0x5f(%rsp), %al
testb $0x1, %al
jne 0x127895
jmp 0x1277a0
movb $0x1, 0xf6(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x48(%rsp)
leaq 0xf7(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0xe0c80
movq 0x50(%rsp), %rdx
leaq 0x60f1c(%rip), %rsi     # 0x1886f1
leaq 0xf8(%rsp), %rdi
callq 0xe00a0
jmp 0x1277e4
movq 0x48(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xd06e0
jmp 0x1277f8
movq 0x48(%rsp), %rdi
movb $0x0, 0xf6(%rsp)
movq 0xa065c(%rip), %rsi     # 0x1c7e68
movq 0xa020d(%rip), %rdx     # 0x1c7a20
callq 0xe01f0
jmp 0x127cb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x127c9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x12786d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xd4550
leaq 0xf7(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0xf6(%rsp)
jne 0x127886
jmp 0x127890
movq 0x48(%rsp), %rdi
callq 0xd5400
jmp 0x127c9c
jmp 0x127897
movq 0x130(%rsp), %rax
testb $0x1, 0x20(%rax)
je 0x1279ac
movq 0x68(%rsp), %rdi
callq 0xdcd90
movb %al, 0x47(%rsp)
jmp 0x1278b9
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0x1279a3
jmp 0x1278c7
movb $0x1, 0xce(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x30(%rsp)
leaq 0xcf(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0xe0c80
movq 0x38(%rsp), %rdx
leaq 0x60df5(%rip), %rsi     # 0x1886f1
leaq 0xd0(%rsp), %rdi
callq 0xe00a0
jmp 0x12790b
movq 0x30(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0xd06e0
jmp 0x12791f
movq 0x30(%rsp), %rdi
movb $0x0, 0xce(%rsp)
movq 0xa0535(%rip), %rsi     # 0x1c7e68
movq 0xa00e6(%rip), %rdx     # 0x1c7a20
callq 0xe01f0
jmp 0x127cb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x12797b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0xd4550
leaq 0xcf(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0xce(%rsp)
jne 0x127994
jmp 0x12799e
movq 0x30(%rsp), %rdi
callq 0xd5400
jmp 0x127c9c
movq 0x70(%rsp), %rax
movb $0x1, 0x20(%rax)
movl $0xffffffff, 0x128(%rsp) # imm = 0xFFFFFFFF
jmp 0x127b15
movl $0x0, 0x128(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xcfb40
movq 0x68(%rsp), %rdi
addq $0x8, %rdi
callq 0xe05e0
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x68(%rsp), %rdi
addq $0x8, %rdi
callq 0xcfd80
movq %rax, 0xb0(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0xd2090
testb $0x1, %al
jne 0x127a2b
jmp 0x127a67
leaq 0xc0(%rsp), %rdi
callq 0xe2210
movq (%rax), %rdi
callq 0xd9c90
movl %eax, 0x2c(%rsp)
jmp 0x127a46
movl 0x2c(%rsp), %eax
addl 0x128(%rsp), %eax
movl %eax, 0x128(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xd21c0
jmp 0x1279fa
movq 0x130(%rsp), %rdi
addq $0x8, %rdi
callq 0xe05e0
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x130(%rsp), %rdi
addq $0x8, %rdi
callq 0xcfd80
movq %rax, 0xa0(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xd2090
testb $0x1, %al
jne 0x127ac4
jmp 0x127aff
movq 0x70(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x20(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xe2210
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0xdd590
jmp 0x127aee
jmp 0x127af0
leaq 0xc0(%rsp), %rdi
callq 0xd21c0
jmp 0x127a90
movq 0x70(%rsp), %rax
movq 0x130(%rsp), %rcx
movb 0x21(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x21(%rax)
movq 0x70(%rsp), %rax
testb $0x1, 0x21(%rax)
je 0x127c00
movq 0x70(%rsp), %rax
testb $0x1, 0x20(%rax)
je 0x127c00
movb $0x1, 0x7e(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x10(%rsp)
leaq 0x7f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xe0c80
movq 0x18(%rsp), %rdx
leaq 0x60bac(%rip), %rsi     # 0x18870e
leaq 0x80(%rsp), %rdi
callq 0xe00a0
jmp 0x127b71
movq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xd06e0
jmp 0x127b85
movq 0x10(%rsp), %rdi
movb $0x0, 0x7e(%rsp)
movq 0xa02d2(%rip), %rsi     # 0x1c7e68
movq 0x9fe83(%rip), %rdx     # 0x1c7a20
callq 0xe01f0
jmp 0x127cb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
jmp 0x127bde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x120(%rsp)
movl %eax, 0x11c(%rsp)
leaq 0x80(%rsp), %rdi
callq 0xd4550
leaq 0x7f(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0x7e(%rsp)
jne 0x127bf1
jmp 0x127bfb
movq 0x10(%rsp), %rdi
callq 0xd5400
jmp 0x127c9c
cmpl $0x0, 0x128(%rsp)
jge 0x127c3e
movq 0x68(%rsp), %rax
movq (%rax), %rdi
movq 0x130(%rsp), %rax
movq (%rax), %rsi
movq (%rdi), %rax
movq 0x28(%rax), %rax
xorl %edx, %edx
callq *%rax
movq %rax, 0x8(%rsp)
jmp 0x127c2f
movq 0x70(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x127c73
movq 0x68(%rsp), %rax
movq (%rax), %rdi
movq 0x130(%rsp), %rax
movq (%rax), %rsi
movl 0x128(%rsp), %edx
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
movq %rax, (%rsp)
jmp 0x127c67
movq 0x70(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, (%rax)
movb $0x1, 0x12f(%rsp)
testb $0x1, 0x12f(%rsp)
jne 0x127c8f
movq 0x70(%rsp), %rdi
callq 0xd2580
movq 0x60(%rsp), %rax
addq $0x148, %rsp            # imm = 0x148
retq
movq 0x70(%rsp), %rdi
callq 0xd2580
movq 0x120(%rsp), %rdi
callq 0xe0be0
nopw %cs:(%rax,%rax)