// File: /workspace/github_cpp_makefile_star2_O3/zimpha[P]MiniSQL/API.cc
// Function: API::Select(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Filter const&)
Response API::Select(const std::string &tableName, const Filter &filter) {
    if (!cm.hasTable(tableName + ".table")) {
        return Response("Table does not exist");
    }
    
    Table nt = cm.loadTable(tableName + ".table");
    std::string dbName = tableName + ".db";
    for (size_t i = 0; i < filter.rules.size(); ++ i) {
        element val = filter.rules[i].val;
        int attrIndex = filter.rules[i].index;
        if (nt.attributes[attrIndex].type != val.type) {
            return Response("Type mismatch");
        }
    }
    
    for (size_t i = 0; i < filter.rules.size(); ++ i) {
        if (filter.rules[i].type == 2) { // =
            element val = filter.rules[i].val;
            int attrIndex = filter.rules[i].index;
            if (!nt.attributes[attrIndex].indices.empty()) { // has index on it
                std::string indexFileName = tableName + "." + nt.attributes[attrIndex].name;
                long offset = getOffset(indexFileName, val);
                // offset == -1 表示没有这个val
                // Record Manager return select result by using index
                // 传入数据库文件名（dbName），偏移量(offset)，过滤器(filter)，当前表(nt)，返回select结果(类型vector<vector<element>>)
                return Response(rm.RecordManagerRecordSelect(dbName, offset, filter, nt));
            }
        }
    }

    // SelectWithoutIndex is just an exceptional case of SelectWithIndex
    /*
    if (filter.rules.empty()) {
        // Record Manager return select result without index
        // 传入数据库文件名（dbName），过滤器(filter)，当前表(nt)，返回select结果(类型vector<vector<element>>)
        return Response(rm.rmSelectWithoutIndex(dbName, filter, nt));
    }
    */

    std::set<long> offset;
    // Record Manager get offset according to dbName
    // 传入数据库文件名(daName)，返回一个offset的集合(类型set)
    offset = rm.RecordManagerGetAllOffsets(dbName, nt);
    for (size_t i = 0; i < filter.rules.size(); ++ i) {
        Rule rule = filter.rules[i];
        int attrIndex = rule.index;
        if (nt.attributes[attrIndex].indices.empty()) {
            continue;
        }
        element val = rule.val;
        std::string indexFileName = tableName + "." + nt.attributes[attrIndex].name;
        std::set<long> newOffset;
        long tmpOffset;
        // B plus tree get offset according to filter rules
        // 传入文件名(indexFileName)，属性的值(val)
        switch (rule.type) {
            case 0: // <
                newOffset = getLessOffset(indexFileName, val);
                break;
            case 1: // <=
                newOffset = getLessOffset(indexFileName, val);
                tmpOffset = getOffset(indexFileName, val);
                if (tmpOffset != -1) {
                    newOffset.insert(tmpOffset);
                }
                break;
            case 2: // =
                assert(false);
                break;
            case 3: // >=
                newOffset = getMoreOffset(indexFileName, val);
                tmpOffset = getOffset(indexFileName, val);
                if (tmpOffset != -1) {
                    newOffset.insert(tmpOffset);
                }
                break;
            case 4: // >
                newOffset = getMoreOffset(indexFileName, val);
                break;
            case 5: // <>
                newOffset = offset;
                break;
            default: 
                assert(false);
                break;
        }
        std::vector<long> tmp(offset.size());
        std::vector<long>::iterator end = std::set_intersection(offset.begin(), offset.end(), newOffset.begin(), newOffset.end(), tmp.begin());
        offset.clear();
        for (std::vector<long>::iterator it = tmp.begin(); it != end; ++ it) {
            offset.insert(*it);
        }
    }
    
    std::vector<std::vector<element> > res;
    for (auto x : offset) {
        std::vector<std::vector<element> > tmp;
        // Record Manager return select result by using index
        // 传入数据库文件名（dbName），偏移量(x)，过滤器(filter)，当前表(nt)，返回select结果(类型Response)
        tmp = rm.RecordManagerRecordSelect(dbName, x, filter, nt);
        for (size_t i = 0; i < tmp.size(); ++ i) {
            res.push_back(tmp[i]);
        }
    }
    return Response(res);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %r13
leaq -0x2a8(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rdx), %rsi
movq %rdx, -0x120(%rbp)
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
leaq -0x2b8(%rbp), %rbx
movq %rbx, %rdi
callq 0x88b4
leaq 0xf4cc(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0x2b8(%rbp), %rsi
movq %r12, %rdi
callq 0xde1c
movl %eax, %ebx
movq -0x2b8(%rbp), %rdi
cmpq %r14, %rdi
je 0x4baf
callq 0x3270
testb %bl, %bl
je 0x59a7
leaq -0x108(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x120(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rbx
movq %rbx, %rdi
callq 0x88b4
leaq 0xf468(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0x2b8(%rbp), %rdi
leaq -0x118(%rbp), %rdx
movq %r12, %rsi
callq 0xdf7e
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x4c18
callq 0x3270
leaq -0x160(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x120(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x170(%rbp), %rdi
callq 0x88b4
leaq 0xf477(%rip), %rsi      # 0x140be
leaq -0x170(%rbp), %rdi
callq 0x34f0
movq %r12, -0x128(%rbp)
movq %r13, -0x178(%rbp)
movq %r15, %rax
movq (%r15), %r15
movq %rax, -0x68(%rbp)
movq 0x8(%rax), %rax
cmpq %r15, %rax
je 0x4d24
leaq -0x100(%rbp), %r14
xorl %r12d, %r12d
xorl %r13d, %r13d
movq -0x68(%rbp), %rbx
movq 0x8(%r15,%r12), %rax
movq %rax, -0x118(%rbp)
movq %r14, -0x110(%rbp)
movq 0x10(%r15,%r12), %rsi
movq 0x18(%r15,%r12), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %rdi
callq 0x88b4
movl 0x30(%r15,%r12), %eax
movl %eax, -0xf0(%rbp)
movq -0x68(%rbp), %rcx
movq (%rcx), %r15
movslq (%r15,%r12), %rcx
movq -0x290(%rbp), %rdx
leaq (%rcx,%rcx,2), %rcx
shlq $0x5, %rcx
cmpl %eax, 0x20(%rdx,%rcx)
jne 0x5a00
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x4cf8
callq 0x3270
movq (%rbx), %r15
incq %r13
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq %r15, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
addq $0x38, %r12
cmpq %rcx, %r13
jb 0x4c89
cmpq %r15, %rax
je 0x4df1
leaq -0x110(%rbp), %rbx
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpl $0x2, 0x4(%r15,%r12)
jne 0x4dc9
movq 0x8(%r15,%r12), %rax
movq %rax, -0x118(%rbp)
leaq -0x100(%rbp), %rax
movq %rax, -0x110(%rbp)
movq 0x10(%r15,%r12), %rsi
movq 0x18(%r15,%r12), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x88b4
movl 0x30(%r15,%r12), %eax
movl %eax, -0xf0(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %r15
movslq (%r15,%r12), %rax
movq -0x290(%rbp), %rcx
leaq (%rax,%rax,2), %r14
shlq $0x5, %r14
cmpq $0x0, 0x58(%rcx,%r14)
jne 0x5a69
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
movq -0x68(%rbp), %r14
je 0x4dc5
callq 0x3270
movq (%r14), %r15
movq 0x8(%r14), %rax
incq %r13
movq %rax, %rcx
subq %r15, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
addq $0x38, %r12
cmpq %rcx, %r13
jb 0x4d3a
leaq -0x1a0(%rbp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq -0x438(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
addq %rsi, %rdx
leaq -0x448(%rbp), %rdi
callq 0x88b4
movq -0x128(%rbp), %rax
leaq 0x30(%rax), %rsi
leaq -0x118(%rbp), %rdi
leaq -0x448(%rbp), %rdx
leaq -0x2b8(%rbp), %rcx
movq %rsi, -0x1b0(%rbp)
callq 0x12c42
movq -0x68(%rbp), %rbx
leaq -0x1a8(%rbp), %rdi
callq 0x8524
movq -0x108(%rbp), %rax
testq %rax, %rax
je 0x4ec9
leaq -0x110(%rbp), %rcx
movl (%rcx), %edx
movl %edx, -0x1a0(%rbp)
movq %rax, -0x198(%rbp)
movups 0x10(%rcx), %xmm0
movups %xmm0, -0x190(%rbp)
leaq -0x1a0(%rbp), %rdx
movq %rdx, 0x8(%rax)
movq 0x20(%rcx), %rax
movq %rax, -0x180(%rbp)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq -0x118(%rbp), %rdi
callq 0x859c
movq -0x448(%rbp), %rdi
cmpq %r14, %rdi
je 0x4ee6
callq 0x3270
movq (%rbx), %r12
cmpq %r12, 0x8(%rbx)
je 0x57bc
addq $0x40, -0x128(%rbp)
leaq -0xa0(%rbp), %r15
leaq -0x1a8(%rbp), %rbx
xorl %r14d, %r14d
imulq $0x38, %r14, %r13
movq (%r12,%r13), %rax
movq %rax, -0x118(%rbp)
movq 0x8(%r12,%r13), %rax
movq %rax, -0x110(%rbp)
leaq -0xf8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq 0x10(%r12,%r13), %rsi
movq 0x18(%r12,%r13), %rdx
addq %rsi, %rdx
leaq -0x108(%rbp), %rdi
callq 0x88b4
addq %r13, %r12
movl 0x30(%r12), %eax
movl %eax, -0xe8(%rbp)
movslq -0x118(%rbp), %rax
movq -0x290(%rbp), %rcx
leaq (%rax,%rax,2), %r12
shlq $0x5, %r12
cmpq $0x0, 0x58(%rcx,%r12)
je 0x5778
movq -0x110(%rbp), %rax
movq -0x108(%rbp), %rsi
movq %rax, -0xe0(%rbp)
leaq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x100(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x88b4
movl -0xe8(%rbp), %eax
movl %eax, -0xb8(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x120(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x88b4
movq %r15, %rdi
leaq 0xf2dc(%rip), %rsi      # 0x142d0
callq 0x34f0
movq -0x290(%rbp), %rax
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq %r15, %rdi
callq 0x30c0
leaq -0x138(%rbp), %rsi
movq %rsi, -0x148(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
movq -0x128(%rbp), %r12
je 0x5048
movq %rdx, -0x148(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x138(%rbp)
jmp 0x504e
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x140(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x5080
callq 0x3270
movl $0x0, -0x98(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x90(%rbp)
leaq -0x98(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movq %rcx, -0x78(%rbp)
movl -0x114(%rbp), %eax
cmpq $0x5, %rax
ja 0x5cd8
leaq 0xef60(%rip), %rcx      # 0x14020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x260(%rbp), %rax
movq %rax, -0x270(%rbp)
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
addq %rsi, %rdx
leaq -0x270(%rbp), %rdi
callq 0x88b4
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rsi
movq %rax, -0x3f8(%rbp)
leaq -0x3e0(%rbp), %rax
movq %rax, -0x3f0(%rbp)
movq -0xd0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x3f0(%rbp), %rdi
callq 0x88b4
movl -0xb8(%rbp), %eax
movl %eax, -0x3d0(%rbp)
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
leaq -0x270(%rbp), %rdx
leaq -0x3f8(%rbp), %rcx
callq 0xc6d6
movq %r15, %rdi
callq 0x8524
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x51a8
movl -0x58(%rbp), %ecx
movl %ecx, -0x98(%rbp)
movq %rax, -0x90(%rbp)
movups -0x48(%rbp), %xmm0
movups %xmm0, -0x88(%rbp)
leaq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x78(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq %rcx, -0x38(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x859c
movq -0x3f0(%rbp), %rdi
leaq -0x3e0(%rbp), %rax
cmpq %rax, %rdi
je 0x51c9
callq 0x3270
movq -0x270(%rbp), %rdi
leaq -0x260(%rbp), %rax
jmp 0x52fa
movq %r15, %rdi
movq %rbx, %rsi
callq 0x85b4
jmp 0x56cb
leaq -0x1c0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1d0(%rbp), %rdi
callq 0x88b4
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rsi
movq %rax, -0x308(%rbp)
leaq -0x2f0(%rbp), %rax
movq %rax, -0x300(%rbp)
movq -0xd0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x300(%rbp), %rdi
callq 0x88b4
movl -0xb8(%rbp), %eax
movl %eax, -0x2e0(%rbp)
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
leaq -0x1d0(%rbp), %rdx
leaq -0x308(%rbp), %rcx
callq 0xc57e
movq %r15, %rdi
callq 0x8524
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x52cb
movl -0x58(%rbp), %ecx
movl %ecx, -0x98(%rbp)
movq %rax, -0x90(%rbp)
movups -0x48(%rbp), %xmm0
movups %xmm0, -0x88(%rbp)
leaq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x78(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq %rcx, -0x38(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x859c
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0x52ec
callq 0x3270
movq -0x1d0(%rbp), %rdi
leaq -0x1c0(%rbp), %rax
cmpq %rax, %rdi
je 0x56cb
callq 0x3270
jmp 0x56cb
leaq -0x200(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
addq %rsi, %rdx
leaq -0x210(%rbp), %rdi
callq 0x88b4
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rsi
movq %rax, -0x368(%rbp)
leaq -0x350(%rbp), %rax
movq %rax, -0x360(%rbp)
movq -0xd0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x360(%rbp), %rdi
callq 0x88b4
movl -0xb8(%rbp), %eax
movl %eax, -0x340(%rbp)
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
leaq -0x210(%rbp), %rdx
leaq -0x368(%rbp), %rcx
callq 0xc57e
movq %r15, %rdi
callq 0x8524
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x53ec
movl -0x58(%rbp), %ecx
movl %ecx, -0x98(%rbp)
movq %rax, -0x90(%rbp)
movups -0x48(%rbp), %xmm0
movups %xmm0, -0x88(%rbp)
leaq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x78(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq %rcx, -0x38(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x859c
movq -0x360(%rbp), %rdi
leaq -0x350(%rbp), %rax
cmpq %rax, %rdi
je 0x540d
callq 0x3270
movq -0x210(%rbp), %rdi
leaq -0x200(%rbp), %rax
cmpq %rax, %rdi
je 0x5425
callq 0x3270
leaq -0x1e0(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1f0(%rbp), %rdi
callq 0x88b4
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rsi
movq %rax, -0x338(%rbp)
leaq -0x320(%rbp), %rax
movq %rax, -0x330(%rbp)
movq -0xd0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x330(%rbp), %rdi
callq 0x88b4
movl -0xb8(%rbp), %eax
movl %eax, -0x310(%rbp)
movq %r12, %rdi
leaq -0x1f0(%rbp), %rsi
leaq -0x338(%rbp), %rdx
callq 0xc4a4
movq %rax, -0x150(%rbp)
movq -0x330(%rbp), %rdi
leaq -0x320(%rbp), %rax
cmpq %rax, %rdi
je 0x54ca
callq 0x3270
movq -0x1f0(%rbp), %rdi
leaq -0x1e0(%rbp), %rax
jmp 0x56a8
leaq -0x240(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
addq %rsi, %rdx
leaq -0x250(%rbp), %rdi
callq 0x88b4
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rsi
movq %rax, -0x3c8(%rbp)
leaq -0x3b0(%rbp), %rax
movq %rax, -0x3c0(%rbp)
movq -0xd0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x3c0(%rbp), %rdi
callq 0x88b4
movl -0xb8(%rbp), %eax
movl %eax, -0x3a0(%rbp)
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
leaq -0x250(%rbp), %rdx
leaq -0x3c8(%rbp), %rcx
callq 0xc6d6
movq %r15, %rdi
callq 0x8524
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x55bc
movl -0x58(%rbp), %ecx
movl %ecx, -0x98(%rbp)
movq %rax, -0x90(%rbp)
movups -0x48(%rbp), %xmm0
movups %xmm0, -0x88(%rbp)
leaq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x78(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq %rcx, -0x38(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x859c
movq -0x3c0(%rbp), %rdi
leaq -0x3b0(%rbp), %rax
cmpq %rax, %rdi
je 0x55dd
callq 0x3270
movq -0x250(%rbp), %rdi
leaq -0x240(%rbp), %rax
cmpq %rax, %rdi
je 0x55f5
callq 0x3270
leaq -0x220(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
addq %rsi, %rdx
leaq -0x230(%rbp), %rdi
callq 0x88b4
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rsi
movq %rax, -0x398(%rbp)
leaq -0x380(%rbp), %rax
movq %rax, -0x390(%rbp)
movq -0xd0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x390(%rbp), %rdi
callq 0x88b4
movl -0xb8(%rbp), %eax
movl %eax, -0x370(%rbp)
movq %r12, %rdi
leaq -0x230(%rbp), %rsi
leaq -0x398(%rbp), %rdx
callq 0xc4a4
movq %rax, -0x150(%rbp)
movq -0x390(%rbp), %rdi
leaq -0x380(%rbp), %rax
cmpq %rax, %rdi
je 0x569a
callq 0x3270
movq -0x230(%rbp), %rdi
leaq -0x220(%rbp), %rax
cmpq %rax, %rdi
je 0x56b2
callq 0x3270
cmpq $-0x1, -0x150(%rbp)
je 0x56cb
movq %r15, %rdi
leaq -0x150(%rbp), %rsi
callq 0x8ede
movq -0x180(%rbp), %rsi
leaq -0x60(%rbp), %rdi
leaq -0xa1(%rbp), %rdx
callq 0x7aba
movq -0x190(%rbp), %rdi
movq -0x88(%rbp), %rdx
movq -0x60(%rbp), %r8
leaq -0x1a0(%rbp), %rsi
leaq -0x98(%rbp), %rcx
callq 0x901e
movq %rax, %r12
movq %rbx, %rdi
callq 0x8524
movq -0x60(%rbp), %r13
cmpq %r12, %r13
je 0x5733
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8ede
addq $0x8, %r13
cmpq %r12, %r13
jne 0x571b
movq -0x60(%rbp), %r13
testq %r13, %r13
je 0x5740
movq %r13, %rdi
callq 0x3270
movq %r15, %rdi
callq 0x859c
movq -0x148(%rbp), %rdi
leaq -0x138(%rbp), %rax
cmpq %rax, %rdi
je 0x5760
callq 0x3270
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x5778
callq 0x3270
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x5790
callq 0x3270
incq %r14
movq -0x68(%rbp), %rax
movq (%rax), %r12
movq 0x8(%rax), %rax
subq %r12, %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
cmpq %rax, %r14
jb 0x4f0c
xorps %xmm0, %xmm0
movaps %xmm0, -0xe0(%rbp)
movq $0x0, -0xd0(%rbp)
movq -0x190(%rbp), %rcx
leaq -0x1a0(%rbp), %rax
cmpq %rax, %rcx
je 0x594e
leaq -0x2c8(%rbp), %r12
leaq -0x2d8(%rbp), %rbx
leaq -0xe0(%rbp), %r13
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, -0x120(%rbp)
movq 0x20(%rcx), %r14
xorps %xmm0, %xmm0
movaps %xmm0, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
movq %r12, -0x2d8(%rbp)
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x88b4
leaq -0x60(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq -0x68(%rbp), %r8
leaq -0x2b8(%rbp), %r9
callq 0x128f0
movaps -0xa0(%rbp), %xmm0
movq -0x90(%rbp), %rax
movaps -0x60(%rbp), %xmm1
movaps %xmm1, -0xa0(%rbp)
movq -0x50(%rbp), %rcx
movq %rcx, -0x90(%rbp)
movups %xmm0, -0x118(%rbp)
movq %rax, -0x108(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x7a6a
leaq -0x60(%rbp), %rdi
callq 0x7a6a
movq -0x2d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x58cf
callq 0x3270
movq -0xa0(%rbp), %rsi
cmpq %rsi, -0x98(%rbp)
je 0x5915
xorl %r14d, %r14d
xorl %r12d, %r12d
addq %r14, %rsi
movq %r13, %rdi
callq 0x7b52
incq %r12
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rax
subq %rsi, %rax
sarq $0x3, %rax
imulq %r15, %rax
addq $0x18, %r14
cmpq %rax, %r12
jb 0x58e5
leaq -0xa0(%rbp), %rdi
callq 0x7a6a
movq -0x120(%rbp), %rdi
callq 0x3320
movq %rax, %rcx
leaq -0x1a0(%rbp), %rax
cmpq %rax, %rcx
leaq -0x2c8(%rbp), %r12
leaq -0x2d8(%rbp), %rbx
jne 0x5807
leaq -0x410(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x7b8e
leaq -0x410(%rbp), %rsi
movq -0x178(%rbp), %r13
movq %r13, %rdi
leaq -0x160(%rbp), %r14
callq 0x13620
leaq -0x410(%rbp), %rdi
callq 0x7a6a
leaq -0xe0(%rbp), %rdi
callq 0x7a6a
leaq -0x1a8(%rbp), %rdi
callq 0x859c
jmp 0x5c80
leaq -0x4b8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xe69f(%rip), %rsi      # 0x14058
leaq 0xe6ac(%rip), %rdx      # 0x1406c
leaq -0x4c8(%rbp), %rbx
movq %rbx, %rdi
callq 0x8952
movq %r13, %rdi
movq %rbx, %rsi
callq 0x135e0
movq -0x4c8(%rbp), %rdi
cmpq %r14, %rdi
je 0x59eb
callq 0x3270
movq %r13, %rax
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x498(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xe75f(%rip), %rsi      # 0x14171
leaq 0xe765(%rip), %rdx      # 0x1417e
leaq -0x4a8(%rbp), %rdi
callq 0x8952
leaq -0x4a8(%rbp), %rsi
movq -0x178(%rbp), %r13
movq %r13, %rdi
callq 0x135e0
movq -0x4a8(%rbp), %rdi
cmpq %r15, %rdi
je 0x5a4c
callq 0x3270
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x5a5d
callq 0x3270
leaq -0x160(%rbp), %r14
jmp 0x5c80
leaq -0xd0(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x120(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x88b4
leaq 0xe837(%rip), %rsi      # 0x142d0
leaq -0xe0(%rbp), %rdi
callq 0x34f0
movq -0x290(%rbp), %rax
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
leaq -0xe0(%rbp), %rdi
callq 0x30c0
leaq -0x198(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x160(%rbp), %r14
je 0x5af5
movq %rdx, -0x1a8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x198(%rbp)
jmp 0x5afc
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x1a0(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xe0(%rbp), %rdi
cmpq %r12, %rdi
je 0x5b27
callq 0x3270
leaq -0x478(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x1a8(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x488(%rbp), %rdi
callq 0x88b4
movq -0x118(%rbp), %rax
movq -0x110(%rbp), %rsi
leaq -0x4f0(%rbp), %rdi
movq %rax, -0x8(%rdi)
leaq -0x4e0(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x108(%rbp), %rdx
addq %rsi, %rdx
callq 0x88b4
movl -0xf0(%rbp), %eax
leaq -0x4f8(%rbp), %rdx
movl %eax, 0x28(%rdx)
movq -0x128(%rbp), %rax
leaq 0x40(%rax), %rdi
leaq -0x488(%rbp), %rsi
callq 0xc4a4
movq %rax, %rbx
movq -0x4f0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5bbe
callq 0x3270
movq -0x488(%rbp), %rdi
cmpq %r12, %rdi
movq -0x178(%rbp), %r13
je 0x5bd6
callq 0x3270
leaq -0x458(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
addq %rsi, %rdx
leaq -0x468(%rbp), %rdi
callq 0x88b4
movq -0x128(%rbp), %rsi
addq $0x30, %rsi
leaq -0x428(%rbp), %rdi
leaq -0x468(%rbp), %rdx
leaq -0x2b8(%rbp), %r9
movq %rbx, %rcx
movq -0x68(%rbp), %r8
callq 0x128f0
leaq -0x428(%rbp), %rsi
movq %r13, %rdi
callq 0x13620
leaq -0x428(%rbp), %rdi
callq 0x7a6a
movq -0x468(%rbp), %rdi
cmpq %r12, %rdi
je 0x5c57
callq 0x3270
movq -0x1a8(%rbp), %rdi
cmpq %r15, %rdi
je 0x5c68
callq 0x3270
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x5c80
callq 0x3270
movq -0x170(%rbp), %rdi
cmpq %r14, %rdi
je 0x5c91
callq 0x3270
leaq -0x290(%rbp), %rbx
movq %rbx, %rdi
callq 0x844c
movq -0x20(%rbx), %rdi
leaq -0x2a0(%rbp), %rax
cmpq %rax, %rdi
jne 0x59e6
jmp 0x59eb
leaq 0xe4bf(%rip), %rdi      # 0x1417f
leaq 0xe442(%rip), %rsi      # 0x14109
leaq 0xe4b7(%rip), %rcx      # 0x14185
movl $0xa5, %edx
callq 0x31a0
leaq 0xe4a0(%rip), %rdi      # 0x1417f
leaq 0xe423(%rip), %rsi      # 0x14109
leaq 0xe498(%rip), %rcx      # 0x14185
movl $0xb5, %edx
callq 0x31a0
movq %rax, %rbx
leaq -0x428(%rbp), %rdi
callq 0x7a6a
jmp 0x5d0b
movq %rax, %rbx
movq -0x468(%rbp), %rdi
jmp 0x5d34
movq %rax, %rbx
movq -0x4f0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5d2d
callq 0x3270
jmp 0x5d2d
movq %rax, %rbx
movq -0x488(%rbp), %rdi
cmpq %r12, %rdi
je 0x5d5b
callq 0x3270
jmp 0x5d5b
jmp 0x5d42
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x5d67
jmp 0x5d6c
movq %rax, %rbx
jmp 0x5d6c
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
cmpq %r15, %rdi
je 0x5d6c
callq 0x3270
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
jne 0x5dad
jmp 0x5fad
movq %rax, %rbx
movq -0x4a8(%rbp), %rdi
cmpq %r15, %rdi
je 0x5d9d
callq 0x3270
jmp 0x5d9d
movq %rax, %rbx
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x5fad
callq 0x3270
jmp 0x5fad
movq %rax, %rbx
leaq -0x410(%rbp), %rdi
jmp 0x604d
movq %rax, %rbx
jmp 0x6052
movq %rax, %rbx
movq -0x448(%rbp), %rdi
cmpq %r14, %rdi
jne 0x603c
jmp 0x605e
jmp 0x5fd4
movq %rax, %rbx
jmp 0x6071
movq %rax, %rbx
jmp 0x6082
jmp 0x5e0c
movq %rax, %rbx
movq -0x4c8(%rbp), %rdi
jmp 0x5f6a
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0x5f6a
movq %rax, %rbx
movq -0x390(%rbp), %rdi
leaq -0x380(%rbp), %rax
cmpq %rax, %rdi
je 0x5e3b
callq 0x3270
jmp 0x5e3b
movq %rax, %rbx
movq -0x230(%rbp), %rdi
leaq -0x220(%rbp), %rax
jmp 0x5f4e
movq %rax, %rbx
movq -0x3c0(%rbp), %rdi
leaq -0x3b0(%rbp), %rax
cmpq %rax, %rdi
je 0x5e6e
callq 0x3270
jmp 0x5e6e
movq %rax, %rbx
movq -0x250(%rbp), %rdi
leaq -0x240(%rbp), %rax
jmp 0x5f4e
jmp 0x5f81
movq %rax, %rbx
movq -0x330(%rbp), %rdi
leaq -0x320(%rbp), %rax
cmpq %rax, %rdi
je 0x5ea6
callq 0x3270
jmp 0x5ea6
movq %rax, %rbx
movq -0x1f0(%rbp), %rdi
leaq -0x1e0(%rbp), %rax
jmp 0x5f4e
movq %rax, %rbx
movq -0x360(%rbp), %rdi
leaq -0x350(%rbp), %rax
cmpq %rax, %rdi
je 0x5ed9
callq 0x3270
jmp 0x5ed9
movq %rax, %rbx
movq -0x210(%rbp), %rdi
leaq -0x200(%rbp), %rax
jmp 0x5f4e
jmp 0x5f81
movq %rax, %rbx
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0x5f0e
callq 0x3270
jmp 0x5f0e
movq %rax, %rbx
movq -0x1d0(%rbp), %rdi
leaq -0x1c0(%rbp), %rax
jmp 0x5f4e
jmp 0x5f81
movq %rax, %rbx
movq -0x3f0(%rbp), %rdi
leaq -0x3e0(%rbp), %rax
cmpq %rax, %rdi
je 0x5f40
callq 0x3270
jmp 0x5f40
movq %rax, %rbx
movq -0x270(%rbp), %rdi
leaq -0x260(%rbp), %rax
cmpq %rax, %rdi
jne 0x5fe8
jmp 0x5fed
jmp 0x5f81
jmp 0x5f60
movq %rax, %rbx
movq -0x2b8(%rbp), %rdi
cmpq %r14, %rdi
je 0x608e
callq 0x3270
jmp 0x608e
jmp 0x5faa
jmp 0x5f81
movq %rax, %rbx
jmp 0x5fed
jmp 0x5f97
jmp 0x5fdc
movq %rax, %rbx
jmp 0x6029
movq %rax, %rbx
jmp 0x6011
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
jmp 0x6007
movq %rax, %rbx
leaq -0x160(%rbp), %r14
jmp 0x6071
jmp 0x6043
movq %rax, %rbx
movq -0x2d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x6046
callq 0x3270
jmp 0x6046
movq %rax, %rbx
jmp 0x605e
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x5fed
callq 0x3270
leaq -0xa0(%rbp), %rdi
callq 0x859c
movq -0x148(%rbp), %rdi
leaq -0x138(%rbp), %rax
cmpq %rax, %rdi
je 0x6011
callq 0x3270
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x6029
callq 0x3270
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x605e
callq 0x3270
jmp 0x605e
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x7a6a
leaq -0xe0(%rbp), %rdi
callq 0x7a6a
leaq -0x160(%rbp), %r14
leaq -0x1a8(%rbp), %rdi
callq 0x859c
movq -0x170(%rbp), %rdi
cmpq %r14, %rdi
je 0x6082
callq 0x3270
leaq -0x2b8(%rbp), %rdi
callq 0x7a3c
movq %rbx, %rdi
callq 0x3480