// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0xd0, %rsp
pushq $0x1
popq %rdi
callq 0x4e84
testb %al, %al
je 0x50f1
leaq 0xa5c0(%rip), %rdi      # 0xf560
leaq 0xc(%rsp), %rsi
callq 0x6b42
testq %rax, %rax
je 0x510c
movq %rax, %rbx
leaq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0x9450
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9496
movl 0xc(%rsp), %eax
movl %eax, 0x68(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x93ac
movq %rsp, %rdi
callq 0x76a0
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x773e
testb %al, %al
je 0x5113
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x785c
testb %al, %al
je 0x5113
leaq 0x40(%rsp), %rdi
callq 0x9422
leaq 0xb0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rax, %rsi
callq 0x639e
leaq 0x90(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x4640
leaq 0x539f(%rip), %rsi      # 0xa3f1
leaq 0x70(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x639e
leaq 0x28(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x6797
leaq 0x70(%rsp), %rdi
callq 0x41b0
leaq 0x90(%rsp), %rdi
callq 0x41b0
movq 0x9f32(%rip), %rdi      # 0xefc8
leaq 0x5090(%rip), %rsi      # 0xa12d
callq 0x4400
movq %rax, %rdi
callq 0x41d0
xorl %r14d, %r14d
movq 0x9f14(%rip), %rbx      # 0xefc8
pushq $0x9
popq %rbp
movl %r14d, %r14d
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r14, %rax
jbe 0x511a
movq %r14, %rax
shlq $0x5, %rax
addq %rax, %rsi
movq %rbx, %rdi
callq 0x43d0
movq %rax, %rdi
movl %ebp, %esi
callq 0x44e0
incl %r14d
jmp 0x50b7
movq 0x9ed0(%rip), %rdi      # 0xefc8
leaq 0x5019(%rip), %rsi      # 0xa118
callq 0x4400
movq %rax, %rdi
callq 0x41d0
xorl %ebx, %ebx
jmp 0x51e4
xorl %ebx, %ebx
jmp 0x51c8
movq 0x9ea7(%rip), %rdi      # 0xefc8
callq 0x41d0
movq 0x9e9b(%rip), %rdi      # 0xefc8
leaq 0x5026(%rip), %rsi      # 0xa15a
callq 0x4400
movq %rax, %rdi
callq 0x41d0
leaq 0x503b(%rip), %rsi      # 0xa183
leaq 0x10(%rsp), %rdi
callq 0x66f4
xorl %r14d, %r14d
movq 0x9e6c(%rip), %rbx      # 0xefc8
pushq $0x9
popq %rbp
movl %r14d, %r14d
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r14, %rax
jbe 0x5199
movq %r14, %rax
shlq $0x5, %rax
addq %rax, %rsi
movq %rbx, %rdi
callq 0x43d0
movq %rax, %rdi
movl %ebp, %esi
callq 0x44e0
incl %r14d
jmp 0x515f
movq 0x9e28(%rip), %rdi      # 0xefc8
callq 0x41d0
leaq 0x10(%rsp), %rdi
callq 0x63da
leaq 0x28(%rsp), %rdi
callq 0x63da
leaq 0xb0(%rsp), %rdi
callq 0x41b0
movb $0x1, %bl
movq %rsp, %rdi
callq 0x772a
leaq 0x40(%rsp), %rdi
callq 0x93ba
leaq 0x58(%rsp), %rdi
callq 0x945e
movl %ebx, %eax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x5233
jmp 0x5242
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x41b0
jmp 0x5208
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x41b0
jmp 0x524f
movq %rax, %rbx
jmp 0x524f
jmp 0x522e
jmp 0x522e
movq %rax, %rbx
jmp 0x5264
jmp 0x5227
movq %rax, %rbx
jmp 0x526e
jmp 0x5242
movq %rax, %rbx
jmp 0x525c
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x63da
jmp 0x5245
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x63da
leaq 0xb0(%rsp), %rdi
callq 0x41b0
movq %rsp, %rdi
callq 0x772a
leaq 0x40(%rsp), %rdi
callq 0x93ba
leaq 0x58(%rsp), %rdi
callq 0x945e
movq %rbx, %rdi
callq 0x47a0