// File: parth-shel[P]xpac/client.cpp
// Function: get_from_server(char const*, char const*)
static inline void get_from_server(const char * command_to_server,const char * pkg_name){


	std::string command = std::string(command_to_server);
	std::string pkg_hash = std::to_string(str_hash(std::string(pkg_name))).c_str();
	command.append(pkg_hash);
	char * final_command_to_server = (char*)command.c_str();
	int res = client_driver(final_command_to_server,strdup("repo.xpac.tech"));

	if(res == -1){
		remove(final_command_to_server);
		exit(1);
	}

	//Integrating MD5 Hashing comparing:
	std::cout<<"Verifiying file integrity :"<<std::endl;
	std::string MD5_command  = std::string(std::string("CHKSM-"));
	MD5_command.append(pkg_hash);
	char * MD5_command_to_server = (char*)MD5_command.c_str();
	res = client_driver(MD5_command_to_server,strdup("repo.xpac.tech"));

	if(res == -1){
		remove(MD5_command.c_str());
		exit(1);
	}
	MD5checksum * new_MD5 = new MD5checksum(final_command_to_server);
	if(!new_MD5->compare_saved_hash(std::string(MD5_command_to_server))){
			std::cout<<"File verification failed!!"<<std::endl;
			exit(1);
	}
	
	std::cout<<"File verification passed"<<std::endl;
		
	//To untar the recieved file:
	untar_file(final_command_to_server);

	//Removing the downloaded files from server:
	remove(final_command_to_server);
	remove(MD5_command_to_server);

	//Setting metadata and install_paths
	metadata_path = std::string(pkg_name) + std::string("/.metadata");
	install_path = std::string(pkg_name) + std::string("/.install_script");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x340, %rsp            # imm = 0x340
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x260(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x46e0
movq -0x260(%rbp), %rsi
movq -0x258(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x4560
jmp 0x7a27
leaq -0x31(%rbp), %rdi
callq 0x4460
movq -0x10(%rbp), %rax
movq %rax, -0x270(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x46e0
movq -0x270(%rbp), %rsi
movq -0x268(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x4560
jmp 0x7a6a
leaq 0x16a3f(%rip), %rdi     # 0x1e4b0
leaq -0xa8(%rbp), %rsi
callq 0xb2f0
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0xb210
jmp 0x7a8e
leaq -0x88(%rbp), %rdi
callq 0x41c0
movq %rax, -0x280(%rbp)
leaq -0xaa(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x46e0
movq -0x280(%rbp), %rsi
movq -0x278(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x4560
jmp 0x7acd
leaq -0xaa(%rbp), %rdi
callq 0x4460
leaq -0x88(%rbp), %rdi
callq 0x47e8
leaq -0xa8(%rbp), %rdi
callq 0x47e8
leaq -0xa9(%rbp), %rdi
callq 0x4460
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4790
jmp 0x7b0c
leaq -0x30(%rbp), %rdi
callq 0x41c0
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x290(%rbp)
leaq 0xd8f3(%rip), %rdi      # 0x15424
callq 0x4720
movq -0x290(%rbp), %rdi
movq %rax, %rsi
callq 0x10cd0
movl %eax, -0x284(%rbp)
jmp 0x7b4d
movl -0x284(%rbp), %eax
movl %eax, -0xbc(%rbp)
cmpl $-0x1, -0xbc(%rbp)
jne 0x7c04
movq -0xb8(%rbp), %rdi
callq 0x4710
movl $0x1, %edi
callq 0x44c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x4460
jmp 0x82a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7be2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7bd6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xaa(%rbp), %rdi
callq 0x4460
leaq -0x88(%rbp), %rdi
callq 0x47e8
leaq -0xa8(%rbp), %rdi
callq 0x47e8
leaq -0xa9(%rbp), %rdi
callq 0x4460
jmp 0x829b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8292
movq 0x163c5(%rip), %rdi     # 0x1dfd0
leaq 0xd821(%rip), %rsi      # 0x15433
callq 0x4400
movq %rax, -0x298(%rbp)
jmp 0x7c20
movq -0x298(%rbp), %rdi
movq 0x1638a(%rip), %rsi     # 0x1dfb8
callq 0x4440
jmp 0x7c35
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x46e0
movq -0x2a0(%rbp), %rdx
leaq 0xd7f9(%rip), %rsi      # 0x1544f
leaq -0xe0(%rbp), %rdi
callq 0x4560
jmp 0x7c64
leaq -0xe1(%rbp), %rdi
callq 0x4460
leaq -0xe0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4790
jmp 0x7c82
leaq -0xe0(%rbp), %rdi
callq 0x41c0
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq 0xd77a(%rip), %rdi      # 0x15424
callq 0x4720
movq -0x2b0(%rbp), %rdi
movq %rax, %rsi
callq 0x10cd0
movl %eax, -0x2a4(%rbp)
jmp 0x7cc6
movl -0x2a4(%rbp), %eax
movl %eax, -0xbc(%rbp)
cmpl $-0x1, -0xbc(%rbp)
jne 0x7d27
leaq -0xe0(%rbp), %rdi
callq 0x41c0
movq %rax, %rdi
callq 0x4710
movl $0x1, %edi
callq 0x44c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe1(%rbp), %rdi
callq 0x4460
jmp 0x8292
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8286
movl $0x40, %edi
callq 0x4410
movq %rax, -0x2b8(%rbp)
jmp 0x7d3a
movb $0x1, -0x11a(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x119(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x46e0
movq -0x2c8(%rbp), %rsi
movq -0x2c0(%rbp), %rdx
leaq -0x118(%rbp), %rdi
callq 0x4560
jmp 0x7d7e
movq -0x2b8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x12de0
jmp 0x7d93
movb $0x0, -0x11a(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x47e8
leaq -0x119(%rbp), %rdi
callq 0x4460
movq -0x2b8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x141(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x46e0
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
leaq -0x140(%rbp), %rdi
callq 0x4560
jmp 0x7e0b
movq -0x2e0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x13160
movb %al, -0x2e1(%rbp)
jmp 0x7e26
movb -0x2e1(%rbp), %al
xorb $-0x1, %al
movb %al, -0x2e2(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x47e8
leaq -0x141(%rbp), %rdi
callq 0x4460
movb -0x2e2(%rbp), %al
testb $0x1, %al
jne 0x7e5b
jmp 0x7f1b
movq 0x1616e(%rip), %rdi     # 0x1dfd0
leaq 0xd5ed(%rip), %rsi      # 0x15456
callq 0x4400
movq %rax, -0x2f0(%rbp)
jmp 0x7e77
movq -0x2f0(%rbp), %rdi
movq 0x16133(%rip), %rsi     # 0x1dfb8
callq 0x4440
jmp 0x7e8c
movl $0x1, %edi
callq 0x44c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7ebc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x47e8
leaq -0x119(%rbp), %rdi
callq 0x4460
testb $0x1, -0x11a(%rbp)
jne 0x7ed3
jmp 0x7edf
movq -0x2b8(%rbp), %rdi
callq 0x43f0
jmp 0x8286
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7f0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x47e8
leaq -0x141(%rbp), %rdi
callq 0x4460
jmp 0x8286
movq 0x160ae(%rip), %rdi     # 0x1dfd0
leaq 0xd548(%rip), %rsi      # 0x15471
callq 0x4400
movq %rax, -0x2f8(%rbp)
jmp 0x7f37
movq -0x2f8(%rbp), %rdi
movq 0x16073(%rip), %rsi     # 0x1dfb8
callq 0x4440
jmp 0x7f4c
movq -0xb8(%rbp), %rax
movq %rax, -0x308(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x46e0
movq -0x308(%rbp), %rsi
movq -0x300(%rbp), %rdx
leaq -0x168(%rbp), %rdi
callq 0x4560
jmp 0x7f89
leaq -0x168(%rbp), %rdi
callq 0x8b80
jmp 0x7f97
leaq -0x168(%rbp), %rdi
callq 0x47e8
leaq -0x169(%rbp), %rdi
callq 0x4460
movq -0xb8(%rbp), %rdi
callq 0x4710
movq -0xf0(%rbp), %rdi
callq 0x4710
movq -0x10(%rbp), %rax
movq %rax, -0x318(%rbp)
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x46e0
movq -0x318(%rbp), %rsi
movq -0x310(%rbp), %rdx
leaq -0x1b0(%rbp), %rdi
callq 0x4560
jmp 0x8001
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x46e0
movq -0x320(%rbp), %rdx
leaq 0xd468(%rip), %rsi      # 0x1548a
leaq -0x1d8(%rbp), %rdi
callq 0x4560
jmp 0x8030
leaq -0x190(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
leaq -0x1d8(%rbp), %rdx
callq 0x90a0
jmp 0x804c
leaq 0x16475(%rip), %rdi     # 0x1e4c8
leaq -0x190(%rbp), %rsi
movq %rsi, -0x338(%rbp)
callq 0x44d0
movq -0x338(%rbp), %rdi
callq 0x47e8
leaq -0x1d8(%rbp), %rdi
callq 0x47e8
leaq -0x1d9(%rbp), %rdi
callq 0x4460
leaq -0x1b0(%rbp), %rdi
callq 0x47e8
leaq -0x1b1(%rbp), %rdi
callq 0x4460
movq -0x10(%rbp), %rax
movq %rax, -0x330(%rbp)
leaq -0x221(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x46e0
movq -0x330(%rbp), %rsi
movq -0x328(%rbp), %rdx
leaq -0x220(%rbp), %rdi
callq 0x4560
jmp 0x80dc
leaq -0x249(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x46e0
movq -0x340(%rbp), %rdx
leaq 0xd398(%rip), %rsi      # 0x15495
leaq -0x248(%rbp), %rdi
callq 0x4560
jmp 0x810b
leaq -0x200(%rbp), %rdi
leaq -0x220(%rbp), %rsi
leaq -0x248(%rbp), %rdx
callq 0x90a0
jmp 0x8127
leaq 0x163ba(%rip), %rdi     # 0x1e4e8
leaq -0x200(%rbp), %rsi
callq 0x44d0
leaq -0x200(%rbp), %rdi
callq 0x47e8
leaq -0x248(%rbp), %rdi
callq 0x47e8
leaq -0x249(%rbp), %rdi
callq 0x4460
leaq -0x220(%rbp), %rdi
callq 0x47e8
leaq -0x221(%rbp), %rdi
callq 0x4460
leaq -0xe0(%rbp), %rdi
callq 0x47e8
leaq -0x68(%rbp), %rdi
callq 0x47e8
leaq -0x30(%rbp), %rdi
callq 0x47e8
addq $0x340, %rsp            # imm = 0x340
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x81c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x47e8
leaq -0x169(%rbp), %rdi
callq 0x4460
jmp 0x8286
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8220
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8208
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x47e8
leaq -0x1d9(%rbp), %rdi
callq 0x4460
leaq -0x1b0(%rbp), %rdi
callq 0x47e8
leaq -0x1b1(%rbp), %rdi
callq 0x4460
jmp 0x8286
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x827a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8262
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x47e8
leaq -0x249(%rbp), %rdi
callq 0x4460
leaq -0x220(%rbp), %rdi
callq 0x47e8
leaq -0x221(%rbp), %rdi
callq 0x4460
leaq -0xe0(%rbp), %rdi
callq 0x47e8
leaq -0x68(%rbp), %rdi
callq 0x47e8
leaq -0x30(%rbp), %rdi
callq 0x47e8
movq -0x40(%rbp), %rdi
callq 0x46d0
nopl (%rax)