// File: /workspace/github_cpp_makefile_star2_O2/panosfoto[P]NGramGraphParallel/src/StringSplitter.cpp
// Function: StringSplitter::splitPayloadToAtoms(Payload<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>*)
vector<Atom<std::string>> StringSplitter::splitPayloadToAtoms(Payload<std::string> *payloadToSplit)
{
    if (atomSize > (*payloadToSplit).getPayload().length())
    {
        // TODO : replace with exception throwing
        cerr << "splitPayloadToAtoms(): Warning: atom size provided is greater than the length of the payload. Payload could not be split." << endl;
        //return;
    }
    vector<Atom<std::string>> atoms;
    std::string tempString;
    Atom<std::string> *tempAtom;
    //test implementation
    for(unsigned int i = 0 ; i < (*payloadToSplit).getPayload().length()-atomSize+1 ; ++i)
    {
        tempString.clear();
        for(unsigned int j = 0 ; j < atomSize ; ++j)
        {
            tempString.push_back((*payloadToSplit).getPayload()[i+j]);
        }
        tempAtom = new Atom<std::string>(tempString);
        atoms.push_back(*tempAtom);
        // added so valgrind won't count it as a memory leak
        delete tempAtom;
    }
    return atoms;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, -0x30(%rbp)
movl 0x8(%rsi), %r12d
movq (%rdx), %rax
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
movq %rdx, %rsi
callq *0x18(%rax)
movq 0x8(%rbx), %r13
movq %rbx, %rdi
callq 0x7160
cmpq %r12, %r13
jae 0x16c27
movq 0x153cd(%rip), %rdi     # 0x2bfe0
leaq 0x7622(%rip), %rsi      # 0x1e23c
callq 0x72e0
movq %rax, %rdi
callq 0x7170
movq -0x30(%rbp), %rcx
andq $0x0, 0x10(%rcx)
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movb $0x0, (%rax)
xorl %ebx, %ebx
leaq -0x98(%rbp), %r12
movq (%r14), %rax
movq %r12, %rdi
movq %r14, %rsi
callq *0x18(%rax)
movl %ebx, %eax
movq %rax, -0x38(%rbp)
movq -0x90(%rbp), %r13
movl 0x8(%r15), %eax
subq %rax, %r13
incq %r13
movq %r12, %rdi
callq 0x7160
cmpq -0x38(%rbp), %r13
jbe 0x16d20
andq $0x0, -0x50(%rbp)
movq -0x58(%rbp), %rax
movb $0x0, (%rax)
xorl %r13d, %r13d
movl 0x8(%r15), %eax
cmpq %rax, %r13
jae 0x16ccd
movq (%r14), %rax
movq %r12, %rdi
movq %r14, %rsi
callq *0x18(%rax)
leal (%rbx,%r13), %eax
movq -0x98(%rbp), %rcx
movsbl (%rcx,%rax), %esi
leaq -0x58(%rbp), %rdi
callq 0x72a0
movq %r12, %rdi
callq 0x7160
incq %r13
jmp 0x16c93
pushq $0x28
popq %rdi
callq 0x72f0
leaq -0x78(%rbp), %r13
movq %rax, -0x38(%rbp)
movq %r13, %rdi
leaq -0x58(%rbp), %rsi
callq 0x73c0
movq -0x38(%rbp), %r13
movq %r13, %rdi
leaq -0x78(%rbp), %rsi
callq 0x16a64
leaq -0x78(%rbp), %rdi
callq 0x7160
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x16d8a
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
incq %rbx
jmp 0x16c4f
leaq -0x58(%rbp), %rdi
callq 0x7160
movq -0x30(%rbp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x16d4d
movq %rax, %r14
leaq -0x78(%rbp), %rdi
callq 0x7160
movq -0x38(%rbp), %rdi
callq 0x72d0
jmp 0x16d70
jmp 0x16d6d
jmp 0x16d6d
movq %rax, %r14
leaq -0x98(%rbp), %rdi
callq 0x7160
jmp 0x16d70
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x7160
movq -0x30(%rbp), %rdi
callq 0x14ef6
movq %r14, %rdi
callq 0x74d0