// File: Konano[P]UselessDatabase/Table.cpp
// Function: Table::queryRecord(int, Any*&)
int Table::queryRecord(const int record_id, Any* &data) {
    BufType buf = bpm->getPage(main_file, record_id / record_onepg);
    if (exist(buf, record_id % record_onepg)) {
        buf += (record_onepg - 1) / 8 + 1;
        buf += record_size * (record_id % record_onepg);
        data = new Any[col_num];
        memset(data, 0, col_num * sizeof(Any));
        for (uint i = 0; i < col_num; i++) {
            fetch(buf, col_ty[i].ty, col_ty[i].size(), data[i]);
        }
        return 0;
    } else return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq 0x48(%rcx), %rdi
movl 0x9fa4(%rcx), %esi
movl -0x14(%rbp), %eax
xorl %edx, %edx
divl 0x9fac(%rcx)
movl %eax, %edx
callq 0x70b0
movq -0x50(%rbp), %rcx
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x14(%rbp), %eax
xorl %edx, %edx
divl 0x9fac(%rcx)
movq -0x48(%rbp), %rax
shrl $0x3, %edx
movl %edx, %edx
movzbl (%rax,%rdx), %eax
movl %eax, -0x3c(%rbp)
movl -0x14(%rbp), %eax
xorl %edx, %edx
divl 0x9fac(%rcx)
movl -0x3c(%rbp), %eax
movl %edx, %ecx
andl $0x7, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x4afca
movq -0x50(%rbp), %rcx
movl 0x9fac(%rcx), %edx
subl $0x1, %edx
shrl $0x3, %edx
addl $0x1, %edx
movq -0x28(%rbp), %rax
movl %edx, %edx
addq %rdx, %rax
movq %rax, -0x28(%rbp)
movl 0x9fa8(%rcx), %eax
movl %eax, -0x74(%rbp)
movl -0x14(%rbp), %eax
xorl %edx, %edx
divl 0x9fac(%rcx)
movq -0x50(%rbp), %rax
movl %edx, %ecx
movl -0x74(%rbp), %edx
imull %ecx, %edx
movq -0x28(%rbp), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, -0x28(%rbp)
movl 0x54(%rax), %eax
movq %rax, -0x68(%rbp)
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, -0x70(%rbp)
callq 0x6040
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x58(%rbp)
cmpq $0x0, %rax
je 0x4aec4
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rdx
shlq $0x3, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0xd240
jmp 0x4aea9
movq -0x88(%rbp), %rcx
movq -0x90(%rbp), %rax
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x80(%rbp)
jne 0x4ae97
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq %rdx, (%rcx)
movq -0x20(%rbp), %rcx
movq (%rcx), %rdi
movl 0x54(%rax), %eax
movl %eax, %edx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x62c0
movl $0x0, -0x38(%rbp)
movq -0x50(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0x54(%rcx), %eax
jae 0x4afc1
movq -0x50(%rbp), %rdi
movq %rdi, %rax
addq $0x58, %rax
movl -0x38(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x24(%rax), %eax
movl %eax, -0x94(%rbp)
addq $0x58, %rdi
movl -0x38(%rbp), %eax
imulq $0x38, %rax, %rax
addq %rax, %rdi
callq 0x3d3d0
movq -0x50(%rbp), %rdi
movl -0x94(%rbp), %edx
movl %eax, %ecx
movq -0x20(%rbp), %rax
movq (%rax), %r8
movl -0x38(%rbp), %eax
shlq $0x3, %rax
addq %rax, %r8
leaq -0x28(%rbp), %rsi
callq 0x47380
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4aef1
movq -0x58(%rbp), %rcx
movq %rax, %rsi
movq -0x90(%rbp), %rax
movq %rsi, -0x30(%rbp)
movl %edx, -0x34(%rbp)
cmpq %rax, %rcx
movq %rax, -0xa0(%rbp)
je 0x4afb2
movq -0xa0(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0xa8(%rbp)
callq 0xc3c0
movq -0x58(%rbp), %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xa0(%rbp)
jne 0x4af84
movq -0x70(%rbp), %rsi
movq -0x60(%rbp), %rdi
callq 0x6970
jmp 0x4afdd
movl $0x0, -0x4(%rbp)
jmp 0x4afd1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x6890
nopw %cs:(%rax,%rax)