// File: davinash[P]regex/src/regex.cpp
// Function: RegEx::Or()
bool RegEx::Or() {

	Table  UpperTable, LowerTable;

	if(!PopTable(LowerTable) || !PopTable(UpperTable))
		return false;

	RegExState *LeftTable	= new RegExState(m_nNextStateID++);
	RegExState *RightTable	= new RegExState(m_nNextStateID++);
	
	LeftTable->AddTransition(EPSILON, ((*(UpperTable.begin()))));
	LeftTable->AddTransition(EPSILON, ((*(LowerTable.begin()))));
	((*(UpperTable.rbegin())))->AddTransition(EPSILON, RightTable);
	((*(LowerTable.rbegin())))->AddTransition(EPSILON, RightTable);

	LowerTable.push_back(RightTable);
	UpperTable.insert(UpperTable.begin(),LeftTable);
	UpperTable.insert(UpperTable.end(), LowerTable.begin(), LowerTable.end());

	m_CharacterClassStack.push(UpperTable);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xa470
leaq -0x40(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0xa470
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0x7370
movb %al, -0xc1(%rbp)
jmp 0x7f7e
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x7f8a
jmp 0x7fae
movq -0xd8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x7370
movb %al, -0xd9(%rbp)
jmp 0x7fa2
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x7fcf
jmp 0x7fae
movb $0x0, -0x1(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x829d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x82bd
movl $0x78, %edi
callq 0x3250
movq %rax, -0xe8(%rbp)
jmp 0x7fe2
movq -0xe8(%rbp), %rdi
movq -0xd8(%rbp), %rax
movl 0x14c(%rax), %esi
movl %esi, %ecx
incl %ecx
movl %ecx, 0x14c(%rax)
callq 0xab80
jmp 0x8007
movq -0xe8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x78, %edi
callq 0x3250
movq %rax, -0xf0(%rbp)
jmp 0x8025
movq -0xf0(%rbp), %rdi
movq -0xd8(%rbp), %rax
movl 0x14c(%rax), %esi
movl %esi, %ecx
incl %ecx
movl %ecx, 0x14c(%rax)
callq 0xab80
jmp 0x804a
movq -0xf0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xa9e0
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xaa10
movq -0xf8(%rbp), %rdi
movq (%rax), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x13ec0
jmp 0x808c
movq -0x58(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xa9e0
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xaa10
movq -0x100(%rbp), %rdi
movq (%rax), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x13ec0
jmp 0x80c3
leaq -0x78(%rbp), %rdi
movq %rdi, -0x110(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xa960
movq -0x110(%rbp), %rdi
callq 0xa9b0
movq %rax, -0x108(%rbp)
jmp 0x80ec
movq -0x108(%rbp), %rax
movq (%rax), %rdi
movq -0x60(%rbp), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x13ec0
jmp 0x8106
leaq -0x80(%rbp), %rdi
movq %rdi, -0x120(%rbp)
leaq -0x40(%rbp), %rsi
callq 0xa960
movq -0x120(%rbp), %rdi
callq 0xa9b0
movq %rax, -0x118(%rbp)
jmp 0x812f
movq -0x118(%rbp), %rax
movq (%rax), %rdi
movq -0x60(%rbp), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x13ec0
jmp 0x8149
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xabe0
jmp 0x8158
leaq -0x28(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0xa9e0
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xab10
movq -0x130(%rbp), %rdi
movq -0x88(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0xaca0
movq %rax, -0x128(%rbp)
jmp 0x81a2
movq -0x128(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0xaae0
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0xab10
leaq -0x40(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0xa9e0
movq -0x148(%rbp), %rdi
movq %rax, -0xb0(%rbp)
callq 0xaae0
movq -0x140(%rbp), %rdi
movq %rax, -0xb8(%rbp)
movq -0xa0(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq -0xb8(%rbp), %rcx
callq 0xaa30
movq %rax, -0x138(%rbp)
jmp 0x822e
movq -0xd8(%rbp), %rdi
movq -0x138(%rbp), %rax
movq %rax, -0xc0(%rbp)
addq $0x30, %rdi
leaq -0x28(%rbp), %rsi
callq 0xab50
jmp 0x8252
movb $0x1, -0x1(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x829d
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x78, %esi
callq 0x3260
jmp 0x82bd
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x78, %esi
callq 0x3260
jmp 0x82bd
leaq -0x40(%rbp), %rdi
callq 0xa530
leaq -0x28(%rbp), %rdi
callq 0xa530
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0xa530
leaq -0x28(%rbp), %rdi
callq 0xa530
movq -0x48(%rbp), %rdi
callq 0x33a0
nopl (%rax,%rax)