// File: /workspace/github_cpp_makefile_star2_O2/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::updateClient(std::vector<Dropbox::_FileRecord, std::allocator<Dropbox::_FileRecord>>, std::vector<Dropbox::_FileRecord, std::allocator<Dropbox::_FileRecord>>, Dropbox::WrapperSocket*, Dropbox::User*)
void Server::updateClient(vector<FileRecord> serverFiles, vector<FileRecord> clientFiles, WrapperSocket *socket, User *user) {
    cout << "Checking if user " << user->getUsername() << " is updated." << endl;
    vector<FileRecord>::iterator it;
    FileRecord temp;
    for(it = clientFiles.begin(); it != clientFiles.end(); it++) {
        switch(this->lookForRecordAndRemove(*it, &serverFiles, &temp)) {
            case OK: 
                break;
            case DELETE:
                this->sendDeleteFile(socket, string(it->filename));
                break;
            case UPDATE: 
                this->sendDeleteFile(socket, string(temp.filename));
                this->sendFile(socket, user->getDirPath() + string(temp.filename), temp, user->getUsername());
                break;
        }
    }
    // Send files that the client didn't have at the moment
    for(FileRecord serverFile: serverFiles) { 
        this->sendFile(socket, user->getDirPath() + string(serverFile.filename), serverFile, user->getUsername());
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5b8, %rsp            # imm = 0x5B8
movq %r8, %r15
movq %rcx, -0x40(%rbp)
movq %rdx, %r13
movq %rsi, -0x50(%rbp)
movq %rdi, -0x38(%rbp)
movq 0x7343(%rip), %rdi      # 0x10fc8
leaq 0x27cc(%rip), %rsi      # 0xc458
callq 0x3310
movq %rax, %rbx
leaq -0x240(%rbp), %r14
movq %r14, %rdi
movq %r15, -0x48(%rbp)
movq %r15, %rsi
callq 0xb34a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32b0
leaq 0x27ae(%rip), %rsi      # 0xc46a
movq %rax, %rdi
callq 0x3310
movq %rax, %rdi
callq 0x31c0
leaq -0x240(%rbp), %rdi
callq 0x3170
movq %r13, -0x58(%rbp)
movq (%r13), %r13
leaq -0x328(%rbp), %r15
movq -0x50(%rbp), %r12
movq -0x58(%rbp), %rax
cmpq 0x8(%rax), %r13
je 0x9e45
pushq $0x1d
popq %rcx
movq %rsp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, %rsi
leaq -0x240(%rbp), %rdx
callq 0x9b80
cmpl $0x1e, %eax
je 0x9e06
cmpl $0x1f, %eax
jne 0x9e39
leaq -0x138(%rbp), %r14
movq %r14, %rdi
leaq -0x240(%rbp), %rsi
movq %r15, %rdx
callq 0x3130
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %r14, %rdx
callq 0x6ab8
movq %r14, %rdi
callq 0x3170
movq %r15, %rdi
movq -0x48(%rbp), %rsi
callq 0xb362
leaq -0x78(%rbp), %r14
movq %r14, %rdi
leaq -0x240(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x3130
movq %r15, %rsi
leaq -0xb8(%rbp), %rdi
movq %r14, %rdx
callq 0x51aa
movl $0xe8, %edx
leaq -0x4f8(%rbp), %r14
movq %r14, %rdi
leaq -0x240(%rbp), %rsi
callq 0x3280
leaq -0x118(%rbp), %rbx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0xb34a
pushq $0x1d
popq %rcx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0xb8(%rbp), %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x5bd2
movq %rbx, %rdi
callq 0x3170
movq %r14, %rdi
callq 0x3170
leaq -0x78(%rbp), %rdi
callq 0x3170
movq %r15, %rdi
callq 0x3170
jmp 0x9e39
movq %r15, %rdx
leaq -0x158(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %rdx, %r14
callq 0x3130
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %r15, %rdx
callq 0x6ab8
movq %r15, %rdi
callq 0x3170
movq %r14, %r15
addq $0xe8, %r13
jmp 0x9ceb
movq (%r12), %rsi
movq 0x8(%r12), %rax
movq %rax, -0x50(%rbp)
leaq -0x98(%rbp), %r15
leaq -0xf8(%rbp), %r12
cmpq -0x50(%rbp), %rsi
je 0x9f39
movl $0xe8, %edx
leaq -0x78(%rbp), %rbx
leaq -0x328(%rbp), %r14
movq %r14, %rdi
movq %rsi, -0x58(%rbp)
callq 0x3280
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0xb362
movq %r15, %rdi
movq %r14, %rsi
leaq -0x29(%rbp), %rdx
callq 0x3130
movq %r12, %r13
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %r12
movq %r15, %rdx
callq 0x51aa
movl $0xe8, %edx
leaq -0x410(%rbp), %rbx
movq %rbx, %rdi
leaq -0x328(%rbp), %rsi
callq 0x3280
leaq -0xd8(%rbp), %r14
movq %r14, %rdi
movq -0x48(%rbp), %rsi
callq 0xb34a
pushq $0x1d
popq %rcx
movq %rsp, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x5bd2
movq %r12, %r15
movq %r14, %rdi
callq 0x3170
movq %r13, %rdi
callq 0x3170
movq %r12, %rdi
callq 0x3170
leaq -0x78(%rbp), %rdi
callq 0x3170
movq -0x58(%rbp), %rsi
addq $0xe8, %rsi
movq %r13, %r12
jmp 0x9e60
addq $0x5b8, %rsp            # imm = 0x5B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
jmp 0x9fef
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x3170
jmp 0x9f70
jmp 0x9fa4
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x3170
jmp 0x9f81
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3170
jmp 0x9f9b
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
jmp 0x9fef
movq %rax, %rbx
leaq -0x328(%rbp), %rdi
jmp 0x9fef
movq %rax, %rbx
jmp 0x9ff4
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
jmp 0x9fef
movq %rax, %rbx
jmp 0x9feb
movq %rax, %rbx
jmp 0x9fdf
movq %rax, %rbx
jmp 0x9fd3
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x3170
leaq -0xf8(%rbp), %rdi
callq 0x3170
leaq -0x98(%rbp), %rdi
callq 0x3170
leaq -0x78(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3540