// File: zimpha[P]MiniSQL/indexManager.cc
// Function: IndexManager::save()
void IndexManager::save() {
    if (currentFile.empty()) return;
    FILE *file = fopen(currentFile.c_str(), "wb");
    int tmp = mp.size();
    fwrite(&tmp, sizeof(int), 1, file);
    for (auto o : mp) {
        char type;
        fwrite(&o.first.type, sizeof(o.first.type), 1, file);
        if (o.first.type == 0) {
            fwrite(&o.first.i, sizeof(o.first.i), 1, file);
        } else if (o.first.type == 1) {
            fwrite(&o.first.f, sizeof(o.first.f), 1, file);
        } else if (o.first.type == 2) {
            for (char c : o.first.s)
                fwrite(&c, sizeof(c), 1, file);
            char c = 0;
            fwrite(&c, sizeof(c), 1, file);
        }
        fwrite(&o.second, sizeof(o.second), 1, file);
    }
    fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
addq $0x38, %rdi
callq 0x34b0
testb $0x1, %al
jne 0x13479
jmp 0x1347e
jmp 0x13690
movq -0xa8(%rbp), %rdi
addq $0x38, %rdi
callq 0x3120
movq %rax, %rdi
leaq 0x13dd8(%rip), %rsi     # 0x27270
callq 0x3370
movq -0xa8(%rbp), %rdi
movq %rax, -0x10(%rbp)
addq $0x8, %rdi
callq 0x15d30
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x14(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3580
movq -0xa8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x15cd0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x15c40
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x15c10
testb $0x1, %al
jne 0x1350a
jmp 0x13687
leaq -0x28(%rbp), %rdi
callq 0x15d50
movq %rax, %rsi
leaq -0x68(%rbp), %rdi
callq 0x15d70
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x3580
jmp 0x13538
cmpl $0x0, -0x40(%rbp)
jne 0x13576
movq -0x10(%rbp), %rcx
leaq -0x68(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3580
jmp 0x13557
jmp 0x13657
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x15e30
jmp 0x13699
cmpl $0x1, -0x40(%rbp)
jne 0x1359a
leaq -0x64(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x3580
jmp 0x13595
jmp 0x13655
cmpl $0x2, -0x40(%rbp)
jne 0x13653
leaq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
callq 0x32b0
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
callq 0x3560
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x15db0
testb $0x1, %al
jne 0x135f2
jmp 0x13630
leaq -0x90(%rbp), %rdi
callq 0x15df0
movb (%rax), %al
movb %al, -0x99(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x99(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3580
jmp 0x13620
jmp 0x13622
leaq -0x90(%rbp), %rdi
callq 0x15e10
jmp 0x135d9
movb $0x0, -0x9a(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x9a(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3580
jmp 0x13651
jmp 0x13653
jmp 0x13655
jmp 0x13657
leaq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x3580
jmp 0x13670
leaq -0x68(%rbp), %rdi
callq 0x15e30
leaq -0x28(%rbp), %rdi
callq 0x15e50
jmp 0x134f4
movq -0x10(%rbp), %rdi
callq 0x32d0
addq $0xb0, %rsp
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x34f0
nopw %cs:(%rax,%rax)