// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq (%rdi), %rax
movq %rax, (%rsp)
leaq 0xaf92(%rip), %r9       # 0x100a7
leaq -0x123c(%rbp), %rdi
movl $0xe, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x65d3
leaq 0x98(%rbx), %r14
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x574b
movq 0x40(%rbx), %rdi
leaq -0x123c(%rbp), %rsi
callq 0xeae4
movl %eax, %r15d
movq %r14, %rdi
callq 0x3280
testl %r15d, %r15d
je 0x5752
movq 0x40(%rbx), %r15
leaq 0xc0(%rbx), %rsi
leaq -0x180(%rbp), %r12
movq %r12, %rdi
callq 0x60e0
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x67b8
movq -0x180(%rbp), %rdi
testq %rdi, %rdi
je 0x51aa
callq 0x3320
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x574b
leaq -0x100(%rbp), %r13
movq %rbx, -0x90(%rbp)
movq 0x40(%rbx), %rdi
movl $0x1, %esi
callq 0xed22
movq %rax, %r15
movq %r14, %rdi
callq 0x3280
testq %r15, %r15
je 0x5752
movl (%r15), %eax
addl $-0x3, %eax
cmpl $0xc, %eax
ja 0x546e
leaq 0xae04(%rip), %rcx      # 0x10004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
addq $0x14, %r15
movl $0xe8, %edx
leaq -0x268(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x32b0
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x574b
movq 0x40(%rbx), %r15
leaq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq %r12, %rdi
callq 0x3170
leaq (%rax,%rbp), %rdx
addq $-0x268, %rdx           # imm = 0xFD98
leaq -0xb0(%rbp), %rdi
movq %r12, %rsi
callq 0x62de
leaq -0x120(%rbp), %rax
movq %rax, -0x130(%rbp)
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
addq %rsi, %rdx
leaq -0x130(%rbp), %r12
movq %r12, %rdi
callq 0x6244
movq %rbx, %rdi
movq %r15, %rsi
leaq -0xb0(%rbp), %rdx
movq %r12, %rcx
callq 0x689a
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x52bd
callq 0x3320
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x52d5
callq 0x3320
movq %r14, %rdi
callq 0x3280
movl $0x1d, %ecx
movq %rsp, %rdi
leaq -0x268(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rbx, %rdi
callq 0x5acc
jmp 0x573b
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x574b
leaq -0xe0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %r15
movq %r15, %rdi
callq 0x6244
leaq -0x148(%rbp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x664e
leaq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %r15
movq %r15, %rdi
callq 0x6244
movq %rbx, %rdi
leaq -0x148(%rbp), %rsi
movq %r15, %rdx
callq 0x7f58
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x5398
callq 0x3320
movq -0x148(%rbp), %rdi
testq %rdi, %rdi
je 0x53a9
callq 0x3320
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
jne 0x5527
jmp 0x552c
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x574b
leaq -0x38(%rbp), %r12
movq %r12, -0x48(%rbp)
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x6244
leaq 0x14(%r15), %r13
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %r13, %rdi
callq 0x3170
leaq (%r15,%rax), %rdx
addq $0x14, %rdx
leaq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0x62de
movq -0x48(%rbp), %rcx
movl $0xf, %esi
cmpq %r12, %rcx
leaq -0x78(%rbp), %r15
je 0x542f
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %r8
movq -0x60(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x545c
movl $0xf, %esi
leaq -0x58(%rbp), %rdi
cmpq %rdi, -0x68(%rbp)
je 0x5453
movq -0x58(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x5539
movq -0x68(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x3100
jmp 0x5546
movl (%r15), %r12d
movl %r12d, %r13d
negl %r13d
cmovsl %r12d, %r13d
movl $0x1, %r15d
cmpl $0xa, %r13d
jb 0x5634
movl $0x4, %r15d
movl %r13d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x562b
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x5631
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x5634
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r15d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x5499
addl $-0x3, %r15d
jmp 0x5634
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
jne 0x574b
movq 0x40(%rbx), %r15
movq %r13, -0x110(%rbp)
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %r12
movq %r12, %rdi
callq 0x6244
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7a7a
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
je 0x552c
callq 0x3320
movq %r14, %rdi
callq 0x3280
jmp 0x573b
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3370
movq %r15, -0x88(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x5569
movq %rdx, -0x88(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x78(%rbp)
jmp 0x5570
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x80(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %rbx, %rdi
leaq -0x88(%rbp), %rsi
callq 0x7ef8
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x55ac
callq 0x3320
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
leaq -0x158(%rbp), %r15
je 0x55c5
callq 0x3320
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x55d7
callq 0x3320
movq %r14, %rdi
callq 0x3280
movq %r15, -0x168(%rbp)
movq %r13, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
leaq -0x168(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x62de
movq %rbx, %rdi
movq %r12, %rsi
callq 0x59f6
leaq -0x100(%rbp), %r13
movq -0x168(%rbp), %rdi
cmpq %r15, %rdi
jne 0x5736
jmp 0x573b
addl $-0x2, %r15d
jmp 0x5634
decl %r15d
movq %r14, %rbx
shrl $0x1f, %r12d
movl %r12d, %esi
addl %r15d, %esi
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %r14
movq %r14, %rdi
movl $0x2d, %edx
callq 0x33b0
movq -0x68(%rbp), %rdi
addq %r12, %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0x61d2
movl $0x9, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xaa3b(%rip), %rcx      # 0x100bb
callq 0x3370
leaq -0x38(%rbp), %r12
movq %r12, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x100(%rbp), %r13
je 0x56b0
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x56b8
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rbx, %r14
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0xf8ef(%rip), %rdi      # 0x14fd0
callq 0x33a0
movq -0x90(%rbp), %rbx
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 -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5729
callq 0x3320
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x573b
callq 0x3320
movq %r14, %rdi
callq 0x3470
testl %eax, %eax
je 0x51c8
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 -0x180(%rbp), %rdi
testq %rdi, %rdi
jne 0x5899
jmp 0x589e
movq %rax, %rbx
jmp 0x5856
movq %rax, %rbx
jmp 0x5867
movq %rax, %rbx
jmp 0x588c
movq %rax, %rbx
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0x57b4
callq 0x3320
jmp 0x57b4
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
jmp 0x5894
jmp 0x57f9
movq %rax, %rbx
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
jne 0x5899
jmp 0x589e
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r15, %rdi
jne 0x5899
jmp 0x589e
movq %rax, %rbx
jmp 0x589e
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x581a
callq 0x3320
jmp 0x581a
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x5831
callq 0x3320
jmp 0x5831
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
jmp 0x5894
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x5856
callq 0x3320
movq -0x148(%rbp), %rdi
testq %rdi, %rdi
je 0x5867
callq 0x3320
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
jmp 0x5894
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x588c
callq 0x3320
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x589e
callq 0x3320
movq %rbx, %rdi
callq 0x3580