// File: Konano[P]UselessDatabase/Table.cpp
// Function: Table::fetchWithOffset(unsigned char*&, enumType, unsigned int, Any&, unsigned int)
void Table::fetchWithOffset(BufType& buf, enumType ty, uint size, Any& val, uint offset) {
    buf += offset;
    BufType temp = buf;
    bool flag = true;
    for (uint i = 0; i < size; i++) {
        if (*(uint8_t*)buf != 255) {
            flag = false;
            break;
        }
        buf += 1;
    }
    buf = temp;
    if (flag) val = Any();
    else{
        switch (ty) {
        case INT: 
            val = *(int*)buf; 
            break;
        case CHAR:
            val = getStr(buf, size);
            break;
        case VARCHAR: 
            val = db->getVarchar(*(uint64_t*)buf); 
            break;
        case DATE: 
            val = *(uint32_t*)buf; 
            break;
        case DECIMAL: 
            val = *(long double*)buf; 
            break;
        }
    }
    buf -= offset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl %edx, %edx
addq %rdx, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movb $0x1, -0x31(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x49889
movq -0x10(%rbp), %rax
movq (%rax), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
je 0x49870
movb $0x0, -0x31(%rbp)
jmp 0x49889
movq -0x10(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x49851
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
testb $0x1, -0x31(%rbp)
je 0x498de
leaq -0x40(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0xd240
movq -0x70(%rbp), %rsi
movq -0x20(%rbp), %rdi
callq 0xd320
jmp 0x498b6
leaq -0x40(%rbp), %rdi
callq 0xc3c0
jmp 0x49989
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xc3c0
jmp 0x499ab
movl -0x14(%rbp), %eax
movq %rax, -0x78(%rbp)
subq $0x4, %rax
ja 0x49987
movq -0x78(%rbp), %rax
leaq 0x3a22a(%rip), %rcx     # 0x83b24
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rdi
callq 0x52f60
jmp 0x49987
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl -0x18(%rbp), %edx
callq 0x49650
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x52fe0
jmp 0x49987
movq -0x68(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
callq 0x8460
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x52fe0
jmp 0x49987
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rdi
callq 0x53060
jmp 0x49987
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rdi
callq 0x530e0
jmp 0x49989
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl %edx, %edx
movl %edx, %esi
xorl %edx, %edx
subq %rsi, %rdx
addq %rdx, %rcx
movq %rcx, (%rax)
addq $0x80, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x6890
nopw %cs:(%rax,%rax)