LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/changliu00[P]ascii-animation/./ascii-anim.h
// Function: rot_pt_pt(std::initializer_list<std::pair<float, float>*>, std::pair<float, float> const&, float)
inline void rot_pt_pt(std::initializer_list<Fpair*> il, const Fpair& p0, float dangle) {
	Fpair v = {cos(dangle), -sin(dangle)}, pd;
	for(auto ppt: il) {
		pd = (*ppt) - p0;
		(*ppt) = Fpair{v * pd, cross(v, pd)} + p0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cvtss2sd %xmm0, %xmm0
movsd %xmm0, (%rsp)
callq 0x3320
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm0
callq 0x3040
cvtsd2ss 0x8(%rsp), %xmm1
cvtsd2ss %xmm0, %xmm0
movaps 0x7a41(%rip), %xmm2     # 0xe010
xorps %xmm0, %xmm2
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
unpcklps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
shlq $0x3, %r14
xorl %eax, %eax
cmpq %rax, %r14
je 0x660f
movq (%r15,%rax), %rcx
movsd (%rcx), %xmm2
movsd (%rbx), %xmm3
subps %xmm3, %xmm2
movaps %xmm1, %xmm4
mulps %xmm2, %xmm4
mulps %xmm0, %xmm2
shufps $0xe1, %xmm2, %xmm2     # xmm2 = xmm2[1,0,2,3]
addps %xmm4, %xmm2
addps %xmm3, %xmm2
movlps %xmm2, (%rcx)
addq $0x8, %rax
jmp 0x65df
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/snugglefish.cpp
// Function: cpu_count()
uint32_t cpu_count(){
    long procs = -1;

    //This only works on some *nixes TODO figure out which systems don't support this call
    procs = sysconf(_SC_NPROCESSORS_ONLN);
    if (procs < 1){
        cerr << "Unable to get CPU count, defaulting to 1 -- Error: " 
             << strerror(errno) << endl;
        return 1;
    }
    return (uint32_t) procs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
pushq $0x54
popq %rdi
callq 0x6190
testq %rax, %rax
jg 0x67e7
movq 0x8832(%rip), %rdi      # 0xefe8
leaq 0x48c3(%rip), %rsi      # 0xb080
callq 0x6270
movq %rax, %rbx
callq 0x6040
movl (%rax), %edi
callq 0x6090
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x6110
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/snugglefish.cpp
// Function: handler(int)
void handler(int sig) {
  void *array[10];
  int size;

  // get void*'s for all entries on the stack
  size = backtrace(array, 10);

  // print out all the frames to stderr
  fprintf(stderr, "Error: signal %d:\n", sig);
  backtrace_symbols_fd(array, size, 2);
  exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
movl %edi, %ebx
leaq -0x70(%rbp), %r14
pushq $0xa
popq %rsi
movq %r14, %rdi
callq 0x63c0
movl %eax, %r15d
movq 0x87a2(%rip), %rax      # 0xefb8
movq (%rax), %rdi
leaq 0x4894(%rip), %rsi      # 0xb0b4
movl %ebx, %edx
xorl %eax, %eax
callq 0x6380
pushq $0x2
popq %rdx
movq %r14, %rdi
movl %r15d, %esi
callq 0x63f0
pushq $0x1
popq %rdi
callq 0x62f0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/snugglefish.cpp
// Function: printHelp()
void printHelp(){
    cout << "Usage: snugglefish [OPTIONS]" << endl;
    cout << "Index files based on Ngrams then Search for a string" << endl;
    cout << "-i, --index            Index Operation, requires -o, and files to index" << endl;
    cout << "-s, --search           Search Operation, requires -f, and search string" << endl;
    cout << "-o, --output           Specifies the output file for indexing, equivalent to -f" << endl;
    cout << "-f, --file             Index file to search, equivalent to -o" << endl;
    cout << "-b, --node_bound       Maximum node buffer memory size before flushing" << endl;
    cout << "-n, --ngramsize        The size of Ngram to use (default is 3)" << endl;
    cout << "-h, --help             This help screen" << endl;
    cout << "-t, --threads          Number of search threads to spawn (default is #cpus)" << endl;
    cout << "Examples:" << endl;
    cout << "Index: snugglefish [-n ngramsize]  -i -o <index filename> <files to index>" << endl;
    cout << "If no file names are given on the commandline, the stdin will be used" << endl;
    cout << "Search: snugglefish [-n ngramsize] -s -f <index filename> <search string>" << endl;
    cout << "If no string is given, it can be entered on the command line" << endl;


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x807f(%rip), %rbx      # 0xefb0
leaq 0x437b(%rip), %rsi      # 0xb2b3
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x4381(%rip), %rsi      # 0xb2d0
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x439f(%rip), %rsi      # 0xb305
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x43d0(%rip), %rsi      # 0xb34d
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x4401(%rip), %rsi      # 0xb395
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x443a(%rip), %rsi      # 0xb3e5
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x4461(%rip), %rsi      # 0xb423
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x4491(%rip), %rsi      # 0xb46a
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x44b9(%rip), %rsi      # 0xb4a9
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x44ca(%rip), %rsi      # 0xb4d1
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x44ff(%rip), %rsi      # 0xb51d
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x44f2(%rip), %rsi      # 0xb527
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x4526(%rip), %rsi      # 0xb572
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x4555(%rip), %rsi      # 0xb5b8
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
callq 0x6110
leaq 0x4588(%rip), %rsi      # 0xb602
movq %rbx, %rdi
callq 0x6270
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x6110
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/snugglefish.cpp
// Function: search(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int, unsigned int)
vector<string>* search(string indexFileName, string searchString, uint32_t ngramSize, uint32_t threads){
	vector<string>* ret;
	nGramSearch searcher(ngramSize, indexFileName, threads);
    vector<uint64_t>* ngrams = searcher.stringToNGrams(searchString);
	ret = searcher.searchNGrams(*ngrams);

    delete ngrams;
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movl %ecx, %r14d
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %rsi
leaq -0x78(%rbp), %r12
movq %r12, %rdi
callq 0x6370
leaq -0xc8(%rbp), %rdi
movl %r15d, %esi
movq %r12, %rdx
movl %r14d, %ecx
callq 0x7f96
leaq -0x78(%rbp), %rdi
callq 0x60f0
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x6370
leaq -0xc8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x80b6
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x60f0
leaq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x778a
leaq -0xc8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x814c
movq %rax, %r14
leaq -0x38(%rbp), %rdi
callq 0x7c78
movq %rbx, %rdi
callq 0x7c78
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x6290
leaq -0xc8(%rbp), %rdi
callq 0x8080
movq %r14, %rax
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x7c78
jmp 0x73f0
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x60f0
jmp 0x73f0
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x60f0
jmp 0x73fc
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x8080
movq %rbx, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/snugglefish.cpp
// Function: printStats(snugglefish::nGramIndex*, unsigned long, unsigned long)
void printStats(nGramIndex* indexer, uint64_t processed, uint64_t listsize){
    uint64_t total;
    uint64_t session;
    uint64_t indexes;
    bool flushing;
    indexer->getStats(total, session, indexes, flushing);

    uint64_t percent = ((double) processed / listsize) * 100;

    cerr << "\r";
    cerr << "Processed: " << percent << "% -- " << processed << "/" << listsize;

    if(flushing){
        cerr << " (Flushing ... )"; 
    }else{
        cerr << "                "; 
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r15
leaq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x38(%rbp), %rcx
leaq -0x29(%rbp), %r14
movq %r14, %r8
callq 0x8f86
movq %r15, %xmm0
movq 0x3c10(%rip), %xmm1     # 0xb050
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x3c14(%rip), %xmm2     # 0xb060
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq %rbx, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm3
mulsd 0x3bef(%rip), %xmm3     # 0xb070
cvttsd2si %xmm3, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x3be3(%rip), %xmm3     # 0xb078
cvttsd2si %xmm3, %r13
andq %rcx, %r13
orq %rax, %r13
movq 0x7b41(%rip), %r12      # 0xefe8
leaq 0x4191(%rip), %rsi      # 0xb63f
movq %r12, %rdi
callq 0x6270
leaq 0x4184(%rip), %rsi      # 0xb641
movq %r12, %rdi
callq 0x6270
movq %rax, %rdi
movq %r13, %rsi
callq 0x61a0
leaq 0x4176(%rip), %rsi      # 0xb64d
movq %rax, %rdi
callq 0x6270
movq %rax, %rdi
movq %r15, %rsi
callq 0x61a0
leaq 0x4162(%rip), %rsi      # 0xb653
movq %rax, %rdi
callq 0x6270
movq %rax, %rdi
movq %rbx, %rsi
callq 0x61a0
leaq 0x414a(%rip), %rax      # 0xb655
leaq 0x4154(%rip), %rsi      # 0xb666
cmpb $0x0, (%r14)
cmovneq %rax, %rsi
movq %r12, %rdi
callq 0x6270
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/snugglefish.cpp
// Function: indexerThread(void*)
void* indexerThread(void* input){
    mi_data* midata = (mi_data*) input;
    nGramIndex* ngramindex = (nGramIndex*) midata->ngramindex;
    fileIndexer indexer(midata->ngramSize);

    while(1){
        pthread_mutex_lock(& midata->filesMutex);
        if (midata->queue >= midata->fileList->size()){
            pthread_mutex_unlock(& midata->filesMutex);
            break;
        }
        uint32_t i = midata->queue++; 
        pthread_mutex_unlock(& midata->filesMutex); 

        try{
            vector<uint32_t>* processedFile = indexer.processFile((*(midata->fileList))[i].c_str());
            if(processedFile != 0){
                pthread_mutex_lock(& midata->nGramIndexMutex);
                ngramindex->addNGrams(processedFile, (*(midata->fileList))[i]);
                pthread_mutex_unlock(& midata->nGramIndexMutex);
            }
        }catch(exception& e){
            cout << "Error in thread:" << e.what() << endl;
            handler(SIGSEGV);
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movq %rax, -0x30(%rbp)
movzbl 0x18(%rdi), %esi
leaq -0x70(%rbp), %rdi
callq 0x902c
leaq 0x20(%rbx), %r12
leaq 0x48(%rbx), %r13
movq %r12, %rdi
callq 0x63b0
movl 0x8(%rbx), %r14d
movq (%rbx), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x5, %rcx
cmpq %r14, %rcx
jbe 0x75f1
leal 0x1(%r14), %eax
movl %eax, 0x8(%rbx)
movq %r12, %rdi
callq 0x6200
movq (%rbx), %rax
movq (%rax), %rax
shlq $0x5, %r14
movq (%rax,%r14), %rsi
leaq -0x70(%rbp), %rdi
callq 0x90a6
movq %rax, %r15
testq %rax, %rax
je 0x7562
movq %r13, %rdi
callq 0x63b0
movq (%rbx), %rax
addq (%rax), %r14
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0x6370
movq -0x30(%rbp), %rdi
movq %r15, %rsi
leaq -0x50(%rbp), %r14
movq %r14, %rdx
callq 0x8d34
movq %r14, %rdi
callq 0x60f0
movq %r13, %rdi
callq 0x6200
jmp 0x7562
movq %r12, %rdi
callq 0x6200
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60f0
jmp 0x7621
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x7674
movq %rbx, %rdi
callq 0x60d0
movq %rax, %rbx
movq 0x7977(%rip), %rdi      # 0xefb0
leaq 0x4037(%rip), %rsi      # 0xb677
callq 0x6270
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x6110
pushq $0xb
popq %rdi
callq 0x67ee
movq %rax, %rbx
callq 0x6430
movq %rbx, %rdi
callq 0x64b0
movq %rax, %rdi
callq 0x777b
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramSearch.cpp
// Function: snugglefish::nGramSearch::nGramSearch(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
nGramSearch::nGramSearch( uint32_t ngramLength, string indexFileName)
    :nGramBase(ngramLength, indexFileName),numThreads(1) {

    masterFile = new smFile(baseFileName, ngramLength);

    if (!masterFile->exists()){
        //some error
    }else{
        masterFile->open('r');
    }


    numIndexFiles = masterFile->getNumIndexFiles();
    numFiles = masterFile->getNumFiles();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl %esi, %r15d
movq %rdi, %rbx
leaq -0x58(%rbp), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x6370
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x7d28
leaq -0x58(%rbp), %rdi
callq 0x60f0
movl $0x1, 0x38(%rbx)
pushq $0x58
popq %rdi
callq 0x6280
movq %rax, %r14
leaq 0x8(%rbx), %rsi
leaq -0x38(%rbp), %rdi
callq 0x6370
movzbl %r15b, %edx
leaq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0xa62c
movq %r14, 0x40(%rbx)
leaq -0x38(%rbp), %rdi
callq 0x60f0
movq 0x40(%rbx), %rdi
callq 0x9fb4
testb %al, %al
je 0x7f3e
movq 0x40(%rbx), %rdi
pushq $0x72
popq %rsi
callq 0xa80c
movq 0x40(%rbx), %rax
movl 0x48(%rax), %ecx
movl %ecx, 0x48(%rbx)
movl 0x4c(%rax), %eax
movl %eax, 0x4c(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
leaq -0x38(%rbp), %rdi
callq 0x60f0
jmp 0x7f6a
movq %rax, %r15
pushq $0x58
popq %rsi
movq %r14, %rdi
callq 0x6290
jmp 0x7f7f
movq %rax, %r15
jmp 0x7f86
movq %rax, %r15
addq $0x8, %rbx
movq %rbx, %r14
movq %r14, %rdi
callq 0x60f0
movq %r15, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramSearch.cpp
// Function: snugglefish::nGramSearch::nGramSearch(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
nGramSearch::nGramSearch( uint32_t ngramLength, string indexFileName, uint32_t threads)
    :nGramBase(ngramLength, indexFileName),numThreads(threads) {

    masterFile = new smFile(baseFileName, ngramLength);

    if (!masterFile->exists()){
        //some error
    }else{
        masterFile->open('r');
    }


    numIndexFiles = masterFile->getNumIndexFiles();
    numFiles = masterFile->getNumFiles();
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %ecx, %r12d
movl %esi, %r15d
movq %rdi, %rbx
leaq -0x60(%rbp), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x6370
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x7d28
leaq -0x60(%rbp), %rdi
callq 0x60f0
movl %r12d, 0x38(%rbx)
pushq $0x58
popq %rdi
callq 0x6280
movq %rax, %r14
leaq 0x8(%rbx), %rsi
leaq -0x40(%rbp), %rdi
callq 0x6370
movzbl %r15b, %edx
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0xa62c
movq %r14, 0x40(%rbx)
leaq -0x40(%rbp), %rdi
callq 0x60f0
movq 0x40(%rbx), %rdi
callq 0x9fb4
testb %al, %al
je 0x8026
movq 0x40(%rbx), %rdi
pushq $0x72
popq %rsi
callq 0xa80c
movq 0x40(%rbx), %rax
movl 0x48(%rax), %ecx
movl %ecx, 0x48(%rbx)
movl 0x4c(%rax), %eax
movl %eax, 0x4c(%rbx)
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
leaq -0x40(%rbp), %rdi
callq 0x60f0
jmp 0x8054
movq %rax, %r15
pushq $0x58
popq %rsi
movq %r14, %rdi
callq 0x6290
jmp 0x8069
movq %rax, %r15
jmp 0x8070
movq %rax, %r15
addq $0x8, %rbx
movq %rbx, %r14
movq %r14, %rdi
callq 0x60f0
movq %r15, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramSearch.cpp
// Function: snugglefish::nGramSearch::stringToNGrams(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<uint64_t>* nGramSearch::stringToNGrams(string searchString){
    uint64_t nGram;
    vector <uint64_t>* ngrams = new vector<uint64_t>;


    for(size_t i = 0; i + ngramLength - 1 < searchString.length(); i++){
        nGram = 0;
        for(size_t j = 0; j < ngramLength; j++){
	    // (1 << (8*j)) is equivalent to pow(256,j)
            nGram += (unsigned char)searchString[i+j] * (1 << (8*j));
        }
        ngrams->push_back(nGram);
    }

    return ngrams;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x18
popq %rdi
callq 0x6280
movq %rax, %r15
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %r13d, %r13d
leaq -0x30(%rbp), %r12
movzbl 0x28(%r14), %eax
leaq (%rax,%r13), %rcx
decq %rcx
cmpq 0x8(%rbx), %rcx
jae 0x8139
andq $0x0, -0x30(%rbp)
shll $0x3, %eax
movq %r13, %rdx
xorl %ecx, %ecx
xorl %esi, %esi
cmpq %rcx, %rax
je 0x8129
movq (%rbx), %rdi
movzbl (%rdi,%rdx), %edi
shll %cl, %edi
movslq %edi, %rdi
addq %rdi, %rsi
movq %rsi, -0x30(%rbp)
addq $0x8, %rcx
incq %rdx
jmp 0x8108
movq %r15, %rdi
movq %r12, %rsi
callq 0x8690
incq %r13
jmp 0x80e7
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramSearch.cpp
// Function: snugglefish::nGramSearch::orderNGrams[abi:cxx11](snugglefish::indexSet*, std::vector<unsigned long, std::allocator<unsigned long>> const&)
list< pair<uint64_t, size_t> > nGramSearch::orderNGrams(indexSet* index, const vector<uint64_t> & nGramQuery){
    bool nomatch = false;
    list< pair<uint64_t, size_t> > queryList;
    for(uint32_t j = 0; j < nGramQuery.size(); j++){
        size_t numfiles = index->getNGramCount(nGramQuery[j]);
        //index_entry* index_table = (index_entry*) (indexEntries + (nGramQuery[j] * (INDEX_ENTRY_SIZE)));

        if(numfiles == 0){
            nomatch = true;
            break;
            //No Files Match
        }

        if(queryList.empty()){
            queryList.push_back(pair<uint64_t,size_t>(nGramQuery[j], numfiles));
        }else{
            bool placed = false;
            for (list< pair<uint64_t, size_t> >::iterator it = queryList.begin(); 
              it != queryList.end(); it++ ){
                if((*it).second > numfiles){
                    queryList.insert(it, pair<uint64_t, size_t>(nGramQuery[j], numfiles));
                    placed = true;
                    break;
                }
            }
            if (!placed){
                queryList.push_back(pair<uint64_t,size_t>(nGramQuery[j], numfiles));
            }
        }
    }

    if (nomatch){
        queryList.clear();
    }

    return queryList;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
andq $0x0, 0x10(%rdi)
movq %rdx, %r14
movq %rsi, %r15
xorl %r13d, %r13d
leaq -0x38(%rbp), %r12
movl %r13d, %r13d
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
jbe 0x8552
movq (%rax,%r13,8), %rsi
movq %r15, %rdi
callq 0xa5ec
testq %rax, %rax
je 0x854a
movq (%rbx), %rsi
cmpq %rbx, %rsi
je 0x84f0
cmpq %rbx, %rsi
je 0x850c
cmpq %rax, 0x18(%rsi)
ja 0x8528
movq (%rsi), %rsi
jmp 0x84e0
movq (%r14), %rcx
movq (%rcx,%r13,8), %rcx
movq %rcx, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x86b8
jmp 0x8542
movq (%r14), %rcx
movq (%rcx,%r13,8), %rcx
movq %rcx, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x86b8
jmp 0x8542
movq (%r14), %rcx
movq (%rcx,%r13,8), %rcx
movq %rcx, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
movq %r12, %rdx
callq 0x8970
incl %r13d
jmp 0x84ad
movq %rbx, %rdi
callq 0x86c8
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x856a
jmp 0x856a
jmp 0x856a
movq %rax, %r14
movq %rbx, %rdi
callq 0x8754
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramIndex.cpp
// Function: snugglefish::nGramIndex::nGramIndex(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
nGramIndex::nGramIndex( uint32_t ngramLength, string indexFileName)
    :nGramBase(ngramLength, indexFileName), bufferMax(MAX_BUFFER_SIZE),
    buffer_memory_usage(0), flush(false), flushing(false) {


    this->maxFileNameLength = DEFAULT_MAX_FILENAME_SIZE;
    
	//allocate output buffer
	this->output_buffer = new buffer_element[maxNgram];
	for(uint64_t i = 0; i < maxNgram; i++){
		this->output_buffer[i].elements_size = 0;
		this->output_buffer[i].elements = new list<ngram_t_fidtype>;
	}

    masterFile = new smFile(baseFileName, ngramLength);

    if (masterFile->exists()){
        masterFile->open('w');
    }else{ //Must create it
        masterFile->create(maxFileNameLength);
    }

    numFilesProcessed = masterFile->getNumFiles();
    numSessionFilesProcessed = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %r14d
movq %rdi, %rbx
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x6370
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x7d28
leaq -0x68(%rbp), %rdi
callq 0x60f0
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x38(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rbx)
andw $0x0, 0x68(%rbx)
movups %xmm0, 0x58(%rbx)
movw $0x41, (%rbx)
movq 0x30(%rbx), %r13
movq %r13, %rax
shrq $0x3c, %rax
movq %r13, %rcx
shlq $0x4, %rcx
xorl %edi, %edi
negq %rax
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x6030
movq %rax, %r15
movq %rax, 0x40(%rbx)
addq $0x8, %r15
pushq $0x18
popq %r12
subq $0x1, %r13
jb 0x8b8d
andq $0x0, -0x8(%r15)
movq %r12, %rdi
callq 0x6280
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
movq %rax, (%r15)
addq $0x10, %r15
jmp 0x8b65
pushq $0x58
popq %rdi
callq 0x6280
movq %rax, %r15
leaq 0x8(%rbx), %rsi
leaq -0x48(%rbp), %rdi
callq 0x6370
movzbl %r14b, %edx
leaq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0xa62c
movq %r15, 0x70(%rbx)
leaq -0x48(%rbp), %rdi
callq 0x60f0
movq 0x70(%rbx), %rdi
callq 0x9fb4
movq 0x70(%rbx), %rdi
testb %al, %al
je 0x8bdd
pushq $0x77
popq %rsi
callq 0xa80c
jmp 0x8be5
movzwl (%rbx), %esi
callq 0xa6b8
movq 0x70(%rbx), %rax
movl 0x4c(%rax), %eax
movq %rax, 0x78(%rbx)
andq $0x0, 0x80(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x48(%rbp), %rdi
callq 0x60f0
jmp 0x8c18
movq %rax, %r14
pushq $0x58
popq %rsi
movq %r15, %rdi
callq 0x6290
jmp 0x8c2f
movq %rax, %r14
jmp 0x8c3f
jmp 0x8c2c
movq %rax, %r14
leaq 0x50(%rbx), %rdi
callq 0x7750
addq $0x8, %rbx
movq %rbx, %r15
movq %r15, %rdi
callq 0x60f0
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramIndex.cpp
// Function: snugglefish::nGramIndex::~nGramIndex()
nGramIndex::~nGramIndex(){
    
	this->flushAll();
	for(uint64_t i = 0; i < maxNgram; i++){
		delete this->output_buffer[i].elements;
	}
	delete[] output_buffer;    

    delete masterFile;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x8cf2
pushq $0x8
popq %r12
xorl %r13d, %r13d
pushq $0x18
popq %r14
movq 0x40(%rbx), %rdi
cmpq 0x30(%rbx), %r13
jae 0x8ca0
movq (%rdi,%r12), %r15
testq %r15, %r15
je 0x8c8c
movq %r15, %rdi
callq 0x8720
movq %r15, %rdi
movq %r14, %rsi
callq 0x6290
incq %r13
addq $0x10, %r12
jmp 0x8c71
testq %rdi, %rdi
je 0x8caa
callq 0x6330
movq 0x70(%rbx), %r14
testq %r14, %r14
je 0x8cbb
movq %r14, %rdi
callq 0xa664
pushq $0x58
popq %rsi
movq %r14, %rdi
callq 0x6290
leaq 0x50(%rbx), %rdi
callq 0x7750
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x60f0
movq %rax, %rdi
callq 0x777b
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramIndex.cpp
// Function: snugglefish::nGramIndex::flushAll()
void nGramIndex::flushAll(){
    flushing = true;
    if(fileNameList.size()){
        ngram_t_indexfcount num_files = fileNameList.size();
        //By updating the master file last, this set can be queried
        //while creating a new index set
        flushIndex(num_files);
        flushMaster();

        numSessionFilesProcessed += num_files;
    }
    flushing = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movb $0x1, 0x69(%rdi)
movq 0x58(%rdi), %r14
subq 0x50(%rdi), %r14
je 0x8d2b
sarq $0x5, %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x8e2c
movq %rbx, %rdi
callq 0x8f12
movl %r14d, %eax
addq %rax, 0x80(%rbx)
movb $0x0, 0x69(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramIndex.cpp
// Function: snugglefish::nGramIndex::addNGrams(std::vector<unsigned int, std::allocator<unsigned int>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void nGramIndex::addNGrams(vector<uint32_t>* nGramList, string filename){
    //POSIX basename may modify argument so create a copy
    char* temp_filename = new char[filename.length() + 1];
    strncpy(temp_filename, filename.c_str(), filename.length() + 1);
    filename = basename(temp_filename);
    delete[] temp_filename;

    ngram_t_fidtype file_id = numFilesProcessed++;
    fileNameList.push_back(filename);

    // Insert ngram into the list, add the new node to the memory usage variable,
    // and check if the maximum memory has been used, and if so, indicate that the
    // nGrams should be flushed to disk
    for(uint32_t i = 0; i < nGramList->size(); i++){
        uint32_t nGram = (*nGramList)[i];
        output_buffer[nGram].elements_size++;
        output_buffer[nGram].elements->push_back(file_id);

        buffer_memory_usage += BUFFER_NODE_SIZE; //Add size of node

        if(buffer_memory_usage >= bufferMax){ 
            flush = true;
        }
    }

    //We cleanup the memory
    delete nGramList;

    if (flush){
        flushAll();
        flush = false;
    }


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdx), %r15
incq %r15
movq %r15, %rdi
callq 0x6030
movq %rax, %r13
movq (%r12), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x6130
movq %r13, %rdi
callq 0x6490
movq %r12, %rdi
movq %rax, %rsi
callq 0x6520
movq %r13, %rdi
callq 0x6330
movq 0x78(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x78(%rbx)
leaq -0x2c(%rbp), %r15
movl %eax, (%r15)
leaq 0x50(%rbx), %rdi
movq %r12, %rsi
callq 0x76c0
xorl %r12d, %r12d
movl %r12d, %r12d
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x8df7
movl (%rax,%r12,4), %eax
movq 0x40(%rbx), %rcx
shlq $0x4, %rax
incq (%rcx,%rax)
movq 0x8(%rcx,%rax), %rdi
movq %r15, %rsi
callq 0x86ea
movq 0x48(%rbx), %rax
addq $0x1c, %rax
movq %rax, 0x48(%rbx)
cmpq 0x38(%rbx), %rax
jb 0x8df2
movb $0x1, 0x68(%rbx)
incl %r12d
jmp 0x8da9
movq %r14, %rdi
callq 0x8fbc
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x6290
cmpb $0x1, 0x68(%rbx)
jne 0x8e1c
movq %rbx, %rdi
callq 0x8cf2
movb $0x0, 0x68(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramIndex.cpp
// Function: snugglefish::nGramIndex::flushIndex(unsigned int)
void nGramIndex::flushIndex(ngram_t_indexfcount num_files){
    //Create the files
    indexSet* tIndex = new indexSet(baseFileName.c_str(), masterFile->getNumIndexFiles(), ngramLength);
    tIndex->create(num_files);

    uint64_t bytes_flushed = 0;

    for(uint32_t i = 0; i < maxNgram; i++){ //iterate through every ngram
        bytes_flushed += output_buffer[i].elements_size * sizeof(ngram_t_fidtype);
        tIndex->addNGrams(i, this->output_buffer[i].elements);
        output_buffer[i].elements_size = 0;

        if (output_buffer[i].elements->size() != 0)
            cout << "Not Zero" << endl;
    }

    buffer_memory_usage = 0;

    tIndex->close();
    delete tIndex;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %r14
pushq $0x68
popq %rdi
callq 0x6280
movq %rax, %rbx
movq 0x8(%r14), %rsi
movq 0x70(%r14), %rax
movl 0x48(%rax), %edx
movzbl 0x28(%r14), %ecx
movq %rbx, %rdi
callq 0x9fdc
movq %rbx, %rdi
movl %r15d, %esi
callq 0xa0fe
xorl %r12d, %r12d
leaq 0x2889(%rip), %r13      # 0xb701
movl %r12d, %r12d
cmpq %r12, 0x30(%r14)
jbe 0x8ecd
movq 0x40(%r14), %rax
movq %r12, %r15
shlq $0x4, %r15
movq 0x8(%rax,%r15), %rdx
movq %rbx, %rdi
movl %r12d, %esi
callq 0xa558
movq 0x40(%r14), %rax
andq $0x0, (%rax,%r15)
movq 0x8(%rax,%r15), %rax
cmpq $0x0, 0x10(%rax)
je 0x8ec8
movq 0x60f8(%rip), %rdi      # 0xefb0
movq %r13, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x6110
incl %r12d
jmp 0x8e78
andq $0x0, 0x48(%r14)
movq %rbx, %rdi
callq 0xa094
movq %rbx, %rdi
callq 0xa020
pushq $0x68
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6290
movq %rax, %r14
pushq $0x68
popq %rsi
movq %rbx, %rdi
callq 0x6290
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/nGramIndex.cpp
// Function: snugglefish::nGramIndex::flushMaster()
void nGramIndex::flushMaster(){
    //Write FileNames to File ID file
    ngram_t_indexfcount num_files = (ngram_t_indexfcount) fileNameList.size();

    if (!num_files){
        return;
    }

    for(unsigned long i = 0; i < num_files; i++){
        masterFile->addFileId(fileNameList[i].c_str());
    }

    //Clear the vector
    fileNameList.clear();

    //Update filid with new value
    masterFile->updateIndexFileCount(masterFile->getNumIndexFiles() + 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x58(%rdi), %rax
subq 0x50(%rdi), %rax
shrq $0x5, %rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
andq %rax, %r15
je 0x8f7c
movq %rdi, %rbx
leaq 0x50(%rdi), %r14
shlq $0x5, %r15
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x8f5e
movq 0x50(%rbx), %rax
movq 0x70(%rbx), %rdi
movq (%rax,%r12), %rsi
callq 0xa910
addq $0x20, %r12
jmp 0x8f42
movq %r14, %rdi
callq 0x8fae
movq 0x70(%rbx), %rdi
movl 0x48(%rdi), %esi
incl %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa968
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/fileIndexer.cpp
// Function: snugglefish::fileIndexer::fileIndexer(unsigned char)
fileIndexer::fileIndexer(uint8_t ngramLength):
filesProcessed(0)
{

    if(ngramLength == 3  || ngramLength == 4){
        this->ngramLength = ngramLength;
        this->maxNgram = ((uint64_t) (1) << (8*ngramLength));
        this->pagesize = getpagesize();
    }
    else {
        throw std::runtime_error("Ngram len must be either 3 or 4");
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
andq $0x0, (%rdi)
leal -0x3(%rsi), %eax
cmpb $0x1, %al
ja 0x9062
movq %rdi, %rbx
movzbl %sil, %ecx
movl %ecx, 0x8(%rdi)
shll $0x3, %ecx
pushq $0x1
popq %rax
shlq %cl, %rax
movq %rax, 0x10(%rdi)
callq 0x64e0
movl %eax, 0x18(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x2696(%rip), %rsi      # 0xb70a
movq %rax, %rdi
callq 0x60c0
movq 0x5f6d(%rip), %rsi      # 0xeff0
movq 0x5f1e(%rip), %rdx      # 0xefa8
movq %rbx, %rdi
callq 0x6480
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/fileIndexer.cpp
// Function: snugglefish::fileIndexer::processNgrams(unsigned char*, unsigned long, bool*)
void fileIndexer::processNgrams(unsigned char* buf, uint64_t fileSize, bool ngramList[]){
    //TODO update with byte array
    uint64_t nGram = 0;
    uint64_t i, j;
    for(i = 0; ((i + this->ngramLength) - 1) < fileSize; i++){
        nGram = 0;
       // creates an ngram using the formula buf[i] + buf[i+1]*256 
       // + buf[i+2]*256*256
        for(j = 0; j < this->ngramLength; j++){
            // (1 <<(8*j)) is equivalent to pow(256,j)
           nGram += (unsigned char)buf[i+j] * (1 << (8*j));
        }
        if(nGram >= this->maxNgram){
            throw std::runtime_error("Ngram greater than maxNgram");
        }
        ngramList[nGram] = 1;
    }

    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rcx, %rax
movl 0x8(%rdi), %r8d
movq 0x10(%rdi), %rdi
leaq (,%r8,8), %r9
xorl %r10d, %r10d
leaq (%r10,%r8), %rcx
decq %rcx
cmpq %rdx, %rcx
jae 0x9314
movq %rsi, %rbx
xorl %ecx, %ecx
xorl %r11d, %r11d
cmpq %rcx, %r9
je 0x9302
movzbl (%rbx), %r14d
shll %cl, %r14d
movslq %r14d, %r14
addq %r14, %r11
addq $0x8, %rcx
incq %rbx
jmp 0x92e7
cmpq %rdi, %r11
jae 0x9319
movb $0x1, (%rax,%r11)
incq %r10
incq %rsi
jmp 0x92d3
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x2419(%rip), %rsi      # 0xb744
movq %rax, %rdi
callq 0x60c0
movq 0x5cb6(%rip), %rsi      # 0xeff0
movq 0x5c67(%rip), %rdx      # 0xefa8
movq %rbx, %rdi
callq 0x6480
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/fileIndexer.cpp
// Function: snugglefish::fileIndexer::processNgrams(unsigned char*, unsigned long)
vector<uint32_t>* fileIndexer::processNgrams(unsigned char* buf, uint64_t fileSize){
    map<uint32_t, bool> ngram_map;

    uint32_t nGram = 0;
    uint32_t i, j;

    for(i = 0; ((i + this->ngramLength) - 1) < fileSize; i++){
        nGram = 0;
        for(j = 0; j < this->ngramLength; j++){
            nGram += (unsigned char)buf[i+j] * (1 << (8*j));
        }
        if(nGram >= this->maxNgram){
            throw std::runtime_error("Ngram greater than maxNgram");
        }
        ngram_map.insert(pair<uint32_t,bool>(nGram, true));
    }

    //We should now have a map of ngrams, turn into a sorted vector
    //TODO pre-allocate vector to do this faster
    vector<uint32_t>* ngramVector = new vector<uint32_t>;
    
    for(map<uint32_t,bool>::iterator it = ngram_map.begin(); it != ngram_map.end() ; it++){
        ngramVector->push_back(it->first);
    }

    return ngramVector;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, %r14
leaq -0x58(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %rdi, %r15
xorl %r12d, %r12d
leaq -0x30(%rbp), %r13
movl 0x8(%r15), %eax
leal (%r12,%rax), %ecx
decl %ecx
cmpq %rbx, %rcx
jae 0x93e8
shlq $0x3, %rax
xorl %ecx, %ecx
movl %r12d, %esi
xorl %edx, %edx
cmpq %rcx, %rax
je 0x93c8
movl %esi, %edi
movzbl (%r14,%rdi), %edi
shll %cl, %edi
addl %edi, %edx
addq $0x8, %rcx
incl %esi
jmp 0x93b0
movl %edx, %eax
cmpq %rax, 0x10(%r15)
jbe 0x943f
movl %edx, -0x30(%rbp)
movb $0x1, -0x2c(%rbp)
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x9672
incl %r12d
jmp 0x9396
pushq $0x18
popq %rdi
callq 0x6280
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq -0x48(%rbp), %r14
leaq -0x58(%rbp), %r15
cmpq %r15, %r14
je 0x9424
leaq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0x9496
movq %r14, %rdi
callq 0x61b0
movq %rax, %r14
jmp 0x9406
leaq -0x60(%rbp), %rdi
callq 0x94bc
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %r14
leaq 0x22f3(%rip), %rsi      # 0xb744
movq %rax, %rdi
callq 0x60c0
movq 0x5b90(%rip), %rsi      # 0xeff0
movq 0x5b41(%rip), %rdx      # 0xefa8
movq %r14, %rdi
callq 0x6480
jmp 0x9482
jmp 0x9482
movq %rax, %rbx
movq %r14, %rdi
callq 0x61d0
jmp 0x9485
jmp 0x9482
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x94bc
movq %rbx, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::file(char const*, unsigned long)
file::file(const char* fileName, size_t buffersize){
    this->bufferparam = buffersize;

    this->buffer = NULL;
    this->buffersize = 0;
    this->bufferused = 0;

    this->fd = 0;
    this->mmapFile = 0;
    this->size = 0;

    this->filename = (char*) malloc(sizeof(char) * (strlen(fileName) + 1));
    strncpy(this->filename, fileName, strlen(fileName) + 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rdx, 0x38(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rdi)
movups %xmm0, 0x1c(%rdi)
movups %xmm0, 0x28(%rdi)
movq %rsi, %rdi
callq 0x60e0
leaq 0x1(%rax), %rdi
callq 0x6360
movq %rax, %r15
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x60e0
leaq 0x1(%rax), %rdx
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6130
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::~file()
file::~file(){
    //File Descriptor is not zero
    if(this->fd){
        this->close();
    }
    
    if (this->filename != NULL){
        free(this->filename);
    }

    if (this->buffer){
        free(this->buffer);
        this->buffer = NULL;
        this->buffersize = this->bufferused = 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0xc(%rdi)
je 0x9893
movq %rbx, %rdi
callq 0x98c8
movq (%rbx), %rdi
callq 0x62e0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x98b8
addq $0x20, %rbx
callq 0x62e0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rdi
callq 0x777b
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::close()
bool file::close(){
    if (!this->fd){ // already closed?
        return true;
    }

    this->flush(); 

    //Close the mmap if opened
    if (this->mmapFile){
        munmap(this->mmapFile, this->size); 
        this->mmapFile = 0;
        this->size = 0;
    }

    //Free the write buffer if allocated
    if (this->buffer){
        free(this->buffer);
        this->buffer = NULL;
        this->buffersize = this->bufferused = 0;
    }

    int32_t retval = ::close(this->fd);
    if(retval){//non zero
        cerr << "Error Closing File: " << this->filename << " -- Error: " << strerror(errno) << endl;
        throw runtime_error("Closing File");
    }

    this->fd = 0;

    return true;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpl $0x0, 0xc(%rdi)
je 0x9928
movq %rdi, %rbx
callq 0x9d12
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x98fa
leaq 0x10(%rbx), %r14
movq 0x18(%rbx), %rsi
callq 0x6180
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x9918
leaq 0x20(%rbx), %r14
callq 0x62e0
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movl 0xc(%rbx), %edi
callq 0x6530
testl %eax, %eax
jne 0x992f
andl $0x0, 0xc(%rbx)
movb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
movq 0x56b2(%rip), %rdi      # 0xefe8
leaq 0x1eb2(%rip), %rsi      # 0xb7ef
callq 0x6270
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x6270
leaq 0x1754(%rip), %rsi      # 0xb0a8
movq %rax, %rdi
callq 0x6270
movq %rax, %rbx
callq 0x6040
movl (%rax), %edi
callq 0x6090
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x6110
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x1e74(%rip), %rsi      # 0xb804
movq %rax, %rdi
callq 0x60c0
movq 0x5651(%rip), %rsi      # 0xeff0
movq 0x5602(%rip), %rdx      # 0xefa8
movq %rbx, %rdi
callq 0x6480
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::create(unsigned int)
bool file::create(mode_t filemode){

    if (this->bufferparam > 0){
        this->buffersize = this->bufferparam;
        this->buffer = (char*) malloc(buffersize);
    }
    this->fd = ::open(this->filename, O_RDWR | O_CREAT, filemode);
    this->readonly = false;

    if (this->fd <= 0){
        cerr << "Unable to Create File: " << filename << " -- Error: " << strerror(errno) << endl;
        throw runtime_error("Creating File");
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x99e5
movq %rdi, 0x28(%rbx)
callq 0x6360
movq %rax, 0x20(%rbx)
movq (%rbx), %rdi
pushq $0x42
popq %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x61e0
movl %eax, 0xc(%rbx)
movb $0x0, 0x8(%rbx)
testl %eax, %eax
jle 0x9a07
movb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
movq 0x55da(%rip), %rdi      # 0xefe8
leaq 0x1d4b(%rip), %rsi      # 0xb760
callq 0x6270
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x6270
leaq 0x167c(%rip), %rsi      # 0xb0a8
movq %rax, %rdi
callq 0x6270
movq %rax, %rbx
callq 0x6040
movl (%rax), %edi
callq 0x6090
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x6110
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x1d10(%rip), %rsi      # 0xb778
movq %rax, %rdi
callq 0x60c0
movq 0x5579(%rip), %rsi      # 0xeff0
movq 0x552a(%rip), %rdx      # 0xefa8
movq %rbx, %rdi
callq 0x6480
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::open(char)
bool file::open(char readwrite){
    switch (readwrite){
        case 'r':
        {    
            this->fd = ::open(this->filename, O_RDONLY);
            this->size = this->get_size();
            this->readonly = true;
            break;
        }
        case 'w':
        {
            if (this->bufferparam > 0){
                this->buffersize = this->bufferparam;
                this->buffer = (char*) malloc(buffersize);
            }
            this->fd = ::open(this->filename, O_RDWR);
            this->readonly = false;
            break;
        }
        default:
            throw runtime_error("Unrecognized read/write mode");
            break;
    }

    if (this->fd <= 0){
        cerr << "Error Opening File: " << this->filename << " -- Error: " << strerror(errno) << endl;
        throw runtime_error("Opening File");
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x77, %esi
je 0x9ad6
cmpl $0x72, %esi
jne 0x9b76
movq (%rbx), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x61e0
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x9bbc
movq %rax, 0x18(%rbx)
movb $0x1, 0x8(%rbx)
movl 0xc(%rbx), %eax
jmp 0x9b00
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x9aec
movq %rdi, 0x28(%rbx)
callq 0x6360
movq %rax, 0x20(%rbx)
movq (%rbx), %rdi
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x61e0
movl %eax, 0xc(%rbx)
movb $0x0, 0x8(%rbx)
testl %eax, %eax
jle 0x9b0b
movb $0x1, %al
popq %rbx
popq %r14
popq %rbp
retq
movq 0x54d6(%rip), %rdi      # 0xefe8
leaq 0x1c8a(%rip), %rsi      # 0xb7a3
callq 0x6270
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x6270
leaq 0x1578(%rip), %rsi      # 0xb0a8
movq %rax, %rdi
callq 0x6270
movq %rax, %rbx
callq 0x6040
movl (%rax), %edi
callq 0x6090
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x6110
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x1c4c(%rip), %rsi      # 0xb7b8
movq %rax, %rdi
callq 0x60c0
jmp 0x9b90
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x1bfe(%rip), %rsi      # 0xb786
movq %rax, %rdi
callq 0x60c0
movq 0x5459(%rip), %rsi      # 0xeff0
movq 0x540a(%rip), %rdx      # 0xefa8
movq %rbx, %rdi
callq 0x6480
jmp 0x9ba8
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::get_size()
const size_t file::get_size(){
    struct stat st;
    size_t filesize = 0;
    if (stat(this->filename, &st) == 0){
       filesize = st.st_size;
    }else{
        throw runtime_error("Statting File");
    } 

    return filesize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq (%rdi), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6260
testl %eax, %eax
jne 0x9bed
movq -0x70(%rbp), %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x1c77(%rip), %rsi      # 0xb876
movq %rax, %rdi
callq 0x60c0
movq 0x53e2(%rip), %rsi      # 0xeff0
movq 0x5393(%rip), %rdx      # 0xefa8
movq %rbx, %rdi
callq 0x6480
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::mmap()
uint8_t* file::mmap(){
    //Open the file first 
    if (this->fd == 0)
        this->open('r');

    if (!this->size)
        return NULL;

    this->mmapFile = (uint8_t*) ::mmap(NULL, this->size, PROT_READ, MAP_SHARED, this->fd, 0);

    if(this->mmapFile == MAP_FAILED){
        cerr << "Error Loading Map for File : " << this->filename<< " -- Error: " << strerror(errno) << endl;
        throw runtime_error("Loading Map");
    }

    return this->mmapFile;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0xc(%rdi)
jne 0x9c4b
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x9a9a
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0x9cf8
movl 0xc(%rbx), %r8d
pushq $0x1
popq %rcx
xorl %edi, %edi
movl %ecx, %edx
xorl %r9d, %r9d
callq 0x64c0
movq %rax, 0x10(%rbx)
cmpq $-0x1, %rax
jne 0x9cfa
movq 0x5368(%rip), %rdi      # 0xefe8
leaq 0x1b3e(%rip), %rsi      # 0xb7c5
callq 0x6270
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x6270
leaq 0x140a(%rip), %rsi      # 0xb0a8
movq %rax, %rdi
callq 0x6270
movq %rax, %rbx
callq 0x6040
movl (%rax), %edi
callq 0x6090
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x6110
pushq $0x10
popq %rdi
callq 0x6120
movq %rax, %rbx
leaq 0x1b09(%rip), %rsi      # 0xb7e3
movq %rax, %rdi
callq 0x60c0
movq 0x5307(%rip), %rsi      # 0xeff0
movq 0x52b8(%rip), %rdx      # 0xefa8
movq %rbx, %rdi
callq 0x6480
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/MITRECND[P]snugglefish/src/file.cpp
// Function: snugglefish::file::flush()
bool file::flush(){
    if(this->readonly){
        return true;
    }

    if (this->bufferused){
        lseek(this->fd, 0, SEEK_END);
        this->real_write(this->fd, (uint8_t*) this->buffer, this->bufferused * sizeof(char));
        this->bufferused = 0;
    }

    return true;
}

// Assembly:
cmpb $0x0, 0x8(%rdi)
jne 0x9d53
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x30(%rdi)
je 0x9d4d
movl 0xc(%rbx), %edi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x6500
movl 0xc(%rbx), %esi
movq 0x20(%rbx), %rdx
movq 0x30(%rbx), %rcx
movq %rbx, %rdi
callq 0x9d56
andq $0x0, 0x30(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
movb $0x1, %al
retq