// File: /workspace/github_cpp_makefile_star2_O3/vianna274[P]dropbox/src/Client.cpp
// Function: Dropbox::Client::askUpdate()
void Client::askUpdate() {
	MessageData request = make_packet(TYPE_REQUEST_UPDATE, 1 , 1, -1, "type_request_update", this->username.c_str());
	socketMtx.lock();
	bool ass = this->socket->send(&request);
	socketMtx.unlock();
	if (ass == -1) {
		socketMtx.lock();
		this->socket = new WrapperSocket(this->payload1, this->payload2);
		socketMtx.unlock();
		ass = this->socket->send(&request);
	}
	else if (ass == 0)
		return;
	this->sendFileList(this->socket, this->fileRecords);
	while(1) {
		socketMtx.lock();
		MessageData * response = this->socket->receive(TIMEOUT_ON);
		socketMtx.unlock();
		FileRecord fileRecord;
		if (response == NULL) return;
		switch (response->type) {
			case TYPE_NOTHING_TO_SEND:
				break;
			case TYPE_REQUEST_UPDATE_DONE:
				return;
			case TYPE_DELETE:
				socketMtx.lock();
				this->deleteFile(this->getSyncDirPath() + string(response->payload));
				socketMtx.unlock();
				this->removeFileRecord(string(response->payload));
				break;
			case TYPE_SEND_FILE:
				fileRecord = *((FileRecord *)response->payload);
				socketMtx.lock();
				this->receiveFile(this->socket, string(fileRecord.filename), 
					this->getSyncDirPath());
				socketMtx.unlock();
				this->updateFileRecord(fileRecord);
				break;
			case TYPE_SEND_UPLOAD_ALL:
				socketMtx.lock();
				this->receiveUploadAll(this->socket, this->getSyncDirPath());
				socketMtx.unlock();
				break;
			case TYPE_DELETE_ALL:
				socketMtx.lock();
				this->deleteAll(this->getFileList(this->getSyncDirPath()), this->getSyncDirPath());
				socketMtx.unlock();
				break;
			default:
				cout << "Received " + to_string(response->type) << endl;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1308, %rsp           # imm = 0x1308
movq %rdi, %r14
movq (%rdi), %rax
movq %rax, (%rsp)
leaq 0xaf94(%rip), %r9       # 0x100a7
leaq -0x1244(%rbp), %rdi
movl $0xe, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x6607
leaq 0x98(%r14), %rbx
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0x576f
movq 0x40(%r14), %rdi
leaq -0x1244(%rbp), %rsi
callq 0xea3c
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3280
testl %r15d, %r15d
je 0x5776
movq 0x40(%r14), %r15
leaq 0xc0(%r14), %rsi
leaq -0x188(%rbp), %r12
movq %r12, %rdi
callq 0x610c
movq %r14, -0x30(%rbp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x67ec
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
movq %rbx, %r14
je 0x51af
callq 0x3320
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x576f
leaq 0xae3e(%rip), %r13      # 0x10004
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rdi
movl $0x1, %esi
callq 0xec2e
movq %rax, %r15
movq %r14, %rbx
movq %r14, %rdi
callq 0x3280
testq %r15, %r15
je 0x5776
movl (%r15), %r12d
leal -0x3(%r12), %eax
cmpl $0xc, %eax
ja 0x5488
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
addq $0x14, %r15
movl $0xe8, %edx
leaq -0x270(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0x576f
movq -0x30(%rbp), %r12
movq 0x40(%r12), %r15
leaq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %r14, %rdi
callq 0x3170
leaq (%rax,%rbp), %rdx
addq $-0x270, %rdx           # imm = 0xFD90
leaq -0xb8(%rbp), %rdi
movq %r14, %rsi
callq 0x630e
leaq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
movq 0x50(%r12), %rsi
movq 0x58(%r12), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %r14
movq %r14, %rdi
callq 0x6270
movq %r12, %rdi
movq %r15, %rsi
leaq -0xb8(%rbp), %rdx
movq %r14, %rcx
callq 0x68ce
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x52c5
callq 0x3320
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
movq -0x30(%rbp), %r14
je 0x52e1
callq 0x3320
movq %rbx, %rdi
callq 0x3280
movl $0x1d, %ecx
movq %rsp, %rdi
leaq -0x270(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
callq 0x5b02
jmp 0x575c
movq %rbx, %r14
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0x576f
leaq -0xe8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x30(%rbp), %r15
movq 0x50(%r15), %rsi
movq 0x58(%r15), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %r12
movq %r12, %rdi
callq 0x6270
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6682
leaq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq 0x50(%r15), %rsi
movq 0x58(%r15), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %r12
movq %r12, %rdi
callq 0x6270
movq %r15, %rdi
leaq -0x130(%rbp), %rsi
movq %r12, %rdx
callq 0x7f96
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x53ab
callq 0x3320
movq -0x130(%rbp), %rdi
testq %rdi, %rdi
je 0x53bc
callq 0x3320
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x53d4
callq 0x3320
movq %r14, %rdi
jmp 0x5562
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0x576f
leaq -0x60(%rbp), %r12
movq %r12, -0x70(%rbp)
movq -0x30(%rbp), %r14
movq 0x50(%r14), %rsi
movq 0x58(%r14), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x6270
leaq 0x14(%r15), %r13
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %r13, %rdi
callq 0x3170
leaq (%r15,%rax), %rdx
addq $0x14, %rdx
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x630e
movq -0x70(%rbp), %rcx
movl $0xf, %edi
cmpq %r12, %rcx
leaq -0x80(%rbp), %r15
je 0x544a
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %r8
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x547a
movl $0xf, %edi
leaq -0x40(%rbp), %r9
cmpq %r9, %rsi
je 0x5471
movq -0x40(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x556c
leaq -0x70(%rbp), %rdi
callq 0x3100
jmp 0x5579
movl %r12d, %r13d
negl %r13d
cmovsl %r12d, %r13d
movl $0x1, %r15d
cmpl $0xa, %r13d
jb 0x5666
movl $0x4, %r15d
movl %r13d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x565d
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x5663
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x5666
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r15d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x54b0
addl $-0x3, %r15d
jmp 0x5666
movq %r13, %r15
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
jne 0x576f
movq -0x30(%rbp), %r14
movq 0x40(%r14), %rax
movq %rax, -0x98(%rbp)
leaq -0x140(%rbp), %r12
movq %r12, -0x150(%rbp)
movq 0x50(%r14), %rsi
movq 0x58(%r14), %rdx
addq %rsi, %rdx
leaq -0x150(%rbp), %r13
movq %r13, %rdi
callq 0x6270
movq %r14, %rdi
movq -0x98(%rbp), %rsi
movq %r13, %rdx
callq 0x7ab8
movq -0x150(%rbp), %rdi
cmpq %r12, %rdi
movq %r15, %r13
je 0x555f
callq 0x3320
movq %rbx, %rdi
callq 0x3280
jmp 0x575c
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3370
movq %r15, -0x90(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x559c
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x55a3
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x88(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %r14, %rdi
leaq -0x90(%rbp), %rsi
callq 0x7f36
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x55e2
callq 0x3320
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
leaq -0x160(%rbp), %r15
je 0x55fb
callq 0x3320
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x5609
callq 0x3320
movq %rbx, %rdi
callq 0x3280
movq %r15, -0x170(%rbp)
movq %r13, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
leaq -0x170(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x630e
movq %r14, %rdi
movq %r12, %rsi
callq 0x5a16
leaq 0xa9bc(%rip), %r13      # 0x10004
movq -0x170(%rbp), %rdi
cmpq %r15, %rdi
jne 0x5757
jmp 0x575c
addl $-0x2, %r15d
jmp 0x5666
decl %r15d
shrl $0x1f, %r12d
movl %r12d, %esi
addl %r15d, %esi
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movl $0x2d, %edx
callq 0x33b0
movq -0x50(%rbp), %rdi
addq %r12, %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0x61fe
movl $0x9, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xaa0c(%rip), %rcx      # 0x100bb
callq 0x3370
leaq -0x60(%rbp), %r12
movq %r12, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0xa934(%rip), %r13      # 0x10004
je 0x56df
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x56e7
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq 0xf8c3(%rip), %rdi      # 0x14fd0
callq 0x33a0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3330
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3260
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x574a
callq 0x3320
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x575c
callq 0x3320
movq %rbx, %r14
movq %rbx, %rdi
callq 0x3470
testl %eax, %eax
je 0x51c6
movl %eax, %edi
callq 0x3250
addq $0x1308, %rsp           # imm = 0x1308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
jne 0x58b9
jmp 0x58be
movq %rax, %rbx
jmp 0x587a
movq %rax, %rbx
jmp 0x588b
movq %rax, %rbx
jmp 0x58ac
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x57d8
callq 0x3320
jmp 0x57d8
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
jmp 0x58b4
jmp 0x581d
movq %rax, %rbx
movq -0x150(%rbp), %rdi
cmpq %r12, %rdi
jne 0x58b9
jmp 0x58be
movq %rax, %rbx
movq -0x170(%rbp), %rdi
cmpq %r15, %rdi
jne 0x58b9
jmp 0x58be
movq %rax, %rbx
jmp 0x58be
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x583e
callq 0x3320
jmp 0x583e
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5855
callq 0x3320
jmp 0x5855
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
jmp 0x58b4
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x587a
callq 0x3320
movq -0x130(%rbp), %rdi
testq %rdi, %rdi
je 0x588b
callq 0x3320
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
jmp 0x58b4
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x58ac
callq 0x3320
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x58be
callq 0x3320
movq %rbx, %rdi
callq 0x3580