// File: /workspace/github_cpp_makefile_star2_O1/Konano[P]UselessDatabase/Table.cpp
// Function: Table::updateRecord(int, std::vector<std::pair<int, Any>, std::allocator<std::pair<int, Any>>>&)
int Table::updateRecord(const int record_id, vector<Pia> &set) {
    Anys before = queryRecord(record_id);
    Anys after = before;
    for (auto it: set) after[it.first] = it.second;

    int index;
    BufType buf = bpm->getPage(main_file, record_id / record_onepg, index);
    buf += (record_onepg - 1) / 8 + 1;
    buf += record_size * (record_id % record_onepg);
    for (uint i = 0; i < col_num; i++) {
        insert(after[i], col_ty[i].ty, col_ty[i].size(), buf);
    }
    bpm->markDirty(index);

    for (uint i = 0; i < index_num; i++) {
        Anys _b = chooseData(before, this->index[i].key);
        Anys _a = chooseData(after, this->index[i].key);
        if (_b != _a) {
            this->index[i].removeRecord(&_b, record_id);
            this->index[i].insertRecord(&_a, record_id);
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movl %esi, %edx
movq %rdi, %r14
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl %edx, 0x4(%rsp)
callq 0x22ea4
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0xa450
movq (%rbx), %r12
movq 0x8(%rbx), %rbx
cmpq %rbx, %r12
je 0x2310e
movl (%r12), %r13d
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x230d6
movq (%rdi), %rax
callq *0x10(%rax)
movq %rax, %r15
jmp 0x230d9
xorl %r15d, %r15d
movq 0x18(%rsp), %rbp
movq $0x0, (%rbp,%r13,8)
testq %r15, %r15
je 0x23108
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %rax, (%rbp,%r13,8)
testq %r15, %r15
je 0x23108
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
addq $0x10, %r12
jmp 0x230b8
movq 0x48(%r14), %rdi
movl 0x9fa4(%r14), %esi
movl 0x4(%rsp), %eax
xorl %edx, %edx
divl 0x9fac(%r14)
leaq 0x14(%rsp), %rcx
movl %eax, %edx
callq 0x6834
movq %rax, 0x8(%rsp)
movl 0x9fac(%r14), %ecx
leal -0x1(%rcx), %edx
shrl $0x3, %edx
leaq (%rax,%rdx), %rsi
addq %rdx, %rax
incq %rax
movq %rax, 0x8(%rsp)
movl 0x4(%rsp), %eax
xorl %edx, %edx
divl %ecx
imull 0x9fa8(%r14), %edx
leaq (%rdx,%rsi), %rax
incq %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x54(%r14)
je 0x231e9
leaq 0x80(%r14), %r15
xorl %r12d, %r12d
leaq 0x8(%rsp), %rbx
leaq 0x1e8b4(%rip), %r13     # 0x41a40
xorl %ebp, %ebp
movl -0x4(%r15), %edx
cmpq $0x4, %rdx
ja 0x231bd
movslq (%r13,%rdx,4), %rax
addq %r13, %rax
jmpq *%rax
movl $0x4, %ecx
jmp 0x231c2
movl $0x10, %ecx
jmp 0x231c2
movzbl (%r15), %ecx
jmp 0x231c2
movl $0x8, %ecx
jmp 0x231c2
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rsi
addq %r12, %rsi
movq %r14, %rdi
movq %rbx, %r8
callq 0x21df2
incq %rbp
movl 0x54(%r14), %eax
addq $0x8, %r12
addq $0x38, %r15
cmpq %rax, %rbp
jb 0x2318e
movq 0x48(%r14), %rdi
movl 0x14(%rsp), %esi
callq 0x68ee
cmpl $0x0, 0x798(%r14)
je 0x2328e
leaq 0x7d0(%r14), %r15
xorl %ebx, %ebx
leaq 0x60(%rsp), %r12
leaq 0x48(%rsp), %rbp
movq %r12, %rdi
leaq 0x30(%rsp), %rdx
movq %r15, %rcx
callq 0x2330a
movq %rbp, %rdi
leaq 0x18(%rsp), %rdx
movq %r15, %rcx
callq 0x2330a
movq %r12, %rdi
movq %rbp, %rsi
callq 0x9abe
testb %al, %al
jne 0x23268
leaq -0x30(%r15), %r13
movq %r13, %rdi
movq %r12, %rsi
movl 0x4(%rsp), %edx
callq 0x1afe8
movq %r13, %rdi
movq %rbp, %rsi
movl 0x4(%rsp), %edx
callq 0x1ae86
movq %rbp, %rdi
callq 0xa564
movq %r12, %rdi
callq 0xa564
incq %rbx
movl 0x798(%r14), %eax
addq $0x98, %r15
cmpq %rax, %rbx
jb 0x23217
leaq 0x18(%rsp), %rdi
callq 0xa564
leaq 0x30(%rsp), %rdi
callq 0xa564
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x232f7
jmp 0x232d1
jmp 0x232d1
movq %rax, %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
jmp 0x232ed
jmp 0x232d1
movq %rax, %rbx
jmp 0x232e3
movq %rax, %rbx
jmp 0x232ed
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xa564
leaq 0x60(%rsp), %rdi
callq 0xa564
leaq 0x18(%rsp), %rdi
callq 0xa564
leaq 0x30(%rsp), %rdi
callq 0xa564
movq %rbx, %rdi
callq 0x56e0
nop