// File: /workspace/github_cpp_makefile_star2_O2/sun98[P]Mini-DFS/namenode.cpp
// Function: NameServer::operator()()
void NameServer::operator()()
{
    while (true)
    {
        std::vector<std::string> parameters = parse_cmd();
        std::vector<int> idx;
        std::ifstream is;
        char *buf = nullptr;
        // md5 checksum for replicate chunks;
        MD5 md5;
        if (parameters.empty())
        {
            std::cerr << "input a blank line" << std::endl;
            continue;
        }
        if (parameters[0] == "quit" || parameters[0] == "exit")
        {
            exit(0);
        }
        // list all the files in name server.
        else if (parameters[0] == "ls")
        {
            if (parameters.size() != 1)
            {
                std::cerr << "Usage: "
                          << "ls (list all files in name server)" << std::endl;
            }
            else
            {
                std::cout << "File ID\tChunk Num\tFile Name" << std::endl;
                fileTree_.list(meta);
            }
            continue;
        }
        // upload file to miniDFS
        else if (parameters[0] == "up")
        {
            if (parameters.size() != 3)
            {
                std::cerr << "Usage: "
                          << "up src dest" << std::endl;
                continue;
            }
            is.open(parameters[1], std::ifstream::ate | std::ifstream::binary);
            if (!is)
            {
                std::cerr << "Failed in opening src file: file " << parameters[1] << std::endl;
                continue;
            }
            else if (!fileTree_.insert_node(parameters[2], true))
            {
                std::cerr << "Failed in creating dest file.\nPlease ensure File: " << parameters[2] << " does not exist" << std::endl;
                continue;
            }
            else
            {
                int totalSize = is.tellg();
                buf = new char[totalSize];
                is.seekg(0, is.beg);
                is.read(buf, totalSize);
                std::vector<double> serverSize;
                for (const auto &server : dataServers_)
                    serverSize.push_back(server->size());
                idx = argsort<double>(serverSize);
                // std::cout << "total size " << totalSize << std::endl;
                ++idCnt_;
                for (int i = 0; i < numReplicate_; ++i)
                {
                    std::unique_lock<std::mutex> lk(dataServers_[idx[i]]->mtx);
                    meta[parameters[2]] = std::make_pair(idCnt_, totalSize);
                    dataServers_[idx[i]]->cmd = "up";
                    dataServers_[idx[i]]->fid = idCnt_;
                    dataServers_[idx[i]]->bufSize = totalSize;
                    dataServers_[idx[i]]->buf = buf;
                    dataServers_[idx[i]]->finish = false;
                    lk.unlock();
                    dataServers_[idx[i]]->cv.notify_all();
                }
            }
        }
        // fetch file from miniDFS
        else if (parameters[0] == "down" || parameters[0] == "down_id")
        {
            if (parameters.size() != 3 && parameters.size() != 4)
            {
                std::cerr << "Usage: "
                          << "down src dest" << std::endl;
                std::cerr << "Usage: "
                          << "down_id file_id offset dest" << std::endl;
                continue;
            }
            else
            {
                if (parameters[0] == "down" && meta.find(parameters[1]) == meta.end())
                {
                    std::cerr << "Error: no such file in MiniDFS." << std::endl;
                    continue;
                }
                for (int i = 0; i < 4; ++i)
                {
                    std::unique_lock<std::mutex> lk(dataServers_[i]->mtx);
                    dataServers_[i]->cmd = parameters[0];
                    if (parameters[0] == "down")
                    {
                        std::pair<int, int> metaData = meta[parameters[1]];
                        dataServers_[i]->fid = metaData.first;
                        dataServers_[i]->bufSize = metaData.second;
                    }
                    else
                    {
                        dataServers_[i]->fid = std::stoi(parameters[1]);
                        dataServers_[i]->offset = std::stoi(parameters[2]);
                    }
                    dataServers_[i]->finish = false;
                    lk.unlock();
                    dataServers_[i]->cv.notify_all();
                }
            }
        }
        // locate the data server given file ID and Offset.
        else if (parameters[0] == "loc")
        {
            if (parameters.size() != 3)
            {
                std::cerr << "Usage: "
                          << "loc file_id offset" << std::endl;
                continue;
            }
            else
            {
                for (int i = 0; i < 4; ++i)
                {
                    std::unique_lock<std::mutex> lk(dataServers_[i]->mtx);
                    dataServers_[i]->cmd = "loc";
                    dataServers_[i]->fid = std::stoi(parameters[1]);
                    dataServers_[i]->offset = std::stoi(parameters[2]);
                    dataServers_[i]->finish = false;
                    lk.unlock();
                    dataServers_[i]->cv.notify_all();
                }
            }
        }
        else
            std::cerr << "Unknown command." << std::endl;

        // waiting for the finish of data server.
        for (const auto &server : dataServers_)
        {
            std::unique_lock<std::mutex> lk(server->mtx);
            (server->cv).wait(lk, [&]() { return server->finish; });
            lk.unlock();
            (server->cv).notify_all();
        }

        // work after processing of data server
        if (parameters[0] == "down" || parameters[0] == "down_id")
        {
            std::string md5_checksum, pre_checksum;
            for (int i = 0; i < 4; ++i)
            {
                if (dataServers_[i]->bufSize)
                {
                    std::ofstream os;
                    if (parameters[0] == "down")
                        os.open(parameters[2]);
                    else if (parameters[0] == "down_id")
                        os.open(parameters[3]);
                    if (!os)
                        std::cerr << "Failed in creating file.\nPlease ensure dest directory exists." << std::endl;
                    else
                    {
                        os.write(dataServers_[i]->buf, dataServers_[i]->bufSize);
                        os.close();
                        md5.update(dataServers_[i]->buf, dataServers_[i]->bufSize);
                        md5.finalize();
                        md5_checksum = md5.toString();
                        if (!pre_checksum.empty() && pre_checksum != md5_checksum)
                        {
                            std::cerr << "Error: inconsistent checksum for files from different data servers. File may be corrupted." << std::endl;
                        }
                        else if (!pre_checksum.empty() && pre_checksum == md5_checksum)
                        {
                            std::cout << "MD5 checksum passed." << std::endl;
                        }
                        pre_checksum = md5_checksum;
                    }
                    delete[] dataServers_[i]->buf;
                }
            }
        }
        else if (parameters[0] == "up")
        {
            std::cout << "Upload success. File ID is " << idCnt_ << std::endl;
        }
        else if (parameters[0] == "loc" || parameters[0] == "ls")
        {
            bool notFound = true;
            for (int i = 0; i < 4; ++i)
            {
                if (dataServers_[i]->bufSize)
                {
                    notFound = false;
                    std::cout << "Found File ID=" << parameters[1] << ", offset=" << parameters[2] << " at " << dataServers_[i]->get_name() << std::endl;
                }
            }
            if (notFound)
                std::cout << "Error, File ID=" << parameters[1] << ", offset=" << parameters[2] << " not found." << std::endl;
        }
        delete[] buf;
        is.close();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x538, %rsp            # imm = 0x538
movq %rdi, %rbx
leaq 0x28(%rdi), %rax
movq %rax, -0x50(%rbp)
leaq 0x30(%rdi), %rax
movq %rax, -0xc0(%rbp)
leaq 0x18(%rdi), %rax
movq %rax, -0x98(%rbp)
leaq -0x40(%rbp), %r12
leaq -0x558(%rbp), %r14
leaq -0x350(%rbp), %r15
movq %r12, %rdi
callq 0x5d76
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
andq $0x0, -0x80(%rbp)
movq %r14, %rdi
callq 0x32b0
leaq -0x12c(%rbp), %rdi
callq 0x4c6e
movq -0x40(%rbp), %rdi
movq 0x60ed(%rip), %rax      # 0xbff0
leaq 0x2311(%rip), %rsi      # 0x821b
cmpq -0x38(%rbp), %rdi
je 0x61f5
leaq 0x2313(%rip), %rsi      # 0x822e
callq 0x4130
testb %al, %al
jne 0x6969
movq -0x40(%rbp), %rdi
leaq 0x2300(%rip), %rsi      # 0x8233
callq 0x4130
testb %al, %al
jne 0x6969
movq -0x40(%rbp), %rdi
leaq 0x22ed(%rip), %rsi      # 0x8238
callq 0x4130
testb %al, %al
je 0x5f96
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
cmpq $0x20, %rax
jne 0x6017
movq 0x6053(%rip), %rdi      # 0xbfc0
leaq 0x22f2(%rip), %rsi      # 0x8266
callq 0x3280
movq %rax, %rdi
callq 0x3180
movq -0x98(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x4632
jmp 0x6205
movq -0x40(%rbp), %rdi
leaq 0x2079(%rip), %rsi      # 0x801a
callq 0x4130
testb %al, %al
je 0x6036
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rax
subq %rsi, %rax
cmpq $0x60, %rax
jne 0x6195
addq $0x20, %rsi
leaq -0x558(%rbp), %rdi
pushq $0x6
popq %rdx
callq 0x3230
movq -0x558(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x538(%rbp,%rax)
je 0x62fb
movq 0x5ffa(%rip), %rdi      # 0xbff0
leaq 0x2291(%rip), %rsi      # 0x828e
callq 0x3280
movq -0x40(%rbp), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x3250
jmp 0x61fd
movq 0x5fd2(%rip), %rdi      # 0xbff0
leaq 0x2216(%rip), %rsi      # 0x823b
callq 0x3280
leaq 0x2212(%rip), %rsi      # 0x8243
jmp 0x61f5
movq -0x40(%rbp), %rdi
leaq 0x1fdc(%rip), %rsi      # 0x801d
callq 0x4130
testb %al, %al
jne 0x6062
movq -0x40(%rbp), %rdi
leaq 0x1fd1(%rip), %rsi      # 0x8026
callq 0x4130
testb %al, %al
je 0x622d
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
subq %rdi, %rax
sarq $0x5, %rax
addq $-0x3, %rax
cmpq $0x2, %rax
jae 0x61b1
leaq 0x1f97(%rip), %rsi      # 0x801d
callq 0x4130
testb %al, %al
je 0x60be
movq -0x40(%rbp), %rsi
addq $0x20, %rsi
movq -0x50(%rbp), %rdi
callq 0x75ec
movq %rax, %rcx
movq 0x5f46(%rip), %rax      # 0xbff0
leaq 0x226c(%rip), %rsi      # 0x831d
cmpq -0xc0(%rbp), %rcx
je 0x61f5
xorl %r14d, %r14d
movq -0x50(%rbp), %r12
cmpq $0x4, %r14
je 0x63bf
movq (%rbx), %rax
movq (%rax,%r14,8), %rsi
addq $0x28, %rsi
movq %r15, %rdi
callq 0x4110
movq -0x40(%rbp), %rsi
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
subq $-0x80, %rdi
callq 0x31a0
movq -0x40(%rbp), %rdi
leaq 0x1f1c(%rip), %rsi      # 0x801d
callq 0x4130
movq -0x40(%rbp), %rsi
addq $0x20, %rsi
testb %al, %al
je 0x612d
movq %r12, %rdi
callq 0x46a4
movq (%rax), %rax
movq (%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movq %rax, 0xa0(%rcx)
jmp 0x6166
movq %rsi, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x6ac6
movq (%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movl %eax, 0xa0(%rcx)
movq -0x40(%rbp), %rdi
addq $0x40, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x6ac6
movq (%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movl %eax, 0xa8(%rcx)
movb $0x0, 0xb8(%rcx)
movq %r15, %rdi
callq 0x4140
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
addq $0x50, %rdi
callq 0x3440
movq %r15, %rdi
callq 0x4170
incq %r14
jmp 0x60c5
movq 0x5e54(%rip), %rdi      # 0xbff0
leaq 0x2098(%rip), %rsi      # 0x823b
callq 0x3280
leaq 0x20d3(%rip), %rsi      # 0x8282
jmp 0x61f5
movq 0x5e38(%rip), %rdi      # 0xbff0
leaq 0x207c(%rip), %rsi      # 0x823b
callq 0x3280
movq %rax, %rdi
leaq 0x2125(%rip), %rsi      # 0x82f3
callq 0x3280
movq %rax, %rdi
callq 0x3180
movq 0x5e0e(%rip), %rdi      # 0xbff0
leaq 0x2052(%rip), %rsi      # 0x823b
callq 0x3280
leaq 0x210c(%rip), %rsi      # 0x8301
movq %rax, %rdi
callq 0x3280
movq %rax, %rdi
callq 0x3180
leaq -0x558(%rbp), %r14
movq %r14, %rdi
callq 0x30c0
leaq -0x90(%rbp), %rdi
callq 0x6d0e
movq %r12, %rdi
callq 0x466c
jmp 0x5ecd
movq -0x40(%rbp), %rdi
leaq 0x1dea(%rip), %rsi      # 0x8022
callq 0x4130
testb %al, %al
je 0x63a4
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
cmpq $0x60, %rax
jne 0x68e0
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x63bf
movq (%rbx), %rax
movq (%rax,%r14,8), %rsi
addq $0x28, %rsi
movq %r15, %rdi
callq 0x4110
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
subq $-0x80, %rdi
leaq 0x1d99(%rip), %rsi      # 0x8022
callq 0x34c0
movq -0x40(%rbp), %rdi
addq $0x20, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x6ac6
movq (%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movl %eax, 0xa0(%rcx)
movq -0x40(%rbp), %rdi
addq $0x40, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x6ac6
movq (%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movl %eax, 0xa8(%rcx)
movb $0x0, 0xb8(%rcx)
movq %r15, %rdi
callq 0x4140
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
addq $0x50, %rdi
callq 0x3440
movq %r15, %rdi
callq 0x4170
incq %r14
jmp 0x625a
movq -0x40(%rbp), %rsi
addq $0x40, %rsi
movq -0x98(%rbp), %rdi
pushq $0x1
popq %rdx
callq 0x4432
testb %al, %al
je 0x66b9
leaq -0x558(%rbp), %rdi
callq 0x3460
movq %rax, %r14
movslq %r14d, %r12
testq %r12, %r12
pushq $-0x1
popq %rdi
cmovnsq %r12, %rdi
callq 0x3030
movq %rax, -0x48(%rbp)
leaq -0x558(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3340
leaq -0x558(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r12, %rdx
callq 0x32f0
andq $0x0, -0x340(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x350(%rbp)
movq (%rbx), %r12
movq 0x8(%rbx), %r13
cmpq %r13, %r12
je 0x66e8
movq (%r12), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movq %r15, %rdi
leaq -0x70(%rbp), %rsi
callq 0x6d36
addq $0x8, %r12
jmp 0x637b
movq 0x5c45(%rip), %rdi      # 0xbff0
leaq 0x1f9e(%rip), %rsi      # 0x8350
callq 0x3280
movq %rax, %rdi
callq 0x3180
movq $0x0, -0x48(%rbp)
movq (%rbx), %r12
movq 0x8(%rbx), %r13
cmpq %r13, %r12
je 0x6428
movq (%r12), %rsi
addq $0x28, %rsi
movq %r15, %rdi
callq 0x4110
movq (%r12), %rax
leaq 0x50(%rax), %r14
cmpb $0x0, 0xb8(%rax)
jne 0x6405
movq %r14, %rdi
movq %r15, %rsi
callq 0x30f0
movq (%r12), %rax
jmp 0x63eb
movq %r15, %rdi
callq 0x4140
movq (%r12), %rdi
addq $0x50, %rdi
callq 0x3440
movq %r15, %rdi
callq 0x4170
addq $0x8, %r12
jmp 0x63ce
movq -0x40(%rbp), %rdi
leaq 0x1bea(%rip), %rsi      # 0x801d
callq 0x4130
testb %al, %al
jne 0x6454
movq -0x40(%rbp), %rdi
leaq 0x1bdf(%rip), %rsi      # 0x8026
callq 0x4130
testb %al, %al
je 0x6675
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
andq $0x0, -0x68(%rbp)
leaq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
andq $0x0, -0xb0(%rbp)
xorl %eax, %eax
movb %al, -0x60(%rbp)
movb %al, -0xa8(%rbp)
xorl %r14d, %r14d
leaq -0x40(%rbp), %r12
cmpq $0x4, %r14
je 0x6641
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
cmpl $0x0, 0xa4(%rax)
je 0x6639
movq %r15, %rdi
callq 0x3430
movq -0x40(%rbp), %rdi
leaq 0x1b63(%rip), %rsi      # 0x801d
callq 0x4130
movq -0x40(%rbp), %rsi
testb %al, %al
je 0x64cd
addq $0x40, %rsi
jmp 0x64e8
movq %rsi, %rdi
leaq 0x1b4f(%rip), %rsi      # 0x8026
callq 0x4130
testb %al, %al
je 0x64f3
movq -0x40(%rbp), %rsi
addq $0x60, %rsi
movq %r15, %rdi
pushq $0x10
popq %rdx
callq 0x3170
movq -0x350(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x330(%rbp,%rax)
je 0x6528
movq 0x5ae1(%rip), %rdi      # 0xbff0
leaq 0x1e4b(%rip), %rsi      # 0x8361
callq 0x3280
movq %rax, %rdi
callq 0x3180
jmp 0x6619
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0xb0(%rax), %rsi
movslq 0xa4(%rax), %rdx
movq %r15, %rdi
callq 0x3330
movq %r15, %rdi
callq 0x3370
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0xb0(%rax), %rsi
movslq 0xa4(%rax), %rdx
leaq -0x12c(%rbp), %rdi
callq 0x54de
leaq -0x12c(%rbp), %rdi
callq 0x54e8
leaq -0x150(%rbp), %r13
movq %r13, %rdi
leaq -0x12c(%rbp), %rsi
callq 0x5578
leaq -0x70(%rbp), %rdi
movq %r13, %rsi
callq 0x32e0
movq %r13, %rdi
callq 0x3150
cmpq $0x0, -0xb0(%rbp)
je 0x6609
leaq -0xb8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4697
movq 0x5a2b(%rip), %rdi      # 0xbff0
leaq 0x1dd3(%rip), %rsi      # 0x839f
testb %al, %al
jne 0x65fc
cmpq $0x0, -0xb0(%rbp)
je 0x6609
leaq -0xb8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4747
movq 0x59cf(%rip), %rdi      # 0xbfc0
leaq 0x1e02(%rip), %rsi      # 0x83fa
testb %al, %al
je 0x6609
callq 0x3280
movq %rax, %rdi
callq 0x3180
leaq -0xb8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x31a0
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0xb0(%rax), %rdi
testq %rdi, %rdi
je 0x6631
callq 0x3310
movq %r15, %rdi
callq 0x33b0
incq %r14
jmp 0x6489
leaq -0xb8(%rbp), %rdi
callq 0x3150
leaq -0x70(%rbp), %rdi
callq 0x3150
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x6664
callq 0x3310
leaq -0x558(%rbp), %rdi
callq 0x30b0
jmp 0x6205
movq -0x40(%rbp), %rdi
leaq 0x199a(%rip), %rsi      # 0x801a
callq 0x4130
testb %al, %al
leaq -0x40(%rbp), %r12
je 0x6809
movq 0x5928(%rip), %rdi      # 0xbfc0
leaq 0x1d70(%rip), %rsi      # 0x840f
callq 0x3280
movl 0x24(%rbx), %esi
movq %rax, %rdi
callq 0x3450
movq %rax, %rdi
callq 0x3180
jmp 0x6656
movq 0x5930(%rip), %rdi      # 0xbff0
leaq 0x1be9(%rip), %rsi      # 0x82b0
callq 0x3280
movq -0x40(%rbp), %rsi
addq $0x40, %rsi
movq %rax, %rdi
callq 0x3250
leaq 0x1c00(%rip), %rsi      # 0x82e3
jmp 0x61f5
leaq -0x70(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x6a4c
leaq -0x90(%rbp), %rdi
movq %r13, %rsi
callq 0x7580
movq %r13, %rdi
callq 0x6d0e
incl 0x24(%rbx)
xorl %r12d, %r12d
movslq 0x20(%rbx), %rax
cmpq %rax, %r12
jge 0x67fc
movq -0x90(%rbp), %rax
movslq (%rax,%r12,4), %rax
movq (%rbx), %rcx
movq (%rcx,%rax,8), %rsi
addq $0x28, %rsi
movq %r13, %rdi
callq 0x4110
movl 0x24(%rbx), %r13d
movq -0x40(%rbp), %rsi
addq $0x40, %rsi
movq -0x50(%rbp), %rdi
callq 0x46a4
movl %r13d, (%rax)
movl %r14d, 0x4(%rax)
movq -0x90(%rbp), %rax
movslq (%rax,%r12,4), %rax
movq (%rbx), %rcx
movq (%rcx,%rax,8), %rdi
subq $-0x80, %rdi
leaq 0x18a2(%rip), %rsi      # 0x801a
callq 0x34c0
leaq -0x70(%rbp), %r13
movl 0x24(%rbx), %eax
movq -0x90(%rbp), %rcx
movslq (%rcx,%r12,4), %rdx
movq (%rbx), %rsi
movq (%rsi,%rdx,8), %rdx
movl %eax, 0xa0(%rdx)
movslq (%rcx,%r12,4), %rax
movq (%rsi,%rax,8), %rax
movl %r14d, 0xa4(%rax)
movslq (%rcx,%r12,4), %rax
movq (%rsi,%rax,8), %rcx
movq -0x48(%rbp), %rdx
movq %rdx, 0xb0(%rcx)
movq (%rsi,%rax,8), %rax
movb $0x0, 0xb8(%rax)
movq %r13, %rdi
callq 0x4140
movq -0x90(%rbp), %rax
movslq (%rax,%r12,4), %rax
movq (%rbx), %rcx
movq (%rcx,%rax,8), %rdi
addq $0x50, %rdi
callq 0x3440
movq %r13, %rdi
callq 0x4170
incq %r12
jmp 0x6714
movq %r15, %rdi
callq 0x6d22
jmp 0x63c7
movq -0x40(%rbp), %rdi
leaq 0x180e(%rip), %rsi      # 0x8022
callq 0x4130
testb %al, %al
jne 0x6835
movq -0x40(%rbp), %rdi
leaq 0x1a10(%rip), %rsi      # 0x8238
callq 0x4130
testb %al, %al
je 0x6656
movb $0x1, %al
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x68ff
movq (%rbx), %rcx
movq (%rcx,%r12,8), %rcx
cmpl $0x0, 0xa4(%rcx)
je 0x68d8
movq 0x5761(%rip), %rdi      # 0xbfc0
leaq 0x1bc5(%rip), %rsi      # 0x842b
callq 0x3280
movq -0x40(%rbp), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
leaq 0x1bb5(%rip), %rsi      # 0x843a
callq 0x3280
movq -0x40(%rbp), %rsi
addq $0x40, %rsi
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
leaq 0x1ba0(%rip), %rsi      # 0x8444
callq 0x3280
movq %rax, %r14
movq (%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x4082
movq %r14, %rdi
movq %r15, %rsi
callq 0x3250
movq %rax, %rdi
callq 0x3180
movq %r15, %rdi
callq 0x3150
xorl %eax, %eax
incq %r12
jmp 0x683a
movq 0x5709(%rip), %rdi      # 0xbff0
leaq 0x194d(%rip), %rsi      # 0x823b
callq 0x3280
leaq 0x1a43(%rip), %rsi      # 0x833d
jmp 0x61f5
testb $0x1, %al
leaq -0x40(%rbp), %r12
je 0x6656
movq 0x56ae(%rip), %rdi      # 0xbfc0
leaq 0x1b30(%rip), %rsi      # 0x8449
callq 0x3280
movq -0x40(%rbp), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
leaq 0x1b02(%rip), %rsi      # 0x843a
callq 0x3280
movq -0x40(%rbp), %rsi
addq $0x40, %rsi
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
leaq 0x1b02(%rip), %rsi      # 0x8459
callq 0x3280
movq %rax, %rdi
callq 0x3180
jmp 0x6656
xorl %edi, %edi
callq 0x32d0
jmp 0x698e
jmp 0x69c5
jmp 0x69c5
jmp 0x69c5
jmp 0x69c5
jmp 0x69c5
jmp 0x69c5
movq %rax, %rbx
leaq -0x350(%rbp), %rdi
jmp 0x69fa
jmp 0x6999
jmp 0x698e
movq %rax, %rbx
jmp 0x69a5
jmp 0x69db
jmp 0x69ca
jmp 0x69c5
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x4170
leaq -0x350(%rbp), %rdi
callq 0x6d22
jmp 0x69ff
movq %rax, %rbx
jmp 0x6a0b
jmp 0x69ca
movq %rax, %rbx
jmp 0x69ea
jmp 0x69c5
jmp 0x69c5
jmp 0x69ca
movq %rax, %rbx
jmp 0x69ff
movq %rax, %rbx
leaq -0x350(%rbp), %rdi
callq 0x4170
jmp 0x69ff
movq %rax, %rbx
leaq -0x350(%rbp), %rdi
callq 0x33b0
leaq -0xb8(%rbp), %rdi
callq 0x3150
leaq -0x70(%rbp), %rdi
callq 0x3150
leaq -0x558(%rbp), %rdi
callq 0x30c0
leaq -0x90(%rbp), %rdi
callq 0x6d0e
leaq -0x40(%rbp), %rdi
callq 0x466c
movq %rbx, %rdi
callq 0x3480