// File: /workspace/github_cpp_makefile_star2_O2/Konano[P]UselessDatabase/Table.cpp
// Function: Table::Table(Database*, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>)
Table::Table(Database* db, json j) { // disassemble from JSON
    this->pointer.s = this; 
    this->db = db;
    this->fm = db->fm;
    this->bpm = db->bpm;
    strcpy(name, j["name"].get<std::string>().c_str());
    table_id = j["table_id"].get<int>();
    col_num = j["col_num"].get<int>();
    record_num = j["record_num"].get<int>();
    record_size = j["record_size"].get<int>();
    record_onepg = j["record_onepg"].get<int>();
    for (uint i = 0; i < col_num; i++) col_ty[i] = Type(j["col_ty"][i]);
    fm->openFile(dirPath(db->name, name, "usid"), main_file);
    index_num = j["index_num"].get<int>();
    for (uint i = 0; i < index_num; i++) index[i] = Index(this, j["index"][i]);
    if (j.count("primary")) p_key = new PrimaryKey(this, j["primary"]);
    if (j.count("foreign")) for (uint i = 0; i < j["foreign"].size(); i++) f_key.push_back(new ForeignKey(this, j["foreign"][i], db));
    p_key_index = j["p_key_index"].get<int>();
    f_key_index.clear();
    for(uint i = 0;i < f_key.size();i ++)f_key_index.push_back(j["f_key_index"][i].get<int>()); 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
andl $0x0, 0x54(%rdi)
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x58(%rdi), %rbp
xorl %r14d, %r14d
leaq 0x18(%rsp), %r15
pushq $0x1
popq %r12
movq %rbp, %r13
andq $0x0, 0x18(%rsp)
movq %r13, %rdi
leaq 0x1f86d(%rip), %rsi     # 0x3a8d4
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r8
movl %r12d, %r9d
callq 0x8e1a
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1b086
movq (%rdi), %rax
callq *0x8(%rax)
addq $-0x38, %r14
addq $0x38, %r13
cmpq $-0x700, %r14           # imm = 0xF900
jne 0x1b057
leaq 0x758(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x760(%rbx), %rax
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x768(%rbx)
movups %xmm0, 0x758(%rbx)
orl $-0x1, 0x778(%rbx)
leaq 0x780(%rbx), %rax
movq %rax, 0x28(%rsp)
movups %xmm0, 0x780(%rbx)
movups %xmm0, 0x78c(%rbx)
movl $0x818, %eax            # imm = 0x818
movups %xmm0, (%rbx,%rax)
andq $0x0, 0x10(%rbx,%rax)
movups %xmm0, -0x48(%rbx,%rax)
movups %xmm0, -0x38(%rbx,%rax)
movups %xmm0, -0x28(%rbx,%rax)
addq $0x98, %rax
cmpq $0xa018, %rax           # imm = 0xA018
jne 0x1b0e6
andl $0x0, 0x9fa0(%rbx)
andl $0x0, 0x9fb0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x9fb8(%rbx)
movups %xmm0, 0x9fc8(%rbx)
movups %xmm0, 0x9fd8(%rbx)
movq %rbx, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rbx)
movups 0x828(%rax), %xmm0
movups %xmm0, 0x40(%rbx)
leaq 0x1cedd(%rip), %rsi     # 0x3802e
movq 0x8(%rsp), %rdi
callq 0x7c7e
leaq 0x80(%rsp), %rdi
movq %rax, %rsi
callq 0x7f18
leaq 0x18(%rbx), %rdi
leaq 0x80(%rsp), %r14
movq (%r14), %rsi
movq %rdi, 0x38(%rsp)
callq 0x53b0
movq %r14, %rdi
callq 0x5200
leaq 0x1ce25(%rip), %rsi     # 0x37fb8
movq 0x8(%rsp), %rdi
callq 0x7c7e
movq %rax, %rdi
callq 0x7f58
movl %eax, 0x50(%rbx)
leaq 0x1ce12(%rip), %rsi     # 0x37fc1
movq 0x8(%rsp), %rdi
callq 0x7c7e
movq %rax, %rdi
callq 0x7f58
movl %eax, 0x54(%rbx)
leaq 0x1ce05(%rip), %rsi     # 0x37fd0
movq 0x8(%rsp), %rdi
callq 0x7c7e
movq %rax, %rdi
callq 0x7f58
movl %eax, 0x9fa0(%rbx)
leaq 0x1caba(%rip), %rsi     # 0x37ca4
movq 0x8(%rsp), %rdi
callq 0x7c7e
movq %rax, %rdi
callq 0x7f58
movl %eax, 0x9fa8(%rbx)
leaq 0x1cdd2(%rip), %rsi     # 0x37fdb
movq 0x8(%rsp), %rdi
callq 0x7c7e
movq %rax, %rdi
callq 0x7f58
leaq 0x7a0(%rbx), %r14
movl %eax, 0x9fac(%rbx)
xorl %r15d, %r15d
leaq 0x70(%rsp), %r13
leaq 0x80(%rsp), %r12
movl 0x54(%rbx), %eax
cmpq %rax, %r15
jae 0x1b2a1
movq 0x8(%rsp), %rdi
leaq 0x1cd7d(%rip), %rsi     # 0x37fc9
callq 0x7c7e
movq %rax, %rdi
movq %r15, %rsi
callq 0x7f8e
movq %r13, %rdi
movq %rax, %rsi
callq 0x80e2
movq %r12, %rdi
movq %r13, %rsi
callq 0x20bea
movq %rbp, %rdi
movq %r12, %rsi
callq 0x20e1a
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1b290
movq (%rdi), %rax
callq *0x8(%rax)
movq %r13, %rdi
callq 0x7de0
incq %r15
addq $0x38, %rbp
jmp 0x1b238
movq 0x40(%rbx), %r15
leaq 0x18442(%rip), %rdx     # 0x336ee
movq 0x10(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x14944
leaq 0x9fa4(%rbx), %rdx
movq %r15, %rdi
movq %rax, %rsi
callq 0x146ea
leaq 0x1cd14(%rip), %rsi     # 0x37fe8
movq 0x8(%rsp), %rdi
callq 0x7c7e
movq %rax, %rdi
callq 0x7f58
movl %eax, 0x798(%rbx)
xorl %r15d, %r15d
leaq 0x1cd1e(%rip), %r12     # 0x38014
leaq 0x60(%rsp), %r13
leaq 0x80(%rsp), %rbp
movl %eax, %eax
cmpq %rax, %r15
jae 0x1b368
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x7c7e
movq %rax, %rdi
movq %r15, %rsi
callq 0x7f8e
movq %r13, %rdi
movq %rax, %rsi
callq 0x80e2
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x150f2
movq %r14, %rdi
movq %rbp, %rsi
callq 0x20e46
movq %rbp, %rdi
callq 0x20bc6
movq %r13, %rdi
callq 0x7de0
incq %r15
movl 0x798(%rbx), %eax
addq $0x98, %r14
jmp 0x1b303
leaq 0x1cc83(%rip), %rsi     # 0x37ff2
movq 0x8(%rsp), %rdi
callq 0x20eb8
testq %rax, %rax
je 0x1b3c9
pushq $0x68
popq %rdi
callq 0x53e0
movq %rax, %r15
leaq 0x1cc62(%rip), %rsi     # 0x37ff2
movq 0x8(%rsp), %rdi
callq 0x7c7e
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x80e2
leaq 0x40(%rsp), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x20eca
movq 0x30(%rsp), %rax
movq %r15, (%rax)
leaq 0x40(%rsp), %rdi
callq 0x7de0
leaq 0x1cc2a(%rip), %rsi     # 0x37ffa
movq 0x8(%rsp), %rdi
callq 0x20eb8
testq %rax, %rax
je 0x1b480
xorl %r14d, %r14d
leaq 0x1cc0d(%rip), %rbp     # 0x37ffa
leaq 0x50(%rsp), %r15
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x7c7e
movl %r14d, %r14d
movq %rax, %rdi
callq 0x114ee
cmpq %r14, %rax
jbe 0x1b480
pushq $0x58
popq %rdi
callq 0x53e0
movq %rax, %r13
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x7c7e
movq %rax, %rdi
movq %r14, %rsi
callq 0x7f8e
movq %r15, %rdi
movq %rax, %rsi
callq 0x80e2
movb $0x1, %r12b
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq 0x10(%rsp), %rcx
callq 0x1940c
movq %r13, 0x80(%rsp)
xorl %r12d, %r12d
movq 0x20(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x198de
movq %r15, %rdi
callq 0x7de0
incl %r14d
jmp 0x1b3f2
leaq 0x1cb7b(%rip), %rsi     # 0x38002
movq 0x8(%rsp), %rdi
callq 0x7c7e
movq %rax, %rdi
callq 0x7f58
movl %eax, 0x778(%rbx)
movq 0x780(%rbx), %rax
cmpq %rax, 0x788(%rbx)
je 0x1b4b6
movq %rax, 0x788(%rbx)
xorl %r14d, %r14d
leaq 0x1cb4e(%rip), %r15     # 0x3800e
leaq 0x80(%rsp), %r12
movl %r14d, %r14d
movq 0x768(%rbx), %rax
subq 0x760(%rbx), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jbe 0x1b51b
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x7c7e
movq %rax, %rdi
movq %r14, %rsi
callq 0x7f8e
movq %rax, %rdi
callq 0x7f58
movl %eax, 0x80(%rsp)
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x18774
incl %r14d
jmp 0x1b4c8
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbp
leaq 0x40(%rsp), %rdi
callq 0x7de0
jmp 0x1b53f
movq %rax, %rbp
pushq $0x68
popq %rsi
movq %r15, %rdi
jmp 0x1b5e6
jmp 0x1b5f1
jmp 0x1b5f1
jmp 0x1b5f1
jmp 0x1b5f1
movq %rax, %rbp
leaq 0x60(%rsp), %rdi
jmp 0x1b588
movq %rax, %rbp
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1b583
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x1b583
movq %rax, %rbp
leaq 0x70(%rsp), %rdi
callq 0x7de0
jmp 0x1b5f4
movq %rax, %rbp
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1b5a2
movq (%rdi), %rax
callq *0x8(%rax)
testq %r14, %r14
je 0x1b65e
negq %r14
movq 0x50(%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x1b5be
movq (%rdi), %rax
callq *0x8(%rax)
addq $-0x38, %r14
jne 0x1b5ae
jmp 0x1b65e
movq %rax, %rbp
leaq 0x50(%rsp), %rdi
callq 0x7de0
testb %r12b, %r12b
jne 0x1b5e0
jmp 0x1b5f4
movq %rax, %rbp
pushq $0x58
popq %rsi
movq %r13, %rdi
callq 0x53f0
jmp 0x1b5f4
jmp 0x1b5f1
jmp 0x1b5f1
movq %rax, %rbp
leaq 0x9fb8(%rbx), %r15
leaq 0x9fd0(%rbx), %rdi
callq 0x9268
movq %r15, %rdi
callq 0x20f30
movl $0x9f08, %r14d          # imm = 0x9F08
leaq (%rbx,%r14), %rdi
callq 0x20bc6
addq $-0x98, %r14
cmpq $0x708, %r14            # imm = 0x708
jne 0x1b615
movq 0x28(%rsp), %rdi
callq 0x8c8c
movq 0x20(%rsp), %rdi
callq 0x21c6a
movl $0x700, %r14d           # imm = 0x700
movq 0x50(%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x1b658
movq (%rdi), %rax
callq *0x8(%rax)
addq $-0x38, %r14
jne 0x1b648
movq %rbp, %rdi
callq 0x56f0