// File: /workspace/github_cpp_makefile_star2_O3/vianna274[P]dropbox/src/Server.cpp
// Function: Dropbox::Server::listenToClient(Dropbox::WrapperSocket*, Dropbox::User*)
void Server::listenToClient(WrapperSocket *socket, User *user)
{   
    bool exit = false;
    FileRecord * temp = NULL;
    FileRecord fileTemp;
    vector<FileRecord> tempFiles = user->getFileRecords();
	while(!exit){
		MessageData *data = socket->receive(TIMEOUT_OFF);
        user->lockDevices();
        switch(data->type){
            case TYPE_REQUEST_DOWNLOAD:
                tempFiles = user->getFileRecords();
                fileTemp = this->getRecord(tempFiles, string(data->payload));
                sendFile(socket, user->getDirPath() + string(data->payload), fileTemp, string(data->username));
                break;
            case TYPE_DELETE: 
                deleteFile(user->getDirPath() + string(data->payload));
                user->removeFileRecord(string(data->payload));
                propagateDelete(string(data->payload), string(data->username));
                break;
            case TYPE_LIST_SERVER:
                sendFileList(socket, user->getFileRecords());
                break;
            case TYPE_SEND_FILE_NO_RECORD:
                receiveFile(socket, string(data->payload), user->getDirPath());
                user->updateFileRecord(this->getRecord(this->getFileList(user->getDirPath()), string(data->payload)));
                sendFileRecord(socket, string(data->payload), user);
                this->propagateFile(string(data->payload), string(data->username));
                break;
            case TYPE_REQUEST_UPLOAD_ALL:
                sendUploadAll(socket, user->getDirPath(), getFileList(user->getDirPath()), user->getUsername());
                break;
            case TYPE_REQUEST_UPDATE:
                receiveAskUpdate(socket, user);
                break;
            case EXIT:
                exitUser(socket, user);
                exit = true;
                break;
        }
        user->unlockDevices();
	}

    delete socket;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x758, %rsp            # imm = 0x758
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
leaq -0xb8(%rbp), %rdi
movq %rdx, %rsi
callq 0xe2e2
movq %r14, -0x38(%rbp)
leaq 0x70(%r14), %rax
movq %rax, -0x60(%rbp)
movq %rbx, %r14
movq %rbx, %rdi
xorl %esi, %esi
callq 0xec2e
movq %rax, %r13
movq -0x60(%rbp), %rdi
callq 0x3470
testl %eax, %eax
jne 0xbb92
movl (%r13), %eax
leal -0x4(%rax), %ecx
cmpl $0xa, %ecx
ja 0xb86b
leaq 0x50b9(%rip), %rdx      # 0x1039c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x14(%r13), %rbx
leaq -0xe8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
addq $0x14, %rdx
leaq -0xf8(%rbp), %rdi
movq %rbx, %rsi
callq 0x630e
leaq -0x2f8(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0xe536
movq -0x30(%rbp), %rdi
movq %r14, %rsi
leaq -0xf8(%rbp), %rdx
movq %r12, %rcx
callq 0x68ce
movq -0x2f8(%rbp), %rdi
leaq -0x2e8(%rbp), %rax
cmpq %rax, %rdi
je 0xb35e
callq 0x3320
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0xb376
callq 0x3320
leaq -0x238(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe536
leaq -0x268(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x238(%rbp), %rdx
callq 0x6682
leaq -0x168(%rbp), %rax
movq %rax, -0x178(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%rbx), %rdx
leaq -0x178(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x630e
leaq -0x5b0(%rbp), %r15
movq %r15, %rdi
movq -0x30(%rbp), %rsi
leaq -0x268(%rbp), %rdx
movq %r12, %rcx
callq 0x69e8
movl $0x1d, %ecx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x38(%rbp), %rdi
callq 0xe3d8
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0xb415
callq 0x3320
movq -0x268(%rbp), %rdi
testq %rdi, %rdi
je 0xb426
callq 0x3320
movq -0x238(%rbp), %rdi
leaq -0x228(%rbp), %rax
cmpq %rax, %rdi
je 0xb43e
callq 0x3320
leaq -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%rbx), %rdx
leaq -0x158(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x630e
movq -0x30(%rbp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq -0x38(%rbp), %rcx
callq 0xc32e
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0xb495
callq 0x3320
leaq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%rbx), %rdx
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
callq 0x630e
leaq 0xfb4(%r13), %rbx
leaq -0x128(%rbp), %rax
movq %rax, -0x138(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
leaq -0x138(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x630e
movq -0x30(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
movq %r15, %rdx
callq 0xc026
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0xb523
callq 0x3320
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
jmp 0xbb2b
leaq -0x3e0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe2e2
movq -0xb8(%rbp), %rdi
movq -0x3e0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movups -0x3d8(%rbp), %xmm0
movups %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x3e0(%rbp)
movq $0x0, -0x3d0(%rbp)
testq %rdi, %rdi
je 0xb599
callq 0x3320
movq -0x3e0(%rbp), %rdi
testq %rdi, %rdi
je 0xb599
callq 0x3320
leaq -0x298(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x610c
leaq 0x14(%r13), %rbx
leaq -0x1e8(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
addq $0x14, %rdx
leaq -0x1f8(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x630e
leaq -0x3e0(%rbp), %r15
movq %r15, %rdi
movq -0x30(%rbp), %rsi
leaq -0x298(%rbp), %rdx
movq %r12, %rcx
callq 0x69e8
movl $0xe8, %edx
leaq -0x4c8(%rbp), %rdi
movq %r15, %rsi
callq 0x32b0
movq -0x1f8(%rbp), %rdi
leaq -0x1e8(%rbp), %rax
cmpq %rax, %rdi
je 0xb629
callq 0x3320
movq -0x298(%rbp), %rdi
testq %rdi, %rdi
je 0xb63a
callq 0x3320
leaq -0x3e0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe536
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%rbx), %rdx
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x630e
movq -0x3e0(%rbp), %rcx
movl $0xf, %edi
leaq -0x3d0(%rbp), %rax
cmpq %rax, %rcx
je 0xb689
movq -0x3d0(%rbp), %rdi
movq -0x3d8(%rbp), %r8
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0xb6bc
movl $0xf, %edi
leaq -0x48(%rbp), %r9
cmpq %r9, %rsi
je 0xb6b3
movq -0x48(%rbp), %rdi
cmpq %rdi, %rax
jbe 0xba03
leaq -0x3e0(%rbp), %rdi
callq 0x3100
jmp 0xba10
leaq -0x280(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe2e2
movq -0x30(%rbp), %rdi
movq %r14, %rsi
leaq -0x280(%rbp), %rdx
callq 0x67ec
movq -0x280(%rbp), %rdi
testq %rdi, %rdi
jne 0xbb30
jmp 0xbb35
movq -0x30(%rbp), %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
callq 0xc414
jmp 0xbb35
leaq -0x218(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe536
leaq -0x2d8(%rbp), %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0xe536
leaq -0x250(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq %rbx, %rdx
callq 0x6682
movq %r14, %rbx
leaq -0x2b8(%rbp), %r15
movq %r15, %rdi
movq -0x38(%rbp), %rsi
callq 0xe50a
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
leaq -0x218(%rbp), %rdx
leaq -0x250(%rbp), %rcx
movq %r15, %r8
callq 0x7bba
movq -0x2b8(%rbp), %rdi
leaq -0x2a8(%rbp), %rax
cmpq %rax, %rdi
je 0xb79b
callq 0x3320
movq -0x250(%rbp), %rdi
testq %rdi, %rdi
je 0xb7ac
callq 0x3320
movq -0x2d8(%rbp), %rdi
leaq -0x2c8(%rbp), %rax
cmpq %rax, %rdi
je 0xb7c4
callq 0x3320
movq -0x218(%rbp), %rdi
leaq -0x208(%rbp), %rax
jmp 0xbb2b
leaq -0x3e0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe536
leaq 0x14(%r13), %rbx
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
addq $0x14, %rdx
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x630e
movq -0x3e0(%rbp), %rcx
movl $0xf, %edi
leaq -0x3d0(%rbp), %rax
cmpq %rax, %rcx
je 0xb82e
movq -0x3d0(%rbp), %rdi
movq -0x3d8(%rbp), %r8
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0xb85d
movl $0xf, %edi
leaq -0x48(%rbp), %r9
cmpq %r9, %rsi
je 0xb858
movq -0x48(%rbp), %rdi
cmpq %rdi, %rax
jbe 0xb879
leaq -0x3e0(%rbp), %rdi
callq 0x3100
jmp 0xb886
cmpl $0x21, %eax
jne 0xbb35
jmp 0xbb46
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3370
leaq -0x70(%rbp), %rsi
movq %rsi, -0x80(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0xb8a7
movq %rdx, -0x80(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x70(%rbp)
jmp 0xb8ad
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x78(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7f36
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xb8e8
callq 0x3320
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xb8fa
callq 0x3320
movq -0x3e0(%rbp), %rdi
leaq -0x3d0(%rbp), %rax
cmpq %rax, %rdi
je 0xb912
callq 0x3320
leaq -0x1a8(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%rbx), %rdx
leaq -0x1b8(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x630e
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0xe2fe
movq -0x1b8(%rbp), %rdi
leaq -0x1a8(%rbp), %rax
cmpq %rax, %rdi
je 0xb962
callq 0x3320
leaq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%rbx), %rdx
leaq -0x118(%rbp), %rdi
movq %rbx, %rsi
callq 0x630e
leaq 0xfb4(%r13), %rbx
leaq -0x188(%rbp), %rax
movq %rax, -0x198(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
leaq -0x198(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x630e
movq -0x30(%rbp), %rdi
leaq -0x118(%rbp), %rsi
movq %r15, %rdx
callq 0xbe26
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0xb9f0
callq 0x3320
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
jmp 0xbb2b
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3370
leaq -0x90(%rbp), %rsi
movq %rsi, -0xa0(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0xba3d
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x90(%rbp)
jmp 0xba43
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x98(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movl $0xe8, %edx
leaq -0x698(%rbp), %r15
movq %r15, %rdi
leaq -0x4c8(%rbp), %rsi
callq 0x32b0
leaq 0xfb4(%r13), %rbx
leaq -0x1c8(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq %rbx, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
leaq -0x1d8(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x630e
movl $0x1d, %ecx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x30(%rbp), %rdi
movq %r14, %rsi
leaq -0xa0(%rbp), %rdx
movq %r12, %rcx
callq 0x6aaa
movq -0x1d8(%rbp), %rdi
leaq -0x1c8(%rbp), %rax
cmpq %rax, %rdi
je 0xbaf3
callq 0x3320
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0xbb0b
callq 0x3320
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xbb1d
callq 0x3320
movq -0x3e0(%rbp), %rdi
leaq -0x3d0(%rbp), %rax
cmpq %rax, %rdi
je 0xbb35
callq 0x3320
movq -0x60(%rbp), %rdi
callq 0x3280
movq %r14, %rbx
jmp 0xb2ab
movq -0x30(%rbp), %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
callq 0xc554
movq -0x60(%rbp), %rdi
callq 0x3280
movq %r14, %rdi
callq 0xe69a
movq %r14, %rdi
callq 0x3320
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0xbb80
callq 0x3320
addq $0x758, %rsp            # imm = 0x758
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
jmp 0xbe0a
movq %rax, %rbx
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0xbbf1
callq 0x3320
jmp 0xbbf1
movq %rax, %rbx
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0xbbdb
callq 0x3320
jmp 0xbbdb
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
jmp 0xbdfc
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
jmp 0xbdfc
jmp 0xbe0a
jmp 0xbe0a
movq %rax, %rbx
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
jmp 0xbdfc
jmp 0xbe0a
movq %rax, %rbx
movq -0x1d8(%rbp), %rdi
leaq -0x1c8(%rbp), %rax
cmpq %rax, %rdi
je 0xbc49
callq 0x3320
jmp 0xbc49
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
jmp 0xbd5f
jmp 0xbd6b
movq %rax, %rbx
jmp 0xbdb2
jmp 0xbe0a
movq %rax, %rbx
jmp 0xbddd
movq %rax, %rbx
movq -0x280(%rbp), %rdi
jmp 0xbcbb
movq %rax, %rbx
jmp 0xbdee
jmp 0xbd82
jmp 0xbe0a
movq %rax, %rbx
movq -0x1f8(%rbp), %rdi
leaq -0x1e8(%rbp), %rax
cmpq %rax, %rdi
je 0xbcb4
callq 0x3320
jmp 0xbcb4
movq %rax, %rbx
movq -0x298(%rbp), %rdi
testq %rdi, %rdi
jne 0xbe01
jmp 0xbe0d
jmp 0xbe0a
jmp 0xbe0a
movq %rax, %rbx
movq -0x2b8(%rbp), %rdi
leaq -0x2a8(%rbp), %rax
cmpq %rax, %rdi
je 0xbcf3
callq 0x3320
jmp 0xbcf3
movq %rax, %rbx
movq -0x250(%rbp), %rdi
testq %rdi, %rdi
je 0xbd09
callq 0x3320
jmp 0xbd09
movq %rax, %rbx
movq -0x2d8(%rbp), %rdi
leaq -0x2c8(%rbp), %rax
cmpq %rax, %rdi
je 0xbd26
callq 0x3320
jmp 0xbd26
movq %rax, %rbx
movq -0x218(%rbp), %rdi
leaq -0x208(%rbp), %rax
jmp 0xbdfc
movq %rax, %rbx
movq -0x1b8(%rbp), %rdi
leaq -0x1a8(%rbp), %rax
jmp 0xbdfc
jmp 0xbe0a
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xbd6e
callq 0x3320
jmp 0xbd6e
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xbd85
callq 0x3320
jmp 0xbd85
movq %rax, %rbx
movq -0x3e0(%rbp), %rdi
leaq -0x3d0(%rbp), %rax
jmp 0xbdfc
jmp 0xbe0a
movq %rax, %rbx
movq -0x2f8(%rbp), %rdi
leaq -0x2e8(%rbp), %rax
cmpq %rax, %rdi
je 0xbdb2
callq 0x3320
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
jmp 0xbdfc
movq %rax, %rbx
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0xbddd
callq 0x3320
movq -0x268(%rbp), %rdi
testq %rdi, %rdi
je 0xbdee
callq 0x3320
movq -0x238(%rbp), %rdi
leaq -0x228(%rbp), %rax
cmpq %rax, %rdi
je 0xbe0d
callq 0x3320
jmp 0xbe0d
jmp 0xbe0a
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0xbe1e
callq 0x3320
movq %rbx, %rdi
callq 0x3580