// File: illmat[P]MemCrawl/main.cpp
// Function: main
int main(int argc, char* argv[])
{
    pid_t pid;
    int input = 0;
    bool isFirstRun = true;
    std::string commando;
    std::vector<scanRegion> regions;
    std::vector<scanResult> results;

    if(argc < 2)
    {
        printError("usage ./MemCrawl <pid>");
        return 1;
    }

    if ((pid = atol(argv[1])) == 0)
    {
        printError("usage ./MemCrawl <pid>");
        return 1;
    }

    // get read/writeable scan regions
    if (getRegions(regions, pid) != 0)
    {
        printError("could not get regions");
        return 1;
    }

    std::cout << "Enter Command (try: help)" << std::endl;
    std::cout << results.size() << "> ";
    std::getline (std::cin, commando);

    while (commando != "quit" && commando != "q")
    {

        try
        {
            input = string2int(commando);
            if (isFirstRun)
            {
                isFirstRun = false;
                if (scanIntInit(regions, results, pid, input) != 0)
                {
                    printError("could not scan memory");
                    return 1;
                }
            }
            else
            {
                if (scanIntResults(results, pid, input) != 0)
                {
                    std::cout << "could not scan memory" << std::endl;
                    return 1;
                }
            }

        }
        catch (int e)
        {
            if (e == 1)
            {
                if (commando == "help")
                {
                    printHelp();
                }

                if (commando == "list")
                {
                    printResults(results);
                }

                if (commando == "update")
                {
                    if (updateIntResults(results, pid) != 0)
                    {
                        printError("could not scan memory");
                        return 1;
                    }
                }

                if (commando == "ulist")
                {
                    if (updateIntResults(results, pid) != 0)
                    {
                        printError("could not scan memory");
                        return 1;
                    }
                    printResults(results);
                }

                if (commando == "info")
                {
                    std::cout << std::endl << "scan regions: " << std::endl;
                    int adresses = 0;
                    for(std::vector<scanRegion>::iterator it = regions.begin(); it != regions.end(); ++it)
                    {
                        scanRegion sr = (scanRegion) *it;
                        std::cout << std::hex << sr.startRegion << " - " << sr.endRegion << std::dec <<std::endl;
                        adresses += sr.endRegion - sr.startRegion;
                    }
                    std::cout << std::endl << adresses << " adresses" << std::endl;

                }

                if (commando == "reset")
                {
                    regions.clear();
                    results.clear();
                    isFirstRun = true;
                    // get read/writeable scan regions
                    if (getRegions(regions, pid) != 0)
                    {
                        printError("could not get regions");
                        return 1;
                    }

                }

                if (commando.substr(0, 3) == "pid")
                {
                    if (commando.length() < 5)
                    {
                        std::cout << "correct usage: pid <pid>" << std::endl;
                    }
                    else
                    {
                        int val = 0;
                        std::stringstream ss(commando.substr(4, commando.length()));
                        if ((ss >> val).fail())
                        {
                            printError("wrong parameter for pid command");
                        }
                        else
                        {
                            pid = val;
                            // reset
                            regions.clear();
                            results.clear();
                            isFirstRun = true;
                            // get read/writeable scan regions
                            if (getRegions(regions, pid) != 0)
                            {
                                printError("could not get regions");
                                return 1;
                            }
                        }
                    }
                }

                if (commando.substr(0, 3) == "set")
                {
                    if (commando.length() < 5)
                    {
                        std::cout << "correct usage: set 5" << std::endl;
                    }
                    else
                    {
                        int val = 0;
                        std::stringstream ss(commando.substr(4, commando.length()));
                        if ((ss >> val).fail())
                        {
                            printError("wrong parameter for set command");
                        }
                        else
                        {
                            if (setInt(results, pid, val) != 0)
                            {
                                std::cout << "could not set value" << std::endl;
                                return 1;
                            }
                        }
                    }
                }
            }
            else
            {
                printError("unknown");
            }
        }
        std::cout << results.size() << "> ";
        std::getline (std::cin, commando);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7e0, %rsp            # imm = 0x7E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movb $0x1, -0x19(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3340
leaq -0x58(%rbp), %rdi
callq 0x4a10
leaq -0x70(%rbp), %rdi
callq 0x4a30
cmpl $0x2, -0x8(%rbp)
jge 0x3787
leaq -0x91(%rbp), %rdi
movq %rdi, -0x650(%rbp)
callq 0x33f0
movq -0x650(%rbp), %rdx
leaq 0x590a(%rip), %rsi      # 0x9004
leaq -0x90(%rbp), %rdi
callq 0x4a50
jmp 0x3708
leaq -0x90(%rbp), %rdi
callq 0x7350
jmp 0x3716
leaq -0x90(%rbp), %rdi
callq 0x3150
leaq -0x91(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x49c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3776
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x3150
leaq -0x91(%rbp), %rdi
callq 0x32a0
jmp 0x49e7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x32f0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0x384e
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x658(%rbp)
callq 0x33f0
movq -0x658(%rbp), %rdx
leaq 0x5843(%rip), %rsi      # 0x9004
leaq -0xc8(%rbp), %rdi
callq 0x4a50
jmp 0x37cf
leaq -0xc8(%rbp), %rdi
callq 0x7350
jmp 0x37dd
leaq -0xc8(%rbp), %rdi
callq 0x3150
leaq -0xc9(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x49c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x383d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3150
leaq -0xc9(%rbp), %rdi
callq 0x32a0
jmp 0x49e7
movl -0x14(%rbp), %esi
leaq -0x58(%rbp), %rdi
callq 0x6540
movl %eax, -0x65c(%rbp)
jmp 0x3862
movl -0x65c(%rbp), %eax
cmpl $0x0, %eax
je 0x3936
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x668(%rbp)
callq 0x33f0
movq -0x668(%rbp), %rdx
leaq 0x5789(%rip), %rsi      # 0x901b
leaq -0xf0(%rbp), %rdi
callq 0x4a50
jmp 0x38a0
leaq -0xf0(%rbp), %rdi
callq 0x7350
jmp 0x38ae
leaq -0xf0(%rbp), %rdi
callq 0x3150
leaq -0xf1(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x49c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x49e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3150
leaq -0xf1(%rbp), %rdi
callq 0x32a0
jmp 0x49e7
movq 0x9693(%rip), %rdi      # 0xcfd0
leaq 0x56ed(%rip), %rsi      # 0x9031
callq 0x3230
movq %rax, -0x670(%rbp)
jmp 0x3952
movq -0x670(%rbp), %rdi
movq 0x9660(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x3967
leaq -0x70(%rbp), %rdi
callq 0x4b00
movq %rax, %rsi
movq 0x9656(%rip), %rdi      # 0xcfd0
callq 0x3080
movq %rax, -0x678(%rbp)
jmp 0x3988
movq -0x678(%rbp), %rdi
leaq 0x56b5(%rip), %rsi      # 0x904b
callq 0x3230
jmp 0x399d
movq 0x963c(%rip), %rdi      # 0xcfe0
leaq -0x40(%rbp), %rsi
callq 0x3060
jmp 0x39af
jmp 0x39b1
leaq 0x5696(%rip), %rsi      # 0x904e
leaq -0x40(%rbp), %rdi
callq 0x4b20
movb %al, -0x679(%rbp)
jmp 0x39c9
movb -0x679(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x67a(%rbp)
jne 0x39de
jmp 0x3a04
leaq 0x566e(%rip), %rsi      # 0x9053
leaq -0x40(%rbp), %rdi
callq 0x4b20
movb %al, -0x67b(%rbp)
jmp 0x39f6
movb -0x67b(%rbp), %al
movb %al, -0x67a(%rbp)
jmp 0x3a04
movb -0x67a(%rbp), %al
testb $0x1, %al
jne 0x3a13
jmp 0x49af
leaq -0x40(%rbp), %rdi
callq 0x6e30
movl %eax, -0x680(%rbp)
jmp 0x3a24
movl -0x680(%rbp), %eax
movl %eax, -0x18(%rbp)
testb $0x1, -0x19(%rbp)
je 0x3bcc
movb $0x0, -0x19(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4b50
jmp 0x3a4d
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq -0x110(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7500
movl %eax, -0x684(%rbp)
jmp 0x3a6b
leaq -0x110(%rbp), %rdi
callq 0x4c40
movl -0x684(%rbp), %eax
cmpl $0x0, %eax
je 0x3bca
leaq -0x131(%rbp), %rdi
movq %rdi, -0x690(%rbp)
callq 0x33f0
movq -0x690(%rbp), %rdx
leaq 0x55ae(%rip), %rsi      # 0x9055
leaq -0x130(%rbp), %rdi
callq 0x4a50
jmp 0x3ab5
leaq -0x130(%rbp), %rdi
callq 0x7350
jmp 0x3ac3
leaq -0x130(%rbp), %rdi
callq 0x3150
leaq -0x131(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x49c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x4c40
jmp 0x3b63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b57
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x3150
leaq -0x131(%rbp), %rdi
callq 0x32a0
movl -0xa4(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x49e7
movq -0xa0(%rbp), %rdi
callq 0x30d0
movl (%rax), %eax
movl %eax, -0x138(%rbp)
cmpl $0x1, -0x138(%rbp)
jne 0x48a7
leaq 0x54cd(%rip), %rsi      # 0x906b
leaq -0x40(%rbp), %rdi
callq 0x4ca0
movb %al, -0x691(%rbp)
jmp 0x3baf
movb -0x691(%rbp), %al
testb $0x1, %al
jne 0x3bbe
jmp 0x3c53
callq 0x73a0
jmp 0x3bc5
jmp 0x3c53
jmp 0x3c37
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
leaq -0x70(%rbp), %rdi
callq 0x7630
movl %eax, -0x698(%rbp)
jmp 0x3be3
movl -0x698(%rbp), %eax
cmpl $0x0, %eax
je 0x3c35
movq 0x93db(%rip), %rdi      # 0xcfd0
leaq 0x5459(%rip), %rsi      # 0x9055
callq 0x3230
movq %rax, -0x6a0(%rbp)
jmp 0x3c0a
movq -0x6a0(%rbp), %rdi
movq 0x93a8(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x3c1f
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x49c0
jmp 0x3c37
jmp 0x495b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x49a8
leaq 0x541e(%rip), %rsi      # 0x9078
leaq -0x40(%rbp), %rdi
callq 0x4ca0
movb %al, -0x6a1(%rbp)
jmp 0x3c6b
movb -0x6a1(%rbp), %al
testb $0x1, %al
jne 0x3c77
jmp 0x3cc8
leaq -0x150(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4cd0
jmp 0x3c89
leaq -0x150(%rbp), %rdi
callq 0x7240
jmp 0x3c97
leaq -0x150(%rbp), %rdi
callq 0x4dc0
jmp 0x3cc8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x4dc0
jmp 0x49a8
leaq 0x53a1(%rip), %rsi      # 0x9070
leaq -0x40(%rbp), %rdi
callq 0x4ca0
movb %al, -0x6a2(%rbp)
jmp 0x3ce0
movb -0x6a2(%rbp), %al
testb $0x1, %al
jne 0x3cef
jmp 0x3dc2
movl -0x14(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0x7790
movl %eax, -0x6a8(%rbp)
jmp 0x3d03
movl -0x6a8(%rbp), %eax
cmpl $0x0, %eax
je 0x3dc0
leaq -0x171(%rbp), %rdi
movq %rdi, -0x6b0(%rbp)
callq 0x33f0
movq -0x6b0(%rbp), %rdx
leaq 0x5322(%rip), %rsi      # 0x9055
leaq -0x170(%rbp), %rdi
callq 0x4a50
jmp 0x3d41
leaq -0x170(%rbp), %rdi
callq 0x7350
jmp 0x3d4f
leaq -0x170(%rbp), %rdi
callq 0x3150
leaq -0x171(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x4948
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3daf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x3150
leaq -0x171(%rbp), %rdi
callq 0x32a0
jmp 0x49a8
jmp 0x3dc2
leaq 0x52ae(%rip), %rsi      # 0x9077
leaq -0x40(%rbp), %rdi
callq 0x4ca0
movb %al, -0x6b1(%rbp)
jmp 0x3dda
movb -0x6b1(%rbp), %al
testb $0x1, %al
jne 0x3de9
jmp 0x3f0b
movl -0x14(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0x7790
movl %eax, -0x6b8(%rbp)
jmp 0x3dfd
movl -0x6b8(%rbp), %eax
cmpl $0x0, %eax
je 0x3eba
leaq -0x199(%rbp), %rdi
movq %rdi, -0x6c0(%rbp)
callq 0x33f0
movq -0x6c0(%rbp), %rdx
leaq 0x5228(%rip), %rsi      # 0x9055
leaq -0x198(%rbp), %rdi
callq 0x4a50
jmp 0x3e3b
leaq -0x198(%rbp), %rdi
callq 0x7350
jmp 0x3e49
leaq -0x198(%rbp), %rdi
callq 0x3150
leaq -0x199(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x4948
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3ea9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3150
leaq -0x199(%rbp), %rdi
callq 0x32a0
jmp 0x49a8
leaq -0x1b8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4cd0
jmp 0x3ecc
leaq -0x1b8(%rbp), %rdi
callq 0x7240
jmp 0x3eda
leaq -0x1b8(%rbp), %rdi
callq 0x4dc0
jmp 0x3f0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x4dc0
jmp 0x49a8
leaq 0x516b(%rip), %rsi      # 0x907d
leaq -0x40(%rbp), %rdi
callq 0x4ca0
movb %al, -0x6c1(%rbp)
jmp 0x3f23
movb -0x6c1(%rbp), %al
testb $0x1, %al
jne 0x3f32
jmp 0x4115
movq 0x9097(%rip), %rdi      # 0xcfd0
movq 0x9080(%rip), %rsi      # 0xcfc0
callq 0x3280
movq %rax, -0x6d0(%rbp)
jmp 0x3f4e
movq -0x6d0(%rbp), %rdi
leaq 0x5126(%rip), %rsi      # 0x9082
callq 0x3230
movq %rax, -0x6d8(%rbp)
jmp 0x3f6a
movq -0x6d8(%rbp), %rdi
movq 0x9048(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x3f7f
movl $0x0, -0x1bc(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4e20
movq %rax, -0x1c8(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4e90
movq %rax, -0x1d0(%rbp)
leaq -0x1c8(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x4e50
testb $0x1, %al
jne 0x3fc5
jmp 0x40ab
leaq -0x1c8(%rbp), %rdi
callq 0x4ec0
movups (%rax), %xmm0
movaps %xmm0, -0x1e0(%rbp)
movq 0x8fee(%rip), %rdi      # 0xcfd0
leaq 0xef7(%rip), %rsi       # 0x4ee0
callq 0x30b0
movq %rax, -0x6e0(%rbp)
jmp 0x3ff7
movq -0x6e0(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
callq 0x3080
movq %rax, -0x6e8(%rbp)
jmp 0x4013
movq -0x6e8(%rbp), %rdi
leaq 0x5070(%rip), %rsi      # 0x9091
callq 0x3230
movq %rax, -0x6f0(%rbp)
jmp 0x402f
movq -0x6f0(%rbp), %rdi
movq -0x1d8(%rbp), %rsi
callq 0x3080
movq %rax, -0x6f8(%rbp)
jmp 0x404b
movq -0x6f8(%rbp), %rdi
leaq 0xeb7(%rip), %rsi       # 0x4f10
callq 0x30b0
movq %rax, -0x700(%rbp)
jmp 0x4067
movq -0x700(%rbp), %rdi
movq 0x8f4b(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x407c
movq -0x1d8(%rbp), %rcx
subq -0x1e0(%rbp), %rcx
movslq -0x1bc(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x1bc(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x4f40
jmp 0x3f99
movq 0x8f1e(%rip), %rdi      # 0xcfd0
movq 0x8f07(%rip), %rsi      # 0xcfc0
callq 0x3280
movq %rax, -0x708(%rbp)
jmp 0x40c7
movq -0x708(%rbp), %rdi
movl -0x1bc(%rbp), %esi
callq 0x33d0
movq %rax, -0x710(%rbp)
jmp 0x40e2
movq -0x710(%rbp), %rdi
leaq 0x4fa5(%rip), %rsi      # 0x9095
callq 0x3230
movq %rax, -0x718(%rbp)
jmp 0x40fe
movq -0x718(%rbp), %rdi
movq 0x8eb4(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x4113
jmp 0x4115
leaq 0x4f83(%rip), %rsi      # 0x909f
leaq -0x40(%rbp), %rdi
callq 0x4ca0
movb %al, -0x719(%rbp)
jmp 0x412d
movb -0x719(%rbp), %al
testb $0x1, %al
jne 0x413c
jmp 0x422f
leaq -0x58(%rbp), %rdi
movq %rdi, -0x728(%rbp)
callq 0x4f60
leaq -0x70(%rbp), %rdi
callq 0x4f80
movq -0x728(%rbp), %rdi
movb $0x1, -0x19(%rbp)
movl -0x14(%rbp), %esi
callq 0x6540
movl %eax, -0x720(%rbp)
jmp 0x4170
movl -0x720(%rbp), %eax
cmpl $0x0, %eax
je 0x422d
leaq -0x201(%rbp), %rdi
movq %rdi, -0x730(%rbp)
callq 0x33f0
movq -0x730(%rbp), %rdx
leaq 0x4e7b(%rip), %rsi      # 0x901b
leaq -0x200(%rbp), %rdi
callq 0x4a50
jmp 0x41ae
leaq -0x200(%rbp), %rdi
callq 0x7350
jmp 0x41bc
leaq -0x200(%rbp), %rdi
callq 0x3150
leaq -0x201(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x4948
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x421c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x3150
leaq -0x201(%rbp), %rdi
callq 0x32a0
jmp 0x49a8
jmp 0x422f
xorl %eax, %eax
movl %eax, %edx
leaq -0x228(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x3, %ecx
callq 0x3270
jmp 0x424a
leaq 0x5112(%rip), %rsi      # 0x9363
leaq -0x228(%rbp), %rdi
callq 0x4ca0
movb %al, -0x731(%rbp)
jmp 0x4265
leaq -0x228(%rbp), %rdi
callq 0x3150
movb -0x731(%rbp), %al
testb $0x1, %al
jne 0x4280
jmp 0x45ae
leaq -0x40(%rbp), %rdi
callq 0x3360
cmpq $0x5, %rax
jae 0x42e8
movq 0x8d3a(%rip), %rdi      # 0xcfd0
leaq 0x4e08(%rip), %rsi      # 0x90a5
callq 0x3230
movq %rax, -0x740(%rbp)
jmp 0x42ab
movq -0x740(%rbp), %rdi
movq 0x8d07(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x42c0
jmp 0x45ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x3150
jmp 0x49a8
movl $0x0, -0x22c(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x748(%rbp)
callq 0x3360
movq -0x748(%rbp), %rsi
movq %rax, %rcx
leaq -0x3d8(%rbp), %rdi
movl $0x4, %edx
callq 0x3270
jmp 0x431f
movl $0x10, %edi
movl $0x8, %esi
callq 0x4fa0
movl %eax, -0x74c(%rbp)
jmp 0x4336
movl -0x74c(%rbp), %edx
leaq -0x3b8(%rbp), %rdi
leaq -0x3d8(%rbp), %rsi
callq 0x3380
jmp 0x4351
leaq -0x3d8(%rbp), %rdi
callq 0x3150
leaq -0x3b8(%rbp), %rdi
leaq -0x22c(%rbp), %rsi
callq 0x3140
movq %rax, -0x758(%rbp)
jmp 0x4379
movq -0x758(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3030
movb %al, -0x759(%rbp)
jmp 0x4397
movb -0x759(%rbp), %al
testb $0x1, %al
jne 0x43a6
jmp 0x447d
leaq -0x3f9(%rbp), %rdi
movq %rdi, -0x768(%rbp)
callq 0x33f0
movq -0x768(%rbp), %rdx
leaq 0x4cf7(%rip), %rsi      # 0x90be
leaq -0x3f8(%rbp), %rdi
callq 0x4a50
jmp 0x43d5
leaq -0x3f8(%rbp), %rdi
callq 0x7350
jmp 0x43e3
leaq -0x3f8(%rbp), %rdi
callq 0x3150
leaq -0x3f9(%rbp), %rdi
callq 0x32a0
jmp 0x4573
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x3d8(%rbp), %rdi
callq 0x3150
jmp 0x49a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x459b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x446c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x3f8(%rbp), %rdi
callq 0x3150
leaq -0x3f9(%rbp), %rdi
callq 0x32a0
jmp 0x459b
movl -0x22c(%rbp), %eax
movl %eax, -0x14(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x778(%rbp)
callq 0x4f60
leaq -0x70(%rbp), %rdi
callq 0x4f80
movq -0x778(%rbp), %rdi
movb $0x1, -0x19(%rbp)
movl -0x14(%rbp), %esi
callq 0x6540
movl %eax, -0x76c(%rbp)
jmp 0x44ba
movl -0x76c(%rbp), %eax
cmpl $0x0, %eax
je 0x4571
leaq -0x421(%rbp), %rdi
movq %rdi, -0x780(%rbp)
callq 0x33f0
movq -0x780(%rbp), %rdx
leaq 0x4b31(%rip), %rsi      # 0x901b
leaq -0x420(%rbp), %rdi
callq 0x4a50
jmp 0x44f8
leaq -0x420(%rbp), %rdi
callq 0x7350
jmp 0x4506
leaq -0x420(%rbp), %rdi
callq 0x3150
leaq -0x421(%rbp), %rdi
callq 0x32a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x457d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x4563
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x420(%rbp), %rdi
callq 0x3150
leaq -0x421(%rbp), %rdi
callq 0x32a0
jmp 0x459b
jmp 0x4573
movl $0x0, -0xa8(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0x3190
movl -0xa8(%rbp), %eax
testl %eax, %eax
jne 0x4948
jmp 0x4599
jmp 0x45ac
leaq -0x3b8(%rbp), %rdi
callq 0x3190
jmp 0x49a8
jmp 0x45ae
xorl %eax, %eax
movl %eax, %edx
leaq -0x448(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x3, %ecx
callq 0x3270
jmp 0x45c9
leaq 0x4ad1(%rip), %rsi      # 0x90a1
leaq -0x448(%rbp), %rdi
callq 0x4ca0
movb %al, -0x781(%rbp)
jmp 0x45e4
leaq -0x448(%rbp), %rdi
callq 0x3150
movb -0x781(%rbp), %al
testb $0x1, %al
jne 0x45ff
jmp 0x48a2
leaq -0x40(%rbp), %rdi
callq 0x3360
cmpq $0x5, %rax
jae 0x4667
movq 0x89bb(%rip), %rdi      # 0xcfd0
leaq 0x4ac2(%rip), %rsi      # 0x90de
callq 0x3230
movq %rax, -0x790(%rbp)
jmp 0x462a
movq -0x790(%rbp), %rdi
movq 0x8988(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x463f
jmp 0x48a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x448(%rbp), %rdi
callq 0x3150
jmp 0x49a8
movl $0x0, -0x44c(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x798(%rbp)
callq 0x3360
movq -0x798(%rbp), %rsi
movq %rax, %rcx
leaq -0x5f8(%rbp), %rdi
movl $0x4, %edx
callq 0x3270
jmp 0x469e
movl $0x10, %edi
movl $0x8, %esi
callq 0x4fa0
movl %eax, -0x79c(%rbp)
jmp 0x46b5
movl -0x79c(%rbp), %edx
leaq -0x5d8(%rbp), %rdi
leaq -0x5f8(%rbp), %rsi
callq 0x3380
jmp 0x46d0
leaq -0x5f8(%rbp), %rdi
callq 0x3150
leaq -0x5d8(%rbp), %rdi
leaq -0x44c(%rbp), %rsi
callq 0x3140
movq %rax, -0x7a8(%rbp)
jmp 0x46f8
movq -0x7a8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3030
movb %al, -0x7a9(%rbp)
jmp 0x4716
movb -0x7a9(%rbp), %al
testb $0x1, %al
jne 0x4725
jmp 0x47fc
leaq -0x619(%rbp), %rdi
movq %rdi, -0x7b8(%rbp)
callq 0x33f0
movq -0x7b8(%rbp), %rdx
leaq 0x49ad(%rip), %rsi      # 0x90f3
leaq -0x618(%rbp), %rdi
callq 0x4a50
jmp 0x4754
leaq -0x618(%rbp), %rdi
callq 0x7350
jmp 0x4762
leaq -0x618(%rbp), %rdi
callq 0x3150
leaq -0x619(%rbp), %rdi
callq 0x32a0
jmp 0x4867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x5f8(%rbp), %rdi
callq 0x3150
jmp 0x49a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x488f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x47eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x618(%rbp), %rdi
callq 0x3150
leaq -0x619(%rbp), %rdi
callq 0x32a0
jmp 0x488f
movl -0x14(%rbp), %esi
movl -0x44c(%rbp), %edx
leaq -0x70(%rbp), %rdi
callq 0x7860
movl %eax, -0x7bc(%rbp)
jmp 0x4816
movl -0x7bc(%rbp), %eax
cmpl $0x0, %eax
je 0x4865
movq 0x87a8(%rip), %rdi      # 0xcfd0
leaq 0x48e4(%rip), %rsi      # 0x9113
callq 0x3230
movq %rax, -0x7c8(%rbp)
jmp 0x483d
movq -0x7c8(%rbp), %rdi
movq 0x8775(%rip), %rsi      # 0xcfc0
callq 0x3280
jmp 0x4852
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
jmp 0x4871
jmp 0x4867
movl $0x0, -0xa8(%rbp)
leaq -0x5d8(%rbp), %rdi
callq 0x3190
movl -0xa8(%rbp), %eax
testl %eax, %eax
jne 0x4948
jmp 0x488d
jmp 0x48a0
leaq -0x5d8(%rbp), %rdi
callq 0x3190
jmp 0x49a8
jmp 0x48a2
jmp 0x493e
leaq -0x641(%rbp), %rdi
movq %rdi, -0x7d0(%rbp)
callq 0x33f0
movq -0x7d0(%rbp), %rdx
leaq 0x485f(%rip), %rsi      # 0x9127
leaq -0x640(%rbp), %rdi
callq 0x4a50
jmp 0x48d6
leaq -0x640(%rbp), %rdi
callq 0x7350
jmp 0x48e4
leaq -0x640(%rbp), %rdi
callq 0x3150
leaq -0x641(%rbp), %rdi
callq 0x32a0
jmp 0x493e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x4930
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x640(%rbp), %rdi
callq 0x3150
leaq -0x641(%rbp), %rdi
callq 0x32a0
jmp 0x49a8
movl $0x0, -0xa8(%rbp)
callq 0x33a0
movl -0xa8(%rbp), %eax
testl %eax, %eax
jne 0x49c0
jmp 0x4959
jmp 0x495b
leaq -0x70(%rbp), %rdi
callq 0x4b00
movq %rax, %rsi
movq 0x8662(%rip), %rdi      # 0xcfd0
callq 0x3080
movq %rax, -0x7d8(%rbp)
jmp 0x497c
movq -0x7d8(%rbp), %rdi
leaq 0x46c1(%rip), %rsi      # 0x904b
callq 0x3230
jmp 0x4991
movq 0x8648(%rip), %rdi      # 0xcfe0
leaq -0x40(%rbp), %rsi
callq 0x3060
jmp 0x49a3
jmp 0x39b1
callq 0x33a0
jmp 0x49e7
movl $0x0, -0x4(%rbp)
movl $0x1, -0xa8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4dc0
leaq -0x58(%rbp), %rdi
callq 0x4c40
leaq -0x40(%rbp), %rdi
callq 0x3150
movl -0x4(%rbp), %eax
addq $0x7e0, %rsp            # imm = 0x7E0
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x4dc0
leaq -0x58(%rbp), %rdi
callq 0x4c40
leaq -0x40(%rbp), %rdi
callq 0x3150
movq -0xa0(%rbp), %rdi
callq 0x33e0
nop