// File: /workspace/github_cpp_makefile_star2_O3/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 0x4f6a
testb %al, %al
je 0x53ea
leaq 0xb4ab(%rip), %rdi      # 0x10560
leaq 0x14(%rsp), %rsi
callq 0x7250
testq %rax, %rax
je 0x542c
movq %rax, %rbx
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0xa3c2
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa410
movl 0x14(%rsp), %eax
movl %eax, 0xd0(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xa2d0
leaq 0x8(%rsp), %rdi
callq 0x809c
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x813a
testb %al, %al
je 0x5430
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x8258
testb %al, %al
je 0x5430
leaq 0x48(%rsp), %rdi
callq 0xa386
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rax, %rsi
callq 0x6904
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x69fa
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x625b(%rip), %rsi      # 0xb3f1
leaq 0x6255(%rip), %rdx      # 0xb3f2
leaq 0x60(%rsp), %rdi
callq 0x6a90
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x6dc2
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x51d5
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4450
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x51f2
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4450
movq 0xadc7(%rip), %rbx      # 0xffc0
leaq 0x5f2d(%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 0xad95(%rip), %rbx      # 0xffc0
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42f0
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x529e
movl $0x1, %ebp
xorl %ecx, %ecx
movq 0xad6b(%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 0x525a
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4410
movsbl %al, %esi
movq 0xad04(%rip), %rdi      # 0xffc0
callq 0x4040
movq %rax, %rdi
callq 0x42f0
movq 0xacf0(%rip), %rbx      # 0xffc0
leaq 0x5e83(%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 0xacbe(%rip), %rbx      # 0xffc0
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42f0
leaq 0x5e6a(%rip), %rsi      # 0xb183
leaq 0x18(%rsp), %rdi
callq 0x6cee
movq 0x18(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0x5386
movl $0x1, %ebp
xorl %ecx, %ecx
movq 0xac83(%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 0x5342
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4410
movsbl %al, %esi
movq 0xac1c(%rip), %rdi      # 0xffc0
callq 0x4040
movq %rax, %rdi
callq 0x42f0
leaq 0x18(%rsp), %rdi
callq 0x6942
leaq 0x30(%rsp), %rdi
callq 0x6942
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x53e6
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4450
movb $0x1, %bl
jmp 0x5432
movq 0xabcf(%rip), %rbx      # 0xffc0
leaq 0x5d20(%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 0x5453
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x8126
leaq 0x48(%rsp), %rdi
callq 0xa2e4
leaq 0xc0(%rsp), %rdi
callq 0xa3d6
movl %ebx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x54d0
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x5484
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4450
jmp 0x5484
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x54dd
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4450
jmp 0x54dd
movq %rax, %rbx
jmp 0x54dd
jmp 0x54ba
jmp 0x54ba
jmp 0x54c1
movq %rax, %rbx
jmp 0x5508
jmp 0x54b5
movq %rax, %rbx
jmp 0x5512
movq %rax, %rbx
jmp 0x54fe
jmp 0x54d0
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6942
jmp 0x54d3
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6942
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x54fe
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4450
leaq 0x8(%rsp), %rdi
callq 0x8126
leaq 0x48(%rsp), %rdi
callq 0xa2e4
leaq 0xc0(%rsp), %rdi
callq 0xa3d6
movq %rbx, %rdi
callq 0x47d0