// File: /workspace/github_cpp_makefile_star2_O1/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 $0x14a8, %rsp           # imm = 0x14A8
movl %ecx, -0x30(%rbp)
movq %rsi, -0x58(%rbp)
leaq -0x4c8(%rbp), %rdi
movq %rdx, %rsi
movl $0x8, %edx
callq 0x22e0
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x2c0(%rbp), %rdi
callq 0x2140
leaq -0x2c(%rbp), %rax
movl $0x1, (%rax)
leaq -0xf8(%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 -0xb8(%rbp), %r14
movq -0x4c8(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x4c8(%rbp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %ecx
movl $0x1000, %edx           # imm = 0x1000
leaq -0x4c8(%rbp), %rdi
leaq -0x14d0(%rbp), %rsi
callq 0x22f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3990
movq %rbx, %r13
movq -0x70(%rbp), %rbx
leaq -0x14d0(%rbp), %r15
movq %r15, %rdi
callq 0x20d0
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r13, %rbx
leaq -0xa8(%rbp), %r13
movq %r15, %rcx
movq %rax, %r8
callq 0x2250
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x2b0(%rbp), %rdi
callq 0x21f0
movq %r13, -0xb8(%rbp)
movq $0x0, -0xb0(%rbp)
movb $0x0, -0xa8(%rbp)
leaq -0x2c0(%rbp), %rdi
movq %r14, %rsi
callq 0x2210
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x394d
leaq -0x100(%rbp), %rdi
movq %r14, %rsi
callq 0x5d90
cmpq %rbx, %rax
je 0x3882
leaq -0x100(%rbp), %rdi
movq %r14, %rsi
callq 0x5bfa
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x38ad
movl -0x2c(%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x3825
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x48(%rbp), %rsi
testq %rsi, %rsi
je 0x38be
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
leaq -0x50(%rbp), %r12
jmp 0x38ce
movq %rax, %rdi
leaq -0x2c(%rbp), %rdx
callq 0x40b0
jmp 0x3825
leaq -0x50(%rbp), %r12
movq %r12, %rdi
leaq -0x2c(%rbp), %rdx
callq 0x40b0
leaq -0x138(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5b5a
leaq -0x100(%rbp), %rdi
movq %r15, %rsi
callq 0x5e2e
movq -0x118(%rbp), %rdi
testq %rdi, %rdi
je 0x390d
movq -0x108(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x392f
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3825
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x3825
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x2c0(%rbp), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x22a0
incl -0x2c(%rbp)
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x3778
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21d0
jmp 0x3778
movq %rbx, %r14
movq 0x663e(%rip), %rdi      # 0x9fd8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x6623(%rip), %rdi      # 0x9fd8
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq -0xe8(%rbp), %rbx
cmpq %r14, %rbx
je 0x3a91
movslq -0x30(%rbp), %r13
leaq -0xd0(%rbp), %r15
movq 0x48(%rbx), %rax
subq 0x40(%rbx), %rax
sarq $0x2, %rax
cmpq %r13, %rax
jb 0x3a7d
movq -0x58(%rbp), %rax
movq (%rax), %r12
leaq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %rdi
callq 0x4f9c
leaq 0x40(%rbx), %rsi
movq %r15, %rdi
callq 0x4030
movq -0x58(%rbp), %rdi
movq %r12, %rsi
leaq -0x98(%rbp), %rdx
movq %r15, %rcx
callq 0x5c7a
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0x3a5b
movq -0xc0(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3a7d
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2130
movq %rax, %rbx
cmpq %r14, %rax
jne 0x39dd
leaq -0x4c8(%rbp), %rdi
callq 0x2060
leaq -0x100(%rbp), %rdi
callq 0x64ae
movq 0x6508(%rip), %rsi      # 0x9fb8
leaq -0x2c0(%rbp), %rdi
callq 0x2160
leaq -0x240(%rbp), %rdi
callq 0x20a0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3ae1
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0x4c8(%rbp), %rdi
callq 0x2080
addq $0x14a8, %rsp           # imm = 0x14A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3b4e
movq %rax, %rbx
jmp 0x3bcb
jmp 0x3b4e
movq %rax, %rbx
jmp 0x3b2e
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0x3b2e
movq -0xc0(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3ba0
movq -0x88(%rbp), %rsi
jmp 0x3b98
jmp 0x3b4e
jmp 0x3b82
movq %rax, %rbx
jmp 0x3ba0
jmp 0x3b66
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
callq 0x5bb8
jmp 0x3b69
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3b85
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x3b85
jmp 0x3b82
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x3ba0
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0x100(%rbp), %rdi
callq 0x64ae
movq 0x6405(%rip), %rsi      # 0x9fb8
leaq -0x2c0(%rbp), %rdi
callq 0x2160
leaq -0x240(%rbp), %rdi
callq 0x20a0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3be4
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0x4c8(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x22c0