// File: 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
subq $0x800, %rsp            # imm = 0x800
movq %rsi, -0x6a8(%rbp)
movq %rdx, -0x6a0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x698(%rbp)
movq 0x11ec9(%rip), %rdi     # 0x22fc8
leaq 0x839e(%rip), %rsi      # 0x194a4
callq 0x33a0
movq %rax, -0x690(%rbp)
movq -0x28(%rbp), %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0x688(%rbp)
callq 0x17010
movq -0x690(%rbp), %rdi
movq -0x688(%rbp), %rsi
callq 0x3330
movq %rax, -0x680(%rbp)
jmp 0x11142
movq -0x680(%rbp), %rdi
leaq 0x8366(%rip), %rsi      # 0x194b6
callq 0x33a0
movq %rax, -0x6b0(%rbp)
jmp 0x1115e
movq -0x6b0(%rbp), %rdi
movq 0x11e44(%rip), %rsi     # 0x22fb0
callq 0x33d0
jmp 0x11173
leaq -0x48(%rbp), %rdi
callq 0x3280
leaq -0x60(%rbp), %rdi
callq 0x6f20
movq -0x6a0(%rbp), %rdi
callq 0x6f40
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x6a0(%rbp), %rdi
callq 0x6fb0
movq %rax, -0x158(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x6f70
testb $0x1, %al
jne 0x111cf
jmp 0x11563
leaq -0x60(%rbp), %rdi
callq 0x7180
movq %rax, %rsi
leaq -0x240(%rbp), %rdi
movq %rdi, -0x6c0(%rbp)
movl $0xe8, %edx
callq 0x3300
movq -0x6c0(%rbp), %rsi
movq %rsp, %rdi
movl $0x1d, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x6a8(%rbp), %rsi
movq -0x698(%rbp), %rdi
leaq -0x148(%rbp), %rdx
callq 0x10e70
movl %eax, %ecx
movl %ecx, -0x6b4(%rbp)
subl $0x1d, %eax
je 0x11269
jmp 0x1122e
movl -0x6b4(%rbp), %eax
subl $0x1e, %eax
je 0x1126e
jmp 0x1123b
movl -0x6b4(%rbp), %eax
subl $0x1f, %eax
je 0x11328
jmp 0x1154a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3280
jmp 0x11769
jmp 0x1154a
movq -0x20(%rbp), %rax
movq %rax, -0x6d8(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7070
movq %rax, -0x6d0(%rbp)
leaq -0x261(%rbp), %rdi
movq %rdi, -0x6c8(%rbp)
callq 0x3620
movq -0x6d0(%rbp), %rsi
movq -0x6c8(%rbp), %rdx
leaq -0x260(%rbp), %rdi
callq 0x3480
jmp 0x112b8
movq -0x6d8(%rbp), %rsi
movq -0x698(%rbp), %rdi
leaq -0x260(%rbp), %rdx
callq 0xb8b0
jmp 0x112d4
leaq -0x260(%rbp), %rdi
callq 0x3280
leaq -0x261(%rbp), %rdi
callq 0x33e0
jmp 0x1154a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11317
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x3280
leaq -0x261(%rbp), %rdi
callq 0x33e0
jmp 0x11769
movq -0x20(%rbp), %rax
movq %rax, -0x6e8(%rbp)
leaq -0x289(%rbp), %rdi
movq %rdi, -0x6e0(%rbp)
callq 0x3620
movq -0x6e0(%rbp), %rdx
leaq -0x288(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x3480
jmp 0x11362
movq -0x6e8(%rbp), %rsi
movq -0x698(%rbp), %rdi
leaq -0x288(%rbp), %rdx
callq 0xb8b0
jmp 0x1137e
leaq -0x288(%rbp), %rdi
callq 0x3280
leaq -0x289(%rbp), %rdi
callq 0x33e0
movq -0x20(%rbp), %rax
movq %rax, -0x6f8(%rbp)
movq -0x28(%rbp), %rsi
leaq -0x2d0(%rbp), %rdi
callq 0x17040
leaq -0x2f1(%rbp), %rdi
movq %rdi, -0x6f0(%rbp)
callq 0x3620
movq -0x6f0(%rbp), %rdx
leaq -0x2f0(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x3480
jmp 0x113e0
leaq -0x2b0(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
leaq -0x2f0(%rbp), %rdx
callq 0x6cb0
jmp 0x113fc
leaq -0x3e0(%rbp), %rdi
leaq -0x148(%rbp), %rsi
movl $0xe8, %edx
callq 0x3300
movq -0x28(%rbp), %rsi
leaq -0x400(%rbp), %rdi
callq 0x17010
jmp 0x11426
movq %rsp, %rdi
movl $0x1d, %ecx
leaq -0x3e0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x6f8(%rbp), %rsi
movq -0x698(%rbp), %rdi
leaq -0x2b0(%rbp), %rdx
leaq -0x400(%rbp), %rcx
callq 0x9ee0
jmp 0x1145b
leaq -0x400(%rbp), %rdi
callq 0x3280
leaq -0x2b0(%rbp), %rdi
callq 0x3280
leaq -0x2f0(%rbp), %rdi
callq 0x3280
leaq -0x2f1(%rbp), %rdi
callq 0x33e0
leaq -0x2d0(%rbp), %rdi
callq 0x3280
jmp 0x1154a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x114c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x3280
leaq -0x289(%rbp), %rdi
callq 0x33e0
jmp 0x11769
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1152d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11521
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11515
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x400(%rbp), %rdi
callq 0x3280
leaq -0x2b0(%rbp), %rdi
callq 0x3280
leaq -0x2f0(%rbp), %rdi
callq 0x3280
leaq -0x2f1(%rbp), %rdi
callq 0x33e0
leaq -0x2d0(%rbp), %rdi
callq 0x3280
jmp 0x11769
jmp 0x1154c
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
callq 0x7140
movq %rax, -0x408(%rbp)
jmp 0x111a3
movq -0x6a8(%rbp), %rax
movq %rax, -0x410(%rbp)
movq -0x410(%rbp), %rdi
callq 0x6f40
movq %rax, -0x418(%rbp)
movq -0x410(%rbp), %rdi
callq 0x6fb0
movq %rax, -0x420(%rbp)
leaq -0x418(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x6f70
testb $0x1, %al
jne 0x115b3
jmp 0x11760
leaq -0x418(%rbp), %rdi
callq 0x7180
movq %rax, %rsi
leaq -0x508(%rbp), %rdi
movq %rdi, -0x708(%rbp)
movl $0xe8, %edx
callq 0x3300
movq -0x20(%rbp), %rax
movq %rax, -0x710(%rbp)
movq -0x28(%rbp), %rsi
leaq -0x548(%rbp), %rdi
callq 0x17040
leaq -0x569(%rbp), %rdi
movq %rdi, -0x700(%rbp)
callq 0x3620
movq -0x708(%rbp), %rsi
movq -0x700(%rbp), %rdx
leaq -0x568(%rbp), %rdi
callq 0x3480
jmp 0x11624
leaq -0x528(%rbp), %rdi
leaq -0x548(%rbp), %rsi
leaq -0x568(%rbp), %rdx
callq 0x6cb0
jmp 0x11640
leaq -0x658(%rbp), %rdi
leaq -0x508(%rbp), %rsi
movl $0xe8, %edx
callq 0x3300
movq -0x28(%rbp), %rsi
leaq -0x678(%rbp), %rdi
callq 0x17010
jmp 0x1166a
movq %rsp, %rdi
movl $0x1d, %ecx
leaq -0x658(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x710(%rbp), %rsi
movq -0x698(%rbp), %rdi
leaq -0x528(%rbp), %rdx
leaq -0x678(%rbp), %rcx
callq 0x9ee0
jmp 0x1169f
leaq -0x678(%rbp), %rdi
callq 0x3280
leaq -0x528(%rbp), %rdi
callq 0x3280
leaq -0x568(%rbp), %rdi
callq 0x3280
leaq -0x569(%rbp), %rdi
callq 0x33e0
leaq -0x548(%rbp), %rdi
callq 0x3280
leaq -0x418(%rbp), %rdi
callq 0x72e0
jmp 0x11597
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11746
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1173a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1172e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x678(%rbp), %rdi
callq 0x3280
leaq -0x528(%rbp), %rdi
callq 0x3280
leaq -0x568(%rbp), %rdi
callq 0x3280
leaq -0x569(%rbp), %rdi
callq 0x33e0
leaq -0x548(%rbp), %rdi
callq 0x3280
jmp 0x11769
addq $0x800, %rsp            # imm = 0x800
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x3610
nopw %cs:(%rax,%rax)