// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %r12
movl %edi, %ebp
pushq $0x10
popq %rdi
callq 0x3180
movq %rax, %rbx
leaq 0x3c5f(%rip), %rsi      # 0x709b
leaq 0x118(%rsp), %rdi
leaq 0x78(%rsp), %rdx
movq %rax, (%rsp)
callq 0x510a
leaq 0x118(%rsp), %rdx
pushq $0x64
popq %rcx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5d1e
leaq 0x118(%rsp), %rdi
callq 0x30b0
pushq $0x10
popq %rdi
callq 0x3180
movq %rax, %r14
leaq 0x3c29(%rip), %rsi      # 0x70af
leaq 0xf8(%rsp), %rdi
leaq 0x78(%rsp), %rdx
movq %rax, 0x8(%rsp)
callq 0x510a
leaq 0xf8(%rsp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x5f64
leaq 0xf8(%rsp), %rdi
callq 0x30b0
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xccb(%rip), %rbx       # 0x4195
movq %rbx, %rsi
xorl %edx, %edx
callq *0x30(%rax)
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq *0x30(%rax)
leaq 0x3bdd(%rip), %rsi      # 0x70c4
leaq 0x78(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x510a
leaq 0x4252(%rip), %rsi      # 0x7752
leaq 0x98(%rsp), %r15
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
callq 0x510a
movslq %ebp, %rax
movq %rax, 0x50(%rsp)
movl $0x0, 0x10(%rsp)
pushq $0x1
popq %rax
movl %eax, 0x5c(%rsp)
movb $0x1, %al
movl %eax, 0x14(%rsp)
pushq $-0x1
popq %rax
movl %eax, 0x1c(%rsp)
pushq $0x1
popq %rbp
leaq 0x20(%rsp), %r13
leaq 0x60(%rsp), %rbx
movl $0x0, 0x48(%rsp)
cmpq 0x50(%rsp), %rbp
jge 0x3772
movq (%r12,%rbp,8), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x510a
movq %r15, %rdi
leaq 0x41e0(%rip), %rsi      # 0x7752
callq 0x5145
movq 0x20(%rsp), %rcx
movb (%rcx), %cl
testb %al, %al
je 0x35e6
cmpb $0x2d, %cl
je 0x3b3e
movq %r13, %rdi
callq 0x33fc
testb %al, %al
je 0x3b8a
movq %r15, %rdi
leaq 0x3b56(%rip), %rsi      # 0x70fb
callq 0x514f
testb %al, %al
jne 0x35c5
movq %r15, %rdi
leaq 0x3b46(%rip), %rsi      # 0x70fe
callq 0x514f
testb %al, %al
je 0x3648
movq (%r12,%rbp,8), %rdi
callq 0x3210
movl %eax, 0x48(%rsp)
movq %r15, %rdi
leaq 0x4176(%rip), %rsi      # 0x7752
callq 0x3290
jmp 0x3762
movq %rbx, %r14
leaq 0x78(%rsp), %rdi
cmpb $0x2d, %cl
jne 0x3757
movq %r13, %rdi
leaq 0x3b42(%rip), %rsi      # 0x7143
callq 0x514f
testb %al, %al
jne 0x3b63
movq %r13, %rdi
leaq 0x3b2e(%rip), %rsi      # 0x7146
callq 0x514f
testb %al, %al
jne 0x3b63
movq %r13, %rdi
leaq 0x3b1e(%rip), %rsi      # 0x714d
callq 0x514f
testb %al, %al
je 0x368c
movl $0x0, 0x14(%rsp)
movq %r14, %rbx
jmp 0x3762
movq %r15, %rdi
leaq 0x3ab3(%rip), %rsi      # 0x7105
callq 0x514f
testb %al, %al
jne 0x366e
movq %r15, %rdi
leaq 0x3aa3(%rip), %rsi      # 0x7108
callq 0x514f
testb %al, %al
je 0x36e0
movq (%r12,%rbp,8), %rdi
callq 0x3210
movl %eax, 0x5c(%rsp)
addl $-0x11, %eax
cmpl $-0x11, %eax
ja 0x35d2
jmp 0x3e00
movq %r13, %rdi
leaq 0x3aba(%rip), %rsi      # 0x7150
callq 0x514f
testb %al, %al
movq %r14, %rbx
je 0x36af
movl $0x0, 0x14(%rsp)
jmp 0x3762
movq %r13, %rdi
leaq 0x3aa1(%rip), %rsi      # 0x715a
callq 0x514f
testb %al, %al
jne 0x36d5
movq %r13, %rdi
leaq 0x3a91(%rip), %rsi      # 0x715d
callq 0x514f
testb %al, %al
je 0x371c
movb $0x1, %al
movl %eax, 0x10(%rsp)
jmp 0x3762
movq %r15, %rdi
leaq 0x3a3d(%rip), %rsi      # 0x7127
callq 0x514f
testb %al, %al
jne 0x370a
movq %r15, %rdi
leaq 0x3a2d(%rip), %rsi      # 0x712a
callq 0x514f
testb %al, %al
je 0x4065
movq (%r12,%rbp,8), %rdi
callq 0x3210
movl %eax, 0x1c(%rsp)
jmp 0x35d2
movq %r13, %rdi
leaq 0x3a3e(%rip), %rsi      # 0x7164
callq 0x514f
movl $0x0, 0x18(%rsp)
testb %al, %al
jne 0x405e
movq %r13, %rdi
leaq 0x3a22(%rip), %rsi      # 0x7167
callq 0x514f
movq %r15, %rdi
testb %al, %al
movb $0x1, %bl
jne 0x3bc9
movq %r13, %rsi
callq 0x30f0
movq %r14, %rbx
movq %r13, %rdi
callq 0x30b0
incq %rbp
jmp 0x354e
leaq 0xa4e(%rip), %rbx       # 0x41c7
pushq $0xf
popq %rdi
movq %rbx, %rsi
callq 0x31b0
pushq $0x3
popq %rdi
movq %rbx, %rsi
callq 0x31b0
pushq $0x2
popq %rdi
movq %rbx, %rsi
callq 0x31b0
leaq 0x3a0a(%rip), %rsi      # 0x71ab
leaq 0x78(%rsp), %rdi
callq 0x514f
testb %al, %al
je 0x3995
movl 0x1c(%rsp), %eax
testl %eax, %eax
pushq $0x28
popq %rbx
cmovnsl %eax, %ebx
movq 0x880a(%rip), %rdi      # 0xbfd0
leaq 0x39e4(%rip), %rsi      # 0x71b1
callq 0x3170
movl 0x48(%rsp), %ebp
leaq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
leaq 0x39cf(%rip), %rsi      # 0x71c1
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
movl %ebp, %esi
callq 0x3250
movq %rax, %rdi
callq 0x30c0
leaq 0x39b5(%rip), %rsi      # 0x71c8
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
movl %ebx, %esi
callq 0x3250
leaq 0x39a4(%rip), %rsi      # 0x71d0
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
callq 0x30c0
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testl %eax, %eax
je 0x3da7
leaq 0x3998(%rip), %rsi      # 0x71ed
leaq 0xd8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x510a
movq (%rsp), %rdi
movq (%rdi), %rax
leaq 0xd8(%rsp), %rdx
movl %ebp, %esi
callq *(%rax)
leaq 0xd8(%rsp), %rdi
callq 0x30b0
movq 0x8742(%rip), %rdi      # 0xbfd0
leaq 0x3965(%rip), %rsi      # 0x71fa
callq 0x3170
movq %rax, %rbx
movq (%rsp), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
movl %ebp, %edx
callq *0x18(%rax)
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
leaq 0x20(%rsp), %rdi
callq 0x30b0
movq (%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x48(%rax)
movq 0x86e8(%rip), %rdi      # 0xbfd0
leaq 0x3913(%rip), %rsi      # 0x7202
callq 0x3170
movq %rax, %rdi
callq 0x30c0
movq 0x86cd(%rip), %rdi      # 0xbfd0
leaq 0x3903(%rip), %rsi      # 0x720d
callq 0x3170
movq %rax, %rdi
callq 0x30c0
leaq 0x60(%rsp), %rbx
movq $0x14, (%rbx)
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %r14
movapd %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movzbl 0x14(%rsp), %ebp
andl $0x1, %ebp
movzbl 0x10(%rsp), %r15d
andl $0x1, %r15d
cmpl $0x0, 0x8819(%rip)      # 0xc168
je 0x3c8b
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x515c
ucomisd 0x369f(%rip), %xmm0     # 0x7008
jne 0x396d
jnp 0x398b
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x41cf
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x398b
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
callq 0x5165
jmp 0x3948
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
movl 0x1c(%rsp), %eax
testl %eax, %eax
movl $0x1f4, %r12d           # imm = 0x1F4
cmovnsl %eax, %r12d
movq 0x8614(%rip), %rdi      # 0xbfd0
leaq 0x37ee(%rip), %rsi      # 0x71b1
callq 0x3170
movl 0x5c(%rsp), %r14d
movl 0x48(%rsp), %ebp
leaq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
leaq 0x37d4(%rip), %rsi      # 0x71c1
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
movl %ebp, %esi
callq 0x3250
movq %rax, %rdi
callq 0x30c0
leaq 0x3823(%rip), %rsi      # 0x7231
movq %rax, %rdi
callq 0x3170
decl %r14d
movq %rax, %rdi
movl %r14d, %esi
callq 0x3250
movq %rax, %rdi
callq 0x30c0
leaq 0x3795(%rip), %rsi      # 0x71c8
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
movl %r12d, %esi
callq 0x3250
leaq 0x3783(%rip), %rsi      # 0x71d0
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
callq 0x30c0
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testl %eax, %eax
je 0x3dc7
leaq 0x37de(%rip), %rsi      # 0x7255
leaq 0xb8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x510a
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
leaq 0xb8(%rsp), %rdx
movl %ebp, %esi
callq *(%rax)
leaq 0xb8(%rsp), %rdi
callq 0x30b0
movq 0x851f(%rip), %rdi      # 0xbfd0
leaq 0x3742(%rip), %rsi      # 0x71fa
callq 0x3170
movq %rax, %rbx
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
movl %ebp, %edx
callq *0x18(%rax)
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
leaq 0x20(%rsp), %rdi
callq 0x30b0
leaq 0x35cc(%rip), %rsi      # 0x70c4
leaq 0x78(%rsp), %rdi
callq 0x514f
movl %eax, %ebp
testb %al, %al
jne 0x3b21
leaq 0x35fb(%rip), %rsi      # 0x710a
leaq 0x78(%rsp), %rdi
callq 0x514f
testb %al, %al
je 0x3e20
leaq 0x60(%rsp), %rdi
movl %r14d, %esi
callq 0x42e7
movb $0x1, %bl
testb %bpl, %bpl
je 0x3e22
jmp 0x3e37
movq 0x848b(%rip), %rdi      # 0xbfd0
leaq 0x98(%rsp), %rsi
callq 0x3160
leaq 0x356f(%rip), %rsi      # 0x70c8
movq %rax, %rdi
callq 0x3170
jmp 0x3bb8
movq 0x8466(%rip), %rdi      # 0xbfd0
leaq 0x37f7(%rip), %rsi      # 0x7368
callq 0x3170
xorl %ebx, %ebx
movq %rax, %rdi
callq 0x30c0
movl $0x0, 0x18(%rsp)
jmp 0x3bc9
movq 0x843f(%rip), %rdi      # 0xbfd0
leaq 0x98(%rsp), %rsi
callq 0x3160
leaq 0x3534(%rip), %rsi      # 0x70d9
movq %rax, %rdi
callq 0x3170
movq %rax, %rdi
movq %r13, %rsi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
pushq $0x1
popq %rax
movl %eax, 0x18(%rsp)
xorl %ebx, %ebx
leaq 0x20(%rsp), %rdi
callq 0x30b0
testb %bl, %bl
movl 0x18(%rsp), %ebx
je 0x3ff9
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testl %eax, %eax
je 0x3cbf
movq 0x83d8(%rip), %rdi      # 0xbfd0
leaq 0x356f(%rip), %rsi      # 0x716e
callq 0x3170
movq %rax, %rdi
callq 0x30c0
xorl %ebx, %ebx
movq 0x83bb(%rip), %r14      # 0xbfd0
leaq 0x355f(%rip), %r15      # 0x717b
leaq 0x35aa(%rip), %r12      # 0x71cd
leaq 0x20(%rsp), %r13
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
cmpl %eax, %ebx
jae 0x3cda
movq %r14, %rdi
movq %r15, %rsi
callq 0x3170
movq %rax, %rdi
movl %ebx, %esi
callq 0x3250
movq %rax, %rdi
movq %r12, %rsi
callq 0x3170
movq %rax, %rbp
movq (%rsp), %rsi
movq (%rsi), %rax
movq %r13, %rdi
movl %ebx, %edx
callq *0x18(%rax)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
movq %r13, %rdi
callq 0x30b0
incl %ebx
jmp 0x3c28
movq 0x833e(%rip), %rdi      # 0xbfd0
leaq 0x3586(%rip), %rsi      # 0x721f
callq 0x3170
movq %rax, %rdi
callq 0x30c0
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
leaq 0x20(%rsp), %rdi
callq 0x52e4
jmp 0x3fe2
movq 0x830a(%rip), %rdi      # 0xbfd0
leaq 0x34b1(%rip), %rsi      # 0x717e
callq 0x3170
movq %rax, %rdi
callq 0x30c0
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testl %eax, %eax
je 0x3d87
movq 0x82dd(%rip), %rdi      # 0xbfd0
leaq 0x3493(%rip), %rsi      # 0x718d
callq 0x3170
movq %rax, %rdi
callq 0x30c0
xorl %ebx, %ebx
movq 0x82c0(%rip), %r14      # 0xbfd0
leaq 0x3464(%rip), %r15      # 0x717b
leaq 0x34af(%rip), %r12      # 0x71cd
leaq 0x20(%rsp), %r13
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
cmpl %eax, %ebx
jae 0x3ff7
movq %r14, %rdi
movq %r15, %rsi
callq 0x3170
movq %rax, %rdi
movl %ebx, %esi
callq 0x3250
movq %rax, %rdi
movq %r12, %rsi
callq 0x3170
movq %rax, %rbp
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
movq %r13, %rdi
movl %ebx, %edx
callq *0x18(%rax)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
movq %r13, %rdi
callq 0x30b0
incl %ebx
jmp 0x3d23
movq 0x8242(%rip), %rdi      # 0xbfd0
leaq 0x3406(%rip), %rsi      # 0x719b
callq 0x3170
movq %rax, %rdi
callq 0x30c0
jmp 0x3ff7
movq 0x8222(%rip), %rdi      # 0xbfd0
leaq 0x341f(%rip), %rsi      # 0x71d4
callq 0x3170
movq %rax, %rdi
callq 0x30c0
jmp 0x3fe2
movq 0x8202(%rip), %rdi      # 0xbfd0
leaq 0x3466(%rip), %rsi      # 0x723b
callq 0x3170
movq %rax, %rdi
callq 0x30c0
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
xorl %ebp, %ebp
xorl %ebx, %ebx
jmp 0x3fd3
movq 0x81c9(%rip), %rdi      # 0xbfd0
leaq 0x98(%rsp), %rsi
callq 0x3160
leaq 0x32f7(%rip), %rsi      # 0x7112
jmp 0x3b59
xorl %ebx, %ebx
leaq 0x343a(%rip), %rsi      # 0x7263
leaq 0x78(%rsp), %rdi
callq 0x514f
testb %al, %al
je 0x3e48
leaq 0x60(%rsp), %rdi
callq 0x4504
movb $0x1, %bl
testb %bpl, %bpl
jne 0x3e5d
leaq 0x341b(%rip), %rsi      # 0x726a
leaq 0x78(%rsp), %rdi
callq 0x514f
testb %al, %al
je 0x3e6e
leaq 0x60(%rsp), %rdi
callq 0x47b3
movb $0x1, %bl
testb %bpl, %bpl
jne 0x3e83
leaq 0x33fe(%rip), %rsi      # 0x7273
leaq 0x78(%rsp), %rdi
callq 0x514f
testb %al, %al
je 0x3e97
leaq 0x60(%rsp), %rdi
movl %r14d, %esi
callq 0x4963
movb $0x1, %bl
testb %bpl, %bpl
jne 0x3eac
leaq 0x33dd(%rip), %rsi      # 0x727b
leaq 0x78(%rsp), %rdi
callq 0x514f
testb %al, %al
je 0x3ec0
leaq 0x60(%rsp), %rdi
movl %r14d, %esi
callq 0x4c58
movb $0x1, %bl
testb %bpl, %bpl
jne 0x3ed9
leaq 0x33ba(%rip), %rsi      # 0x7281
leaq 0x78(%rsp), %rdi
callq 0x514f
testb %al, %al
je 0x4024
leaq 0x60(%rsp), %rdi
callq 0x4d7c
movl %r12d, %eax
leaq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0x8265(%rip), %eax      # 0xc168
movq 0x80c6(%rip), %r13      # 0xbfd0
leaq 0x3388(%rip), %rbp      # 0x7299
movzbl 0x14(%rsp), %ebx
andl $0x1, %ebx
movzbl 0x10(%rsp), %r14d
andl $0x1, %r14d
movq %rcx, 0x50(%rsp)
cmpq 0x48(%rsp), %rcx
je 0x3fc3
testl %eax, %eax
je 0x3fc3
movq %r13, %rdi
movq 0x50(%rsp), %rsi
callq 0x3160
movq %rax, %rdi
leaq 0x32b5(%rip), %rsi      # 0x7207
callq 0x3170
movq %rax, %rdi
callq 0x30c0
movq 0x50(%rsp), %rax
movq 0x20(%rax), %r12
movq 0x28(%rax), %r15
movl 0x81f6(%rip), %eax      # 0xc168
cmpq %r15, %r12
je 0x3fb5
testl %eax, %eax
je 0x3fb5
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3170
movq %r12, %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x41cf
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x48(%rax)
leaq 0x20(%rsp), %rdi
callq 0x5165
addq $0x18, %r12
jmp 0x3f6c
movq 0x50(%rsp), %rcx
addq $0x38, %rcx
jmp 0x3f23
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
xorl %ebx, %ebx
movb $0x1, %bpl
leaq 0x60(%rsp), %rdi
callq 0x51ba
testb %bpl, %bpl
je 0x3ff9
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
xorl %ebx, %ebx
leaq 0x98(%rsp), %rdi
callq 0x30b0
leaq 0x78(%rsp), %rdi
callq 0x30b0
movl %ebx, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %bl, %bl
jne 0x3ee3
movq 0x7f9d(%rip), %rdi      # 0xbfd0
leaq 0x3250(%rip), %rsi      # 0x728a
callq 0x3170
leaq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x3160
movq %rax, %rdi
callq 0x30c0
pushq $0x1
popq %rbx
xorl %ebp, %ebp
jmp 0x3fd3
movb $0x1, %bl
jmp 0x3bc9
movq 0x7f64(%rip), %rdi      # 0xbfd0
leaq 0x30bf(%rip), %rsi      # 0x7132
callq 0x3170
leaq 0x98(%rsp), %r13
jmp 0x3bad
jmp 0x4169
jmp 0x4169
movq %rax, %r15
leaq 0xb8(%rsp), %rdi
jmp 0x40c3
jmp 0x4169
jmp 0x4164
movq %rax, %r15
leaq 0xd8(%rsp), %rdi
jmp 0x415b
jmp 0x4164
movq %rax, %r15
leaq 0x20(%rsp), %rdi
callq 0x30b0
jmp 0x416c
jmp 0x4153
jmp 0x413e
jmp 0x4169
jmp 0x4169
movq %rax, %r15
jmp 0x4183
movq %rax, %r15
jmp 0x418d
movq %rax, %r15
leaq 0xf8(%rsp), %rdi
callq 0x30b0
jmp 0x4103
movq %rax, %r15
pushq $0x10
popq %rsi
movq 0x8(%rsp), %rdi
jmp 0x4129
movq %rax, %r15
leaq 0x118(%rsp), %rdi
callq 0x30b0
jmp 0x4122
movq %rax, %r15
pushq $0x10
popq %rsi
movq (%rsp), %rdi
callq 0x3190
jmp 0x418d
jmp 0x4164
jmp 0x4153
jmp 0x4169
jmp 0x4164
jmp 0x4164
jmp 0x4164
jmp 0x4169
movq %rax, %r15
leaq 0x20(%rsp), %rdi
callq 0x52e4
jmp 0x4176
jmp 0x4153
jmp 0x4153
jmp 0x4164
movq %rax, %r15
leaq 0x20(%rsp), %rdi
callq 0x30b0
jmp 0x4176
jmp 0x4164
movq %rax, %r15
jmp 0x4176
movq %rax, %r15
leaq 0x60(%rsp), %rdi
callq 0x51ba
leaq 0x98(%rsp), %rdi
callq 0x30b0
leaq 0x78(%rsp), %rdi
callq 0x30b0
movq %r15, %rdi
callq 0x3260