// File: 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
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0xd8(%rbp)
movl -0xc(%rbp), %edx
leaq -0x30(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x4aff0
movq -0xd0(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xc400
jmp 0x4b266
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x52e20
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x52e50
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x52e80
testb $0x1, %al
jne 0x4b29e
jmp 0x4b33a
leaq -0x68(%rbp), %rdi
callq 0x52ec0
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
callq 0x52ee0
jmp 0x4b2b5
leaq -0x78(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl -0x80(%rbp), %esi
leaq -0x48(%rbp), %rdi
callq 0xc8f0
movq %rax, -0xe0(%rbp)
jmp 0x4b2d5
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdi
callq 0xd320
jmp 0x4b2ea
leaq -0x80(%rbp), %rdi
callq 0x52f20
leaq -0x68(%rbp), %rdi
callq 0x52f40
jmp 0x4b288
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4b615
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4b60c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x52f20
jmp 0x4b60c
movq -0xd8(%rbp), %rcx
movq 0x48(%rcx), %rdi
movl 0x9fa4(%rcx), %esi
movl -0xc(%rbp), %eax
movl 0x9fac(%rcx), %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %edx
leaq -0x84(%rbp), %rcx
callq 0x71d0
movq %rax, -0xf0(%rbp)
jmp 0x4b36f
movq -0xd8(%rbp), %rsi
movq -0xf0(%rbp), %rax
movq %rax, -0x90(%rbp)
movl 0x9fac(%rsi), %ecx
subl $0x1, %ecx
shrl $0x3, %ecx
addl $0x1, %ecx
movq -0x90(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl 0x9fa8(%rsi), %ecx
movl -0xc(%rbp), %eax
xorl %edx, %edx
divl 0x9fac(%rsi)
imull %edx, %ecx
movq -0x90(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl $0x0, -0x94(%rbp)
movq -0xd8(%rbp), %rcx
movl -0x94(%rbp), %eax
cmpl 0x54(%rcx), %eax
jae 0x4b470
movl -0x94(%rbp), %esi
leaq -0x48(%rbp), %rdi
callq 0xc8f0
movq %rax, -0xf8(%rbp)
jmp 0x4b405
movq -0xd8(%rbp), %rax
movl -0x94(%rbp), %ecx
imulq $0x38, %rcx, %rcx
leaq 0x58(%rax,%rcx), %rdi
movl 0x7c(%rax,%rcx), %eax
movl %eax, -0x100(%rbp)
callq 0x3d3d0
movl %eax, -0xfc(%rbp)
jmp 0x4b432
movl -0xfc(%rbp), %ecx
movl -0x100(%rbp), %edx
movq -0xf8(%rbp), %rsi
movq -0xd8(%rbp), %rdi
leaq -0x90(%rbp), %r8
callq 0x496a0
jmp 0x4b45a
jmp 0x4b45c
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x4b3d7
movq -0xd8(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x84(%rbp), %esi
callq 0x7300
jmp 0x4b488
movl $0x0, -0x98(%rbp)
movq -0xd8(%rbp), %rcx
movl -0x98(%rbp), %eax
cmpl 0x798(%rcx), %eax
jae 0x4b5ef
movq -0xd8(%rbp), %rsi
movl -0x98(%rbp), %eax
imulq $0x98, %rax, %rax
leaq 0x7d0(%rsi,%rax), %rcx
leaq -0xb0(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x4b630
jmp 0x4b4d9
movq -0xd8(%rbp), %rsi
movl -0x98(%rbp), %eax
imulq $0x98, %rax, %rax
leaq 0x7d0(%rsi,%rax), %rcx
leaq -0xc8(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x4b630
jmp 0x4b507
leaq -0xb0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xc5a0
movb %al, -0x101(%rbp)
jmp 0x4b522
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x4b531
jmp 0x4b5b5
movq -0xd8(%rbp), %rax
movl -0x98(%rbp), %ecx
imulq $0x98, %rcx, %rcx
leaq 0x7a0(%rax,%rcx), %rdi
movl -0xc(%rbp), %edx
leaq -0xb0(%rbp), %rsi
callq 0x393a0
jmp 0x4b55e
movq -0xd8(%rbp), %rax
movl -0x98(%rbp), %ecx
imulq $0x98, %rcx, %rcx
leaq 0x7a0(%rax,%rcx), %rdi
movl -0xc(%rbp), %edx
leaq -0xc8(%rbp), %rsi
callq 0x390e0
jmp 0x4b58b
jmp 0x4b5b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4b5e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xc430
jmp 0x4b5e1
leaq -0xc8(%rbp), %rdi
callq 0xc430
leaq -0xb0(%rbp), %rdi
callq 0xc430
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x4b492
leaq -0xb0(%rbp), %rdi
callq 0xc430
jmp 0x4b60c
leaq -0x48(%rbp), %rdi
callq 0xc430
leaq -0x30(%rbp), %rdi
callq 0xc430
xorl %eax, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0xc430
leaq -0x30(%rbp), %rdi
callq 0xc430
movq -0x50(%rbp), %rdi
callq 0x6890
nopw (%rax,%rax)