// File: danomatika[P]miditester/src/main.cpp
// Function: main
int main(int argc, char *argv[]) {
    RtMidiIn *midiin = new RtMidiIn();
    RtMidiOut *midiout = new RtMidiOut();
    midiin->setErrorCallback(midiError);
    midiout->setErrorCallback(midiError);

    // parse commandline
    std::string tests = "all";
    int port = 0;
    int channel = 1;
    int speed = -1;
    bool hex = true;
    bool name = false;
    bool list = false;
    std::string option = "";
    for(int i = 1; i < argc; ++i) {
        std::string arg = argv[i];

        // previous option which expects a value
        if(option != "") {
            if(arg[0] == '-') {
                std::cout << option << " expects a value" << std::endl;
                return 1;
            }
            if(!isnumeric(arg)) {
                std::cout << option << " expects a positive integer, got "
                          << arg << std::endl;
                return 1;
            }
            if(option == "-p" || option == "--port") {
                port = std::atoi(argv[i]);
            }
            else if(option == "-c" || option == "--channel") {
                channel = std::atoi(argv[i]);
                if(channel < 1 || channel > 16) {
                    std::cout << option << " option must be 1-16" << std::endl;
                    return 1;
                }
            }
            else if(option == "-s" || option == "--speed") {
                speed = std::atoi(argv[i]);
            }
            else {
                std::cout << "unknown option: " << option << std::endl;
                return 1;
            }
            option = "";
            continue;
        }

        // current argument
        if(arg[0] == '-') {
            // option
            if(arg == "-h" || arg == "--help") {
                std::cout << HELP << std::endl;
                return 0;
            }
            else if(arg == "-d" || arg == "--decimal") {
                hex = false;
            }
            else if(arg == "-n" || arg == "--name") {
                name = true;
            }
            else if(arg == "-l" || arg == "--list") {
                list = true;
                break;
            }
            else {
                option = arg;
            }
        }
        else {
            // argument
            tests = arg;
        }      
    }

    // list devices and exit?
    if(list) {
        if(midiin->getPortCount() > 0) {
            std::cout << "input ports:" << std::endl;
            for(int i = 0; i < midiin->getPortCount(); ++i) {
              std::cout << "  " << i << ": "
                        << midiin->getPortName(i) << std::endl;
            }
        }
        else {
            std::cout << "no input ports" << std::endl;
        }
        if(midiin->getPortCount() > 0) {
            std::cout << "output ports:" << std::endl;
            for(int i = 0; i < midiin->getPortCount(); ++i) {
              std::cout << "  " << i << ": "
                        << midiout->getPortName(i) << std::endl;
            }
        }
        else {
            std::cout << "no output ports" << std::endl;
        }
        return 0;
    }

    channel--; // decrement from human-readable index

    // set signal handling
    signal(SIGTERM, signalExit); // terminate
    signal(SIGQUIT, signalExit); // quit
    signal(SIGINT,  signalExit); // interrupt

    if(tests == "input") {
        if(speed < 0) speed = 40;

        std::cout << "running tests: " << tests << std::endl
          << "port: " << port << std::endl
          << "speed: " << speed << " ms" << std::endl;

        // check if there is anything to receive from
        unsigned int numPorts = midiin->getPortCount();
        if(numPorts == 0) {
            std::cout << "no input ports available" << std::endl;
            delete midiin;
            delete midiout;
            return 0;
        }

        // try opening given port
        midiin->openPort(port);
        std::cout << "opened " << midiin->getPortName(port) << std::endl;

        // disable message filtering
        midiin->ignoreTypes(false, false, false);

        // listen for new messages until loop is stopped
        std::cout << "input test" << std::endl;
        std::cout << "started listening" << std::endl;
        std::chrono::milliseconds sleepMS(20);
        std::vector<unsigned char> message;
        while(run) {
            if(midiin->getMessage(&message)) {
                printMessage(message, hex, name);
                message.clear();
            }
            std::this_thread::sleep_for(sleepMS);
        }
        std::cout << "stopped listening" << std::endl;

        // done
        midiin->closePort();
    }
    else {
        TestQueue queue;
        if(speed < 0) speed = 500;

        std::cout << "running tests: " << tests << std::endl
          << "port: " << port << std::endl
          << "channel: " << channel << std::endl
          << "speed: " << speed << " ms" << std::endl;

        // check if there is anything to send to
        unsigned int numPorts = midiout->getPortCount();
        if(numPorts == 0) {
            std::cout << "no output ports available" << std::endl;
            delete midiin;
            delete midiout;
            return 0;
        }

        // try opening given port
        midiout->openPort(port);
        std::cout << "opened " << midiout->getPortName(port) << std::endl;
        
        // prepare message queue
        bool allTests = (tests == "all");
        bool addedTest = false;
        if(allTests || tests == "channel")  channelMessages(queue, channel), addedTest = true;
        if(allTests || tests == "system")   systemMessages(queue, channel), addedTest = true;
        if(allTests || tests == "realtime") realtimeMessages(queue, channel), addedTest = true;
        if(allTests || tests == "running")  runningStatus(queue, channel), addedTest = true;
        if(allTests || tests == "sysex")    sysex(queue, channel), addedTest = true;
        if(allTests || tests == "timecode") timecode(queue), addedTest = true;
        if(!addedTest) {
            std::cout << "unknown test: " << tests << std::endl;
            return 1;
        }

        // send messages
        std::chrono::milliseconds sleepMS(speed);
        for(auto &test : queue) {
            if(!run) {break;}
            std::cout << test.name << " test" << std::endl;
            for(auto &message : test.messages) {
                if(!run) {break;}
                std::cout << "  sending ";
                printMessage(message, hex, name);
                midiout->sendMessage(&message);
                std::this_thread::sleep_for(sleepMS);
            }
        }

        // done
        midiout->closePort();
    }

    // cleanup
    delete midiin;
    delete midiout;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x580, %rsp            # imm = 0x580
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x10, %edi
callq 0x31e0
movq %rax, -0x290(%rbp)
movb $0x1, -0x4d(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x3330
movq -0x288(%rbp), %rdx
leaq 0xcc83(%rip), %rsi      # 0x1020f
leaq -0x38(%rbp), %rdi
callq 0x8130
jmp 0x3597
movq -0x290(%rbp), %rdi
xorl %esi, %esi
leaq -0x38(%rbp), %rdx
movl $0x64, %ecx
callq 0xc850
jmp 0x35b0
movb $0x0, -0x4d(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3150
leaq -0x39(%rbp), %rdi
callq 0x3220
movq -0x290(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x10, %edi
callq 0x31e0
movq %rax, -0x2a0(%rbp)
movb $0x1, -0x7a(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x3330
movq -0x298(%rbp), %rdx
leaq 0xcc1f(%rip), %rsi      # 0x10223
leaq -0x78(%rbp), %rdi
callq 0x8130
jmp 0x360f
movq -0x2a0(%rbp), %rdi
xorl %esi, %esi
leaq -0x78(%rbp), %rdx
callq 0xcc80
jmp 0x3623
movb $0x0, -0x7a(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3150
leaq -0x79(%rbp), %rdi
callq 0x3220
movq -0x2a0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x30(%rax), %rax
leaq 0x194a(%rip), %rsi      # 0x4fa0
movq %rsi, -0x2b8(%rbp)
xorl %ecx, %ecx
movl %ecx, %edx
movq %rdx, -0x2b0(%rbp)
callq *%rax
movq -0x2b8(%rbp), %rsi
movq -0x2b0(%rbp), %rdx
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq 0x30(%rax), %rax
callq *%rax
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x3330
movq -0x2a8(%rbp), %rdx
leaq 0xcb92(%rip), %rsi      # 0x10238
leaq -0xa0(%rbp), %rdi
callq 0x8130
jmp 0x36b4
leaq -0xa1(%rbp), %rdi
callq 0x3220
movl $0x0, -0xa8(%rbp)
movl $0x1, -0xac(%rbp)
movl $0xffffffff, -0xb0(%rbp) # imm = 0xFFFFFFFF
movb $0x1, -0xb1(%rbp)
movb $0x0, -0xb2(%rbp)
movb $0x0, -0xb3(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x3330
movq -0x2c0(%rbp), %rdx
leaq 0xd1a6(%rip), %rsi      # 0x108ba
leaq -0xd8(%rbp), %rdi
callq 0x8130
jmp 0x3722
leaq -0xd9(%rbp), %rdi
callq 0x3220
movl $0x1, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x3e93
movq -0x10(%rbp), %rax
movslq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2d0(%rbp)
leaq -0x101(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x3330
movq -0x2d0(%rbp), %rsi
movq -0x2c8(%rbp), %rdx
leaq -0x100(%rbp), %rdi
callq 0x8130
jmp 0x378c
leaq -0x101(%rbp), %rdi
callq 0x3220
leaq 0xd11b(%rip), %rsi      # 0x108ba
leaq -0xd8(%rbp), %rdi
callq 0x81e0
movb %al, -0x2d1(%rbp)
jmp 0x37b3
movb -0x2d1(%rbp), %al
testb $0x1, %al
jne 0x37c2
jmp 0x3c2f
xorl %eax, %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0x3380
movq %rax, -0x2e0(%rbp)
jmp 0x37db
movq -0x2e0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x3959
movq 0x147db(%rip), %rdi     # 0x17fd0
leaq -0xd8(%rbp), %rsi
callq 0x31c0
movq %rax, -0x2e8(%rbp)
jmp 0x380a
movq -0x2e8(%rbp), %rdi
leaq 0xca24(%rip), %rsi      # 0x1023c
callq 0x31d0
movq %rax, -0x2f0(%rbp)
jmp 0x3826
movq -0x2f0(%rbp), %rdi
movq 0x14784(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x383b
movl $0x1, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x3e42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3874
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3150
leaq -0x39(%rbp), %rdi
callq 0x3220
testb $0x1, -0x4d(%rbp)
jne 0x3885
jmp 0x3896
movq -0x290(%rbp), %rdi
movl $0x10, %esi
callq 0x31f0
jmp 0x4f88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x38be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3150
leaq -0x79(%rbp), %rdi
callq 0x3220
testb $0x1, -0x7a(%rbp)
jne 0x38cf
jmp 0x38e0
movq -0x2a0(%rbp), %rdi
movl $0x10, %esi
callq 0x31f0
jmp 0x4f88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa1(%rbp), %rdi
callq 0x3220
jmp 0x4f88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd9(%rbp), %rdi
callq 0x3220
jmp 0x4f7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x101(%rbp), %rdi
callq 0x3220
jmp 0x4f70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x3150
jmp 0x4f70
leaq -0x100(%rbp), %rdi
callq 0x3510
testb $0x1, %al
jne 0x39e8
movq 0x14660(%rip), %rdi     # 0x17fd0
leaq -0xd8(%rbp), %rsi
callq 0x31c0
movq %rax, -0x2f8(%rbp)
jmp 0x3985
movq -0x2f8(%rbp), %rdi
leaq 0xc8ba(%rip), %rsi      # 0x1024d
callq 0x31d0
movq %rax, -0x300(%rbp)
jmp 0x39a1
movq -0x300(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x31c0
movq %rax, -0x308(%rbp)
jmp 0x39bd
movq -0x308(%rbp), %rdi
movq 0x145ed(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x39d2
movl $0x1, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x3e42
leaq 0xc880(%rip), %rsi      # 0x1026f
leaq -0xd8(%rbp), %rdi
callq 0x8210
movb %al, -0x309(%rbp)
jmp 0x3a03
movb -0x309(%rbp), %al
testb $0x1, %al
jne 0x3a36
jmp 0x3a0f
leaq 0xc85c(%rip), %rsi      # 0x10272
leaq -0xd8(%rbp), %rdi
callq 0x8210
movb %al, -0x30a(%rbp)
jmp 0x3a2a
movb -0x30a(%rbp), %al
testb $0x1, %al
jne 0x3a36
jmp 0x3a55
movq -0x10(%rbp), %rax
movslq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x32d0
movl %eax, -0xa8(%rbp)
jmp 0x3c0b
leaq 0xc81d(%rip), %rsi      # 0x10279
leaq -0xd8(%rbp), %rdi
callq 0x8210
movb %al, -0x30b(%rbp)
jmp 0x3a70
movb -0x30b(%rbp), %al
testb $0x1, %al
jne 0x3aa6
jmp 0x3a7c
leaq 0xc7f9(%rip), %rsi      # 0x1027c
leaq -0xd8(%rbp), %rdi
callq 0x8210
movb %al, -0x30c(%rbp)
jmp 0x3a97
movb -0x30c(%rbp), %al
testb $0x1, %al
jne 0x3aa6
jmp 0x3b3a
movq -0x10(%rbp), %rax
movslq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x32d0
movl %eax, -0xac(%rbp)
cmpl $0x1, -0xac(%rbp)
jl 0x3ad2
cmpl $0x10, -0xac(%rbp)
jle 0x3b35
movq 0x144f7(%rip), %rdi     # 0x17fd0
leaq -0xd8(%rbp), %rsi
callq 0x31c0
movq %rax, -0x318(%rbp)
jmp 0x3aee
movq -0x318(%rbp), %rdi
leaq 0xc78a(%rip), %rsi      # 0x10286
callq 0x31d0
movq %rax, -0x320(%rbp)
jmp 0x3b0a
movq -0x320(%rbp), %rdi
movq 0x144a0(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x3b1f
movl $0x1, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x3e42
jmp 0x3c09
leaq 0xc75a(%rip), %rsi      # 0x1029b
leaq -0xd8(%rbp), %rdi
callq 0x8210
movb %al, -0x321(%rbp)
jmp 0x3b55
movb -0x321(%rbp), %al
testb $0x1, %al
jne 0x3b88
jmp 0x3b61
leaq 0xc736(%rip), %rsi      # 0x1029e
leaq -0xd8(%rbp), %rdi
callq 0x8210
movb %al, -0x322(%rbp)
jmp 0x3b7c
movb -0x322(%rbp), %al
testb $0x1, %al
jne 0x3b88
jmp 0x3ba4
movq -0x10(%rbp), %rax
movslq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x32d0
movl %eax, -0xb0(%rbp)
jmp 0x3c07
movq 0x14425(%rip), %rdi     # 0x17fd0
leaq 0xc6f4(%rip), %rsi      # 0x102a6
callq 0x31d0
movq %rax, -0x330(%rbp)
jmp 0x3bc0
movq -0x330(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x31c0
movq %rax, -0x338(%rbp)
jmp 0x3bdc
movq -0x338(%rbp), %rdi
movq 0x143ce(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x3bf1
movl $0x1, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x3e42
jmp 0x3c09
jmp 0x3c0b
leaq 0xcca8(%rip), %rsi      # 0x108ba
leaq -0xd8(%rbp), %rdi
callq 0x3290
jmp 0x3c20
movl $0x4, -0x108(%rbp)
jmp 0x3e42
xorl %eax, %eax
movl %eax, %esi
leaq -0x100(%rbp), %rdi
callq 0x3380
movq %rax, -0x340(%rbp)
jmp 0x3c48
movq -0x340(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x3e21
leaq 0xc655(%rip), %rsi      # 0x102b7
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x341(%rbp)
jmp 0x3c76
movb -0x341(%rbp), %al
testb $0x1, %al
jne 0x3ca9
jmp 0x3c82
leaq 0xc631(%rip), %rsi      # 0x102ba
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x342(%rbp)
jmp 0x3c9d
movb -0x342(%rbp), %al
testb $0x1, %al
jne 0x3ca9
jmp 0x3cf0
movq 0x14530(%rip), %rsi     # 0x181e0
movq 0x14319(%rip), %rdi     # 0x17fd0
callq 0x31d0
movq %rax, -0x350(%rbp)
jmp 0x3cc5
movq -0x350(%rbp), %rdi
movq 0x142e5(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x3cda
movl $0x0, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x3e42
leaq 0xc5ca(%rip), %rsi      # 0x102c1
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x351(%rbp)
jmp 0x3d0b
movb -0x351(%rbp), %al
testb $0x1, %al
jne 0x3d3e
jmp 0x3d17
leaq 0xc5a6(%rip), %rsi      # 0x102c4
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x352(%rbp)
jmp 0x3d32
movb -0x352(%rbp), %al
testb $0x1, %al
jne 0x3d3e
jmp 0x3d4a
movb $0x0, -0xb1(%rbp)
jmp 0x3e1d
leaq 0xc57d(%rip), %rsi      # 0x102ce
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x353(%rbp)
jmp 0x3d65
movb -0x353(%rbp), %al
testb $0x1, %al
jne 0x3d98
jmp 0x3d71
leaq 0xc559(%rip), %rsi      # 0x102d1
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x354(%rbp)
jmp 0x3d8c
movb -0x354(%rbp), %al
testb $0x1, %al
jne 0x3d98
jmp 0x3da1
movb $0x1, -0xb2(%rbp)
jmp 0x3e1b
leaq 0xc530(%rip), %rsi      # 0x102d8
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x355(%rbp)
jmp 0x3dbc
movb -0x355(%rbp), %al
testb $0x1, %al
jne 0x3def
jmp 0x3dc8
leaq 0xc50c(%rip), %rsi      # 0x102db
leaq -0x100(%rbp), %rdi
callq 0x8210
movb %al, -0x356(%rbp)
jmp 0x3de3
movb -0x356(%rbp), %al
testb $0x1, %al
jne 0x3def
jmp 0x3e02
movb $0x1, -0xb3(%rbp)
movl $0x2, -0x108(%rbp)
jmp 0x3e42
leaq -0xd8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x3040
jmp 0x3e17
jmp 0x3e19
jmp 0x3e1b
jmp 0x3e1d
jmp 0x3e1f
jmp 0x3e38
leaq -0xa0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x3040
jmp 0x3e36
jmp 0x3e38
movl $0x0, -0x108(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x3150
movl -0x108(%rbp), %eax
movl %eax, -0x35c(%rbp)
testl %eax, %eax
je 0x3e7d
jmp 0x3e60
movl -0x35c(%rbp), %eax
subl $0x2, %eax
je 0x3e93
jmp 0x3e6d
movl -0x35c(%rbp), %eax
subl $0x4, %eax
je 0x3e7f
jmp 0x4f4c
jmp 0x3e7f
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe0(%rbp)
jmp 0x3738
testb $0x1, -0xb3(%rbp)
je 0x4213
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x360(%rbp)
jmp 0x3eb5
movl -0x360(%rbp), %eax
cmpl $0x0, %eax
jbe 0x4024
movq 0x14105(%rip), %rdi     # 0x17fd0
leaq 0xc410(%rip), %rsi      # 0x102e2
callq 0x31d0
movq %rax, -0x368(%rbp)
jmp 0x3ee0
movq -0x368(%rbp), %rdi
movq 0x140ca(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x3ef5
movl $0x0, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
movl %eax, -0x370(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x36c(%rbp)
jmp 0x3f20
movl -0x370(%rbp), %eax
movl -0x36c(%rbp), %ecx
cmpl %ecx, %eax
jae 0x4022
movq 0x14095(%rip), %rdi     # 0x17fd0
leaq 0xc3ad(%rip), %rsi      # 0x102ef
callq 0x31d0
movq %rax, -0x378(%rbp)
jmp 0x3f50
movq -0x378(%rbp), %rdi
movl -0x10c(%rbp), %esi
callq 0x3310
movq %rax, -0x380(%rbp)
jmp 0x3f6b
movq -0x380(%rbp), %rdi
leaq 0xc3c8(%rip), %rsi      # 0x10341
callq 0x31d0
movq %rax, -0x388(%rbp)
jmp 0x3f87
movq -0x18(%rbp), %rsi
movl -0x10c(%rbp), %edx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x130(%rbp), %rdi
callq *%rax
jmp 0x3fa3
movq -0x388(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x31c0
movq %rax, -0x390(%rbp)
jmp 0x3fbf
movq -0x390(%rbp), %rdi
movq 0x13feb(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x3fd4
leaq -0x130(%rbp), %rdi
callq 0x3150
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x3eff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4f70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x3150
jmp 0x4f70
jmp 0x4057
movq 0x13fa5(%rip), %rdi     # 0x17fd0
leaq 0xc2c0(%rip), %rsi      # 0x102f2
callq 0x31d0
movq %rax, -0x398(%rbp)
jmp 0x4040
movq -0x398(%rbp), %rdi
movq 0x13f6a(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x4055
jmp 0x4057
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x39c(%rbp)
jmp 0x406c
movl -0x39c(%rbp), %eax
cmpl $0x0, %eax
jbe 0x41ca
movq 0x13f4e(%rip), %rdi     # 0x17fd0
leaq 0xc278(%rip), %rsi      # 0x10301
callq 0x31d0
movq %rax, -0x3a8(%rbp)
jmp 0x4097
movq -0x3a8(%rbp), %rdi
movq 0x13f13(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x40ac
movl $0x0, -0x134(%rbp)
movl -0x134(%rbp), %eax
movl %eax, -0x3b0(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x3ac(%rbp)
jmp 0x40d7
movl -0x3b0(%rbp), %eax
movl -0x3ac(%rbp), %ecx
cmpl %ecx, %eax
jae 0x41c8
movq 0x13ede(%rip), %rdi     # 0x17fd0
leaq 0xc1f6(%rip), %rsi      # 0x102ef
callq 0x31d0
movq %rax, -0x3b8(%rbp)
jmp 0x4107
movq -0x3b8(%rbp), %rdi
movl -0x134(%rbp), %esi
callq 0x3310
movq %rax, -0x3c0(%rbp)
jmp 0x4122
movq -0x3c0(%rbp), %rdi
leaq 0xc211(%rip), %rsi      # 0x10341
callq 0x31d0
movq %rax, -0x3c8(%rbp)
jmp 0x413e
movq -0x58(%rbp), %rsi
movl -0x134(%rbp), %edx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x158(%rbp), %rdi
callq *%rax
jmp 0x415a
movq -0x3c8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x31c0
movq %rax, -0x3d0(%rbp)
jmp 0x4176
movq -0x3d0(%rbp), %rdi
movq 0x13e34(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x418b
leaq -0x158(%rbp), %rdi
callq 0x3150
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x40b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x3150
jmp 0x4f70
jmp 0x41fd
movq 0x13dff(%rip), %rdi     # 0x17fd0
leaq 0xc137(%rip), %rsi      # 0x1030f
callq 0x31d0
movq %rax, -0x3d8(%rbp)
jmp 0x41e6
movq -0x3d8(%rbp), %rdi
movq 0x13dc4(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x41fb
jmp 0x41fd
movl $0x0, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x4f4c
movl -0xac(%rbp), %eax
decl %eax
movl %eax, -0xac(%rbp)
leaq 0xdc8(%rip), %rsi       # 0x4ff0
movq %rsi, -0x3e8(%rbp)
movl $0xf, %edi
callq 0x3260
movq -0x3e8(%rbp), %rsi
movl $0x3, %edi
callq 0x3260
movq -0x3e8(%rbp), %rsi
movl $0x2, %edi
callq 0x3260
leaq 0xc0bd(%rip), %rsi      # 0x1031f
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x3d9(%rbp)
jmp 0x4276
movb -0x3d9(%rbp), %al
testb $0x1, %al
jne 0x4285
jmp 0x471a
cmpl $0x0, -0xb0(%rbp)
jge 0x4298
movl $0x28, -0xb0(%rbp)
movq 0x13d31(%rip), %rdi     # 0x17fd0
leaq 0xc07f(%rip), %rsi      # 0x10325
callq 0x31d0
movq %rax, -0x3f0(%rbp)
jmp 0x42b4
movq -0x3f0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x31c0
movq %rax, -0x3f8(%rbp)
jmp 0x42d0
movq -0x3f8(%rbp), %rdi
movq 0x13cda(%rip), %rsi     # 0x17fb8
callq 0x3200
movq %rax, -0x400(%rbp)
jmp 0x42ec
movq -0x400(%rbp), %rdi
leaq 0xc03b(%rip), %rsi      # 0x10335
callq 0x31d0
movq %rax, -0x408(%rbp)
jmp 0x4308
movq -0x408(%rbp), %rdi
movl -0xa8(%rbp), %esi
callq 0x3310
movq %rax, -0x410(%rbp)
jmp 0x4323
movq -0x410(%rbp), %rdi
movq 0x13c87(%rip), %rsi     # 0x17fb8
callq 0x3200
movq %rax, -0x418(%rbp)
jmp 0x433f
movq -0x418(%rbp), %rdi
leaq 0xbfef(%rip), %rsi      # 0x1033c
callq 0x31d0
movq %rax, -0x420(%rbp)
jmp 0x435b
movq -0x420(%rbp), %rdi
movl -0xb0(%rbp), %esi
callq 0x3310
movq %rax, -0x428(%rbp)
jmp 0x4376
movq -0x428(%rbp), %rdi
leaq 0xbfc0(%rip), %rsi      # 0x10344
callq 0x31d0
movq %rax, -0x430(%rbp)
jmp 0x4392
movq -0x430(%rbp), %rdi
movq 0x13c18(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x43a7
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x434(%rbp)
jmp 0x43bc
movl -0x434(%rbp), %eax
movl %eax, -0x15c(%rbp)
cmpl $0x0, -0x15c(%rbp)
jne 0x4458
movq 0x13bf4(%rip), %rdi     # 0x17fd0
leaq 0xbf65(%rip), %rsi      # 0x10348
callq 0x31d0
movq %rax, -0x440(%rbp)
jmp 0x43f1
movq -0x440(%rbp), %rdi
movq 0x13bb9(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x4406
movq -0x18(%rbp), %rax
movq %rax, -0x448(%rbp)
cmpq $0x0, %rax
je 0x4424
movq -0x448(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x450(%rbp)
cmpq $0x0, %rax
je 0x4442
movq -0x450(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movl $0x0, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x4f4c
movq -0x18(%rbp), %rax
movq %rax, -0x468(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x45c(%rbp)
leaq -0x181(%rbp), %rdi
movq %rdi, -0x458(%rbp)
callq 0x3330
movq -0x458(%rbp), %rdx
leaq 0xbed1(%rip), %rsi      # 0x10361
leaq -0x180(%rbp), %rdi
callq 0x8130
jmp 0x449e
movl -0x45c(%rbp), %esi
movq -0x468(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
leaq -0x180(%rbp), %rdx
callq *%rax
jmp 0x44bc
leaq -0x180(%rbp), %rdi
callq 0x3150
leaq -0x181(%rbp), %rdi
callq 0x3220
movq 0x13af5(%rip), %rdi     # 0x17fd0
leaq 0xbe8c(%rip), %rsi      # 0x1036e
callq 0x31d0
movq %rax, -0x470(%rbp)
jmp 0x44f0
movq -0x18(%rbp), %rsi
movl -0xa8(%rbp), %edx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x1a8(%rbp), %rdi
callq *%rax
jmp 0x450c
movq -0x470(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x31c0
movq %rax, -0x478(%rbp)
jmp 0x4528
movq -0x478(%rbp), %rdi
movq 0x13a82(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x453d
leaq -0x1a8(%rbp), %rdi
callq 0x3150
movq -0x18(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
movl %ecx, %edx
callq 0x8240
jmp 0x455a
movq 0x13a6f(%rip), %rdi     # 0x17fd0
leaq 0xbe0e(%rip), %rsi      # 0x10376
callq 0x31d0
movq %rax, -0x480(%rbp)
jmp 0x4576
movq -0x480(%rbp), %rdi
movq 0x13a34(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x458b
movq 0x13a3e(%rip), %rdi     # 0x17fd0
leaq 0xbde8(%rip), %rsi      # 0x10381
callq 0x31d0
movq %rax, -0x488(%rbp)
jmp 0x45a7
movq -0x488(%rbp), %rdi
movq 0x13a03(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x45bc
movq 0xc2ad(%rip), %rax      # 0x10870
movq %rax, -0x1b0(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x82a0
cmpl $0x0, 0x13bfb(%rip)     # 0x181d8
je 0x46c9
movq -0x18(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x82c0
movsd %xmm0, -0x490(%rbp)
jmp 0x45fd
movsd -0x490(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4615
jp 0x4615
jmp 0x46b6
movzbl -0xb2(%rbp), %edx
movzbl -0xb1(%rbp), %esi
andl $0x1, %esi
andl $0x1, %edx
leaq -0x1c8(%rbp), %rdi
callq 0x5010
jmp 0x4637
leaq -0x1c8(%rbp), %rdi
callq 0x82f0
jmp 0x46b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x466b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x3150
leaq -0x181(%rbp), %rdi
callq 0x3220
jmp 0x4f70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x3150
jmp 0x4f70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x83c0
jmp 0x4f70
leaq -0x1b0(%rbp), %rdi
callq 0x8310
jmp 0x46c4
jmp 0x45d6
movq 0x13900(%rip), %rdi     # 0x17fd0
leaq 0xbcbc(%rip), %rsi      # 0x10393
callq 0x31d0
movq %rax, -0x498(%rbp)
jmp 0x46e5
movq -0x498(%rbp), %rdi
movq 0x138c5(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x46fa
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x4709
leaq -0x1c8(%rbp), %rdi
callq 0x83c0
jmp 0x4eff
leaq -0x1e0(%rbp), %rdi
callq 0x8420
cmpl $0x0, -0xb0(%rbp)
jge 0x4739
movl $0x1f4, -0xb0(%rbp)     # imm = 0x1F4
movq 0x13890(%rip), %rdi     # 0x17fd0
leaq 0xbbde(%rip), %rsi      # 0x10325
callq 0x31d0
movq %rax, -0x4a0(%rbp)
jmp 0x4755
movq -0x4a0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x31c0
movq %rax, -0x4a8(%rbp)
jmp 0x4771
movq -0x4a8(%rbp), %rdi
movq 0x13839(%rip), %rsi     # 0x17fb8
callq 0x3200
movq %rax, -0x4b0(%rbp)
jmp 0x478d
movq -0x4b0(%rbp), %rdi
leaq 0xbb9a(%rip), %rsi      # 0x10335
callq 0x31d0
movq %rax, -0x4b8(%rbp)
jmp 0x47a9
movq -0x4b8(%rbp), %rdi
movl -0xa8(%rbp), %esi
callq 0x3310
movq %rax, -0x4c0(%rbp)
jmp 0x47c4
movq -0x4c0(%rbp), %rdi
movq 0x137e6(%rip), %rsi     # 0x17fb8
callq 0x3200
movq %rax, -0x4c8(%rbp)
jmp 0x47e0
movq -0x4c8(%rbp), %rdi
leaq 0xbbb7(%rip), %rsi      # 0x103a5
callq 0x31d0
movq %rax, -0x4d0(%rbp)
jmp 0x47fc
movq -0x4d0(%rbp), %rdi
movl -0xac(%rbp), %esi
callq 0x3310
movq %rax, -0x4d8(%rbp)
jmp 0x4817
movq -0x4d8(%rbp), %rdi
movq 0x13793(%rip), %rsi     # 0x17fb8
callq 0x3200
movq %rax, -0x4e0(%rbp)
jmp 0x4833
movq -0x4e0(%rbp), %rdi
leaq 0xbafb(%rip), %rsi      # 0x1033c
callq 0x31d0
movq %rax, -0x4e8(%rbp)
jmp 0x484f
movq -0x4e8(%rbp), %rdi
movl -0xb0(%rbp), %esi
callq 0x3310
movq %rax, -0x4f0(%rbp)
jmp 0x486a
movq -0x4f0(%rbp), %rdi
leaq 0xbacc(%rip), %rsi      # 0x10344
callq 0x31d0
movq %rax, -0x4f8(%rbp)
jmp 0x4886
movq -0x4f8(%rbp), %rdi
movq 0x13724(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x489b
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x4fc(%rbp)
jmp 0x48b0
movl -0x4fc(%rbp), %eax
movl %eax, -0x1e4(%rbp)
cmpl $0x0, -0x1e4(%rbp)
jne 0x495d
movq 0x13700(%rip), %rdi     # 0x17fd0
leaq 0xbad8(%rip), %rsi      # 0x103af
callq 0x31d0
movq %rax, -0x508(%rbp)
jmp 0x48e5
movq -0x508(%rbp), %rdi
movq 0x136c5(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x48fa
movq -0x18(%rbp), %rax
movq %rax, -0x510(%rbp)
cmpq $0x0, %rax
je 0x4918
movq -0x510(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x518(%rbp)
cmpq $0x0, %rax
je 0x4936
movq -0x518(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movl $0x0, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x4ed7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4ef1
movq -0x58(%rbp), %rax
movq %rax, -0x530(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x524(%rbp)
leaq -0x209(%rbp), %rdi
movq %rdi, -0x520(%rbp)
callq 0x3330
movq -0x520(%rbp), %rdx
leaq 0xba34(%rip), %rsi      # 0x103c9
leaq -0x208(%rbp), %rdi
callq 0x8130
jmp 0x49a3
movl -0x524(%rbp), %esi
movq -0x530(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
leaq -0x208(%rbp), %rdx
callq *%rax
jmp 0x49c1
leaq -0x208(%rbp), %rdi
callq 0x3150
leaq -0x209(%rbp), %rdi
callq 0x3220
movq 0x135f0(%rip), %rdi     # 0x17fd0
leaq 0xb987(%rip), %rsi      # 0x1036e
callq 0x31d0
movq %rax, -0x538(%rbp)
jmp 0x49f5
movq -0x58(%rbp), %rsi
movl -0xa8(%rbp), %edx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x230(%rbp), %rdi
callq *%rax
jmp 0x4a11
movq -0x538(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x31c0
movq %rax, -0x540(%rbp)
jmp 0x4a2d
movq -0x540(%rbp), %rdi
movq 0x1357d(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x4a42
leaq -0x230(%rbp), %rdi
callq 0x3150
leaq 0xb7e3(%rip), %rsi      # 0x10238
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x541(%rbp)
jmp 0x4a69
movb -0x541(%rbp), %al
andb $0x1, %al
movb %al, -0x231(%rbp)
movb $0x0, -0x232(%rbp)
testb $0x1, -0x231(%rbp)
jne 0x4aae
leaq 0xb7f0(%rip), %rsi      # 0x1027e
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x542(%rbp)
jmp 0x4aa2
movb -0x542(%rbp), %al
testb $0x1, %al
jne 0x4aae
jmp 0x4b1f
movl -0xac(%rbp), %esi
leaq -0x1e0(%rbp), %rdi
callq 0x51a0
jmp 0x4ac2
movb $0x1, -0x232(%rbp)
jmp 0x4b1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4af1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x3150
leaq -0x209(%rbp), %rdi
callq 0x3220
jmp 0x4ef1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x3150
jmp 0x4ef1
testb $0x1, -0x231(%rbp)
jne 0x4b4f
leaq 0xb8a8(%rip), %rsi      # 0x103d7
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x543(%rbp)
jmp 0x4b43
movb -0x543(%rbp), %al
testb $0x1, %al
jne 0x4b4f
jmp 0x4b6a
movl -0xac(%rbp), %esi
leaq -0x1e0(%rbp), %rdi
callq 0x57d0
jmp 0x4b63
movb $0x1, -0x232(%rbp)
testb $0x1, -0x231(%rbp)
jne 0x4b9a
leaq 0xb864(%rip), %rsi      # 0x103de
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x544(%rbp)
jmp 0x4b8e
movb -0x544(%rbp), %al
testb $0x1, %al
jne 0x4b9a
jmp 0x4bb5
movl -0xac(%rbp), %esi
leaq -0x1e0(%rbp), %rdi
callq 0x60e0
jmp 0x4bae
movb $0x1, -0x232(%rbp)
testb $0x1, -0x231(%rbp)
jne 0x4be5
leaq 0xb822(%rip), %rsi      # 0x103e7
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x545(%rbp)
jmp 0x4bd9
movb -0x545(%rbp), %al
testb $0x1, %al
jne 0x4be5
jmp 0x4c00
movl -0xac(%rbp), %esi
leaq -0x1e0(%rbp), %rdi
callq 0x6600
jmp 0x4bf9
movb $0x1, -0x232(%rbp)
testb $0x1, -0x231(%rbp)
jne 0x4c30
leaq 0xb7df(%rip), %rsi      # 0x103ef
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x546(%rbp)
jmp 0x4c24
movb -0x546(%rbp), %al
testb $0x1, %al
jne 0x4c30
jmp 0x4c4b
movl -0xac(%rbp), %esi
leaq -0x1e0(%rbp), %rdi
callq 0x7020
jmp 0x4c44
movb $0x1, -0x232(%rbp)
testb $0x1, -0x231(%rbp)
jne 0x4c7b
leaq 0xb79a(%rip), %rsi      # 0x103f5
leaq -0xa0(%rbp), %rdi
callq 0x8210
movb %al, -0x547(%rbp)
jmp 0x4c6f
movb -0x547(%rbp), %al
testb $0x1, %al
jne 0x4c7b
jmp 0x4c90
leaq -0x1e0(%rbp), %rdi
callq 0x7340
jmp 0x4c89
movb $0x1, -0x232(%rbp)
testb $0x1, -0x232(%rbp)
jne 0x4cfc
movq 0x13330(%rip), %rdi     # 0x17fd0
leaq 0xb757(%rip), %rsi      # 0x103fe
callq 0x31d0
movq %rax, -0x550(%rbp)
jmp 0x4cb5
movq -0x550(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x31c0
movq %rax, -0x558(%rbp)
jmp 0x4cd1
movq -0x558(%rbp), %rdi
movq 0x132d9(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x4ce6
movl $0x1, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
jmp 0x4ed7
leaq -0x240(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x8440
jmp 0x4d11
leaq -0x1e0(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rdi
callq 0x8460
movq %rax, -0x250(%rbp)
movq -0x248(%rbp), %rdi
callq 0x8490
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x84c0
testb $0x1, %al
jne 0x4d61
jmp 0x4ebe
leaq -0x250(%rbp), %rdi
callq 0x8500
movq %rax, -0x260(%rbp)
cmpl $0x0, 0x1345d(%rip)     # 0x181d8
jne 0x4d82
jmp 0x4ebe
movq -0x260(%rbp), %rsi
movq 0x13240(%rip), %rdi     # 0x17fd0
callq 0x31c0
movq %rax, -0x560(%rbp)
jmp 0x4d9e
movq -0x560(%rbp), %rdi
leaq 0xb5cf(%rip), %rsi      # 0x1037b
callq 0x31d0
movq %rax, -0x568(%rbp)
jmp 0x4dba
movq -0x568(%rbp), %rdi
movq 0x131f0(%rip), %rsi     # 0x17fb8
callq 0x3200
jmp 0x4dcf
movq -0x260(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x268(%rbp)
movq -0x268(%rbp), %rdi
callq 0x8520
movq %rax, -0x270(%rbp)
movq -0x268(%rbp), %rdi
callq 0x8550
movq %rax, -0x278(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x8580
testb $0x1, %al
jne 0x4e23
jmp 0x4eab
leaq -0x270(%rbp), %rdi
callq 0x85c0
movq %rax, -0x280(%rbp)
cmpl $0x0, 0x1339b(%rip)     # 0x181d8
jne 0x4e41
jmp 0x4eab
movq 0x13188(%rip), %rdi     # 0x17fd0
leaq 0xb5be(%rip), %rsi      # 0x1040d
callq 0x31d0
jmp 0x4e56
movq -0x280(%rbp), %rdi
movzbl -0xb2(%rbp), %edx
movzbl -0xb1(%rbp), %esi
andl $0x1, %esi
andl $0x1, %edx
callq 0x5010
jmp 0x4e78
movq -0x58(%rbp), %rdi
movq -0x280(%rbp), %rsi
callq 0x85e0
jmp 0x4e8a
leaq -0x240(%rbp), %rdi
callq 0x8310
jmp 0x4e98
jmp 0x4e9a
leaq -0x270(%rbp), %rdi
callq 0x8610
jmp 0x4e07
jmp 0x4ead
leaq -0x250(%rbp), %rdi
callq 0x8630
jmp 0x4d45
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x4ecd
movl $0x0, -0x108(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x8650
movl -0x108(%rbp), %eax
testl %eax, %eax
jne 0x4f4c
jmp 0x4eef
jmp 0x4eff
leaq -0x1e0(%rbp), %rdi
callq 0x8650
jmp 0x4f70
movq -0x18(%rbp), %rax
movq %rax, -0x570(%rbp)
cmpq $0x0, %rax
je 0x4f1d
movq -0x570(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x578(%rbp)
cmpq $0x0, %rax
je 0x4f3b
movq -0x578(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movl $0x0, -0x4(%rbp)
movl $0x1, -0x108(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3150
leaq -0xa0(%rbp), %rdi
callq 0x3150
movl -0x4(%rbp), %eax
addq $0x580, %rsp            # imm = 0x580
popq %rbp
retq
leaq -0xd8(%rbp), %rdi
callq 0x3150
leaq -0xa0(%rbp), %rdi
callq 0x3150
movq -0x48(%rbp), %rdi
callq 0x3320
nopw %cs:(%rax,%rax)