// File: /workspace/github_cpp_makefile_star2_O2/dnegovan[P]Intruder-On-Donnar-V/dansLibrary.cpp
// Function: printFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double)
void printFile(std::string fileName, std::string color, double seconds)
{
    //open file
    std::ifstream stream(fileName, std::ios::in);

    //keep a character count, newline if we hit the line width global const
    int counter = 0;

    std::cout << color;
    std::string contents;

    //grab each line
    while(getline(stream, contents))
    {
        if (contents.empty())
        {
            counter = 0;
        }
        std::string temp;
        std::stringstream ss;

        //put each line into stream
        ss << contents;
        while (!ss.eof())
        {
            //put each word into string
            ss >> temp;
            counter += temp.size();
            if (counter < LINE_WIDTH)
            {
                std::cout << temp;
            }
            if (counter >= LINE_WIDTH)
            {
                //wait given seconds to print next line
                wait(seconds);
                std::cout << "\n" << temp;
                counter = 0;
                counter += temp.size();
            }
            //put the space back in
            std::cout << " ";
        }

        ss.clear();
        //wait a bit between lines
        wait(seconds/2);
        std::cout << "\n";
        counter = 0;
    }

    // a bit at the end for drama!
    wait(seconds);

    std::cout << RESET;
    stream.close();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movsd %xmm0, -0x30(%rbp)
movq %rsi, %rbx
movq %rdi, %rsi
leaq -0x408(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x32c0
movq 0xa6a7(%rip), %rdi      # 0x15fc8
movq %rbx, %rsi
callq 0x31b0
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movsd 0x4b2f(%rip), %xmm0     # 0x10470
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x200(%rbp), %r12
leaq -0x58(%rbp), %r13
movq 0xa66b(%rip), %rbx      # 0x15fc8
leaq 0x56d3(%rip), %r14      # 0x11037
leaq -0x408(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3030
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xba61
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
andq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq %r12, %rdi
callq 0x3160
leaq -0x1f0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x31b0
xorl %r15d, %r15d
movq -0x200(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x1e0(%rbp,%rax)
jne 0xba21
movq %r12, %rdi
movq %r13, %rsi
callq 0x3210
movslq %r15d, %r15
addq -0x50(%rbp), %r15
cmpl $0x39, %r15d
jg 0xb9ec
movq %rbx, %rdi
movq %r13, %rsi
callq 0x31b0
jmp 0xba14
movsd -0x30(%rbp), %xmm0
callq 0xbaf9
movq %rbx, %rdi
leaq 0x4f24(%rip), %rsi      # 0x10924
callq 0x31d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x31b0
movq -0x50(%rbp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31d0
jmp 0xb9b2
leaq (%rax,%rbp), %rdi
addq $-0x200, %rdi           # imm = 0xFE00
xorl %esi, %esi
callq 0x32e0
movsd -0x38(%rbp), %xmm0
callq 0xbaf9
movq %rbx, %rdi
leaq 0x4edd(%rip), %rsi      # 0x10924
callq 0x31d0
movq %r12, %rdi
callq 0x3170
movq %r13, %rdi
callq 0x3368
jmp 0xb964
movsd -0x30(%rbp), %xmm0
callq 0xbaf9
movq 0xa556(%rip), %rdi      # 0x15fc8
leaq 0x463a(%rip), %rsi      # 0x100b3
callq 0x31d0
leaq -0x408(%rbp), %rdi
callq 0x3040
leaq -0x78(%rbp), %rdi
callq 0x3368
leaq -0x408(%rbp), %rdi
callq 0x3070
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xbae5
jmp 0xbabd
movq %rax, %rbx
jmp 0xbad3
movq %rax, %rbx
jmp 0xbadc
jmp 0xbac4
movq %rax, %rbx
leaq -0x200(%rbp), %rdi
callq 0x3170
leaq -0x58(%rbp), %rdi
callq 0x3368
leaq -0x78(%rbp), %rdi
callq 0x3368
leaq -0x408(%rbp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x3300