// File: /workspace/github_cpp_makefile_star2_O1/luigix25[P]SSLP/client_files/client.cpp
// Function: cmd_list()
bool cmd_list(){

	if(!send_command(LIST_COMMAND)){
		cout<<"[Error] send command"<<endl;
		return false;
	}
	
	char *recvd;
	int len;
	recvd = recvDataHMAC(server_socket,len);
	if(recvd == NULL) return false;

	EncryptedChunk ec;
	ec.setCipherText(recvd);
	ec.size = len;

	Chunk c;

	DecryptManager dm;
	if(!dm.DecryptUpdate(c,ec))
		return false;

	if(!dm.DecryptFinal(c))
		return false;

	string concatenated(c.getPlainText());

	vector<string> files_list = split(concatenated,string(" "));

	cout<<"Files Available for downloading from Server:"<<endl;
	for(uint i= 0;i<files_list.size();i++){
		cout<<files_list[i]<<'\t';
	}
	cout<<endl;

	cout<<"Files Available for uploading to Server:"<<endl;

	vector<string> files_client = get_file_list(CLIENT_PATH);

	for(uint i= 0;i<files_client.size();i++){
		cout<<files_client[i]<<'\t';
	}
	cout << endl;

	return true;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movl $0x1, %edi
callq 0x4f63
testb %al, %al
je 0x53e3
leaq 0xb4b2(%rip), %rdi      # 0x10560
leaq 0x14(%rsp), %rsi
callq 0x7270
testq %rax, %rax
je 0x5425
movq %rax, %rbx
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0xa48e
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa4dc
movl 0x14(%rsp), %eax
movl %eax, 0xd0(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xa378
leaq 0x8(%rsp), %rdi
callq 0x8110
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x81ae
testb %al, %al
je 0x5429
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x82cc
testb %al, %al
je 0x5429
leaq 0x48(%rsp), %rdi
callq 0xa446
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rax, %rsi
callq 0x691a
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x6a0e
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6262(%rip), %rsi      # 0xb3f1
leaq 0x625c(%rip), %rdx      # 0xb3f2
leaq 0x60(%rsp), %rdi
callq 0x6a9e
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x6dd4
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x51ce
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4450
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x51eb
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4450
movq 0xadce(%rip), %rbx      # 0xffc0
leaq 0x5f34(%rip), %rsi      # 0xb12d
movl $0x2c, %edx
movq %rbx, %rdi
callq 0x44e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4410
movsbl %al, %esi
movq 0xad9c(%rip), %rbx      # 0xffc0
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42f0
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x5297
movl $0x1, %ebp
xorl %ecx, %ecx
movq 0xad72(%rip), %r14      # 0xffc0
leaq 0x18(%rsp), %r15
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %r14, %rdi
callq 0x44e0
movb $0x9, 0x18(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
movl %ebp, %ecx
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x5253
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4410
movsbl %al, %esi
movq 0xad0b(%rip), %rdi      # 0xffc0
callq 0x4040
movq %rax, %rdi
callq 0x42f0
movq 0xacf7(%rip), %rbx      # 0xffc0
leaq 0x5e8a(%rip), %rsi      # 0xb15a
movl $0x28, %edx
movq %rbx, %rdi
callq 0x44e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4410
movsbl %al, %esi
movq 0xacc5(%rip), %rbx      # 0xffc0
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42f0
leaq 0x5e71(%rip), %rsi      # 0xb183
leaq 0x18(%rsp), %rdi
callq 0x6d00
movq 0x18(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0x537f
movl $0x1, %ebp
xorl %ecx, %ecx
movq 0xac8a(%rip), %r14      # 0xffc0
leaq 0x7(%rsp), %r15
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %r14, %rdi
callq 0x44e0
movb $0x9, 0x7(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
movl %ebp, %ecx
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x533b
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4410
movsbl %al, %esi
movq 0xac23(%rip), %rdi      # 0xffc0
callq 0x4040
movq %rax, %rdi
callq 0x42f0
leaq 0x18(%rsp), %rdi
callq 0x6958
leaq 0x30(%rsp), %rdi
callq 0x6958
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x53df
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4450
movb $0x1, %bl
jmp 0x542b
movq 0xabd6(%rip), %rbx      # 0xffc0
leaq 0x5d27(%rip), %rsi      # 0xb118
movl $0x14, %edx
movq %rbx, %rdi
callq 0x44e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4410
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42f0
xorl %ebx, %ebx
jmp 0x544c
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x819a
leaq 0x48(%rsp), %rdi
callq 0xa38c
leaq 0xc0(%rsp), %rdi
callq 0xa4a2
movl %ebx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x54c9
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x547d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4450
jmp 0x547d
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x54d6
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4450
jmp 0x54d6
movq %rax, %rbx
jmp 0x54d6
jmp 0x54b3
jmp 0x54b3
jmp 0x54ba
movq %rax, %rbx
jmp 0x5501
jmp 0x54ae
movq %rax, %rbx
jmp 0x550b
movq %rax, %rbx
jmp 0x54f7
jmp 0x54c9
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6958
jmp 0x54cc
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6958
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x54f7
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4450
leaq 0x8(%rsp), %rdi
callq 0x819a
leaq 0x48(%rsp), %rdi
callq 0xa38c
leaq 0xc0(%rsp), %rdi
callq 0xa4a2
movq %rbx, %rdi
callq 0x47d0