// File: /workspace/github_cpp_makefile_star2_O1/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 0x20a89
leaq 0x758(%rbx), %rax
movq %rax, 0xc8(%rsp)
leaq 0x760(%rbx), %rax
movq %rax, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x768(%rbx)
movups %xmm0, 0x758(%rbx)
movl $0xffffffff, 0x778(%rbx) # imm = 0xFFFFFFFF
leaq 0x780(%rbx), %rax
movq %rax, 0x10(%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 0x20b11
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), %rcx
movq %rcx, 0x38(%rbx)
movq 0x828(%rcx), %rax
movq %rax, 0x40(%rbx)
movq 0x830(%rcx), %rax
movq %rax, 0x48(%rbx)
leaq 0x2108d(%rip), %rsi     # 0x41c16
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x92c0
leaq 0x18(%rbx), %rdi
leaq 0x40(%rsp), %r15
movq -0x10(%r15), %r14
movq %rdi, 0xd0(%rsp)
movq %r14, %rsi
callq 0x5360
cmpq %r15, %r14
je 0x20bd0
movq 0x40(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x53a0
leaq 0x20fc9(%rip), %rsi     # 0x41ba0
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0x50(%rbx)
leaq 0x20faf(%rip), %rsi     # 0x41ba9
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0x54(%rbx)
leaq 0x20f9b(%rip), %rsi     # 0x41bb8
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0x9fa0(%rbx)
leaq 0x20c8d(%rip), %rsi     # 0x418d0
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0x9fa8(%rbx)
leaq 0x20f5a(%rip), %rsi     # 0x41bc3
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0x9fac(%rbx)
cmpl $0x0, 0x54(%rbx)
je 0x20d53
leaq 0x88(%rbx), %r13
xorl %r15d, %r15d
leaq 0xf8(%rsp), %rbp
leaq 0x30(%rsp), %r14
movq %r12, %rdi
leaq 0x20efe(%rip), %rsi     # 0x41bb1
callq 0x8fa0
movq %rax, %rdi
movq %r15, %rsi
callq 0x930e
movq %rbp, %rdi
movq %rax, %rsi
callq 0x94e0
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2844c
movups 0x30(%rsp), %xmm0
movups 0x40(%rsp), %xmm1
movups 0x50(%rsp), %xmm2
movups %xmm2, -0x10(%r13)
movups %xmm1, -0x20(%r13)
movups %xmm0, -0x30(%r13)
movq $0x0, (%r13)
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x20d13
movq (%rdi), %rax
callq *0x10(%rax)
movq %rax, (%r13)
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x20d23
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbp, %rdi
callq 0xd52a
movzbl 0xf8(%rsp), %esi
leaq 0x100(%rsp), %rdi
callq 0xd5cc
incq %r15
movl 0x54(%rbx), %eax
addq $0x38, %r13
cmpq %rax, %r15
jb 0x20ca9
movq 0x40(%rbx), %r14
leaq 0x1c990(%rip), %rdx     # 0x3d6ee
movq (%rsp), %rdi
movq 0xd0(%rsp), %rsi
callq 0x186c1
leaq 0x9fa4(%rbx), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x183ec
leaq 0x20e48(%rip), %rsi     # 0x41bd0
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0x798(%rbx)
testl %eax, %eax
je 0x20ee7
leaq 0x60(%rsp), %rbp
leaq 0x830(%rbx), %r14
xorl %r15d, %r15d
leaq 0xe8(%rsp), %r13
movq %r12, %rdi
leaq 0x20e2c(%rip), %rsi     # 0x41bfc
callq 0x8fa0
movq %rax, %rdi
movq %r15, %rsi
callq 0x930e
movq %r13, %rdi
movq %rax, %rsi
callq 0x94e0
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x190fa
movups 0x30(%rsp), %xmm0
movups 0x40(%rsp), %xmm1
movups 0x4c(%rsp), %xmm2
movups %xmm2, -0x74(%r14)
movups %xmm1, -0x80(%r14)
movups %xmm0, -0x90(%r14)
leaq -0x60(%r14), %rdi
movq %rbp, %rsi
callq 0x28da4
leaq -0x48(%r14), %rdi
leaq 0x78(%rsp), %rsi
callq 0x28da4
movq 0x40(%rbp), %rax
movq %rax, -0x20(%r14)
movups 0x30(%rbp), %xmm0
movups %xmm0, -0x30(%r14)
leaq -0x18(%r14), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x28de4
movq 0xc0(%rsp), %rax
movq %rax, (%r14)
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x20e80
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x20e9a
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x20eb1
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x53a0
movq %r13, %rdi
callq 0xd52a
movzbl 0xe8(%rsp), %esi
leaq 0xf0(%rsp), %rdi
callq 0xd5cc
incq %r15
movl 0x798(%rbx), %eax
addq $0x98, %r14
cmpq %rax, %r15
jb 0x20dc6
cmpb $0x1, (%r12)
jne 0x20f01
movq 0x8(%r12), %rdi
leaq 0x20ce0(%rip), %rsi     # 0x41bda
callq 0x291a8
jmp 0x20f03
xorl %eax, %eax
testq %rax, %rax
je 0x20f64
movl $0x68, %edi
callq 0x5390
movq %rax, %r14
leaq 0x20cbe(%rip), %rsi     # 0x41bda
movq %r12, %rdi
callq 0x8fa0
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x94e0
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x28720
movq 0xc8(%rsp), %rax
movq %r14, (%rax)
leaq 0x20(%rsp), %rdi
callq 0xd52a
leaq 0x28(%rsp), %rdi
movzbl -0x8(%rdi), %esi
callq 0xd5cc
cmpb $0x1, (%r12)
jne 0x20f7e
movq 0x8(%r12), %rdi
leaq 0x20c6b(%rip), %rsi     # 0x41be2
callq 0x291a8
jmp 0x20f80
xorl %eax, %eax
testq %rax, %rax
je 0x21069
xorl %r14d, %r14d
leaq 0xd8(%rsp), %rbp
movq %r12, %rdi
leaq 0x20c44(%rip), %rsi     # 0x41be2
callq 0x8fa0
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x20fd4
cmpl $0x1, %ecx
je 0x20fc5
cmpl $0x2, %ecx
jne 0x20fcf
movq 0x8(%rax), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x4, %rcx
jmp 0x20fd4
movq 0x8(%rax), %rax
movq 0x28(%rax), %rcx
jmp 0x20fd4
movl $0x1, %ecx
movl %r14d, %r14d
cmpq %r14, %rcx
jbe 0x21069
movl $0x58, %edi
callq 0x5390
movq %rax, %r15
movq %r12, %r13
movq %r12, %rdi
leaq 0x20be8(%rip), %rsi     # 0x41be2
callq 0x8fa0
movq %rax, %rdi
movq %r14, %rsi
callq 0x930e
movq %rbp, %rdi
movq %rax, %rsi
callq 0x94e0
movb $0x1, %r12b
movq %r15, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq (%rsp), %rcx
callq 0x1df68
movq %r15, 0x30(%rsp)
xorl %r12d, %r12d
movq 0x18(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1e5a6
movq %rbp, %rdi
callq 0xd52a
movzbl 0xd8(%rsp), %esi
leaq 0xe0(%rsp), %rdi
callq 0xd5cc
incl %r14d
movq %r13, %r12
jmp 0x20f94
leaq 0x20b7a(%rip), %rsi     # 0x41bea
movq %r12, %rdi
callq 0x8fa0
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0x778(%rbx)
movq 0x780(%rbx), %rax
cmpq %rax, 0x788(%rbx)
je 0x210a6
movq %rax, 0x788(%rbx)
movq 0x768(%rbx), %rax
cmpq 0x760(%rbx), %rax
je 0x21142
movl $0x1, %r13d
xorl %ebp, %ebp
leaq 0x20b2d(%rip), %r14     # 0x41bf6
leaq 0x30(%rsp), %r15
movq %r12, %rdi
movq %r14, %rsi
callq 0x8fa0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x930e
movq %rax, %rdi
movq %r15, %rsi
callq 0xe350
movl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x788(%rbx), %rsi
cmpq 0x790(%rbx), %rsi
je 0x21116
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x788(%rbx)
jmp 0x21125
movq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x1d2b4
movq 0x768(%rbx), %rax
subq 0x760(%rbx), %rax
movl %r13d, %ebp
sarq $0x3, %rax
incl %r13d
cmpq %rbp, %rax
ja 0x210ce
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r13
leaq 0x20(%rsp), %rdi
callq 0x915e
jmp 0x21166
movq %rax, %r13
movl $0x68, %esi
movq %r14, %rdi
jmp 0x211d1
jmp 0x211dc
movq %rax, %r13
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x2119d
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x2119d
jmp 0x211dc
jmp 0x211dc
jmp 0x211dc
movq %rax, %r13
leaq 0xe8(%rsp), %rdi
jmp 0x211a5
movq %rax, %r13
leaq 0xf8(%rsp), %rdi
callq 0x915e
jmp 0x211df
movq %rax, %r13
leaq 0xd8(%rsp), %rdi
callq 0x915e
jmp 0x211c4
movq %rax, %r13
movb $0x1, %r12b
testb %r12b, %r12b
je 0x211df
movl $0x58, %esi
movq %r15, %rdi
callq 0x53a0
jmp 0x211df
jmp 0x211dc
jmp 0x211dc
movq %rax, %r13
leaq 0x9fb8(%rbx), %r14
leaq 0x9fd0(%rbx), %rdi
callq 0xa564
movq %r14, %rdi
callq 0x28798
movl $0x9f08, %r14d          # imm = 0x9F08
leaq (%rbx,%r14), %rdi
callq 0x28402
addq $-0x98, %r14
cmpq $0x708, %r14            # imm = 0x708
jne 0x21200
movq 0x10(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x21235
movq 0x790(%rbx), %rsi
subq %rdi, %rsi
callq 0x53a0
movq 0x18(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x21251
movq 0x770(%rbx), %rsi
subq %rdi, %rsi
callq 0x53a0
movl $0x700, %r14d           # imm = 0x700
movq 0x50(%rbx,%r14), %rdi
testq %rdi, %rdi
je 0x21267
movq (%rdi), %rax
callq *0x8(%rax)
addq $-0x38, %r14
jne 0x21257
movq %r13, %rdi
callq 0x56e0
nop