// File: /workspace/github_cpp_makefile_star2_O1/MITRECND[P]snugglefish/src/indexSet.cpp
// Function: snugglefish::indexSet::open()
void indexSet::open(){
    string indexFileName, nGramFileName;
    indexFileName = nGramFileName = this->fileBase;
    char number_string[FILE_NUM_BUFFER_SIZE];
    snprintf(number_string, FILE_NUM_BUFFER_SIZE, FILE_NUM_SPRINTF_STRING, this->count);

    indexFileName.append(INDEX_FILE_EXTENSION).append(number_string);
    nGramFileName.append(NGRAM_FILE_EXTENSION).append(number_string);

    indexFile = new file(indexFileName.c_str());

    if(!indexFile->exists()){
        throw runtime_error("index file does not exist");
    }

    nGramFile = new file(nGramFileName.c_str());

    if (!nGramFile->exists()){
        throw runtime_error("index file does not exist");
    }

    indexFile->open('r');
    nGramFile->open('r');

    indexMap = indexFile->mmap();
    nGramMap = nGramFile->mmap();

    indexEntries = indexMap + INDEX_HEADER_SIZE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x28(%rdi), %rsi
leaq -0x40(%rbp), %rdi
callq 0x5140
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x5140
movl 0x58(%rbx), %ecx
leaq 0x1957(%rip), %rdx      # 0xb8a6
leaq -0x80(%rbp), %rdi
movl $0x1e, %esi
xorl %eax, %eax
callq 0x5430
leaq 0x178d(%rip), %rsi      # 0xb6f3
leaq -0x60(%rbp), %rdi
callq 0x5550
leaq -0x80(%rbp), %rsi
movq %rax, %rdi
callq 0x5550
leaq 0x176a(%rip), %rsi      # 0xb6ec
leaq -0x40(%rbp), %rdi
callq 0x5550
leaq -0x80(%rbp), %rsi
movq %rax, %rdi
callq 0x5550
movl $0x40, %edi
callq 0x5280
movq %rax, %r14
movq -0x60(%rbp), %rsi
movl $0x10000000, %edx       # imm = 0x10000000
movq %rax, %rdi
callq 0x92e8
movq %r14, (%rbx)
movq %r14, %rdi
callq 0x9af0
testb %al, %al
je 0xa071
movl $0x40, %edi
callq 0x5280
movq %rax, %r14
movq -0x40(%rbp), %rsi
movl $0x10000000, %edx       # imm = 0x10000000
movq %rax, %rdi
callq 0x92e8
movq %r14, 0x8(%rbx)
movq %r14, %rdi
callq 0x9af0
testb %al, %al
je 0xa08f
movq (%rbx), %rdi
movl $0x72, %esi
callq 0x958e
movq 0x8(%rbx), %rdi
movl $0x72, %esi
callq 0x958e
movq (%rbx), %rdi
callq 0x973a
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rdi
callq 0x973a
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rax
addq $0xa, %rax
movq %rax, 0x20(%rbx)
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xa04f
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x5290
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0xa064
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x5290
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
leaq 0x184e(%rip), %rsi      # 0xb8d3
movq %rax, %rdi
callq 0x50d0
jmp 0xa0ab
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
leaq 0x1830(%rip), %rsi      # 0xb8d3
movq %rax, %rdi
callq 0x50d0
movq 0x4f3e(%rip), %rsi      # 0xeff0
movq 0x4eef(%rip), %rdx      # 0xefa8
movq %r14, %rdi
callq 0x54b0
jmp 0xa0c3
movq %rax, %rbx
movq %r14, %rdi
callq 0x51d0
jmp 0xa0e9
jmp 0xa0d2
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x5290
jmp 0xa0e9
jmp 0xa0e6
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xa0fe
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x5290
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0xa113
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x5290
movq %rbx, %rdi
callq 0x54e0
nop