// File: /workspace/github_cpp_makefile_star2_O3/dianejdan[P]Eclat/./DbReader.hpp
// Function: void DbReader::read_txt<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(PatternStore<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>&, char*, int)
void read_txt(PatternStore<Typ>& pS, char* filename, int minsup){

        ifstream in_(filename); // open input file
        char buffer[4096]; // store each line/transaction
        string line; // change char array to a string
        stringstream ss; // used for parse each item in a line/transaction

        int tid = 1; // transaction id, start from 1
        map<Typ, vector<int> > tidList; // use a map to store item and its transactions

        // parse the input file, add item and tid into the tid list
        while(in_.getline(buffer, 4096)){
            line = buffer; // change char array to string
            ss << line; // transform string to a stringstream so we can parse items
            Typ item;

            while(ss >> item){ // parse each item in the transaction

                if (tidList.find(item) == tidList.end()){ // if not find a item, create a new
                                                          // record in tidList for this item
                    vector<int> tids; // transaction list for the current item
                    tids.push_back(tid); // add this current transaction to transaction list
                    tidList.insert(std::pair<Typ, vector<int> >(item, tids)); // add <item, tids> to the map of tidList

                }else{

                    tidList[item].push_back(tid); // if the item is already in map of tidList, find the <item, tidList>
                                                  // add the current transaction id to the tid list

                }
            }

            ss.clear(); // clear state of stringstream for next transaction
            ++tid; // add one to the transaction id for next transaction
        }

        //cout << "Number of unique items in input file is  " << tidList.size() << "." << endl; // check how many items in the input file
        cout << endl;

        // now populate level-1 (single-item) frequency patterns
        int count = 0; // count level-1 (single-item) frequency patterns
        typename map<Typ, vector<int> >::iterator iter;

        for (iter = tidList.begin(); iter != tidList.end(); ++iter){ // iterate through tid list
            if (iter->second.size() >= minsup){ // store level-1 pattern only when |t(i)| > minsup
                pS.add_pattern(pS.root(), iter->first, iter->second); // add the frequent pattern to pattern store
                count++;
            }
        }

        in_.close(); // finish reading, close input file
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1498, %rsp           # imm = 0x1498
movl %ecx, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
leaq -0x4c0(%rbp), %rdi
movq %rdx, %rsi
movl $0x8, %edx
callq 0x22e0
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x2b8(%rbp), %rdi
callq 0x2140
leaq -0x2c(%rbp), %rax
movl $0x1, (%rax)
leaq -0xf0(%rbp), %rbx
movl $0x0, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
movq %rax, 0x20(%rbx)
leaq -0xb0(%rbp), %r14
leaq -0x130(%rbp), %r15
movq -0x4c0(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x4c0(%rbp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %ecx
movl $0x1000, %edx           # imm = 0x1000
leaq -0x4c0(%rbp), %rdi
leaq -0x14c0(%rbp), %rsi
callq 0x22f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x397b
movq %rbx, %r13
movq -0x50(%rbp), %rbx
leaq -0x14c0(%rbp), %r12
movq %r12, %rdi
callq 0x20d0
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r13, %rbx
leaq -0xa0(%rbp), %r13
movq %r12, %rcx
movq %rax, %r8
callq 0x2250
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x2a8(%rbp), %rdi
callq 0x21f0
movq %r13, -0xb0(%rbp)
movq $0x0, -0xa8(%rbp)
movb $0x0, -0xa0(%rbp)
leaq -0x2b8(%rbp), %rdi
movq %r14, %rsi
callq 0x2210
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3938
leaq -0xf8(%rbp), %rdi
movq %r14, %rsi
callq 0x5d50
cmpq %rbx, %rax
je 0x3885
leaq -0xf8(%rbp), %rdi
movq %r14, %rsi
callq 0x5bba
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x3927
movl -0x2c(%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x3824
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
movq $0x0, -0x80(%rbp)
leaq -0x90(%rbp), %r12
movq %r12, %rdi
xorl %esi, %esi
leaq -0x2c(%rbp), %rdx
callq 0x408a
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5b1a
leaq -0xf8(%rbp), %rdi
movq %r15, %rsi
callq 0x5dee
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x38e4
movq -0x100(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x3906
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x3824
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x3824
movq %rax, %rdi
leaq -0x2c(%rbp), %rdx
callq 0x408a
jmp 0x3824
movq -0x2b8(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x2b8(%rbp), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x22a0
incl -0x2c(%rbp)
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x3777
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x21d0
jmp 0x3777
movq %rbx, %r14
movq 0x6653(%rip), %rdi      # 0x9fd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x6638(%rip), %rdi      # 0x9fd8
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq -0xe0(%rbp), %rbx
cmpq %r14, %rbx
je 0x3a63
movslq -0x30(%rbp), %r13
leaq -0xc8(%rbp), %r15
movq 0x48(%rbx), %rax
subq 0x40(%rbx), %rax
sarq $0x2, %rax
cmpq %r13, %rax
jb 0x3a4f
movq -0x38(%rbp), %rax
movq (%rax), %r12
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x4f5a
leaq 0x40(%rbx), %rsi
movq %r15, %rdi
callq 0x400a
movq -0x38(%rbp), %rdi
movq %r12, %rsi
leaq -0x78(%rbp), %rdx
movq %r15, %rcx
callq 0x5c3a
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x3a36
movq -0xb8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3a4f
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2130
movq %rax, %rbx
cmpq %r14, %rax
jne 0x39c8
leaq -0x4c0(%rbp), %rdi
callq 0x2060
leaq -0xf8(%rbp), %rdi
callq 0x6464
movq 0x6536(%rip), %rsi      # 0x9fb8
leaq -0x2b8(%rbp), %rdi
callq 0x2160
leaq -0x238(%rbp), %rdi
callq 0x20a0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3ab3
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0x4c0(%rbp), %rdi
callq 0x2080
addq $0x1498, %rsp           # imm = 0x1498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3b17
movq %rax, %rbx
jmp 0x3b97
jmp 0x3b17
movq %rax, %rbx
jmp 0x3b00
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x3b00
movq -0xb8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3b6c
movq -0x68(%rbp), %rsi
jmp 0x3b64
jmp 0x3b17
jmp 0x3b4e
movq %rax, %rbx
jmp 0x3b6c
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x5b78
jmp 0x3b32
jmp 0x3b2f
movq %rax, %rbx
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x3b51
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x3b51
jmp 0x3b4e
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x3b6c
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0xf8(%rbp), %rdi
callq 0x6464
movq 0x6439(%rip), %rsi      # 0x9fb8
leaq -0x2b8(%rbp), %rdi
callq 0x2160
leaq -0x238(%rbp), %rdi
callq 0x20a0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x3bb0
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0x4c0(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22c0