// File: /workspace/github_cpp_makefile_star2_O1/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 $0x768, %rsp            # imm = 0x768
movq %rdx, %r14
movq %rsi, -0x40(%rbp)
movq %rdi, -0x30(%rbp)
leaq -0xc0(%rbp), %rdi
movq %rdx, %rsi
callq 0xe346
movq %r14, -0x38(%rbp)
leaq 0x70(%r14), %r13
movq $0x0, -0xa8(%rbp)
movq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0xed22
movq %rax, %r12
movq %r13, %rdi
callq 0x3470
testl %eax, %eax
jne 0xbc1f
movl (%r12), %eax
leal -0x4(%rax), %ecx
cmpl $0xa, %ecx
ja 0xb5b3
leaq 0x5040(%rip), %rdx      # 0x1039c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x14(%r12), %r15
leaq -0xf0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%r12,%rax), %rdx
addq $0x14, %rdx
leaq -0x100(%rbp), %rdi
movq %r15, %rsi
callq 0x62de
leaq -0x300(%rbp), %r14
movq %r14, %rdi
movq -0x38(%rbp), %rsi
callq 0xe582
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0x100(%rbp), %rdx
movq %r14, %rcx
callq 0x689a
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0xb3d9
callq 0x3320
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0xb3f1
callq 0x3320
leaq -0x240(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe582
leaq -0x270(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x240(%rbp), %rdx
callq 0x664e
leaq -0x170(%rbp), %rax
movq %rax, -0x180(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%rax,%r15), %rdx
leaq -0x180(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x62de
leaq -0x5c0(%rbp), %rbx
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
leaq -0x270(%rbp), %rdx
movq %r14, %rcx
callq 0x69b4
movl $0x1d, %ecx
movq %rsp, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x38(%rbp), %rdi
callq 0xe42a
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
je 0xb490
callq 0x3320
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0xb4a1
callq 0x3320
movq -0x240(%rbp), %rdi
leaq -0x230(%rbp), %rax
cmpq %rax, %rdi
je 0xb4b9
callq 0x3320
leaq -0x150(%rbp), %rax
movq %rax, -0x160(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%rax,%r15), %rdx
leaq -0x160(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x62de
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rbx, %rdx
movq -0x38(%rbp), %rcx
callq 0xc3ae
movq -0x160(%rbp), %rdi
leaq -0x150(%rbp), %rax
cmpq %rax, %rdi
je 0xb511
callq 0x3320
leaq -0xd0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%rax,%r15), %rdx
leaq -0xe0(%rbp), %rdi
movq %r15, %rsi
callq 0x62de
leaq 0xfb4(%r12), %r15
leaq -0x130(%rbp), %rax
movq %rax, -0x140(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%r12,%rax), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
leaq -0x140(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x62de
movq -0x30(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdx
callq 0xc0a6
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0xb5a0
callq 0x3320
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
jmp 0xbbc9
cmpl $0x21, %eax
jne 0xbbd3
movb $0x1, %al
movq %rax, -0xa8(%rbp)
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0xc5d4
jmp 0xbbd3
leaq -0x3f0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe346
movq -0xc0(%rbp), %rdi
movq -0x3f0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movups -0x3e8(%rbp), %xmm0
movups %xmm0, -0xb8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x3f0(%rbp)
movq $0x0, -0x3e0(%rbp)
testq %rdi, %rdi
je 0xb62d
callq 0x3320
movq -0x3f0(%rbp), %rdi
testq %rdi, %rdi
je 0xb63e
callq 0x3320
leaq -0x2a0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x60e0
leaq 0x14(%r12), %r15
leaq -0x1f0(%rbp), %rax
movq %rax, -0x200(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%r12,%rax), %rdx
addq $0x14, %rdx
leaq -0x200(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x62de
leaq -0x3f0(%rbp), %rbx
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
leaq -0x2a0(%rbp), %rdx
movq %r14, %rcx
callq 0x69b4
movl $0xe8, %edx
leaq -0x4d8(%rbp), %rdi
movq %rbx, %rsi
callq 0x32b0
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0xb6cf
callq 0x3320
movq -0x2a0(%rbp), %rdi
testq %rdi, %rdi
je 0xb6e0
callq 0x3320
leaq -0x3f0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe582
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%rax,%r15), %rdx
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
callq 0x62de
movq -0x3f0(%rbp), %rcx
movl $0xf, %esi
leaq -0x3e0(%rbp), %rax
cmpq %rax, %rcx
je 0xb72f
movq -0x3e0(%rbp), %rsi
movq -0x3e8(%rbp), %r8
movq -0x58(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0xb75f
movl $0xf, %esi
leaq -0x50(%rbp), %rdi
cmpq %rdi, -0x60(%rbp)
je 0xb756
movq -0x50(%rbp), %rsi
cmpq %rsi, %rax
jbe 0xba9f
movq -0x60(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x3100
jmp 0xbaac
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0xc494
jmp 0xbbd3
leaq -0x220(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe582
leaq -0x2e0(%rbp), %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0xe582
leaq -0x258(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq %rbx, %rdx
callq 0x664e
leaq -0x2c0(%rbp), %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0xe556
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0x220(%rbp), %rdx
leaq -0x258(%rbp), %rcx
movq %rbx, %r8
callq 0x7b7c
movq -0x2c0(%rbp), %rdi
leaq -0x2b0(%rbp), %rax
cmpq %rax, %rdi
je 0xb809
callq 0x3320
movq -0x258(%rbp), %rdi
testq %rdi, %rdi
je 0xb81a
callq 0x3320
movq -0x2e0(%rbp), %rdi
leaq -0x2d0(%rbp), %rax
cmpq %rax, %rdi
je 0xb832
callq 0x3320
movq -0x220(%rbp), %rdi
leaq -0x210(%rbp), %rax
jmp 0xbbc9
leaq -0x288(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe346
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0x288(%rbp), %rdx
callq 0x67b8
movq -0x288(%rbp), %rdi
testq %rdi, %rdi
jne 0xbbce
jmp 0xbbd3
leaq -0x3f0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xe582
leaq 0x14(%r12), %r15
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%r12,%rax), %rdx
addq $0x14, %rdx
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
callq 0x62de
movq -0x3f0(%rbp), %rcx
movl $0xf, %esi
leaq -0x3e0(%rbp), %rax
cmpq %rax, %rcx
je 0xb8d6
movq -0x3e0(%rbp), %rsi
movq -0x3e8(%rbp), %r8
movq -0x58(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0xb902
movl $0xf, %esi
leaq -0x50(%rbp), %rdi
cmpq %rdi, -0x60(%rbp)
je 0xb8fd
movq -0x50(%rbp), %rsi
cmpq %rsi, %rax
jbe 0xb914
movq -0x60(%rbp), %rsi
leaq -0x3f0(%rbp), %rdi
callq 0x3100
jmp 0xb921
leaq -0x60(%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 0xb942
movq %rdx, -0x80(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x70(%rbp)
jmp 0xb948
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 0x7ef8
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xb983
callq 0x3320
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xb995
callq 0x3320
movq -0x3f0(%rbp), %rdi
leaq -0x3e0(%rbp), %rax
cmpq %rax, %rdi
je 0xb9ad
callq 0x3320
leaq -0x1b0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%rax,%r15), %rdx
leaq -0x1c0(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x62de
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0xe362
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0xb9fd
callq 0x3320
leaq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%rax,%r15), %rdx
leaq -0x120(%rbp), %rdi
movq %r15, %rsi
callq 0x62de
leaq 0xfb4(%r12), %r15
leaq -0x190(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%r12,%rax), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
leaq -0x1a0(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x62de
movq -0x30(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movq %rbx, %rdx
callq 0xbea6
movq -0x1a0(%rbp), %rdi
leaq -0x190(%rbp), %rax
cmpq %rax, %rdi
je 0xba8c
callq 0x3320
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
jmp 0xbbc9
leaq -0x60(%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 0xbad9
movq %rdx, -0xa0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x90(%rbp)
jmp 0xbadf
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 -0x6a8(%rbp), %rbx
movq %rbx, %rdi
leaq -0x4d8(%rbp), %rsi
callq 0x32b0
leaq 0xfb4(%r12), %r15
leaq -0x1d0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq %r15, %rdi
callq 0x3170
leaq (%r12,%rax), %rdx
addq $0xfb4, %rdx            # imm = 0xFB4
leaq -0x1e0(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x62de
movl $0x1d, %ecx
movq %rsp, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
movq %r14, %rcx
callq 0x6a6c
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xbb91
callq 0x3320
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0xbba9
callq 0x3320
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xbbbb
callq 0x3320
movq -0x3f0(%rbp), %rdi
leaq -0x3e0(%rbp), %rax
cmpq %rax, %rdi
je 0xbbd3
callq 0x3320
movq %r13, %rdi
callq 0x3280
testb $0x1, -0xa8(%rbp)
je 0xb327
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0xe6de
movq %rbx, %rdi
callq 0x3320
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0xbc0d
callq 0x3320
addq $0x768, %rsp            # imm = 0x768
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x3250
jmp 0xbe89
movq %rax, %rbx
jmp 0xbe5c
movq %rax, %rbx
jmp 0xbe6d
movq %rax, %rbx
movq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rax
cmpq %rax, %rdi
je 0xbc5b
callq 0x3320
jmp 0xbc5b
movq %rax, %rbx
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
jmp 0xbe7b
jmp 0xbe89
movq %rax, %rbx
movq -0x288(%rbp), %rdi
jmp 0xbce8
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xbc9f
callq 0x3320
jmp 0xbc9f
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
jmp 0xbdc4
jmp 0xbded
jmp 0xbe17
jmp 0xbe89
movq %rax, %rbx
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0xbce1
callq 0x3320
jmp 0xbce1
movq %rax, %rbx
movq -0x2a0(%rbp), %rdi
testq %rdi, %rdi
jne 0xbe80
jmp 0xbe8c
jmp 0xbe89
jmp 0xbe89
movq %rax, %rbx
movq -0x2c0(%rbp), %rdi
leaq -0x2b0(%rbp), %rax
cmpq %rax, %rdi
je 0xbd20
callq 0x3320
jmp 0xbd20
movq %rax, %rbx
movq -0x258(%rbp), %rdi
testq %rdi, %rdi
je 0xbd36
callq 0x3320
jmp 0xbd36
movq %rax, %rbx
movq -0x2e0(%rbp), %rdi
leaq -0x2d0(%rbp), %rax
cmpq %rax, %rdi
je 0xbd53
callq 0x3320
jmp 0xbd53
movq %rax, %rbx
movq -0x220(%rbp), %rdi
leaq -0x210(%rbp), %rax
jmp 0xbe7b
movq %rax, %rbx
movq -0x1a0(%rbp), %rdi
leaq -0x190(%rbp), %rax
cmpq %rax, %rdi
je 0xbd86
callq 0x3320
jmp 0xbd86
movq %rax, %rbx
movq -0x120(%rbp), %rdi
leaq -0x110(%rbp), %rax
jmp 0xbe7b
jmp 0xbe89
movq %rax, %rbx
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
jmp 0xbe7b
jmp 0xbe89
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xbdf0
callq 0x3320
jmp 0xbdf0
movq %rax, %rbx
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0xbe07
callq 0x3320
jmp 0xbe07
movq %rax, %rbx
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xbe1a
callq 0x3320
jmp 0xbe1a
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
jmp 0xbe7b
movq %rax, %rbx
movq -0x3f0(%rbp), %rdi
leaq -0x3e0(%rbp), %rax
jmp 0xbe7b
jmp 0xbe89
jmp 0xbe89
movq %rax, %rbx
movq -0x160(%rbp), %rdi
leaq -0x150(%rbp), %rax
jmp 0xbe7b
movq %rax, %rbx
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
je 0xbe5c
callq 0x3320
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0xbe6d
callq 0x3320
movq -0x240(%rbp), %rdi
leaq -0x230(%rbp), %rax
cmpq %rax, %rdi
je 0xbe8c
callq 0x3320
jmp 0xbe8c
jmp 0xbe89
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0xbe9d
callq 0x3320
movq %rbx, %rdi
callq 0x3580
nop