// File: /workspace/github_cpp_makefile_star2_O3/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, 0x8(%rsp)
callq 0x22900
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xa26a
movq (%rbx), %r12
movq 0x8(%rbx), %rbx
cmpq %rbx, %r12
je 0x22b5f
movl (%r12), %r13d
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x22b4c
movq (%rdi), %rax
callq *0x10(%rax)
movq %rax, %r15
movq 0x10(%rsp), %rbp
movq $0x0, (%rbp,%r13,8)
testq %rax, %rax
je 0x22b59
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %rax, (%rbp,%r13,8)
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
jmp 0x22b59
movq 0x10(%rsp), %rax
movq $0x0, (%rax,%r13,8)
addq $0x10, %r12
jmp 0x22b04
movq 0x48(%r14), %rdi
movl 0x9fa4(%r14), %esi
movl 0x8(%rsp), %eax
xorl %edx, %edx
divl 0x9fac(%r14)
leaq 0xc(%rsp), %rcx
movl %eax, %edx
callq 0x67e4
movq %rax, %rcx
movl 0x9fac(%r14), %esi
leal -0x1(%rsi), %eax
shrl $0x3, %eax
addq %rax, %rcx
movl 0x8(%rsp), %eax
xorl %edx, %edx
divl %esi
imull 0x9fa8(%r14), %edx
leaq (%rdx,%rcx), %rax
incq %rax
movq %rax, 0x28(%rsp)
cmpl $0x0, 0x54(%r14)
je 0x22c2c
leaq 0x80(%r14), %r15
xorl %r12d, %r12d
leaq 0x28(%rsp), %rbx
leaq 0x1de61(%rip), %r13     # 0x40a30
xorl %ebp, %ebp
movl -0x4(%r15), %edx
cmpq $0x4, %rdx
ja 0x22c00
movslq (%r13,%rdx,4), %rax
addq %r13, %rax
jmpq *%rax
movl $0x4, %ecx
jmp 0x22c05
movl $0x10, %ecx
jmp 0x22c05
movzbl (%r15), %ecx
jmp 0x22c05
movl $0x8, %ecx
jmp 0x22c05
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rsi
addq %r12, %rsi
movq %r14, %rdi
movq %rbx, %r8
callq 0x218fe
incq %rbp
movl 0x54(%r14), %eax
addq $0x8, %r12
addq $0x38, %r15
cmpq %rax, %rbp
jb 0x22bd1
movq 0x48(%r14), %rdi
movl 0xc(%rsp), %esi
callq 0x689e
cmpl $0x0, 0x798(%r14)
je 0x22cd1
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 0x22d4c
movq %rbp, %rdi
leaq 0x10(%rsp), %rdx
movq %r15, %rcx
callq 0x22d4c
movq %r12, %rdi
movq %rbp, %rsi
callq 0x9996
testb %al, %al
jne 0x22cab
leaq -0x30(%r15), %r13
movq %r13, %rdi
movq %r12, %rsi
movl 0x8(%rsp), %edx
callq 0x1a82c
movq %r13, %rdi
movq %rbp, %rsi
movl 0x8(%rsp), %edx
callq 0x1a6ca
movq %rbp, %rdi
callq 0xa37e
movq %r12, %rdi
callq 0xa37e
incq %rbx
movl 0x798(%r14), %eax
addq $0x98, %r15
cmpq %rax, %rbx
jb 0x22c5a
leaq 0x10(%rsp), %rdi
callq 0xa37e
leaq 0x30(%rsp), %rdi
callq 0xa37e
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x22d3a
jmp 0x22d14
movq %rax, %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
jmp 0x22d30
jmp 0x22d14
jmp 0x22d14
movq %rax, %rbx
jmp 0x22d26
movq %rax, %rbx
jmp 0x22d30
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xa37e
leaq 0x60(%rsp), %rdi
callq 0xa37e
leaq 0x10(%rsp), %rdi
callq 0xa37e
leaq 0x30(%rsp), %rdi
callq 0xa37e
movq %rbx, %rdi
callq 0x56e0