// File: KitchMKelly[P]Team-9-OSU-Hackathon-Winter-2018/BawkBusterFunctions.cpp
// Function: importMovieDataFromFile(std::vector<Video, std::allocator<Video>>&)
bool importMovieDataFromFile(vector<Video> &videoList)
{
    string title;
    string genre;
    string director;
    string actor;
    
    std::ifstream inputFile("movie-dataset.csv");
    if (!inputFile)  // ifstream object equals 0 if open fails
    {
        cout << "Could not access file" << endl;
        return false;
    }

    while(inputFile) //read through to the end of the file
    {
        getline(inputFile,title,',');  //title = title from file
        getline(inputFile,genre,',');  //genre = genre from file
        getline(inputFile,director,',');  //director = director from file
        getline(inputFile,actor,'\n');  //actor = actor from file

        videoList.push_back(Video(title, genre, director, actor)); 
    }

    inputFile.close();
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3e0, %rsp            # imm = 0x3E0
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x22d0
leaq -0x50(%rbp), %rdi
callq 0x22d0
leaq -0x70(%rbp), %rdi
callq 0x22d0
leaq -0x90(%rbp), %rdi
callq 0x22d0
leaq 0x65ab(%rip), %rsi      # 0x9038
leaq -0x298(%rbp), %rdi
movl $0x8, %edx
callq 0x2370
jmp 0x2aa0
movq -0x298(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x298(%rbp,%rax), %rdi
callq 0x2110
movb %al, -0x3c1(%rbp)
jmp 0x2ac0
movb -0x3c1(%rbp), %al
testb $0x1, %al
jne 0x2acc
jmp 0x2b3e
movq 0xa4fd(%rip), %rdi      # 0xcfd0
leaq 0x6570(%rip), %rsi      # 0x904a
callq 0x21f0
movq %rax, -0x3d0(%rbp)
jmp 0x2ae8
movq -0x3d0(%rbp), %rdi
movq 0xa4ca(%rip), %rsi      # 0xcfc0
callq 0x2220
jmp 0x2afd
movb $0x0, -0x1(%rbp)
movl $0x1, -0x2a8(%rbp)
jmp 0x2d60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x2dad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x2da1
jmp 0x2b40
movq -0x298(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x298(%rbp,%rax), %rdi
callq 0x2290
movb %al, -0x3d1(%rbp)
jmp 0x2b60
movb -0x3d1(%rbp), %al
testb $0x1, %al
jne 0x2b6f
jmp 0x2d44
leaq -0x298(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x2c, %edx
callq 0x2380
jmp 0x2b86
leaq -0x298(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0x2c, %edx
callq 0x2380
jmp 0x2b9d
leaq -0x298(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x2c, %edx
callq 0x2380
jmp 0x2bb4
leaq -0x298(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0xa, %edx
callq 0x2380
jmp 0x2bce
movq -0x10(%rbp), %rax
movq %rax, -0x3e0(%rbp)
leaq -0x360(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x20e0
jmp 0x2beb
leaq -0x380(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x20e0
jmp 0x2bfd
leaq -0x3a0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x20e0
jmp 0x2c0f
leaq -0x3c0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x20e0
jmp 0x2c24
leaq -0x340(%rbp), %rdi
leaq -0x360(%rbp), %rsi
leaq -0x380(%rbp), %rdx
leaq -0x3a0(%rbp), %rcx
leaq -0x3c0(%rbp), %r8
callq 0x7ba0
jmp 0x2c4e
movq -0x3e0(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x53d0
jmp 0x2c63
leaq -0x340(%rbp), %rdi
callq 0x2900
leaq -0x3c0(%rbp), %rdi
callq 0x2150
leaq -0x3a0(%rbp), %rdi
callq 0x2150
leaq -0x380(%rbp), %rdi
callq 0x2150
leaq -0x360(%rbp), %rdi
callq 0x2150
jmp 0x2b40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x2d36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x2d2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x2d1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
jmp 0x2d12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2a0(%rbp)
movl %eax, -0x2a4(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x2900
leaq -0x3c0(%rbp), %rdi
callq 0x2150
leaq -0x3a0(%rbp), %rdi
callq 0x2150
leaq -0x380(%rbp), %rdi
callq 0x2150
leaq -0x360(%rbp), %rdi
callq 0x2150
jmp 0x2da1
leaq -0x298(%rbp), %rdi
callq 0x2060
jmp 0x2d52
movb $0x1, -0x1(%rbp)
movl $0x1, -0x2a8(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x2080
leaq -0x90(%rbp), %rdi
callq 0x2150
leaq -0x70(%rbp), %rdi
callq 0x2150
leaq -0x50(%rbp), %rdi
callq 0x2150
leaq -0x30(%rbp), %rdi
callq 0x2150
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbp
retq
leaq -0x298(%rbp), %rdi
callq 0x2080
leaq -0x90(%rbp), %rdi
callq 0x2150
leaq -0x70(%rbp), %rdi
callq 0x2150
leaq -0x50(%rbp), %rdi
callq 0x2150
leaq -0x30(%rbp), %rdi
callq 0x2150
movq -0x2a0(%rbp), %rdi
callq 0x2340