// File: /workspace/github_cpp_makefile_star2_O1/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 $0x4c8, %rsp            # imm = 0x4C8
movq %rcx, -0x38(%rbp)
movq %rsi, %r15
movq %rdi, %r13
leaq -0x298(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rdx), %rsi
movq %rdx, -0x118(%rbp)
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
leaq -0x2a8(%rbp), %rbx
movq %rbx, %rdi
callq 0x8766
leaq 0xf511(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0x2a8(%rbp), %rsi
movq %r15, %rdi
callq 0xdd18
movl %eax, %ebx
movq -0x2a8(%rbp), %rdi
cmpq %r14, %rdi
je 0x4b6a
callq 0x3270
testb %bl, %bl
je 0x5926
leaq -0x100(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x118(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %rbx
movq %rbx, %rdi
callq 0x8766
leaq 0xf4ad(%rip), %rsi      # 0x14051
movq %rbx, %rdi
callq 0x34f0
leaq -0x2a8(%rbp), %rdi
leaq -0x110(%rbp), %rdx
movq %r15, %rsi
callq 0xde70
movq -0x110(%rbp), %rdi
cmpq %r14, %rdi
je 0x4bd3
callq 0x3270
leaq -0x188(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x198(%rbp), %rdi
callq 0x8766
movq %r15, -0x30(%rbp)
movq %r13, -0x148(%rbp)
leaq 0xf4b1(%rip), %rsi      # 0x140be
leaq -0x198(%rbp), %rdi
callq 0x34f0
movq -0x38(%rbp), %rax
movq (%rax), %r13
cmpq %r13, 0x8(%rax)
je 0x4cd6
leaq -0x108(%rbp), %rbx
leaq -0xf8(%rbp), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%r13,%r15), %rax
movq %rax, -0x110(%rbp)
movq %r14, -0x108(%rbp)
movq 0x10(%r13,%r15), %rsi
movq 0x18(%r13,%r15), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x8766
movl 0x30(%r13,%r15), %eax
movl %eax, -0xe8(%rbp)
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
movslq (%rcx,%r15), %rcx
movq -0x280(%rbp), %rdx
leaq (%rcx,%rcx,2), %rcx
shlq $0x5, %rcx
cmpl %eax, 0x20(%rdx,%rcx)
jne 0x597f
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x4ca6
callq 0x3270
incq %r12
movq -0x38(%rbp), %rax
movq (%rax), %r13
movq 0x8(%rax), %rax
subq %r13, %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
addq $0x38, %r15
cmpq %rax, %r12
jb 0x4c3e
movq -0x38(%rbp), %rax
movq (%rax), %r13
cmpq %r13, 0x8(%rax)
je 0x4d9d
leaq -0x108(%rbp), %rbx
leaq -0xf8(%rbp), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpl $0x2, 0x4(%r13,%r15)
jne 0x4d6d
movq 0x8(%r13,%r15), %rax
movq %rax, -0x110(%rbp)
movq %r14, -0x108(%rbp)
movq 0x10(%r13,%r15), %rsi
movq 0x18(%r13,%r15), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x8766
movl 0x30(%r13,%r15), %eax
movl %eax, -0xe8(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq (%rax,%r15), %rax
movq -0x280(%rbp), %rcx
leaq (%rax,%rax,2), %r13
shlq $0x5, %r13
cmpq $0x0, 0x58(%rcx,%r13)
jne 0x59c6
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x4d6d
callq 0x3270
incq %r12
movq -0x38(%rbp), %rax
movq (%rax), %r13
movq 0x8(%rax), %rax
subq %r13, %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
addq $0x38, %r15
cmpq %rax, %r12
jb 0x4cfb
leaq -0x170(%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 -0x428(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x198(%rbp), %rsi
movq -0x190(%rbp), %rdx
addq %rsi, %rdx
leaq -0x438(%rbp), %rdi
callq 0x8766
movq -0x30(%rbp), %rax
leaq 0x30(%rax), %rsi
leaq -0x110(%rbp), %rdi
leaq -0x438(%rbp), %rdx
leaq -0x2a8(%rbp), %rcx
movq %rsi, -0x1a0(%rbp)
callq 0x12ade
leaq -0x178(%rbp), %rdi
callq 0x83dc
movq -0x100(%rbp), %rax
testq %rax, %rax
je 0x4e6e
leaq -0x108(%rbp), %rcx
movl (%rcx), %edx
movl %edx, -0x170(%rbp)
movq %rax, -0x168(%rbp)
movups 0x10(%rcx), %xmm0
movups %xmm0, -0x160(%rbp)
leaq -0x170(%rbp), %rdx
movq %rdx, 0x8(%rax)
movq 0x20(%rcx), %rax
movq %rax, -0x150(%rbp)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq -0x110(%rbp), %rdi
callq 0x8454
movq -0x438(%rbp), %rdi
cmpq %r14, %rdi
je 0x4e8b
callq 0x3270
movq -0x38(%rbp), %rax
movq (%rax), %r14
cmpq %r14, 0x8(%rax)
je 0x5734
addq $0x40, -0x30(%rbp)
leaq -0xd0(%rbp), %r15
leaq -0x178(%rbp), %rbx
xorl %r12d, %r12d
imulq $0x38, %r12, %r13
movq (%r14,%r13), %rax
movq %rax, -0x110(%rbp)
movq 0x8(%r14,%r13), %rax
movq %rax, -0x108(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq 0x10(%r14,%r13), %rsi
movq 0x18(%r14,%r13), %rdx
addq %rsi, %rdx
leaq -0x100(%rbp), %rdi
callq 0x8766
addq %r13, %r14
movl 0x30(%r14), %eax
movl %eax, -0xe0(%rbp)
movslq -0x110(%rbp), %rax
movq -0x280(%rbp), %rcx
leaq (%rax,%rax,2), %r14
shlq $0x5, %r14
cmpq $0x0, 0x58(%rcx,%r14)
je 0x56f0
movq -0x108(%rbp), %rax
movq -0x100(%rbp), %rsi
movq %rax, -0xa0(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xf8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %rdi
callq 0x8766
movl -0xe0(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x8766
movq %r15, %rdi
leaq 0xf33a(%rip), %rsi      # 0x142d0
callq 0x34f0
movq -0x280(%rbp), %rax
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
movq %r15, %rdi
callq 0x30c0
leaq -0x128(%rbp), %rsi
movq %rsi, -0x138(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0xc8(%rbp), %r14
je 0x4fea
movq %rdx, -0x138(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x128(%rbp)
jmp 0x4ff0
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x130(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x5022
callq 0x3270
movl $0x0, -0xc8(%rbp)
xorl %eax, %eax
movq %rax, -0xc0(%rbp)
movq %r14, -0xb8(%rbp)
movq %r14, -0xb0(%rbp)
movq %rax, -0xa8(%rbp)
movl -0x10c(%rbp), %eax
cmpq $0x5, %rax
ja 0x5c28
leaq 0xefbf(%rip), %rcx      # 0x14020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x250(%rbp), %rax
movq %rax, -0x260(%rbp)
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
addq %rsi, %rdx
leaq -0x260(%rbp), %rdi
callq 0x8766
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rsi
movq %rax, -0x3e8(%rbp)
leaq -0x3d0(%rbp), %rax
movq %rax, -0x3e0(%rbp)
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x3e0(%rbp), %rdi
callq 0x8766
movl -0x78(%rbp), %eax
movl %eax, -0x3c0(%rbp)
leaq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x260(%rbp), %rdx
leaq -0x3e8(%rbp), %rcx
callq 0xc588
movq %r15, %rdi
callq 0x83dc
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x5143
movl -0x60(%rbp), %ecx
movl %ecx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
movups -0x50(%rbp), %xmm0
movups %xmm0, -0xb8(%rbp)
movq %r14, 0x8(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0xa8(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x58(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rax, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8454
movq -0x3e0(%rbp), %rdi
leaq -0x3d0(%rbp), %rax
cmpq %rax, %rdi
je 0x5164
callq 0x3270
movq -0x260(%rbp), %rdi
leaq -0x250(%rbp), %rax
jmp 0x528f
movq %r15, %rdi
movq %rbx, %rsi
callq 0x846c
jmp 0x5650
leaq -0x1b0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1c0(%rbp), %rdi
callq 0x8766
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rsi
movq %rax, -0x2f8(%rbp)
leaq -0x2e0(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x2f0(%rbp), %rdi
callq 0x8766
movl -0x78(%rbp), %eax
movl %eax, -0x2d0(%rbp)
leaq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x1c0(%rbp), %rdx
leaq -0x2f8(%rbp), %rcx
callq 0xc428
movq %r15, %rdi
callq 0x83dc
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x5260
movl -0x60(%rbp), %ecx
movl %ecx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
movups -0x50(%rbp), %xmm0
movups %xmm0, -0xb8(%rbp)
movq %r14, 0x8(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0xa8(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x58(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rax, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8454
movq -0x2f0(%rbp), %rdi
leaq -0x2e0(%rbp), %rax
cmpq %rax, %rdi
je 0x5281
callq 0x3270
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0x5650
callq 0x3270
jmp 0x5650
leaq -0x1f0(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
addq %rsi, %rdx
leaq -0x200(%rbp), %rdi
callq 0x8766
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rsi
movq %rax, -0x358(%rbp)
leaq -0x340(%rbp), %rax
movq %rax, -0x350(%rbp)
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x350(%rbp), %rdi
callq 0x8766
movl -0x78(%rbp), %eax
movl %eax, -0x330(%rbp)
leaq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x200(%rbp), %rdx
leaq -0x358(%rbp), %rcx
callq 0xc428
movq %r15, %rdi
callq 0x83dc
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x537b
movl -0x60(%rbp), %ecx
movl %ecx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
movups -0x50(%rbp), %xmm0
movups %xmm0, -0xb8(%rbp)
movq %r14, 0x8(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0xa8(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x58(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rax, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8454
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
je 0x539c
callq 0x3270
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0x53b4
callq 0x3270
leaq -0x1d0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x8766
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rsi
movq %rax, -0x328(%rbp)
leaq -0x310(%rbp), %rax
movq %rax, -0x320(%rbp)
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x320(%rbp), %rdi
callq 0x8766
movl -0x78(%rbp), %eax
movl %eax, -0x300(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
leaq -0x328(%rbp), %rdx
callq 0xc34e
movq %rax, -0x140(%rbp)
movq -0x320(%rbp), %rdi
leaq -0x310(%rbp), %rax
cmpq %rax, %rdi
je 0x5457
callq 0x3270
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
jmp 0x562d
leaq -0x230(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
addq %rsi, %rdx
leaq -0x240(%rbp), %rdi
callq 0x8766
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rsi
movq %rax, -0x3b8(%rbp)
leaq -0x3a0(%rbp), %rax
movq %rax, -0x3b0(%rbp)
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x3b0(%rbp), %rdi
callq 0x8766
movl -0x78(%rbp), %eax
movl %eax, -0x390(%rbp)
leaq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x240(%rbp), %rdx
leaq -0x3b8(%rbp), %rcx
callq 0xc588
movq %r15, %rdi
callq 0x83dc
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x5543
movl -0x60(%rbp), %ecx
movl %ecx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
movups -0x50(%rbp), %xmm0
movups %xmm0, -0xb8(%rbp)
movq %r14, 0x8(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0xa8(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x58(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rax, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8454
movq -0x3b0(%rbp), %rdi
leaq -0x3a0(%rbp), %rax
cmpq %rax, %rdi
je 0x5564
callq 0x3270
movq -0x240(%rbp), %rdi
leaq -0x230(%rbp), %rax
cmpq %rax, %rdi
je 0x557c
callq 0x3270
leaq -0x210(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
addq %rsi, %rdx
leaq -0x220(%rbp), %rdi
callq 0x8766
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rsi
movq %rax, -0x388(%rbp)
leaq -0x370(%rbp), %rax
movq %rax, -0x380(%rbp)
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x380(%rbp), %rdi
callq 0x8766
movl -0x78(%rbp), %eax
movl %eax, -0x360(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x220(%rbp), %rsi
leaq -0x388(%rbp), %rdx
callq 0xc34e
movq %rax, -0x140(%rbp)
movq -0x380(%rbp), %rdi
leaq -0x370(%rbp), %rax
cmpq %rax, %rdi
je 0x561f
callq 0x3270
movq -0x220(%rbp), %rdi
leaq -0x210(%rbp), %rax
cmpq %rax, %rdi
je 0x5637
callq 0x3270
cmpq $-0x1, -0x140(%rbp)
je 0x5650
movq %r15, %rdi
leaq -0x140(%rbp), %rsi
callq 0x8d7e
movq -0x150(%rbp), %rsi
leaq -0x68(%rbp), %rdi
leaq -0x69(%rbp), %rdx
callq 0x796c
movq -0x160(%rbp), %rdi
movq -0xb8(%rbp), %rdx
movq -0x68(%rbp), %r8
leaq -0x170(%rbp), %rsi
movq %r14, %rcx
callq 0x8ec8
movq %rax, %r13
movq %rbx, %rdi
callq 0x83dc
movq -0x68(%rbp), %r14
cmpq %r13, %r14
je 0x56aa
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8d7e
addq $0x8, %r14
jmp 0x5694
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x56b8
callq 0x3270
movq %r15, %rdi
callq 0x8454
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x56d8
callq 0x3270
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x56f0
callq 0x3270
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x5708
callq 0x3270
incq %r12
movq -0x38(%rbp), %rax
movq (%rax), %r14
movq 0x8(%rax), %rax
subq %r14, %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
cmpq %rax, %r12
jb 0x4eb2
xorps %xmm0, %xmm0
movaps %xmm0, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x160(%rbp), %rcx
leaq -0x170(%rbp), %rax
cmpq %rax, %rcx
je 0x58d4
leaq -0x2b8(%rbp), %r12
leaq -0x2c8(%rbp), %rbx
leaq -0xa0(%rbp), %r13
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, -0x118(%rbp)
movq 0x20(%rcx), %r14
xorps %xmm0, %xmm0
movaps %xmm0, -0xd0(%rbp)
movq $0x0, -0xc0(%rbp)
movq %r12, -0x2c8(%rbp)
movq -0x198(%rbp), %rsi
movq -0x190(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x8766
leaq -0x68(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq -0x38(%rbp), %r8
leaq -0x2a8(%rbp), %r9
callq 0x1278c
xorps %xmm0, %xmm0
movaps %xmm0, -0x110(%rbp)
movaps -0xd0(%rbp), %xmm0
movq -0xc0(%rbp), %rax
movups -0x68(%rbp), %xmm1
movaps %xmm1, -0xd0(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movaps -0x110(%rbp), %xmm1
movaps %xmm0, -0x110(%rbp)
movq %rax, -0x100(%rbp)
movups %xmm1, -0x68(%rbp)
movq $0x0, -0x58(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x7926
leaq -0x68(%rbp), %rdi
callq 0x7926
movq -0x2c8(%rbp), %rdi
cmpq %r12, %rdi
je 0x5855
callq 0x3270
movq -0xd0(%rbp), %rsi
cmpq %rsi, -0xc8(%rbp)
je 0x589b
xorl %r14d, %r14d
xorl %r12d, %r12d
addq %r14, %rsi
movq %r13, %rdi
callq 0x7a00
incq %r12
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rax
subq %rsi, %rax
sarq $0x3, %rax
imulq %r15, %rax
addq $0x18, %r14
cmpq %rax, %r12
jb 0x586b
leaq -0xd0(%rbp), %rdi
callq 0x7926
movq -0x118(%rbp), %rdi
callq 0x3320
movq %rax, %rcx
leaq -0x170(%rbp), %rax
cmpq %rax, %rcx
leaq -0x2b8(%rbp), %r12
leaq -0x2c8(%rbp), %rbx
jne 0x577f
leaq -0x400(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7a3c
leaq -0x400(%rbp), %rsi
movq -0x148(%rbp), %r13
movq %r13, %rdi
callq 0x134ee
leaq -0x400(%rbp), %rdi
callq 0x7926
leaq -0xa0(%rbp), %rdi
callq 0x7926
leaq -0x178(%rbp), %rdi
callq 0x8454
jmp 0x5bc9
leaq -0x4a8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xe720(%rip), %rsi      # 0x14058
leaq 0xe72d(%rip), %rdx      # 0x1406c
leaq -0x4b8(%rbp), %rbx
movq %rbx, %rdi
callq 0x8800
movq %r13, %rdi
movq %rbx, %rsi
callq 0x134ae
movq -0x4b8(%rbp), %rdi
cmpq %r14, %rdi
je 0x596a
callq 0x3270
movq %r13, %rax
addq $0x4c8, %rsp            # imm = 0x4C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x488(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xe7e0(%rip), %rsi      # 0x14171
leaq 0xe7e6(%rip), %rdx      # 0x1417e
leaq -0x498(%rbp), %rdi
callq 0x8800
movq -0x148(%rbp), %r13
leaq -0x498(%rbp), %rsi
movq %r13, %rdi
callq 0x134ae
movq -0x498(%rbp), %rdi
jmp 0x5bae
leaq -0x90(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x118(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x8766
leaq 0xe8da(%rip), %rsi      # 0x142d0
leaq -0xa0(%rbp), %rdi
callq 0x34f0
movq -0x280(%rbp), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x30c0
leaq -0x168(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5a4b
movq %rdx, -0x178(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x168(%rbp)
jmp 0x5a52
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x170(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
je 0x5a7d
callq 0x3270
leaq -0x468(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
addq %rsi, %rdx
leaq -0x478(%rbp), %rdi
callq 0x8766
movq -0x110(%rbp), %rax
movq -0x108(%rbp), %rsi
leaq -0x4e0(%rbp), %rdi
movq %rax, -0x8(%rdi)
leaq -0x4d0(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x100(%rbp), %rdx
addq %rsi, %rdx
callq 0x8766
movl -0xe8(%rbp), %eax
leaq -0x4e8(%rbp), %rdx
movl %eax, 0x28(%rdx)
movq -0x30(%rbp), %rax
leaq 0x40(%rax), %rdi
leaq -0x478(%rbp), %rsi
callq 0xc34e
movq %rax, %rbx
movq -0x4e0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5b11
callq 0x3270
movq -0x478(%rbp), %rdi
cmpq %r12, %rdi
movq -0x148(%rbp), %r13
je 0x5b29
callq 0x3270
leaq -0x448(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x198(%rbp), %rsi
movq -0x190(%rbp), %rdx
addq %rsi, %rdx
leaq -0x458(%rbp), %rdi
callq 0x8766
movq -0x30(%rbp), %rsi
addq $0x30, %rsi
leaq -0x418(%rbp), %rdi
leaq -0x458(%rbp), %rdx
leaq -0x2a8(%rbp), %r9
movq %rbx, %rcx
movq -0x38(%rbp), %r8
callq 0x1278c
leaq -0x418(%rbp), %rsi
movq %r13, %rdi
callq 0x134ee
leaq -0x418(%rbp), %rdi
callq 0x7926
movq -0x458(%rbp), %rdi
cmpq %r12, %rdi
je 0x5ba7
callq 0x3270
movq -0x178(%rbp), %rdi
cmpq %r15, %rdi
je 0x5bb8
callq 0x3270
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x5bc9
callq 0x3270
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0x5be1
callq 0x3270
leaq -0x280(%rbp), %rbx
movq %rbx, %rdi
callq 0x8304
movq -0x20(%rbx), %rdi
leaq -0x290(%rbp), %rax
cmpq %rax, %rdi
jne 0x5965
jmp 0x596a
leaq 0xe56f(%rip), %rdi      # 0x1417f
leaq 0xe4f2(%rip), %rsi      # 0x14109
leaq 0xe567(%rip), %rcx      # 0x14185
movl $0xa5, %edx
callq 0x31a0
leaq 0xe550(%rip), %rdi      # 0x1417f
leaq 0xe4d3(%rip), %rsi      # 0x14109
leaq 0xe548(%rip), %rcx      # 0x14185
movl $0xb5, %edx
callq 0x31a0
movq %rax, %rbx
leaq -0x418(%rbp), %rdi
callq 0x7926
jmp 0x5c5b
movq %rax, %rbx
movq -0x458(%rbp), %rdi
jmp 0x5c84
movq %rax, %rbx
movq -0x4e0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5c7d
callq 0x3270
jmp 0x5c7d
movq %rax, %rbx
movq -0x478(%rbp), %rdi
cmpq %r12, %rdi
je 0x5ca8
callq 0x3270
jmp 0x5ca8
jmp 0x5c92
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x5cc0
jmp 0x5cca
jmp 0x5cc7
movq %rax, %rbx
movq -0x178(%rbp), %rdi
jmp 0x5cbb
movq %rax, %rbx
movq -0x498(%rbp), %rdi
cmpq %r15, %rdi
je 0x5cca
callq 0x3270
jmp 0x5cca
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x5f8d
callq 0x3270
jmp 0x5f8d
movq %rax, %rbx
leaq -0x400(%rbp), %rdi
jmp 0x5f70
movq %rax, %rbx
jmp 0x5f75
movq %rax, %rbx
movq -0x438(%rbp), %rdi
cmpq %r14, %rdi
jne 0x5f5f
jmp 0x5f81
jmp 0x5ef7
jmp 0x5ed4
movq %rax, %rbx
jmp 0x5fa5
jmp 0x5d36
movq %rax, %rbx
movq -0x4b8(%rbp), %rdi
jmp 0x5e94
movq %rax, %rbx
movq -0x110(%rbp), %rdi
jmp 0x5e94
movq %rax, %rbx
movq -0x380(%rbp), %rdi
leaq -0x370(%rbp), %rax
cmpq %rax, %rdi
je 0x5d65
callq 0x3270
jmp 0x5d65
movq %rax, %rbx
movq -0x220(%rbp), %rdi
leaq -0x210(%rbp), %rax
jmp 0x5e78
movq %rax, %rbx
movq -0x3b0(%rbp), %rdi
leaq -0x3a0(%rbp), %rax
cmpq %rax, %rdi
je 0x5d98
callq 0x3270
jmp 0x5d98
movq %rax, %rbx
movq -0x240(%rbp), %rdi
leaq -0x230(%rbp), %rax
jmp 0x5e78
jmp 0x5eab
movq %rax, %rbx
movq -0x320(%rbp), %rdi
leaq -0x310(%rbp), %rax
cmpq %rax, %rdi
je 0x5dd0
callq 0x3270
jmp 0x5dd0
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
jmp 0x5e78
movq %rax, %rbx
movq -0x350(%rbp), %rdi
leaq -0x340(%rbp), %rax
cmpq %rax, %rdi
je 0x5e03
callq 0x3270
jmp 0x5e03
movq %rax, %rbx
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
jmp 0x5e78
jmp 0x5eab
movq %rax, %rbx
movq -0x2f0(%rbp), %rdi
leaq -0x2e0(%rbp), %rax
cmpq %rax, %rdi
je 0x5e38
callq 0x3270
jmp 0x5e38
movq %rax, %rbx
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
jmp 0x5e78
jmp 0x5eab
movq %rax, %rbx
movq -0x3e0(%rbp), %rdi
leaq -0x3d0(%rbp), %rax
cmpq %rax, %rdi
je 0x5e6a
callq 0x3270
jmp 0x5e6a
movq %rax, %rbx
movq -0x260(%rbp), %rdi
leaq -0x250(%rbp), %rax
cmpq %rax, %rdi
jne 0x5f0b
jmp 0x5f10
jmp 0x5eab
jmp 0x5e8a
movq %rax, %rbx
movq -0x2a8(%rbp), %rdi
cmpq %r14, %rdi
je 0x5fb1
callq 0x3270
jmp 0x5fb1
jmp 0x5ed4
jmp 0x5eab
movq %rax, %rbx
jmp 0x5f10
jmp 0x5ec1
jmp 0x5eff
movq %rax, %rbx
jmp 0x5f4c
movq %rax, %rbx
jmp 0x5f34
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
jmp 0x5f2a
movq %rax, %rbx
jmp 0x5f8d
jmp 0x5f66
movq %rax, %rbx
movq -0x2c8(%rbp), %rdi
cmpq %r12, %rdi
je 0x5f69
callq 0x3270
jmp 0x5f69
movq %rax, %rbx
jmp 0x5f81
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x5f10
callq 0x3270
leaq -0xd0(%rbp), %rdi
callq 0x8454
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x5f34
callq 0x3270
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x5f4c
callq 0x3270
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x5f81
callq 0x3270
jmp 0x5f81
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x7926
leaq -0xa0(%rbp), %rdi
callq 0x7926
leaq -0x178(%rbp), %rdi
callq 0x8454
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0x5fa5
callq 0x3270
leaq -0x2a8(%rbp), %rdi
callq 0x78f8
movq %rbx, %rdi
callq 0x3480
nop