// File: KitchMKelly[P]Team-9-OSU-Hackathon-Winter-2018/BawkBusterFunctions.cpp
// Function: titleSearchVector(std::vector<Video, std::allocator<Video>> const&, std::vector<Video, std::allocator<Video>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void titleSearchVector(const vector<Video>& videos, vector<Video>& results, string titleIn)  
//takes a const vector of movies to search, a vector of videos to add results to, and a search term.
{
    Video temp;  //creates a temporary video to hold values as we process vector
    int index = 0;
    int size = videos.size();
    for(int i = 0; i < titleIn.size(); i++)
      titleIn.at(i) = toupper(titleIn.at(i));
    while(index < size)
    {
       	temp = videos[index];  //set temp equal to the video at [index]
        std::string tempName = temp.getTitle();
        for (int i = 0; i < tempName.size(); i++)
          tempName.at(i) = toupper(tempName.at(i));
       	if(tempName == titleIn)
    		results.push_back(videos[index]);  //if video is found, add it to results
       	index++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdx, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x7aa0
movl $0x0, -0xb4(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5400
movl %eax, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
movq -0x100(%rbp), %rdi
movslq -0xbc(%rbp), %rax
movq %rax, -0x108(%rbp)
callq 0x2180
movq %rax, %rcx
movq -0x108(%rbp), %rax
cmpq %rcx, %rax
jae 0x4931
movq -0x100(%rbp), %rdi
movslq -0xbc(%rbp), %rsi
callq 0x23b0
movq %rax, -0x110(%rbp)
jmp 0x48c6
movq -0x110(%rbp), %rax
movsbl (%rax), %edi
callq 0x2390
movq -0x100(%rbp), %rdi
movb %al, -0x119(%rbp)
movslq -0xbc(%rbp), %rsi
callq 0x23b0
movq %rax, -0x118(%rbp)
jmp 0x48f7
movq -0x118(%rbp), %rax
movb -0x119(%rbp), %cl
movb %cl, (%rax)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x487d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x4abe
jmp 0x4933
movl -0xb4(%rbp), %eax
cmpl -0xb8(%rbp), %eax
jge 0x4aa9
movq -0x8(%rbp), %rdi
movslq -0xb4(%rbp), %rsi
callq 0x56d0
movq %rax, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x56f0
jmp 0x4966
leaq -0xf0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x7cc0
jmp 0x497b
movl $0x0, -0xf4(%rbp)
movslq -0xf4(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x2180
movq %rax, %rcx
movq -0x128(%rbp), %rax
cmpq %rcx, %rax
jae 0x4a42
movslq -0xf4(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x23b0
movq %rax, -0x130(%rbp)
jmp 0x49ce
movq -0x130(%rbp), %rax
movsbl (%rax), %edi
callq 0x2390
movb %al, -0x139(%rbp)
movslq -0xf4(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x23b0
movq %rax, -0x138(%rbp)
jmp 0x49ff
movq -0x138(%rbp), %rax
movb -0x139(%rbp), %cl
movb %cl, (%rax)
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x4985
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x2150
jmp 0x4abe
movq -0x100(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x5780
testb $0x1, %al
jne 0x4a5b
jmp 0x4a89
movq -0x10(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x8(%rbp), %rdi
movslq -0xb4(%rbp), %rsi
callq 0x56d0
movq -0x148(%rbp), %rdi
movq %rax, %rsi
callq 0x5810
jmp 0x4a87
jmp 0x4a89
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x2150
jmp 0x4933
leaq -0xb0(%rbp), %rdi
callq 0x2900
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0xb0(%rbp), %rdi
callq 0x2900
movq -0xc8(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)