// File: zimpha[P]MiniSQL/RecordManager.cc
// Function: RecordManager::InputRecord(Block&, int, std::vector<element, std::allocator<element>> const&, Table&)
void RecordManager::InputRecord(Block & block, int tuplePos, const std::vector<element> & entry, Table & nt)
{
    int startPos = tuplePos;
    block.data[startPos] = 'Y';
    startPos++;
    int index = 0;
    for (auto ele : entry) {
        assert(nt.attributes[index].type == ele.type);
        switch (ele.type) {
            case 0:
                setInt(block, startPos, ele.i);
                startPos += sizeof(int);
                break;
            case 1:
                setFloat(block, startPos, ele.f);
                startPos += sizeof(float);
                break;
            case 2:
                setString(block, startPos, ele.s);
                startPos += nt.attributes[index].length;//Include +1
                break;
            default:
                break;
        }
        index++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x59, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0xe0b0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0xe0e0
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xe440
testb $0x1, %al
jne 0x230b3
jmp 0x23229
leaq -0x40(%rbp), %rdi
callq 0xe4b0
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x7aa0
movq -0x28(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rsi
callq 0x7810
movl 0x20(%rax), %eax
cmpl -0x50(%rbp), %eax
jne 0x230e3
jmp 0x23102
leaq 0x45de(%rip), %rdi      # 0x276c8
leaq 0x45fd(%rip), %rsi      # 0x276ee
movl $0x88, %edx
leaq 0x4602(%rip), %rcx      # 0x276ff
callq 0x31f0
movl -0x50(%rbp), %eax
movl %eax, -0xb4(%rbp)
testl %eax, %eax
je 0x2312e
jmp 0x23111
movl -0xb4(%rbp), %eax
subl $0x1, %eax
je 0x23154
jmp 0x2311e
movl -0xb4(%rbp), %eax
subl $0x2, %eax
je 0x2317c
jmp 0x23207
movq -0xb0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl -0x78(%rbp), %ecx
callq 0x22830
movslq -0x2c(%rbp), %rax
addq $0x4, %rax
movl %eax, -0x2c(%rbp)
jmp 0x23209
movq -0xb0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x2c(%rbp), %edx
movss -0x74(%rbp), %xmm0
callq 0x22900
movslq -0x2c(%rbp), %rax
addq $0x4, %rax
movl %eax, -0x2c(%rbp)
jmp 0x23209
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0xb8(%rbp)
leaq -0x70(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x3130
jmp 0x231a2
movl -0xb8(%rbp), %edx
movq -0xc0(%rbp), %rsi
movq -0xb0(%rbp), %rdi
leaq -0x98(%rbp), %rcx
callq 0x22a30
leaq -0x98(%rbp), %rdi
callq 0x35b8
movq -0x28(%rbp), %rdi
addq $0x28, %rdi
movslq -0x30(%rbp), %rsi
callq 0x7810
movl 0x24(%rax), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x23209
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x7af0
jmp 0x23232
jmp 0x23209
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x7af0
leaq -0x40(%rbp), %rdi
callq 0xe4d0
jmp 0x2309d
addq $0xc0, %rsp
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x34f0
nop