// File: 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
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdx, -0x1b8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
callq 0xe960
movq -0x1b0(%rbp), %rax
movl $0x0, 0x54(%rax)
addq $0x58, %rax
movq %rax, -0x1a8(%rbp)
movq %rax, %rcx
addq $0x700, %rcx            # imm = 0x700
movq %rcx, -0x1a0(%rbp)
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x1c0(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xd240
jmp 0x47bf8
movq -0x1c0(%rbp), %rdi
leaq 0x3ea24(%rip), %rsi     # 0x8662a
xorl %ecx, %ecx
leaq -0x20(%rbp), %r8
movl $0x1, %r9d
movl %ecx, %edx
callq 0xe970
jmp 0x47c1b
leaq -0x20(%rbp), %rdi
callq 0xc3c0
movq -0x1c0(%rbp), %rax
movq -0x1a0(%rbp), %rcx
addq $0x38, %rax
cmpq %rcx, %rax
movq %rax, -0x198(%rbp)
jne 0x47bdf
movq -0x1b0(%rbp), %rdi
movq $0x0, 0x758(%rdi)
addq $0x760, %rdi            # imm = 0x760
movq %rdi, -0x1e8(%rbp)
callq 0xea10
movq -0x1b0(%rbp), %rdi
movl $0xffffffff, 0x778(%rdi) # imm = 0xFFFFFFFF
addq $0x780, %rdi            # imm = 0x780
movq %rdi, -0x1e0(%rbp)
callq 0xd880
movq -0x1b0(%rbp), %rax
movl $0x0, 0x798(%rax)
addq $0x7a0, %rax            # imm = 0x7A0
movq %rax, -0x1d8(%rbp)
movq %rax, %rcx
addq $0x9800, %rcx           # imm = 0x9800
movq %rcx, -0x1d0(%rbp)
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0xea30
jmp 0x47cd6
movq -0x1d0(%rbp), %rcx
movq -0x1f0(%rbp), %rax
addq $0x98, %rax
cmpq %rcx, %rax
movq %rax, -0x1c8(%rbp)
jne 0x47cc1
movq -0x1b0(%rbp), %rdi
movl $0x0, 0x9fa0(%rdi)
movl $0x0, 0x9fb0(%rdi)
addq $0x9fb8, %rdi           # imm = 0x9FB8
movq %rdi, -0x200(%rbp)
callq 0xeab0
movq -0x1b0(%rbp), %rdi
addq $0x9fd0, %rdi           # imm = 0x9FD0
movq %rdi, -0x1f8(%rbp)
callq 0xc310
jmp 0x47d40
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rax
movq %rax, (%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rcx
movq 0x828(%rcx), %rcx
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rcx
movq 0x830(%rcx), %rcx
movq %rcx, 0x48(%rax)
addq $0x18, %rax
movq %rax, -0x210(%rbp)
leaq 0x3be8d(%rip), %rsi     # 0x83c16
callq 0xae60
movq %rax, -0x208(%rbp)
jmp 0x47d97
movq -0x208(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0xb390
jmp 0x47da9
leaq -0x50(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x6210
movq -0x210(%rbp), %rdi
movq %rax, %rsi
callq 0x6460
movq -0x220(%rbp), %rdi
callq 0x6340
movq -0x1b8(%rbp), %rdi
leaq 0x3bdbe(%rip), %rsi     # 0x83ba0
callq 0xae60
movq %rax, -0x218(%rbp)
jmp 0x47df0
movq -0x218(%rbp), %rdi
callq 0xb410
movl %eax, -0x224(%rbp)
jmp 0x47e04
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rax
movl -0x224(%rbp), %ecx
movl %ecx, 0x50(%rax)
leaq 0x3bd87(%rip), %rsi     # 0x83ba9
callq 0xae60
movq %rax, -0x230(%rbp)
jmp 0x47e30
movq -0x230(%rbp), %rdi
callq 0xb410
movl %eax, -0x234(%rbp)
jmp 0x47e44
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rax
movl -0x234(%rbp), %ecx
movl %ecx, 0x54(%rax)
leaq 0x3bd56(%rip), %rsi     # 0x83bb8
callq 0xae60
movq %rax, -0x240(%rbp)
jmp 0x47e70
movq -0x240(%rbp), %rdi
callq 0xb410
movl %eax, -0x244(%rbp)
jmp 0x47e84
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rax
movl -0x244(%rbp), %ecx
movl %ecx, 0x9fa0(%rax)
leaq 0x3ba1b(%rip), %rsi     # 0x838c0
callq 0xae60
movq %rax, -0x250(%rbp)
jmp 0x47eb3
movq -0x250(%rbp), %rdi
callq 0xb410
movl %eax, -0x254(%rbp)
jmp 0x47ec7
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rax
movl -0x254(%rbp), %ecx
movl %ecx, 0x9fa8(%rax)
leaq 0x3bcdb(%rip), %rsi     # 0x83bc3
callq 0xae60
movq %rax, -0x260(%rbp)
jmp 0x47ef6
movq -0x260(%rbp), %rdi
callq 0xb410
movl %eax, -0x264(%rbp)
jmp 0x47f0a
movq -0x1b0(%rbp), %rax
movl -0x264(%rbp), %ecx
movl %ecx, 0x9fac(%rax)
movl $0x0, -0x54(%rbp)
movq -0x1b0(%rbp), %rcx
movl -0x54(%rbp), %eax
cmpl 0x54(%rcx), %eax
jae 0x48107
movq -0x1b8(%rbp), %rdi
leaq 0x3bc6c(%rip), %rsi     # 0x83bb1
callq 0xae60
movq %rax, -0x270(%rbp)
jmp 0x47f53
movq -0x270(%rbp), %rdi
movl -0x54(%rbp), %eax
movl %eax, %esi
callq 0xb470
movq %rax, -0x278(%rbp)
jmp 0x47f6d
movq -0x278(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xb700
jmp 0x47f82
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x52650
jmp 0x47f97
movq -0x1b0(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x38, %rcx, %rcx
leaq 0x58(%rax,%rcx), %rdi
leaq -0x90(%rbp), %rsi
callq 0x52af0
jmp 0x47fb8
leaq -0x90(%rbp), %rdi
callq 0xe9f0
leaq -0xa0(%rbp), %rdi
callq 0xb110
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x47f24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x48001
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xc3c0
movq -0x1c0(%rbp), %rax
movq -0x1a8(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x280(%rbp)
je 0x4804c
movq -0x280(%rbp), %rdi
addq $-0x38, %rdi
movq %rdi, -0x288(%rbp)
callq 0xe9f0
movq -0x1a8(%rbp), %rcx
movq -0x288(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x280(%rbp)
jne 0x4801b
jmp 0x4873d
movq -0x1d8(%rbp), %rcx
movq %rax, %rsi
movq -0x1f0(%rbp), %rax
movq %rsi, -0x28(%rbp)
movl %edx, -0x2c(%rbp)
cmpq %rax, %rcx
movq %rax, -0x290(%rbp)
je 0x480a9
movq -0x290(%rbp), %rdi
addq $-0x98, %rdi
movq %rdi, -0x298(%rbp)
callq 0xea70
movq -0x1d8(%rbp), %rcx
movq -0x298(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x290(%rbp)
jne 0x48075
jmp 0x486de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x48688
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4867c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x480f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xe9f0
leaq -0xa0(%rbp), %rdi
callq 0xb110
jmp 0x4867c
movq -0x1b0(%rbp), %rsi
movq 0x40(%rsi), %rax
movq %rax, -0x2a8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x18, %rsi
leaq 0x3690a(%rip), %rdx     # 0x7ea32
callq 0x35280
movq %rax, -0x2a0(%rbp)
jmp 0x48136
movq -0x2a0(%rbp), %rsi
movq -0x2a8(%rbp), %rdi
movq -0x1b0(%rbp), %rdx
addq $0x9fa4, %rdx           # imm = 0x9FA4
callq 0x34e90
jmp 0x48159
movq -0x1b8(%rbp), %rdi
leaq 0x3ba69(%rip), %rsi     # 0x83bd0
callq 0xae60
movq %rax, -0x2b0(%rbp)
jmp 0x48175
movq -0x2b0(%rbp), %rdi
callq 0xb410
movl %eax, -0x2b4(%rbp)
jmp 0x48189
movq -0x1b0(%rbp), %rax
movl -0x2b4(%rbp), %ecx
movl %ecx, 0x798(%rax)
movl $0x0, -0xa4(%rbp)
movq -0x1b0(%rbp), %rcx
movl -0xa4(%rbp), %eax
cmpl 0x798(%rcx), %eax
jae 0x4829c
movq -0x1b8(%rbp), %rdi
leaq 0x3ba2f(%rip), %rsi     # 0x83bfc
callq 0xae60
movq %rax, -0x2c0(%rbp)
jmp 0x481db
movq -0x2c0(%rbp), %rdi
movl -0xa4(%rbp), %eax
movl %eax, %esi
callq 0xb470
movq %rax, -0x2c8(%rbp)
jmp 0x481f8
movq -0x2c8(%rbp), %rsi
leaq -0x150(%rbp), %rdi
callq 0xb700
jmp 0x4820d
movq -0x1b0(%rbp), %rsi
leaq -0x140(%rbp), %rdi
leaq -0x150(%rbp), %rdx
callq 0x361d0
jmp 0x48229
movq -0x1b0(%rbp), %rdi
addq $0x7a0, %rdi            # imm = 0x7A0
movl -0xa4(%rbp), %eax
imulq $0x98, %rax, %rax
addq %rax, %rdi
leaq -0x140(%rbp), %rsi
callq 0x52b40
leaq -0x140(%rbp), %rdi
callq 0xea70
leaq -0x150(%rbp), %rdi
callq 0xb110
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x481a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xb110
jmp 0x4867c
movq -0x1b8(%rbp), %rdi
leaq 0x3b930(%rip), %rsi     # 0x83bda
callq 0x52be0
movq %rax, -0x2d0(%rbp)
jmp 0x482b8
movq -0x2d0(%rbp), %rax
cmpq $0x0, %rax
je 0x483a1
movl $0x68, %edi
callq 0x64a0
movq %rax, -0x2d8(%rbp)
jmp 0x482dc
movq -0x1b8(%rbp), %rdi
movb $0x1, -0x161(%rbp)
leaq 0x3b8e9(%rip), %rsi     # 0x83bda
callq 0xae60
movq %rax, -0x2e0(%rbp)
jmp 0x482ff
movq -0x2e0(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0xb700
jmp 0x48314
movq -0x1b0(%rbp), %rsi
movq -0x2d8(%rbp), %rdi
leaq -0x160(%rbp), %rdx
callq 0x52c30
jmp 0x48330
movq -0x1b0(%rbp), %rax
movq -0x2d8(%rbp), %rcx
movb $0x0, -0x161(%rbp)
movq %rcx, 0x758(%rax)
leaq -0x160(%rbp), %rdi
callq 0xb110
jmp 0x483a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x48380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0xb110
testb $0x1, -0x161(%rbp)
jne 0x4838b
jmp 0x4839c
movq -0x2d8(%rbp), %rdi
movl $0x68, %esi
callq 0x64b0
jmp 0x4867c
movq -0x1b8(%rbp), %rdi
leaq 0x3b833(%rip), %rsi     # 0x83be2
callq 0x52be0
movq %rax, -0x2e8(%rbp)
jmp 0x483bd
movq -0x2e8(%rbp), %rax
cmpq $0x0, %rax
je 0x4854f
movl $0x0, -0x168(%rbp)
movq -0x1b8(%rbp), %rdi
movl -0x168(%rbp), %eax
movq %rax, -0x2f8(%rbp)
leaq 0x3b7ef(%rip), %rsi     # 0x83be2
callq 0xae60
movq %rax, -0x2f0(%rbp)
jmp 0x48401
movq -0x2f0(%rbp), %rdi
callq 0x2b630
movq %rax, %rcx
movq -0x2f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x4854d
movq -0x1b0(%rbp), %rax
addq $0x760, %rax            # imm = 0x760
movq %rax, -0x308(%rbp)
movl $0x58, %edi
callq 0x64a0
movq %rax, -0x300(%rbp)
jmp 0x48447
movq -0x1b8(%rbp), %rdi
movb $0x1, -0x181(%rbp)
leaq 0x3b786(%rip), %rsi     # 0x83be2
callq 0xae60
movq %rax, -0x310(%rbp)
jmp 0x4846a
movq -0x310(%rbp), %rdi
movl -0x168(%rbp), %eax
movl %eax, %esi
callq 0xb470
movq %rax, -0x318(%rbp)
jmp 0x48487
movq -0x318(%rbp), %rsi
leaq -0x180(%rbp), %rdi
callq 0xb700
jmp 0x4849c
movq -0x1b0(%rbp), %rsi
movq -0x300(%rbp), %rdi
movq -0x10(%rbp), %rcx
leaq -0x180(%rbp), %rdx
callq 0x434f0
jmp 0x484bc
movq -0x308(%rbp), %rdi
movq -0x300(%rbp), %rax
movb $0x0, -0x181(%rbp)
movq %rax, -0x170(%rbp)
leaq -0x170(%rbp), %rsi
callq 0x438f0
jmp 0x484e6
leaq -0x180(%rbp), %rdi
callq 0xb110
movl -0x168(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x168(%rbp)
jmp 0x483d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4852c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0xb110
testb $0x1, -0x181(%rbp)
jne 0x48537
jmp 0x48548
movq -0x300(%rbp), %rdi
movl $0x58, %esi
callq 0x64b0
jmp 0x4867c
jmp 0x4854f
movq -0x1b8(%rbp), %rdi
leaq 0x3b68d(%rip), %rsi     # 0x83bea
callq 0xae60
movq %rax, -0x320(%rbp)
jmp 0x4856b
movq -0x320(%rbp), %rdi
callq 0xb410
movl %eax, -0x324(%rbp)
jmp 0x4857f
movq -0x1b0(%rbp), %rdi
movl -0x324(%rbp), %eax
movl %eax, 0x778(%rdi)
addq $0x780, %rdi            # imm = 0x780
callq 0x3d660
movl $0x0, -0x188(%rbp)
movq -0x1b0(%rbp), %rdi
movl -0x188(%rbp), %eax
movq %rax, -0x330(%rbp)
addq $0x760, %rdi            # imm = 0x760
callq 0x447e0
movq %rax, %rcx
movq -0x330(%rbp), %rax
cmpq %rcx, %rax
jae 0x48673
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rax
addq $0x780, %rax            # imm = 0x780
movq %rax, -0x340(%rbp)
leaq 0x3b5f9(%rip), %rsi     # 0x83bf6
callq 0xae60
movq %rax, -0x338(%rbp)
jmp 0x4860b
movq -0x338(%rbp), %rdi
movl -0x188(%rbp), %eax
movl %eax, %esi
callq 0xb470
movq %rax, -0x348(%rbp)
jmp 0x48628
movq -0x348(%rbp), %rdi
callq 0xb410
movl %eax, -0x34c(%rbp)
jmp 0x4863c
movq -0x340(%rbp), %rdi
movl -0x34c(%rbp), %eax
movl %eax, -0x18c(%rbp)
leaq -0x18c(%rbp), %rsi
callq 0x3d6c0
jmp 0x4865d
jmp 0x4865f
movl -0x188(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x188(%rbp)
jmp 0x485a8
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0x1f8(%rbp), %rdi
callq 0xc430
movq -0x200(%rbp), %rdi
callq 0xead0
movq -0x1d8(%rbp), %rax
addq $0x9800, %rax           # imm = 0x9800
movq %rax, -0x358(%rbp)
movq -0x358(%rbp), %rdi
addq $-0x98, %rdi
movq %rdi, -0x360(%rbp)
callq 0xea70
movq -0x1d8(%rbp), %rcx
movq -0x360(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x358(%rbp)
jne 0x486a8
jmp 0x486de
movq -0x1e0(%rbp), %rdi
callq 0xde10
movq -0x1e8(%rbp), %rdi
callq 0xeb30
movq -0x1a8(%rbp), %rax
addq $0x700, %rax            # imm = 0x700
movq %rax, -0x368(%rbp)
movq -0x368(%rbp), %rdi
addq $-0x38, %rdi
movq %rdi, -0x370(%rbp)
callq 0xe9f0
movq -0x1a8(%rbp), %rcx
movq -0x370(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x368(%rbp)
jne 0x4870a
jmp 0x4873d
movq -0x28(%rbp), %rdi
callq 0x6890
nopw %cs:(%rax,%rax)