// File: /workspace/github_cpp_makefile_star2_O3/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 $0x108, %rsp            # imm = 0x108
movq %rdx, %r12
movq %rsi, (%rsp)
movq %rdi, %rbx
movl $0x0, 0x54(%rdi)
movl $0x88, %eax
xorl %ecx, %ecx
movw $0x1, -0x30(%rbx,%rax)
movl $0x0, -0xc(%rbx,%rax)
movb %cl, -0x8(%rbx,%rax)
movl $0x2, -0x4(%rbx,%rax)
movq $0x0, (%rbx,%rax)
movb %cl, -0x2e(%rbx,%rax)
addq $0x38, %rax
cmpq $0x788, %rax            # imm = 0x788
jne 0x2037b
leaq 0x758(%rbx), %rax
movq %rax, 0xd8(%rsp)
leaq 0x760(%rbx), %rax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x768(%rbx)
movups %xmm0, 0x758(%rbx)
movl $0xffffffff, 0x778(%rbx) # imm = 0xFFFFFFFF
leaq 0x780(%rbx), %rax
movq %rax, 0x18(%rsp)
movups %xmm0, 0x780(%rbx)
movups %xmm0, 0x78c(%rbx)
movl $0x818, %eax            # imm = 0x818
movups %xmm0, (%rbx,%rax)
movq $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 0x20403
xorl %eax, %eax
movl %eax, 0x9fa0(%rbx)
movl %eax, 0x9fb0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x9fb8(%rbx)
movups %xmm0, 0x9fc8(%rbx)
movups %xmm0, 0x9fd8(%rbx)
movq %rbx, (%rbx)
movq (%rsp), %rax
movq %rax, 0x38(%rbx)
movups 0x828(%rax), %xmm0
movups %xmm0, 0x40(%rbx)
leaq 0x207d6(%rip), %rsi     # 0x40c46
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x91f2
leaq 0x18(%rbx), %rdi
leaq 0x50(%rsp), %r15
movq -0x10(%r15), %r14
movq %rdi, 0xe0(%rsp)
movq %r14, %rsi
callq 0x5360
cmpq %r15, %r14
je 0x204b7
movq 0x50(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x53a0
leaq 0x20712(%rip), %rsi     # 0x40bd0
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0x50(%rbx)
leaq 0x206f8(%rip), %rsi     # 0x40bd9
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0x54(%rbx)
leaq 0x206e4(%rip), %rsi     # 0x40be8
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0x9fa0(%rbx)
leaq 0x20396(%rip), %rsi     # 0x408c0
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0x9fa8(%rbx)
leaq 0x206a3(%rip), %rsi     # 0x40bf3
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0x9fac(%rbx)
cmpl $0x0, 0x54(%rbx)
je 0x2063a
leaq 0x88(%rbx), %r13
xorl %r15d, %r15d
leaq 0xf8(%rsp), %rbp
leaq 0x40(%rsp), %r14
movq %r12, %rdi
leaq 0x20647(%rip), %rsi     # 0x40be1
callq 0x8eb2
movq %rax, %rdi
movq %r15, %rsi
callq 0x9240
movq %rbp, %rdi
movq %rax, %rsi
callq 0x942c
movq %r14, %rdi
movq %rbp, %rsi
callq 0x27d72
movups 0x40(%rsp), %xmm0
movups 0x50(%rsp), %xmm1
movups 0x60(%rsp), %xmm2
movups %xmm2, -0x10(%r13)
movups %xmm1, -0x20(%r13)
movups %xmm0, -0x30(%r13)
movq $0x0, (%r13)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x2060a
movq (%rdi), %rax
callq *0x10(%rax)
movq %rax, (%r13)
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x2060a
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbp, %rdi
callq 0xd118
movzbl 0xf8(%rsp), %esi
leaq 0x100(%rsp), %rdi
callq 0xd1ba
incq %r15
movl 0x54(%rbx), %eax
addq $0x38, %r13
cmpq %rax, %r15
jb 0x20590
movq 0x40(%rbx), %r14
leaq 0x1c0a9(%rip), %rdx     # 0x3c6ee
movq (%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x17f62
leaq 0x9fa4(%rbx), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x17c8c
leaq 0x20591(%rip), %rsi     # 0x40c00
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0x798(%rbx)
testl %eax, %eax
je 0x20868
leaq 0x70(%rsp), %r15
leaq 0x830(%rbx), %rbp
xorl %r14d, %r14d
leaq 0xe8(%rsp), %r13
movq %r12, %rdi
leaq 0x20575(%rip), %rsi     # 0x40c2c
callq 0x8eb2
movq %rax, %rdi
movq %r14, %rsi
callq 0x9240
movq %r13, %rdi
movq %rax, %rsi
callq 0x942c
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x1891c
movups 0x40(%rsp), %xmm0
movups 0x50(%rsp), %xmm1
movups 0x5c(%rsp), %xmm2
movups %xmm2, -0x74(%rbp)
movups %xmm1, -0x80(%rbp)
movups %xmm0, -0x90(%rbp)
movq -0x60(%rbp), %rdi
movq -0x50(%rbp), %rsi
movups 0x70(%rsp), %xmm0
movups %xmm0, -0x60(%rbp)
movq 0x80(%rsp), %rax
movq %rax, -0x50(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq $0x0, 0x10(%r15)
testq %rdi, %rdi
je 0x20739
subq %rdi, %rsi
callq 0x53a0
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movups 0x88(%rsp), %xmm0
movups %xmm0, -0x48(%rbp)
movq 0x98(%rsp), %rax
movq %rax, -0x38(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r15)
movq $0x0, 0x28(%r15)
testq %rdi, %rdi
je 0x20776
subq %rdi, %rsi
callq 0x53a0
movq 0x40(%r15), %rax
movq %rax, -0x20(%rbp)
movups 0x30(%r15), %xmm0
movups %xmm0, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movups 0xb8(%rsp), %xmm0
movups %xmm0, -0x18(%rbp)
movq 0xc8(%rsp), %rax
movq %rax, -0x8(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r15)
movq $0x0, 0x58(%r15)
testq %rdi, %rdi
je 0x207ef
subq %rdi, %rsi
callq 0x53a0
movq 0xb8(%rsp), %rdi
movq 0xd0(%rsp), %rax
movq %rax, (%rbp)
testq %rdi, %rdi
je 0x207fb
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
jmp 0x207fb
movq 0xd0(%rsp), %rax
movq %rax, (%rbp)
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x20818
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x20832
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
movq %r13, %rdi
callq 0xd118
movzbl 0xe8(%rsp), %esi
leaq 0xf0(%rsp), %rdi
callq 0xd1ba
incq %r14
movl 0x798(%rbx), %eax
addq $0x98, %rbp
cmpq %rax, %r14
jb 0x206ad
cmpb $0x1, (%r12)
jne 0x209d3
movq 0x8(%r12), %rdi
leaq 0x2038b(%rip), %rsi     # 0x40c0a
callq 0x28a4e
testq %rax, %rax
je 0x208e5
movl $0x68, %edi
callq 0x5390
movq %rax, %r14
leaq 0x2036d(%rip), %rsi     # 0x40c0a
movq %r12, %rdi
callq 0x8eb2
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x942c
leaq 0x30(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x28048
movq 0xd8(%rsp), %rax
movq %r14, (%rax)
leaq 0x30(%rsp), %rdi
callq 0xd118
leaq 0x38(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0xd1ba
cmpb $0x1, (%r12)
jne 0x209d3
movq 0x8(%r12), %rdi
leaq 0x20316(%rip), %rsi     # 0x40c12
callq 0x28a4e
testq %rax, %rax
je 0x209d3
xorl %r14d, %r14d
leaq 0x202fe(%rip), %r13     # 0x40c12
leaq 0x20(%rsp), %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x8eb2
movzbl (%rax), %ecx
cmpl $0x1, %ecx
je 0x20950
cmpl $0x2, %ecx
je 0x2093f
movl $0x1, %eax
testl %ecx, %ecx
jne 0x20958
jmp 0x209d3
movq 0x8(%rax), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x4, %rax
jmp 0x20958
movq 0x8(%rax), %rax
movq 0x28(%rax), %rax
movl %r14d, %r14d
cmpq %r14, %rax
jbe 0x209d3
movl $0x58, %edi
callq 0x5390
movq %rax, %r15
movq %r12, %rdi
movq %r13, %rsi
callq 0x8eb2
movq %rax, %rdi
movq %r14, %rsi
callq 0x9240
movq %rbp, %rdi
movq %rax, %rsi
callq 0x942c
movq %r15, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq (%rsp), %rcx
callq 0x1d8d4
movq %r15, 0x40(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x1df10
movq %rbp, %rdi
callq 0xd118
movzbl 0x20(%rsp), %esi
leaq 0x28(%rsp), %rdi
callq 0xd1ba
incl %r14d
jmp 0x20919
leaq 0x20240(%rip), %rsi     # 0x40c1a
movq %r12, %rdi
callq 0x8eb2
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0x778(%rbx)
movq 0x780(%rbx), %rax
cmpq %rax, 0x788(%rbx)
je 0x20a10
movq %rax, 0x788(%rbx)
movq 0x768(%rbx), %rax
cmpq 0x760(%rbx), %rax
je 0x20aac
movl $0x1, %r13d
xorl %ebp, %ebp
leaq 0x201f3(%rip), %r14     # 0x40c26
leaq 0x40(%rsp), %r15
movq %r12, %rdi
movq %r14, %rsi
callq 0x8eb2
movq %rax, %rdi
movq %rbp, %rsi
callq 0x9240
movq %rax, %rdi
movq %r15, %rsi
callq 0xdf5b
movl 0x40(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x788(%rbx), %rsi
cmpq 0x790(%rbx), %rsi
je 0x20a80
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x788(%rbx)
jmp 0x20a8f
movq 0x18(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x1cbbc
movq 0x768(%rbx), %rax
subq 0x760(%rbx), %rax
movl %r13d, %ebp
sarq $0x3, %rax
incl %r13d
cmpq %rbp, %rax
ja 0x20a38
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
leaq 0x30(%rsp), %rdi
callq 0x907c
jmp 0x20ad0
movq %rax, %r12
movl $0x68, %esi
movq %r14, %rdi
jmp 0x20b04
jmp 0x20b45
jmp 0x20b45
movq %rax, %r12
leaq 0x20(%rsp), %rdi
jmp 0x20b3a
movq %rax, %r12
leaq 0x20(%rsp), %rdi
callq 0x907c
jmp 0x20afc
jmp 0x20b45
movq %rax, %r12
movl $0x58, %esi
movq %r15, %rdi
callq 0x53a0
jmp 0x20b48
movq %rax, %r12
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x20b32
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x20b32
jmp 0x20b45
movq %rax, %r12
leaq 0xe8(%rsp), %rdi
jmp 0x20b3a
movq %rax, %r12
leaq 0xf8(%rsp), %rdi
callq 0x907c
jmp 0x20b48
jmp 0x20b45
jmp 0x20b45
movq %rax, %r12
leaq 0x9fb8(%rbx), %r14
leaq 0x9fd0(%rbx), %rdi
callq 0xa37e
movq %r14, %rdi
callq 0x280c0
movl $0x9f08, %r14d          # imm = 0x9F08
leaq (%rbx,%r14), %rdi
callq 0x27d28
addq $-0x98, %r14
cmpq $0x708, %r14            # imm = 0x708
jne 0x20b69
movq 0x18(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x20b9e
movq 0x790(%rbx), %rsi
subq %rdi, %rsi
callq 0x53a0
movq 0x10(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x20bba
movq 0x770(%rbx), %rsi
subq %rdi, %rsi
callq 0x53a0
movl $0x700, %r14d           # imm = 0x700
movq 0x50(%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x20bd0
movq (%rdi), %rax
callq *0x8(%rax)
addq $-0x38, %r14
jne 0x20bc0
movq %r12, %rdi
callq 0x56e0