// File: pawan231[P]MiniDataBase/include/BPtree.h
// Function: BPtree::BPtree(char*)
BPtree(char table_name[])
    {
        strcpy(tablename,table_name);
        char *str;
        str = (char *) malloc(sizeof(char) * BPTREE_MAX_FILE_PATH_SIZE);
        sprintf(str, "mkdir -p table/%s/tree", tablename);
        system(str);
        sprintf(str, "table/%s/tree/meta_tree.dat", tablename);

        std::ifstream in_file(str, std::ifstream::in | std::ifstream::binary);
        if (!in_file)
        {
            /* If no meta data for table's BTree is found i.e.,
               It is new table. Then Create new meta data */
            std::ofstream out_file(str, std::ofstream::binary |
                                   std::ofstream::out | std::ofstream::trunc);
            if (!out_file)
            {
                printf("Critical Error : Unable to Write on Disk !!");
                printf("\nAborting ... ... \n");
                abort();
            }
            files_till_now = root_num = 0;
            out_file.write((char *) (&files_till_now), sizeof(files_till_now));
            out_file.write((char *) (&root_num), sizeof(root_num));
            //out_file << files_till_now << " " << root_num;
            out_file.close();
            Btreenode root(true);
            root.set_next(-1);
            write_node(0, root);
        }
        else
        {
            /* Read old Meta Data */
            in_file >> files_till_now >> root_num;
            in_file.close();
        }
        free(str);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x500, %rsp            # imm = 0x500
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x4d8(%rbp)
addq $0x8, %rdi
movq %rdi, -0x4d0(%rbp)
movq -0x10(%rbp), %rsi
callq 0x2180
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x2260
movq -0x4d0(%rbp), %rdx
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x5d6f(%rip), %rsi      # 0xbd41
xorl %eax, %eax
movb %al, -0x4c1(%rbp)
callq 0x2040
movq -0x18(%rbp), %rdi
callq 0x2140
movq -0x4d0(%rbp), %rdx
movb -0x4c1(%rbp), %al
movq -0x18(%rbp), %rdi
leaq 0x5cf4(%rip), %rsi      # 0xbcf4
callq 0x2040
movq -0x18(%rbp), %rax
movq %rax, -0x4c0(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x63b0
movq -0x4c0(%rbp), %rsi
movl %eax, %edx
leaq -0x220(%rbp), %rdi
callq 0x2370
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x20b0
movb %al, -0x4b1(%rbp)
jmp 0x6054
movb -0x4b1(%rbp), %al
testb $0x1, %al
jne 0x6063
jmp 0x623e
movq -0x18(%rbp), %rax
movq %rax, -0x4e0(%rbp)
movl $0x4, %edi
movl $0x10, %esi
callq 0x63b0
movl %eax, %edi
movl $0x20, %esi
callq 0x63b0
movq -0x4e0(%rbp), %rsi
movl %eax, %edx
leaq -0x430(%rbp), %rdi
callq 0x21d0
jmp 0x60a0
movq -0x430(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x430(%rbp,%rax), %rdi
callq 0x20b0
movb %al, -0x4e1(%rbp)
jmp 0x60c0
movb -0x4e1(%rbp), %al
testb $0x1, %al
jne 0x60cc
jmp 0x611f
leaq 0x5c85(%rip), %rdi      # 0xbd58
xorl %eax, %eax
callq 0x2030
jmp 0x60dc
leaq 0x5ca1(%rip), %rdi      # 0xbd84
xorl %eax, %eax
callq 0x2030
jmp 0x60ec
callq 0x20f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x62a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x6230
movq -0x4d8(%rbp), %rsi
movl $0x0, 0x4(%rsi)
movl $0x0, (%rsi)
leaq -0x430(%rbp), %rdi
movl $0x4, %edx
callq 0x2250
jmp 0x6146
movq -0x4d8(%rbp), %rsi
addq $0x4, %rsi
leaq -0x430(%rbp), %rdi
movl $0x4, %edx
callq 0x2250
jmp 0x6164
leaq -0x430(%rbp), %rdi
callq 0x2290
jmp 0x6172
leaq -0x470(%rbp), %rdi
movl $0x1, %esi
callq 0x5320
jmp 0x6185
leaq -0x470(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5ce0
movq -0x4f0(%rbp), %rsi
leaq -0x4b0(%rbp), %rdi
callq 0x5970
jmp 0x61b2
movq -0x4d8(%rbp), %rdi
xorl %esi, %esi
leaq -0x4b0(%rbp), %rdx
callq 0x5860
jmp 0x61c9
leaq -0x4b0(%rbp), %rdi
callq 0x5570
leaq -0x470(%rbp), %rdi
callq 0x5570
leaq -0x430(%rbp), %rdi
callq 0x22c0
jmp 0x6283
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x6224
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x4b0(%rbp), %rdi
callq 0x5570
leaq -0x470(%rbp), %rdi
callq 0x5570
leaq -0x430(%rbp), %rdi
callq 0x22c0
jmp 0x62a1
movq -0x4d8(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0x2100
movq %rax, -0x4f8(%rbp)
jmp 0x625a
movq -0x4f8(%rbp), %rdi
movq -0x4d8(%rbp), %rsi
addq $0x4, %rsi
callq 0x2100
jmp 0x6273
leaq -0x220(%rbp), %rdi
callq 0x2050
jmp 0x6281
jmp 0x6283
movq -0x18(%rbp), %rdi
callq 0x2220
leaq -0x220(%rbp), %rdi
callq 0x2060
addq $0x500, %rsp            # imm = 0x500
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x2060
movq -0x228(%rbp), %rdi
callq 0x2340
nopl (%rax)