// File: 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
subq $0x8c0, %rsp            # imm = 0x8C0
movq %rdi, -0x7e0(%rbp)
movq %rdi, %rax
movq %rax, -0x7d8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x7d0(%rbp)
movq -0x18(%rbp), %rsi
leaq 0x22493(%rip), %rdx     # 0x27035
leaq -0x40(%rbp), %rdi
movq %rdi, -0x7c8(%rbp)
callq 0x76d0
movq -0x7d0(%rbp), %rdi
movq -0x7c8(%rbp), %rsi
callq 0x1b550
movb %al, -0x7b9(%rbp)
jmp 0x4bcd
movb -0x7b9(%rbp), %al
xorb $-0x1, %al
movb %al, -0x7e1(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x35b8
movb -0x7e1(%rbp), %al
testb $0x1, %al
jne 0x4bf3
jmp 0x4c90
leaq -0x71(%rbp), %rdi
movq %rdi, -0x7f0(%rbp)
callq 0x3500
movq -0x7f0(%rbp), %rdx
leaq 0x2242b(%rip), %rsi     # 0x2703c
leaq -0x70(%rbp), %rdi
callq 0x3400
jmp 0x4c1c
movq -0x7e0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x24ba0
jmp 0x4c2e
leaq -0x70(%rbp), %rdi
callq 0x35b8
leaq -0x71(%rbp), %rdi
callq 0x3320
jmp 0x5e40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x35b8
jmp 0x5e50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4c82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x35b8
leaq -0x71(%rbp), %rdi
callq 0x3320
jmp 0x5e50
movq -0x18(%rbp), %rsi
leaq 0x2239a(%rip), %rdx     # 0x27035
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x7f8(%rbp)
callq 0x76d0
movq -0x7d0(%rbp), %rsi
movq -0x7f8(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x1b750
jmp 0x4cca
leaq -0xe0(%rbp), %rdi
callq 0x35b8
movq -0x18(%rbp), %rsi
leaq 0x223c1(%rip), %rdx     # 0x270a2
leaq -0x100(%rbp), %rdi
callq 0x76d0
jmp 0x4cef
movq $0x0, -0x108(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x800(%rbp)
movq -0x20(%rbp), %rdi
callq 0x7a50
movq %rax, %rcx
movq -0x800(%rbp), %rax
cmpq %rcx, %rax
jae 0x4eb3
movq -0x20(%rbp), %rdi
movq -0x108(%rbp), %rsi
callq 0x7a80
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x138(%rbp), %rdi
callq 0x7aa0
jmp 0x4d49
movq -0x20(%rbp), %rdi
movq -0x108(%rbp), %rsi
callq 0x7a80
movl (%rax), %eax
movl %eax, -0x13c(%rbp)
leaq -0xc0(%rbp), %rdi
addq $0x28, %rdi
movslq -0x13c(%rbp), %rsi
callq 0x7810
movl 0x20(%rax), %eax
cmpl -0x110(%rbp), %eax
je 0x4e74
leaq -0x161(%rbp), %rdi
movq %rdi, -0x808(%rbp)
callq 0x3500
movq -0x808(%rbp), %rdx
leaq 0x223ad(%rip), %rsi     # 0x27155
leaq -0x160(%rbp), %rdi
callq 0x3400
jmp 0x4db6
movq -0x7e0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x24ba0
jmp 0x4dcb
leaq -0x160(%rbp), %rdi
callq 0x35b8
leaq -0x161(%rbp), %rdi
callq 0x3320
movl $0x1, -0x168(%rbp)
jmp 0x4e7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x35b8
jmp 0x5e50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5e32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5e26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4e57
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x35b8
leaq -0x161(%rbp), %rdi
callq 0x3320
leaq -0x138(%rbp), %rdi
callq 0x7af0
jmp 0x5e26
movl $0x0, -0x168(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x7af0
movl -0x168(%rbp), %eax
testl %eax, %eax
jne 0x5e0c
jmp 0x4e9a
jmp 0x4e9c
movq -0x108(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x108(%rbp)
jmp 0x4cfa
movq $0x0, -0x170(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x810(%rbp)
movq -0x20(%rbp), %rdi
callq 0x7a50
movq %rax, %rcx
movq -0x810(%rbp), %rax
cmpq %rcx, %rax
jae 0x51cc
movq -0x20(%rbp), %rdi
movq -0x170(%rbp), %rsi
callq 0x7a80
cmpl $0x2, 0x4(%rax)
jne 0x51b3
movq -0x20(%rbp), %rdi
movq -0x170(%rbp), %rsi
callq 0x7a80
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x1a0(%rbp), %rdi
callq 0x7aa0
jmp 0x4f27
movq -0x20(%rbp), %rdi
movq -0x170(%rbp), %rsi
callq 0x7a80
movl (%rax), %eax
movl %eax, -0x1a4(%rbp)
leaq -0xc0(%rbp), %rdi
addq $0x28, %rdi
movslq -0x1a4(%rbp), %rsi
callq 0x7810
movq %rax, %rdi
addq $0x30, %rdi
callq 0x7b10
testb $0x1, %al
jne 0x517a
movq -0x18(%rbp), %rsi
leaq 0x22315(%rip), %rdx     # 0x2728a
leaq -0x1e8(%rbp), %rdi
callq 0x76d0
jmp 0x4f83
leaq -0x98(%rbp), %rdi
movslq -0x1a4(%rbp), %rsi
callq 0x7810
movq %rax, %rdx
leaq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x78a0
jmp 0x4fae
leaq -0x1e8(%rbp), %rdi
callq 0x35b8
leaq -0x210(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x3130
jmp 0x4fcf
leaq -0x240(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x7aa0
jmp 0x4fe4
movq -0x7d0(%rbp), %rdi
leaq -0x210(%rbp), %rsi
leaq -0x240(%rbp), %rdx
callq 0x5e60
movq %rax, -0x818(%rbp)
jmp 0x5007
leaq -0x240(%rbp), %rdi
callq 0x7af0
leaq -0x210(%rbp), %rdi
callq 0x35b8
movq -0x818(%rbp), %rcx
movq -0x7d0(%rbp), %rax
movq %rcx, -0x1f0(%rbp)
addq $0x30, %rax
movq %rax, -0x820(%rbp)
leaq -0x278(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x3130
jmp 0x5054
movq -0x820(%rbp), %rsi
movq -0x1f0(%rbp), %rcx
movq -0x20(%rbp), %r8
leaq -0x258(%rbp), %rdi
leaq -0x278(%rbp), %rdx
leaq -0xc0(%rbp), %r9
callq 0x23850
jmp 0x5082
movq -0x7e0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x24be0
jmp 0x5097
leaq -0x258(%rbp), %rdi
callq 0x7b30
leaq -0x278(%rbp), %rdi
callq 0x35b8
movl $0x1, -0x168(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x35b8
jmp 0x5184
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x51a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x35b8
jmp 0x51a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x516c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x512c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x7af0
leaq -0x210(%rbp), %rdi
callq 0x35b8
jmp 0x516c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5160
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x7b30
leaq -0x278(%rbp), %rdi
callq 0x35b8
leaq -0x1c8(%rbp), %rdi
callq 0x35b8
jmp 0x51a2
movl $0x0, -0x168(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x7af0
movl -0x168(%rbp), %eax
testl %eax, %eax
jne 0x5e0c
jmp 0x51a0
jmp 0x51b3
leaq -0x1a0(%rbp), %rdi
callq 0x7af0
jmp 0x5e26
jmp 0x51b5
movq -0x170(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x170(%rbp)
jmp 0x4ebe
leaq -0x2a8(%rbp), %rdi
callq 0x7b90
movq -0x7d0(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x828(%rbp)
leaq -0x2f8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x3130
jmp 0x51ff
movq -0x828(%rbp), %rsi
leaq -0x2d8(%rbp), %rdi
leaq -0x2f8(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x23ca0
jmp 0x5222
leaq -0x2a8(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x7bb0
leaq -0x2d8(%rbp), %rdi
callq 0x7be0
leaq -0x2f8(%rbp), %rdi
callq 0x35b8
movq $0x0, -0x300(%rbp)
movq -0x300(%rbp), %rax
movq %rax, -0x830(%rbp)
movq -0x20(%rbp), %rdi
callq 0x7a50
movq %rax, %rcx
movq -0x830(%rbp), %rax
cmpq %rcx, %rax
jae 0x5bb0
movq -0x20(%rbp), %rdi
movq -0x300(%rbp), %rsi
callq 0x7a80
movq %rax, %rsi
leaq -0x338(%rbp), %rdi
callq 0x7c00
jmp 0x52a3
movl -0x338(%rbp), %eax
movl %eax, -0x33c(%rbp)
leaq -0xc0(%rbp), %rdi
addq $0x28, %rdi
movslq -0x33c(%rbp), %rsi
callq 0x7810
movq %rax, %rdi
addq $0x30, %rdi
callq 0x7b10
testb $0x1, %al
jne 0x52d8
jmp 0x5315
movl $0xa, -0x168(%rbp)
jmp 0x5b48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5dfe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x35b8
jmp 0x5dfe
leaq -0x330(%rbp), %rsi
leaq -0x370(%rbp), %rdi
callq 0x7aa0
jmp 0x532a
movq -0x18(%rbp), %rsi
leaq 0x21f55(%rip), %rdx     # 0x2728a
leaq -0x3b0(%rbp), %rdi
callq 0x76d0
jmp 0x5343
leaq -0x98(%rbp), %rdi
movslq -0x33c(%rbp), %rsi
callq 0x7810
movq %rax, %rdx
leaq -0x390(%rbp), %rdi
leaq -0x3b0(%rbp), %rsi
callq 0x78a0
jmp 0x536e
leaq -0x3b0(%rbp), %rdi
callq 0x35b8
leaq -0x3e0(%rbp), %rdi
callq 0x7b90
movl -0x334(%rbp), %eax
movq %rax, -0x838(%rbp)
subq $0x5, %rax
ja 0x5931
movq -0x838(%rbp), %rax
leaq 0x21c59(%rip), %rcx     # 0x27004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5b9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5b93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x3b0(%rbp), %rdi
callq 0x35b8
jmp 0x5b93
leaq -0x438(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x3130
jmp 0x5408
leaq -0x468(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x7aa0
jmp 0x541d
movq -0x7d0(%rbp), %rsi
leaq -0x418(%rbp), %rdi
leaq -0x438(%rbp), %rdx
leaq -0x468(%rbp), %rcx
callq 0x5e90
jmp 0x5440
leaq -0x3e0(%rbp), %rdi
leaq -0x418(%rbp), %rsi
callq 0x7bb0
leaq -0x418(%rbp), %rdi
callq 0x7be0
leaq -0x468(%rbp), %rdi
callq 0x7af0
leaq -0x438(%rbp), %rdi
callq 0x35b8
jmp 0x5950
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5b7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x54b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x7af0
leaq -0x438(%rbp), %rdi
callq 0x35b8
jmp 0x5b7b
leaq -0x4b8(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x3130
jmp 0x54d9
leaq -0x4e8(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x7aa0
jmp 0x54ee
movq -0x7d0(%rbp), %rsi
leaq -0x498(%rbp), %rdi
leaq -0x4b8(%rbp), %rdx
leaq -0x4e8(%rbp), %rcx
callq 0x5e90
jmp 0x5511
leaq -0x3e0(%rbp), %rdi
leaq -0x498(%rbp), %rsi
movq %rsi, -0x840(%rbp)
callq 0x7bb0
movq -0x840(%rbp), %rdi
callq 0x7be0
leaq -0x4e8(%rbp), %rdi
callq 0x7af0
leaq -0x4b8(%rbp), %rdi
callq 0x35b8
leaq -0x508(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x3130
jmp 0x5564
leaq -0x538(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x7aa0
jmp 0x5579
movq -0x7d0(%rbp), %rdi
leaq -0x508(%rbp), %rsi
leaq -0x538(%rbp), %rdx
callq 0x5e60
movq %rax, -0x848(%rbp)
jmp 0x559c
movq -0x848(%rbp), %rax
movq %rax, -0x3e8(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x7af0
leaq -0x508(%rbp), %rdi
callq 0x35b8
cmpq $-0x1, -0x3e8(%rbp)
je 0x567c
leaq -0x3e0(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x7c40
movb %dl, -0x851(%rbp)
movq %rax, -0x850(%rbp)
jmp 0x55f2
movb -0x851(%rbp), %al
movq -0x850(%rbp), %rcx
movq %rcx, -0x548(%rbp)
movb %al, -0x540(%rbp)
jmp 0x567c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5634
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x4e8(%rbp), %rdi
callq 0x7af0
leaq -0x4b8(%rbp), %rdi
callq 0x35b8
jmp 0x5b7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x566b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x7af0
leaq -0x508(%rbp), %rdi
callq 0x35b8
jmp 0x5b7b
jmp 0x5950
leaq 0x21adb(%rip), %rdi     # 0x27163
leaq 0x21a5e(%rip), %rsi     # 0x270ed
movl $0xa5, %edx
leaq 0x21ace(%rip), %rcx     # 0x27169
callq 0x31f0
leaq -0x598(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x3130
jmp 0x56b5
leaq -0x5c8(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x7aa0
jmp 0x56ca
movq -0x7d0(%rbp), %rsi
leaq -0x578(%rbp), %rdi
leaq -0x598(%rbp), %rdx
leaq -0x5c8(%rbp), %rcx
callq 0x5ed0
jmp 0x56ed
leaq -0x3e0(%rbp), %rdi
leaq -0x578(%rbp), %rsi
movq %rsi, -0x860(%rbp)
callq 0x7bb0
movq -0x860(%rbp), %rdi
callq 0x7be0
leaq -0x5c8(%rbp), %rdi
callq 0x7af0
leaq -0x598(%rbp), %rdi
callq 0x35b8
leaq -0x5e8(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x3130
jmp 0x5740
leaq -0x618(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x7aa0
jmp 0x5755
movq -0x7d0(%rbp), %rdi
leaq -0x5e8(%rbp), %rsi
leaq -0x618(%rbp), %rdx
callq 0x5e60
movq %rax, -0x868(%rbp)
jmp 0x5778
movq -0x868(%rbp), %rax
movq %rax, -0x3e8(%rbp)
leaq -0x618(%rbp), %rdi
callq 0x7af0
leaq -0x5e8(%rbp), %rdi
callq 0x35b8
cmpq $-0x1, -0x3e8(%rbp)
je 0x5858
leaq -0x3e0(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x7c40
movb %dl, -0x871(%rbp)
movq %rax, -0x870(%rbp)
jmp 0x57ce
movb -0x871(%rbp), %al
movq -0x870(%rbp), %rcx
movq %rcx, -0x628(%rbp)
movb %al, -0x620(%rbp)
jmp 0x5858
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5810
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x5c8(%rbp), %rdi
callq 0x7af0
leaq -0x598(%rbp), %rdi
callq 0x35b8
jmp 0x5b7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5847
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x618(%rbp), %rdi
callq 0x7af0
leaq -0x5e8(%rbp), %rdi
callq 0x35b8
jmp 0x5b7b
jmp 0x5950
leaq -0x678(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x3130
jmp 0x5872
leaq -0x6a8(%rbp), %rdi
leaq -0x370(%rbp), %rsi
callq 0x7aa0
jmp 0x5887
movq -0x7d0(%rbp), %rsi
leaq -0x658(%rbp), %rdi
leaq -0x678(%rbp), %rdx
leaq -0x6a8(%rbp), %rcx
callq 0x5ed0
jmp 0x58aa
leaq -0x3e0(%rbp), %rdi
leaq -0x658(%rbp), %rsi
callq 0x7bb0
leaq -0x658(%rbp), %rdi
callq 0x7be0
leaq -0x6a8(%rbp), %rdi
callq 0x7af0
leaq -0x678(%rbp), %rdi
callq 0x35b8
jmp 0x5950
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5909
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x6a8(%rbp), %rdi
callq 0x7af0
leaq -0x678(%rbp), %rdi
callq 0x35b8
jmp 0x5b7b
leaq -0x3e0(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x7c90
jmp 0x592f
jmp 0x5950
leaq 0x2182b(%rip), %rdi     # 0x27163
leaq 0x217ae(%rip), %rsi     # 0x270ed
movl $0xb5, %edx
leaq 0x2181e(%rip), %rcx     # 0x27169
callq 0x31f0
leaq -0x2a8(%rbp), %rdi
callq 0x7cc0
movq %rax, -0x888(%rbp)
leaq -0x6c1(%rbp), %rdi
movq %rdi, -0x880(%rbp)
callq 0x7ce0
movq -0x888(%rbp), %rsi
movq -0x880(%rbp), %rdx
leaq -0x6c0(%rbp), %rdi
callq 0x7d00
jmp 0x5992
leaq -0x6c1(%rbp), %rdi
callq 0x7d70
leaq -0x2a8(%rbp), %rdi
movq %rdi, -0x8a0(%rbp)
callq 0x7e00
movq -0x8a0(%rbp), %rdi
movq %rax, -0x6d8(%rbp)
callq 0x7e30
movq %rax, -0x6e0(%rbp)
leaq -0x3e0(%rbp), %rdi
movq %rdi, -0x898(%rbp)
callq 0x7e00
movq -0x898(%rbp), %rdi
movq %rax, -0x6e8(%rbp)
callq 0x7e30
movq %rax, -0x6f0(%rbp)
leaq -0x6c0(%rbp), %rdi
callq 0x7e60
movq %rax, -0x6f8(%rbp)
movq -0x6d8(%rbp), %rdi
movq -0x6e0(%rbp), %rsi
movq -0x6e8(%rbp), %rdx
movq -0x6f0(%rbp), %rcx
movq -0x6f8(%rbp), %r8
callq 0x7d90
movq %rax, -0x890(%rbp)
jmp 0x5a3c
movq -0x890(%rbp), %rax
movq %rax, -0x6d0(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x7e90
leaq -0x6c0(%rbp), %rdi
callq 0x7e60
movq %rax, -0x700(%rbp)
leaq -0x700(%rbp), %rdi
leaq -0x6d0(%rbp), %rsi
callq 0x7eb0
testb $0x1, %al
jne 0x5a85
jmp 0x5b0e
leaq -0x700(%rbp), %rdi
callq 0x7ef0
movq %rax, %rsi
leaq -0x2a8(%rbp), %rdi
callq 0x7c40
movb %dl, -0x8a9(%rbp)
movq %rax, -0x8a8(%rbp)
jmp 0x5aaf
movb -0x8a9(%rbp), %al
movq -0x8a8(%rbp), %rcx
movq %rcx, -0x710(%rbp)
movb %al, -0x708(%rbp)
leaq -0x700(%rbp), %rdi
callq 0x7f10
jmp 0x5a69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x6c1(%rbp), %rdi
callq 0x7d70
jmp 0x5b7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x6c0(%rbp), %rdi
callq 0x7f30
jmp 0x5b7b
leaq -0x6c0(%rbp), %rdi
callq 0x7f30
leaq -0x3e0(%rbp), %rdi
callq 0x7be0
leaq -0x390(%rbp), %rdi
callq 0x35b8
leaq -0x370(%rbp), %rdi
callq 0x7af0
movl $0x0, -0x168(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x7f90
movl -0x168(%rbp), %eax
testl %eax, %eax
je 0x5b62
jmp 0x5b60
jmp 0x5b64
jmp 0x5b64
movq -0x300(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x300(%rbp)
jmp 0x5258
leaq -0x3e0(%rbp), %rdi
callq 0x7be0
leaq -0x390(%rbp), %rdi
callq 0x35b8
leaq -0x370(%rbp), %rdi
callq 0x7af0
leaq -0x338(%rbp), %rdi
callq 0x7f90
jmp 0x5dfe
leaq -0x728(%rbp), %rdi
callq 0x7fb0
leaq -0x2a8(%rbp), %rax
movq %rax, -0x730(%rbp)
movq -0x730(%rbp), %rdi
callq 0x7e00
movq %rax, -0x738(%rbp)
movq -0x730(%rbp), %rdi
callq 0x7e30
movq %rax, -0x740(%rbp)
leaq -0x738(%rbp), %rdi
leaq -0x740(%rbp), %rsi
callq 0x7fd0
testb $0x1, %al
jne 0x5c0c
jmp 0x5d72
leaq -0x738(%rbp), %rdi
callq 0x8000
movq (%rax), %rax
movq %rax, -0x748(%rbp)
leaq -0x760(%rbp), %rdi
callq 0x7fb0
movq -0x7d0(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x8b8(%rbp)
leaq -0x798(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x3130
jmp 0x5c55
movq -0x8b8(%rbp), %rsi
movq -0x748(%rbp), %rcx
movq -0x20(%rbp), %r8
leaq -0x778(%rbp), %rdi
leaq -0x798(%rbp), %rdx
leaq -0xc0(%rbp), %r9
callq 0x23850
jmp 0x5c83
leaq -0x760(%rbp), %rdi
leaq -0x778(%rbp), %rsi
callq 0x8020
leaq -0x778(%rbp), %rdi
callq 0x7b30
leaq -0x798(%rbp), %rdi
callq 0x35b8
movq $0x0, -0x7a0(%rbp)
movq -0x7a0(%rbp), %rax
movq %rax, -0x8c0(%rbp)
leaq -0x760(%rbp), %rdi
callq 0x8050
movq %rax, %rcx
movq -0x8c0(%rbp), %rax
cmpq %rcx, %rax
jae 0x5d44
movq -0x7a0(%rbp), %rsi
leaq -0x760(%rbp), %rdi
callq 0x80f0
movq %rax, %rsi
leaq -0x728(%rbp), %rdi
callq 0x8080
jmp 0x5d06
jmp 0x5d08
movq -0x7a0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x7a0(%rbp)
jmp 0x5cb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5d61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x798(%rbp), %rdi
callq 0x35b8
jmp 0x5d61
leaq -0x760(%rbp), %rdi
callq 0x7b30
leaq -0x738(%rbp), %rdi
callq 0x8110
jmp 0x5bf0
leaq -0x760(%rbp), %rdi
callq 0x7b30
jmp 0x5df2
leaq -0x7b8(%rbp), %rdi
leaq -0x728(%rbp), %rsi
callq 0x8140
jmp 0x5d87
movq -0x7e0(%rbp), %rdi
leaq -0x7b8(%rbp), %rsi
callq 0x24be0
jmp 0x5d9c
leaq -0x7b8(%rbp), %rdi
callq 0x7b30
movl $0x1, -0x168(%rbp)
leaq -0x728(%rbp), %rdi
callq 0x7b30
leaq -0x2a8(%rbp), %rdi
callq 0x7be0
jmp 0x5e0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5df2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x7b8(%rbp), %rdi
callq 0x7b30
leaq -0x728(%rbp), %rdi
callq 0x7b30
leaq -0x2a8(%rbp), %rdi
callq 0x7be0
jmp 0x5e26
leaq -0x100(%rbp), %rdi
callq 0x35b8
leaq -0xc0(%rbp), %rdi
callq 0x7920
jmp 0x5e40
leaq -0x100(%rbp), %rdi
callq 0x35b8
leaq -0xc0(%rbp), %rdi
callq 0x7920
jmp 0x5e50
movq -0x7d8(%rbp), %rax
addq $0x8c0, %rsp            # imm = 0x8C0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x34f0
nopl (%rax)