// File: Konano[P]UselessDatabase/Index.cpp
// Function: Index::Index(Table*, 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>)
Index::Index(Table* table, json j) : table(table) {
    strcpy(name, j["name"].get<std::string>().c_str());
    key.clear();
    ty.clear();
    offset.clear();
    key_num = j["key_num"].get<int>();
    for (uint i = 0; i < key_num; i++) key.push_back(j["key"][i]);
    for (uint i = 0; i < key_num; i++) offset.push_back(j["offset"][i]);
    page_num = j["page_num"].get<int>();
    root_page = j["root_page"].get<int>();
    next_del_page = j["next_del_page"].get<int>();
    record_size = j["record_size"].get<int>();
    for (uint i = 0; i < key_num; i++) ty.push_back((enumType)j["ty"][i]);
    fileID = -1; // file is closed
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdx, -0x78(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq %rax, (%rdi)
addq $0x30, %rdi
movq %rdi, -0x98(%rbp)
callq 0xec40
movq -0x80(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0x90(%rbp)
callq 0xec40
movq -0x80(%rbp), %rdi
addq $0x78, %rdi
movq %rdi, -0x88(%rbp)
callq 0xec60
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rdi
addq $0x8, %rax
movq %rax, -0x70(%rbp)
leaq 0x4d9cd(%rip), %rsi     # 0x83c16
callq 0xae60
movq %rax, -0x68(%rbp)
jmp 0x36254
movq -0x68(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xb390
jmp 0x36263
leaq -0x38(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x6210
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x6460
movq -0xa8(%rbp), %rdi
callq 0x6340
movq -0x80(%rbp), %rdi
addq $0x30, %rdi
callq 0x3d020
movq -0x80(%rbp), %rdi
addq $0x78, %rdi
callq 0x3d040
movq -0x80(%rbp), %rdi
addq $0x48, %rdi
callq 0x3d020
movq -0x78(%rbp), %rdi
leaq 0x4d5d3(%rip), %rsi     # 0x83890
callq 0xae60
movq %rax, -0xa0(%rbp)
jmp 0x362cb
movq -0xa0(%rbp), %rdi
callq 0xb410
movl %eax, -0xac(%rbp)
jmp 0x362df
movq -0x80(%rbp), %rax
movl -0xac(%rbp), %ecx
movl %ecx, 0x28(%rax)
movl $0x0, -0x48(%rbp)
movq -0x80(%rbp), %rcx
movl -0x48(%rbp), %eax
cmpl 0x28(%rcx), %eax
jae 0x363b9
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rax
addq $0x30, %rax
movq %rax, -0xc0(%rbp)
leaq 0x4b23b(%rip), %rsi     # 0x81558
callq 0xae60
movq %rax, -0xb8(%rbp)
jmp 0x3632b
movq -0xb8(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0xb470
movq %rax, -0xc8(%rbp)
jmp 0x36345
movq -0xc8(%rbp), %rdi
callq 0x3d090
movl %eax, -0xcc(%rbp)
jmp 0x36359
movq -0xc0(%rbp), %rdi
movl -0xcc(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq -0x4c(%rbp), %rsi
callq 0x3d060
jmp 0x36374
jmp 0x36376
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x362f3
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0xede0
movq -0x90(%rbp), %rdi
callq 0xee40
movq -0x98(%rbp), %rdi
callq 0xee40
jmp 0x365e6
movl $0x0, -0x50(%rbp)
movq -0x80(%rbp), %rcx
movl -0x50(%rbp), %eax
cmpl 0x28(%rcx), %eax
jae 0x36451
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rax
addq $0x48, %rax
movq %rax, -0xe0(%rbp)
leaq 0x4d4ae(%rip), %rsi     # 0x83898
callq 0xae60
movq %rax, -0xd8(%rbp)
jmp 0x363f8
movq -0xd8(%rbp), %rdi
movl -0x50(%rbp), %eax
movl %eax, %esi
callq 0xb470
movq %rax, -0xe8(%rbp)
jmp 0x36412
movq -0xe8(%rbp), %rdi
callq 0x3d090
movl %eax, -0xec(%rbp)
jmp 0x36426
movq -0xe0(%rbp), %rdi
movl -0xec(%rbp), %eax
movl %eax, -0x54(%rbp)
leaq -0x54(%rbp), %rsi
callq 0x3d060
jmp 0x36441
jmp 0x36443
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x363c0
movq -0x78(%rbp), %rdi
leaq 0x4d443(%rip), %rsi     # 0x8389f
callq 0xae60
movq %rax, -0xf8(%rbp)
jmp 0x3646a
movq -0xf8(%rbp), %rdi
callq 0xb410
movl %eax, -0xfc(%rbp)
jmp 0x3647e
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rax
movl -0xfc(%rbp), %ecx
movl %ecx, 0x60(%rax)
leaq 0x4d412(%rip), %rsi     # 0x838a8
callq 0xae60
movq %rax, -0x108(%rbp)
jmp 0x364a4
movq -0x108(%rbp), %rdi
callq 0xb410
movl %eax, -0x10c(%rbp)
jmp 0x364b8
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rax
movl -0x10c(%rbp), %ecx
movl %ecx, 0x64(%rax)
leaq 0x4d3e2(%rip), %rsi     # 0x838b2
callq 0xae60
movq %rax, -0x118(%rbp)
jmp 0x364de
movq -0x118(%rbp), %rdi
callq 0xb410
movl %eax, -0x11c(%rbp)
jmp 0x364f2
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rax
movl -0x11c(%rbp), %ecx
movl %ecx, 0x68(%rax)
leaq 0x4d3b6(%rip), %rsi     # 0x838c0
callq 0xae60
movq %rax, -0x128(%rbp)
jmp 0x36518
movq -0x128(%rbp), %rdi
callq 0xb410
movl %eax, -0x12c(%rbp)
jmp 0x3652c
movq -0x80(%rbp), %rax
movl -0x12c(%rbp), %ecx
movw %cx, 0x6c(%rax)
movl $0x0, -0x58(%rbp)
movq -0x80(%rbp), %rcx
movl -0x58(%rbp), %eax
cmpl 0x28(%rcx), %eax
jae 0x365d2
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rax
addq $0x78, %rax
movq %rax, -0x140(%rbp)
leaq 0x4d64a(%rip), %rsi     # 0x83bb5
callq 0xae60
movq %rax, -0x138(%rbp)
jmp 0x36579
movq -0x138(%rbp), %rdi
movl -0x58(%rbp), %eax
movl %eax, %esi
callq 0xb470
movq %rax, -0x148(%rbp)
jmp 0x36593
movq -0x148(%rbp), %rdi
callq 0x3d0e0
movl %eax, -0x14c(%rbp)
jmp 0x365a7
movq -0x140(%rbp), %rdi
movl -0x14c(%rbp), %eax
movl %eax, -0x5c(%rbp)
leaq -0x5c(%rbp), %rsi
callq 0x3d0b0
jmp 0x365c2
jmp 0x365c4
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x36541
movq -0x80(%rbp), %rax
movl $0xffffffff, 0x74(%rax) # imm = 0xFFFFFFFF
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x6890
nop