// File: luizaes[P]post-machine-simulator/main.cpp
// Function: main
int main() {

	string input_word;
	bool output;
	auto pm = new PostMachineSimulator();

	DiagramState* diagram = pm->BuildDiagram();

	if(!diagram->IsValid()) {
		cout << diagram->GetError() << endl;
		return 0;
	}

	cout << "[SUCCESS] Post Machine created successfuly." << endl;

	cin >> input_word;

	output = pm->Run(input_word);

	if(output == ACCEPT) {
		cout << "[ACCEPT] The input \"" << input_word << "\" was accepted by the machine." << endl;
	} else {
		cout << "[REJECT] The input \"" << input_word << "\" was rejected by the machine." << endl;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl $0x0, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x22c0
movl $0xa8, %edi
callq 0x2200
movq %rax, -0x80(%rbp)
jmp 0x25cb
movq -0x80(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, 0x90(%rdi)
movaps %xmm0, 0x80(%rdi)
movaps %xmm0, 0x70(%rdi)
movaps %xmm0, 0x60(%rdi)
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq $0x0, 0xa0(%rdi)
callq 0x2880
jmp 0x2618
movq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x3c80
movq %rax, -0x98(%rbp)
jmp 0x2632
movq -0x98(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x7210
movb %al, -0x99(%rbp)
jmp 0x264e
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x2701
jmp 0x265e
movq -0x50(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x7230
jmp 0x266d
movq 0x995c(%rip), %rdi      # 0xbfd0
leaq -0x70(%rbp), %rsi
callq 0x21e0
movq %rax, -0xa8(%rbp)
jmp 0x2686
movq -0xa8(%rbp), %rdi
movq 0x992c(%rip), %rsi      # 0xbfc0
callq 0x2230
jmp 0x269b
leaq -0x70(%rbp), %rdi
callq 0x2160
movl $0x0, -0x4(%rbp)
movl $0x1, -0x74(%rbp)
jmp 0x284f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x2864
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0xa8, %esi
callq 0x2210
jmp 0x2864
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2160
jmp 0x2864
movq 0x98c8(%rip), %rdi      # 0xbfd0
leaq 0x58f5(%rip), %rsi      # 0x8004
callq 0x21f0
movq %rax, -0xb0(%rbp)
jmp 0x271d
movq -0xb0(%rbp), %rdi
movq 0x9895(%rip), %rsi      # 0xbfc0
callq 0x2230
jmp 0x2732
movq 0x98a7(%rip), %rdi      # 0xbfe0
leaq -0x28(%rbp), %rsi
callq 0x22a0
jmp 0x2744
movq -0x38(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x4b20
movb %al, -0xb1(%rbp)
jmp 0x2759
movb -0xb1(%rbp), %al
andb $0x1, %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x27d9
movq 0x9858(%rip), %rdi      # 0xbfd0
leaq 0x58b1(%rip), %rsi      # 0x8030
callq 0x21f0
movq %rax, -0xc0(%rbp)
jmp 0x278d
movq -0xc0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x21e0
movq %rax, -0xc8(%rbp)
jmp 0x27a6
movq -0xc8(%rbp), %rdi
leaq 0x5891(%rip), %rsi      # 0x8045
callq 0x21f0
movq %rax, -0xd0(%rbp)
jmp 0x27c2
movq -0xd0(%rbp), %rdi
movq 0x97f0(%rip), %rsi      # 0xbfc0
callq 0x2230
jmp 0x27d7
jmp 0x2841
movq 0x97f0(%rip), %rdi      # 0xbfd0
leaq 0x587d(%rip), %rsi      # 0x8064
callq 0x21f0
movq %rax, -0xd8(%rbp)
jmp 0x27f5
movq -0xd8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x21e0
movq %rax, -0xe0(%rbp)
jmp 0x280e
movq -0xe0(%rbp), %rdi
leaq 0x585d(%rip), %rsi      # 0x8079
callq 0x21f0
movq %rax, -0xe8(%rbp)
jmp 0x282a
movq -0xe8(%rbp), %rdi
movq 0x9788(%rip), %rsi      # 0xbfc0
callq 0x2230
jmp 0x283f
jmp 0x2841
movl $0x0, -0x4(%rbp)
movl $0x1, -0x74(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2160
movl -0x4(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x2160
movq -0x40(%rbp), %rdi
callq 0x2370
nopw %cs:(%rax,%rax)