// File: johan-bjareholt[P]lua-compiler/src/convert.cc
// Function: convertThreeAd(ThreeAd&, std::ostream&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, bool)
void convertThreeAd(ThreeAd& op, std::ostream& ss, std::set<std::string>& outputSymbols, std::set<std::string>& inputSymbols, bool localScope){
	regVar(op.result);
	
	std::string lhs = op.lhs;
	std::string rhs = op.rhs;

	switch(op.op){
		case '+':
			{
            formatSymbol(rhs, inputSymbols, localScope);
            formatSymbol(lhs, inputSymbols, localScope);
            formatSymbol(op.result, outputSymbols, localScope);

			ss << pre_in << "movq " << lhs << ", %%rax" << post_in;
			ss << pre_in << "addq " << rhs << ", %%rax" << post_in;
			ss << pre_in << "movq " << "%%rax, " << op.result << post_in;
			}
			break;
		case '-':
			{
            formatSymbol(rhs, inputSymbols, localScope);
            formatSymbol(lhs, inputSymbols, localScope);
            formatSymbol(op.result, outputSymbols, localScope);

			ss << pre_in << "movq " << lhs << ", %%rax" << post_in;
			ss << pre_in << "subq " << rhs << ", %%rax" << post_in;
			ss << pre_in << "movq " << "%%rax, " << op.result << post_in;
			}
			break;
		case '*':
            {
            formatSymbol(rhs, inputSymbols, localScope);
            formatSymbol(lhs, inputSymbols, localScope);
            formatSymbol(op.result, outputSymbols, localScope);

			ss << pre_in << "movq " << rhs << ", %%rax" << post_in;
			ss << pre_in << "movq " << lhs << ", %%rbx" << post_in;
			ss << pre_in << "imulq " << "%%rbx" << ", %%rax" << post_in;
			ss << pre_in << "movq " << "%%rax" << ", " << op.result << post_in;
            }
			break;
        case '/':
            {
            formatSymbol(rhs, inputSymbols, localScope);
            formatSymbol(lhs, inputSymbols, localScope);
            formatSymbol(op.result, outputSymbols, localScope);
			
            ss << pre_in << "movq " << lhs << ", %%rax" << post_in;
            ss << pre_in << "movq " << rhs << ", %%rbx" << post_in;
			ss << pre_in << "cqto" << post_in; // Sign extend %rax to %rdx:rax
			ss << pre_in << "idivq " << "%%rbx" << post_in;
			ss << pre_in << "movq " << "%%rax" << ", " << op.result << post_in;
            }
            break;
        case '%':
            {
            formatSymbol(rhs, inputSymbols, localScope);
            formatSymbol(lhs, inputSymbols, localScope);
            formatSymbol(op.result, outputSymbols, localScope);
			
            ss << pre_in << "movq " << lhs << ", %%rax" << post_in;
            ss << pre_in << "movq " << rhs << ", %%rbx" << post_in;
			ss << pre_in << "cqto" << post_in; // Sign extend %rax to %rdx:rax
			ss << pre_in << "idivq " << "%%rbx" << post_in;
			ss << pre_in << "movq " << "%%rdx" << ", " << op.result << post_in;
            }
            break;
		case '=':
        case 'e':
        case '<':
        case '>':
			{
            formatSymbol(rhs, inputSymbols, localScope);
            formatSymbol(lhs, inputSymbols, localScope);

			ss << pre_in << "movq " << lhs << ", %%rax" << post_in;
			ss << pre_in << "movq " << rhs << ", %%rbx" << post_in;
			ss << pre_in << "cmp "  << "%%rbx, %%rax" << post_in;
			}
			break;
		// Copy
		case 'c':
            {
            if (is_string(rhs)){
                //std::cout << "test1: " << lhs << "," << rhs << std::endl;
                formatSymbol(rhs, inputSymbols, localScope);
                addVar(lhs, VT_POINTER, "");
                add_brackets(lhs);
            }
            else if (is_digits(rhs)){
                formatSymbol(lhs, inputSymbols, localScope);
                std::stringstream tempss;
                tempss << "$" << rhs;
                rhs = tempss.str();
            }
            else {
                formatSymbol(lhs, inputSymbols, localScope);
                formatSymbol(rhs, inputSymbols, localScope);
            }
            ss << pre_in << "movq " << rhs << ", " << "%%rax" << post_in;
            ss << pre_in << "movq " << "%%rax" << ", " << lhs << post_in;
            }
			break;
        // Function argument
        case 'a':
            // TODO: Support for multiple arguments
            formatSymbol(lhs, inputSymbols, localScope);
            // Push to stack
            ss << pre_in << "movq %%rdi, " << lhs << post_in;
            break;
        // Function Return
		case 'r':
            {
            formatSymbol(lhs, inputSymbols, localScope);
			ss << pre_in << "movq " << lhs << ", " << "%%rax" << post_in;
            }
			break;
		// Call function
		case 'f':
            {
            // FIXME: Ugly type check and convertion
            std::string funcname = lhs;
            if (funcname == "print" || funcname == "io_write"){
                bool is_int = false;
                if (is_digits(rhs))
                    is_int = true;
                else {
                    auto arginfo = vars2.find(rhs);
                    if (arginfo != vars2.end()){
                        if ((*arginfo).second.first == VT_INT)
                            is_int = true;
                        else if ((*arginfo).second.first == VT_UNKNOWN)
                            is_int = true;
                    }
                }
                
                if (is_int){
                    if (lhs == "print")
                        funcname = "print_i";
                    else
                        funcname = "io_write_i";
                }
            }

            formatSymbol(op.result, outputSymbols, localScope);
            formatSymbol(rhs, inputSymbols, localScope);

            // Set arguments
            // FIXME: Only supports one argument :(
            ss << pre_in << "movq " << rhs << ", %%rdi" << post_in;
           
            // Call
            ss << pre_in << "call " << funcname << post_in;
            // Move return 
            ss << pre_in << "movq " << "%%rax, " << op.result << post_in;
            }
			break;
        default:
            std::cout << "Unknown 3ac: " << op.op << std::endl;
            exit(-1);
	 }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6c0, %rsp            # imm = 0x6C0
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x3100
movq -0x2c8(%rbp), %rdi
callq 0x15640
jmp 0x138c9
leaq -0x48(%rbp), %rdi
callq 0x3528
movq -0x8(%rbp), %rsi
addq $0x28, %rsi
leaq -0x78(%rbp), %rdi
callq 0x3100
movq -0x8(%rbp), %rsi
addq $0x48, %rsi
leaq -0x98(%rbp), %rdi
callq 0x3100
jmp 0x138f9
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
addl $-0x25, %eax
movl %eax, %ecx
movq %rcx, -0x2d0(%rbp)
subl $0x4d, %eax
ja 0x14e1d
movq -0x2d0(%rbp), %rax
leaq 0x17aa1(%rip), %rcx     # 0x2b3c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3528
jmp 0x14ea7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x14e9e
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x13970
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x13986
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
callq 0x15030
jmp 0x139a0
movq -0x10(%rbp), %rdi
leaq 0x2aa25(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x2d8(%rbp)
jmp 0x139b9
movq -0x2d8(%rbp), %rdi
leaq 0x17e91(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x2e0(%rbp)
jmp 0x139d5
movq -0x2e0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x2e8(%rbp)
jmp 0x139ee
movq -0x2e8(%rbp), %rdi
leaq 0x17ea1(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x2f0(%rbp)
jmp 0x13a0a
movq -0x2f0(%rbp), %rdi
leaq 0x2a9d8(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13a1f
movq -0x10(%rbp), %rdi
leaq 0x2a9a6(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x2f8(%rbp)
jmp 0x13a38
movq -0x2f8(%rbp), %rdi
leaq 0x17e18(%rip), %rsi     # 0x2b85e
callq 0x3260
movq %rax, -0x300(%rbp)
jmp 0x13a54
movq -0x300(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x308(%rbp)
jmp 0x13a70
movq -0x308(%rbp), %rdi
leaq 0x17e1f(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x310(%rbp)
jmp 0x13a8c
movq -0x310(%rbp), %rdi
leaq 0x2a956(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13aa1
movq -0x10(%rbp), %rdi
leaq 0x2a924(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x318(%rbp)
jmp 0x13aba
movq -0x318(%rbp), %rdi
leaq 0x17d90(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x320(%rbp)
jmp 0x13ad6
movq -0x320(%rbp), %rdi
leaq 0x17d80(%rip), %rsi     # 0x2b864
callq 0x3260
movq %rax, -0x328(%rbp)
jmp 0x13af2
movq -0x328(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x3220
movq %rax, -0x330(%rbp)
jmp 0x13b0f
movq -0x330(%rbp), %rdi
leaq 0x2a8d3(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13b24
jmp 0x14e74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x14e92
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x13b53
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x13b69
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
callq 0x15030
jmp 0x13b83
movq -0x10(%rbp), %rdi
leaq 0x2a842(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x338(%rbp)
jmp 0x13b9c
movq -0x338(%rbp), %rdi
leaq 0x17cae(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x340(%rbp)
jmp 0x13bb8
movq -0x340(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x348(%rbp)
jmp 0x13bd1
movq -0x348(%rbp), %rdi
leaq 0x17cbe(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x350(%rbp)
jmp 0x13bed
movq -0x350(%rbp), %rdi
leaq 0x2a7f5(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13c02
movq -0x10(%rbp), %rdi
leaq 0x2a7c3(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x358(%rbp)
jmp 0x13c1b
movq -0x358(%rbp), %rdi
leaq 0x17c43(%rip), %rsi     # 0x2b86c
callq 0x3260
movq %rax, -0x360(%rbp)
jmp 0x13c37
movq -0x360(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x368(%rbp)
jmp 0x13c53
movq -0x368(%rbp), %rdi
leaq 0x17c3c(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x370(%rbp)
jmp 0x13c6f
movq -0x370(%rbp), %rdi
leaq 0x2a773(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13c84
movq -0x10(%rbp), %rdi
leaq 0x2a741(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x378(%rbp)
jmp 0x13c9d
movq -0x378(%rbp), %rdi
leaq 0x17bad(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x380(%rbp)
jmp 0x13cb9
movq -0x380(%rbp), %rdi
leaq 0x17b9d(%rip), %rsi     # 0x2b864
callq 0x3260
movq %rax, -0x388(%rbp)
jmp 0x13cd5
movq -0x388(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x3220
movq %rax, -0x390(%rbp)
jmp 0x13cf2
movq -0x390(%rbp), %rdi
leaq 0x2a6f0(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13d07
jmp 0x14e74
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x13d25
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x13d3b
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
callq 0x15030
jmp 0x13d55
movq -0x10(%rbp), %rdi
leaq 0x2a670(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x398(%rbp)
jmp 0x13d6e
movq -0x398(%rbp), %rdi
leaq 0x17adc(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x3a0(%rbp)
jmp 0x13d8a
movq -0x3a0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x3a8(%rbp)
jmp 0x13da6
movq -0x3a8(%rbp), %rdi
leaq 0x17ae9(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x3b0(%rbp)
jmp 0x13dc2
movq -0x3b0(%rbp), %rdi
leaq 0x2a620(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13dd7
movq -0x10(%rbp), %rdi
leaq 0x2a5ee(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x3b8(%rbp)
jmp 0x13df0
movq -0x3b8(%rbp), %rdi
leaq 0x17a5a(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x3c0(%rbp)
jmp 0x13e0c
movq -0x3c0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x3c8(%rbp)
jmp 0x13e25
movq -0x3c8(%rbp), %rdi
leaq 0x17a3f(%rip), %rsi     # 0x2b872
callq 0x3260
movq %rax, -0x3d0(%rbp)
jmp 0x13e41
movq -0x3d0(%rbp), %rdi
leaq 0x2a5a1(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13e56
movq -0x10(%rbp), %rdi
leaq 0x2a56f(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x3d8(%rbp)
jmp 0x13e6f
movq -0x3d8(%rbp), %rdi
leaq 0x179fd(%rip), %rsi     # 0x2b87a
callq 0x3260
movq %rax, -0x3e0(%rbp)
jmp 0x13e8b
movq -0x3e0(%rbp), %rdi
leaq 0x179db(%rip), %rsi     # 0x2b874
callq 0x3260
movq %rax, -0x3e8(%rbp)
jmp 0x13ea7
movq -0x3e8(%rbp), %rdi
leaq 0x179e8(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x3f0(%rbp)
jmp 0x13ec3
movq -0x3f0(%rbp), %rdi
leaq 0x2a51f(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13ed8
movq -0x10(%rbp), %rdi
leaq 0x2a4ed(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x3f8(%rbp)
jmp 0x13ef1
movq -0x3f8(%rbp), %rdi
leaq 0x17959(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x400(%rbp)
jmp 0x13f0d
movq -0x400(%rbp), %rdi
leaq 0x17984(%rip), %rsi     # 0x2b89f
callq 0x3260
movq %rax, -0x408(%rbp)
jmp 0x13f29
movq -0x408(%rbp), %rdi
leaq 0x17978(%rip), %rsi     # 0x2b8af
callq 0x3260
movq %rax, -0x410(%rbp)
jmp 0x13f45
movq -0x410(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x3220
movq %rax, -0x418(%rbp)
jmp 0x13f62
movq -0x418(%rbp), %rdi
leaq 0x2a480(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x13f77
jmp 0x14e74
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x13f95
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x13fab
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
callq 0x15030
jmp 0x13fc5
movq -0x10(%rbp), %rdi
leaq 0x2a400(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x420(%rbp)
jmp 0x13fde
movq -0x420(%rbp), %rdi
leaq 0x1786c(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x428(%rbp)
jmp 0x13ffa
movq -0x428(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x430(%rbp)
jmp 0x14013
movq -0x430(%rbp), %rdi
leaq 0x1787c(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x438(%rbp)
jmp 0x1402f
movq -0x438(%rbp), %rdi
leaq 0x2a3b3(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14044
movq -0x10(%rbp), %rdi
leaq 0x2a381(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x440(%rbp)
jmp 0x1405d
movq -0x440(%rbp), %rdi
leaq 0x177ed(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x448(%rbp)
jmp 0x14079
movq -0x448(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x450(%rbp)
jmp 0x14095
movq -0x450(%rbp), %rdi
leaq 0x177cf(%rip), %rsi     # 0x2b872
callq 0x3260
movq %rax, -0x458(%rbp)
jmp 0x140b1
movq -0x458(%rbp), %rdi
leaq 0x2a331(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x140c6
movq -0x10(%rbp), %rdi
leaq 0x2a2ff(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x460(%rbp)
jmp 0x140df
movq -0x460(%rbp), %rdi
leaq 0x17794(%rip), %rsi     # 0x2b881
callq 0x3260
movq %rax, -0x468(%rbp)
jmp 0x140fb
movq -0x468(%rbp), %rdi
leaq 0x2a2e7(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14110
movq -0x10(%rbp), %rdi
leaq 0x2a2b5(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x470(%rbp)
jmp 0x14129
movq -0x470(%rbp), %rdi
leaq 0x1774f(%rip), %rsi     # 0x2b886
callq 0x3260
movq %rax, -0x478(%rbp)
jmp 0x14145
movq -0x478(%rbp), %rdi
leaq 0x17721(%rip), %rsi     # 0x2b874
callq 0x3260
movq %rax, -0x480(%rbp)
jmp 0x14161
movq -0x480(%rbp), %rdi
leaq 0x2a281(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14176
movq -0x10(%rbp), %rdi
leaq 0x2a24f(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x488(%rbp)
jmp 0x1418f
movq -0x488(%rbp), %rdi
leaq 0x176bb(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x490(%rbp)
jmp 0x141ab
movq -0x490(%rbp), %rdi
leaq 0x176e6(%rip), %rsi     # 0x2b89f
callq 0x3260
movq %rax, -0x498(%rbp)
jmp 0x141c7
movq -0x498(%rbp), %rdi
leaq 0x176da(%rip), %rsi     # 0x2b8af
callq 0x3260
movq %rax, -0x4a0(%rbp)
jmp 0x141e3
movq -0x4a0(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x3220
movq %rax, -0x4a8(%rbp)
jmp 0x14200
movq -0x4a8(%rbp), %rdi
leaq 0x2a1e2(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14215
jmp 0x14e74
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x14233
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x14249
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
callq 0x15030
jmp 0x14263
movq -0x10(%rbp), %rdi
leaq 0x2a162(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x4b0(%rbp)
jmp 0x1427c
movq -0x4b0(%rbp), %rdi
leaq 0x175ce(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x4b8(%rbp)
jmp 0x14298
movq -0x4b8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x4c0(%rbp)
jmp 0x142b1
movq -0x4c0(%rbp), %rdi
leaq 0x175de(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x4c8(%rbp)
jmp 0x142cd
movq -0x4c8(%rbp), %rdi
leaq 0x2a115(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x142e2
movq -0x10(%rbp), %rdi
leaq 0x2a0e3(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x4d0(%rbp)
jmp 0x142fb
movq -0x4d0(%rbp), %rdi
leaq 0x1754f(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x4d8(%rbp)
jmp 0x14317
movq -0x4d8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x4e0(%rbp)
jmp 0x14333
movq -0x4e0(%rbp), %rdi
leaq 0x17531(%rip), %rsi     # 0x2b872
callq 0x3260
movq %rax, -0x4e8(%rbp)
jmp 0x1434f
movq -0x4e8(%rbp), %rdi
leaq 0x2a093(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14364
movq -0x10(%rbp), %rdi
leaq 0x2a061(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x4f0(%rbp)
jmp 0x1437d
movq -0x4f0(%rbp), %rdi
leaq 0x174f6(%rip), %rsi     # 0x2b881
callq 0x3260
movq %rax, -0x4f8(%rbp)
jmp 0x14399
movq -0x4f8(%rbp), %rdi
leaq 0x2a049(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x143ae
movq -0x10(%rbp), %rdi
leaq 0x2a017(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x500(%rbp)
jmp 0x143c7
movq -0x500(%rbp), %rdi
leaq 0x174b1(%rip), %rsi     # 0x2b886
callq 0x3260
movq %rax, -0x508(%rbp)
jmp 0x143e3
movq -0x508(%rbp), %rdi
leaq 0x17483(%rip), %rsi     # 0x2b874
callq 0x3260
movq %rax, -0x510(%rbp)
jmp 0x143ff
movq -0x510(%rbp), %rdi
leaq 0x29fe3(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14414
movq -0x10(%rbp), %rdi
leaq 0x29fb1(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x518(%rbp)
jmp 0x1442d
movq -0x518(%rbp), %rdi
leaq 0x1741d(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x520(%rbp)
jmp 0x14449
movq -0x520(%rbp), %rdi
leaq 0x17436(%rip), %rsi     # 0x2b88d
callq 0x3260
movq %rax, -0x528(%rbp)
jmp 0x14465
movq -0x528(%rbp), %rdi
leaq 0x1743c(%rip), %rsi     # 0x2b8af
callq 0x3260
movq %rax, -0x530(%rbp)
jmp 0x14481
movq -0x530(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x3220
movq %rax, -0x538(%rbp)
jmp 0x1449e
movq -0x538(%rbp), %rdi
leaq 0x29f44(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x144b3
jmp 0x14e74
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x144d1
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x144e7
movq -0x10(%rbp), %rdi
leaq 0x29ede(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x540(%rbp)
jmp 0x14500
movq -0x540(%rbp), %rdi
leaq 0x1734a(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x548(%rbp)
jmp 0x1451c
movq -0x548(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x550(%rbp)
jmp 0x14535
movq -0x550(%rbp), %rdi
leaq 0x1735a(%rip), %rsi     # 0x2b89d
callq 0x3260
movq %rax, -0x558(%rbp)
jmp 0x14551
movq -0x558(%rbp), %rdi
leaq 0x29e91(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14566
movq -0x10(%rbp), %rdi
leaq 0x29e5f(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x560(%rbp)
jmp 0x1457f
movq -0x560(%rbp), %rdi
leaq 0x172cb(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x568(%rbp)
jmp 0x1459b
movq -0x568(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x570(%rbp)
jmp 0x145b7
movq -0x570(%rbp), %rdi
leaq 0x172ad(%rip), %rsi     # 0x2b872
callq 0x3260
movq %rax, -0x578(%rbp)
jmp 0x145d3
movq -0x578(%rbp), %rdi
leaq 0x29e0f(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x145e8
movq -0x10(%rbp), %rdi
leaq 0x29ddd(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x580(%rbp)
jmp 0x14601
movq -0x580(%rbp), %rdi
leaq 0x17284(%rip), %rsi     # 0x2b893
callq 0x3260
movq %rax, -0x588(%rbp)
jmp 0x1461d
movq -0x588(%rbp), %rdi
leaq 0x1726d(%rip), %rsi     # 0x2b898
callq 0x3260
movq %rax, -0x590(%rbp)
jmp 0x14639
movq -0x590(%rbp), %rdi
leaq 0x29da9(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x1464e
jmp 0x14e74
leaq -0x98(%rbp), %rdi
callq 0x14f00
testb $0x1, %al
jne 0x14668
jmp 0x14753
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x14681
leaq -0xb8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3100
jmp 0x14693
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x598(%rbp)
callq 0x34c0
movq -0x598(%rbp), %rdx
leaq 0x16e66(%rip), %rsi     # 0x2b51a
leaq -0xd8(%rbp), %rdi
callq 0x3390
jmp 0x146c2
leaq -0xb8(%rbp), %rdi
movl $0x2, %esi
leaq -0xd8(%rbp), %rdx
callq 0x11910
jmp 0x146dc
leaq -0xd8(%rbp), %rdi
callq 0x3528
leaq -0xd9(%rbp), %rdi
callq 0x32c0
leaq -0xb8(%rbp), %rdi
callq 0x3528
leaq -0x78(%rbp), %rdi
callq 0x14f50
jmp 0x1470b
jmp 0x1485d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x14736
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3528
leaq -0xd9(%rbp), %rdi
callq 0x32c0
leaq -0xb8(%rbp), %rdi
callq 0x3528
jmp 0x14e92
leaq -0x98(%rbp), %rdi
callq 0x14eb0
movb %al, -0x599(%rbp)
jmp 0x14767
movb -0x599(%rbp), %al
testb $0x1, %al
jne 0x14776
jmp 0x1482a
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x1478c
leaq -0x268(%rbp), %rdi
callq 0x31d0
jmp 0x1479a
leaq -0x258(%rbp), %rdi
leaq 0x170a1(%rip), %rsi     # 0x2b849
callq 0x3260
movq %rax, -0x5a8(%rbp)
jmp 0x147b6
movq -0x5a8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
jmp 0x147cb
leaq -0x288(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x3250
jmp 0x147e0
leaq -0x98(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x3340
leaq -0x288(%rbp), %rdi
callq 0x3528
leaq -0x268(%rbp), %rdi
callq 0x31e0
jmp 0x1485b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x31e0
jmp 0x14e92
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x14840
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x14859
jmp 0x1485b
jmp 0x1485d
movq -0x10(%rbp), %rdi
leaq 0x29b68(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x5b0(%rbp)
jmp 0x14876
movq -0x5b0(%rbp), %rdi
leaq 0x16fd4(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x5b8(%rbp)
jmp 0x14892
movq -0x5b8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x5c0(%rbp)
jmp 0x148ae
movq -0x5c0(%rbp), %rdi
leaq 0x16ff3(%rip), %rsi     # 0x2b8af
callq 0x3260
movq %rax, -0x5c8(%rbp)
jmp 0x148ca
movq -0x5c8(%rbp), %rdi
leaq 0x16fc7(%rip), %rsi     # 0x2b89f
callq 0x3260
movq %rax, -0x5d0(%rbp)
jmp 0x148e6
movq -0x5d0(%rbp), %rdi
leaq 0x29afc(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x148fb
movq -0x10(%rbp), %rdi
leaq 0x29aca(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x5d8(%rbp)
jmp 0x14914
movq -0x5d8(%rbp), %rdi
leaq 0x16f36(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x5e0(%rbp)
jmp 0x14930
movq -0x5e0(%rbp), %rdi
leaq 0x16f61(%rip), %rsi     # 0x2b89f
callq 0x3260
movq %rax, -0x5e8(%rbp)
jmp 0x1494c
movq -0x5e8(%rbp), %rdi
leaq 0x16f55(%rip), %rsi     # 0x2b8af
callq 0x3260
movq %rax, -0x5f0(%rbp)
jmp 0x14968
movq -0x5f0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x5f8(%rbp)
jmp 0x14981
movq -0x5f8(%rbp), %rdi
leaq 0x29a61(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14996
jmp 0x14e74
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x149b1
movq -0x10(%rbp), %rdi
leaq 0x29a14(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x600(%rbp)
jmp 0x149ca
movq -0x600(%rbp), %rdi
leaq 0x16ecd(%rip), %rsi     # 0x2b8a5
callq 0x3260
movq %rax, -0x608(%rbp)
jmp 0x149e6
movq -0x608(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x610(%rbp)
jmp 0x149ff
movq -0x610(%rbp), %rdi
leaq 0x299e3(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14a14
jmp 0x14e74
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x78(%rbp), %rdi
callq 0x15030
jmp 0x14a2f
movq -0x10(%rbp), %rdi
leaq 0x29996(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x618(%rbp)
jmp 0x14a48
movq -0x618(%rbp), %rdi
leaq 0x16e02(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x620(%rbp)
jmp 0x14a64
movq -0x620(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, -0x628(%rbp)
jmp 0x14a7d
movq -0x628(%rbp), %rdi
leaq 0x16e24(%rip), %rsi     # 0x2b8af
callq 0x3260
movq %rax, -0x630(%rbp)
jmp 0x14a99
movq -0x630(%rbp), %rdi
leaq 0x16df8(%rip), %rsi     # 0x2b89f
callq 0x3260
movq %rax, -0x638(%rbp)
jmp 0x14ab5
movq -0x638(%rbp), %rdi
leaq 0x2992d(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14aca
jmp 0x14e74
leaq -0x2a8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3100
jmp 0x14ae1
leaq 0x16dca(%rip), %rsi     # 0x2b8b2
leaq -0x2a8(%rbp), %rdi
callq 0xa770
movb %al, -0x639(%rbp)
jmp 0x14afc
movb -0x639(%rbp), %al
testb $0x1, %al
jne 0x14b32
jmp 0x14b08
leaq 0x16da9(%rip), %rsi     # 0x2b8b8
leaq -0x2a8(%rbp), %rdi
callq 0xa770
movb %al, -0x63a(%rbp)
jmp 0x14b23
movb -0x63a(%rbp), %al
testb $0x1, %al
jne 0x14b32
jmp 0x14c71
movb $0x0, -0x2a9(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x14eb0
movb %al, -0x63b(%rbp)
jmp 0x14b4d
movb -0x63b(%rbp), %al
testb $0x1, %al
jne 0x14b59
jmp 0x14b82
movb $0x1, -0x2a9(%rbp)
jmp 0x14c12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x3528
jmp 0x14e92
leaq 0x29887(%rip), %rdi     # 0x3e410
leaq -0x98(%rbp), %rsi
callq 0x15e10
movq %rax, -0x648(%rbp)
jmp 0x14b9e
movq -0x648(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq 0x2985d(%rip), %rdi     # 0x3e410
callq 0x15870
movq %rax, -0x2c0(%rbp)
leaq -0x2b8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x158a0
testb $0x1, %al
jne 0x14bd8
jmp 0x14c10
leaq -0x2b8(%rbp), %rdi
callq 0x158d0
cmpl $0x1, 0x20(%rax)
jne 0x14bf3
movb $0x1, -0x2a9(%rbp)
jmp 0x14c0e
leaq -0x2b8(%rbp), %rdi
callq 0x158d0
cmpl $0x5, 0x20(%rax)
jne 0x14c0c
movb $0x1, -0x2a9(%rbp)
jmp 0x14c0e
jmp 0x14c10
jmp 0x14c12
testb $0x1, -0x2a9(%rbp)
je 0x14c6f
leaq 0x16c90(%rip), %rsi     # 0x2b8b2
leaq -0x78(%rbp), %rdi
callq 0xa770
movb %al, -0x649(%rbp)
jmp 0x14c33
movb -0x649(%rbp), %al
testb $0x1, %al
jne 0x14c3f
jmp 0x14c56
leaq 0x16c7b(%rip), %rsi     # 0x2b8c1
leaq -0x2a8(%rbp), %rdi
callq 0x3380
jmp 0x14c54
jmp 0x14c6d
leaq 0x16c6c(%rip), %rsi     # 0x2b8c9
leaq -0x2a8(%rbp), %rdi
callq 0x3380
jmp 0x14c6b
jmp 0x14c6d
jmp 0x14c6f
jmp 0x14c71
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
callq 0x15030
jmp 0x14c8b
movq -0x20(%rbp), %rsi
movzbl -0x21(%rbp), %edx
andl $0x1, %edx
leaq -0x98(%rbp), %rdi
callq 0x15030
jmp 0x14ca4
movq -0x10(%rbp), %rdi
leaq 0x29721(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x658(%rbp)
jmp 0x14cbd
movq -0x658(%rbp), %rdi
leaq 0x16b8d(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x660(%rbp)
jmp 0x14cd9
movq -0x660(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, -0x668(%rbp)
jmp 0x14cf5
movq -0x668(%rbp), %rdi
leaq 0x169c8(%rip), %rsi     # 0x2b6cb
callq 0x3260
movq %rax, -0x670(%rbp)
jmp 0x14d11
movq -0x670(%rbp), %rdi
leaq 0x296d1(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14d26
movq -0x10(%rbp), %rdi
leaq 0x2969f(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x678(%rbp)
jmp 0x14d3f
movq -0x678(%rbp), %rdi
leaq 0x16b87(%rip), %rsi     # 0x2b8d4
callq 0x3260
movq %rax, -0x680(%rbp)
jmp 0x14d5b
movq -0x680(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x3220
movq %rax, -0x688(%rbp)
jmp 0x14d77
movq -0x688(%rbp), %rdi
leaq 0x2966b(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14d8c
movq -0x10(%rbp), %rdi
leaq 0x29639(%rip), %rsi     # 0x3e3d0
callq 0x3220
movq %rax, -0x690(%rbp)
jmp 0x14da5
movq -0x690(%rbp), %rdi
leaq 0x16aa5(%rip), %rsi     # 0x2b858
callq 0x3260
movq %rax, -0x698(%rbp)
jmp 0x14dc1
movq -0x698(%rbp), %rdi
leaq 0x16a95(%rip), %rsi     # 0x2b864
callq 0x3260
movq %rax, -0x6a0(%rbp)
jmp 0x14ddd
movq -0x6a0(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x3220
movq %rax, -0x6a8(%rbp)
jmp 0x14dfa
movq -0x6a8(%rbp), %rdi
leaq 0x295e8(%rip), %rsi     # 0x3e3f0
callq 0x3220
jmp 0x14e0f
leaq -0x2a8(%rbp), %rdi
callq 0x3528
jmp 0x14e74
movq 0x291a4(%rip), %rdi     # 0x3dfc8
leaq 0x16aaf(%rip), %rsi     # 0x2b8da
callq 0x3260
movq %rax, -0x6b0(%rbp)
jmp 0x14e39
movq -0x6b0(%rbp), %rdi
movq -0x8(%rbp), %rax
movsbl (%rax), %esi
callq 0x3300
movq %rax, -0x6b8(%rbp)
jmp 0x14e55
movq -0x6b8(%rbp), %rdi
movq 0x2913d(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x14e6a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3330
leaq -0x98(%rbp), %rdi
callq 0x3528
leaq -0x78(%rbp), %rdi
callq 0x3528
addq $0x6c0, %rsp            # imm = 0x6C0
popq %rbp
retq
leaq -0x98(%rbp), %rdi
callq 0x3528
leaq -0x78(%rbp), %rdi
callq 0x3528
movq -0x50(%rbp), %rdi
callq 0x34b0