// File: /workspace/github_cpp_makefile_star2_O1/parth-shel[P]xpac/client.cpp
// Function: upgrade_all_packages()
void upgrade_all_packages() {
	std::vector<std::string> updates;

	std::fstream file;
	file.open(update_file, std::ios::in);

	std::string next_line;
	while(getline(file,next_line)) {
		updates.push_back(next_line);
	}

	if(updates.size() == 0)	{
		std::cout<<"No updates available!"<<std::endl;
		return;
	}

	std::cout<<"The following packages will be updated: "<<std::endl;
	for(auto itr = updates.begin(); itr!=updates.end(); itr++){
		std::cout<<*itr<<std::endl;
	}
	char confirm;
	do {
		std::cout<<"Do you confirm?[Y/n]"<<std::endl;
		std::cin>>confirm;
	} while(confirm != 'Y' && confirm != 'n' && confirm != 'N' && confirm != 'y');

	if(confirm == 'n' || confirm == 'N') {
		exit(0);
	}
	else { //Updating all packages:
		for(auto itr = updates.begin(); itr!=updates.end(); itr++) {
			auto find_itr = user_installed_list.find(*itr);
			user_installed_list.erase(find_itr);
			install_package((*itr).c_str());
			std::string next_pkg_filepath = metadata_dir + "/." + *itr + ".metadata";
			metadata * new_pkg = metadata::get_package(next_pkg_filepath);
			//Adding the package back to the user installed list:
			user_installed_list.insert(std::make_pair(*itr,new_pkg->get_pkg_ver()));
			//Rewriting the user installed packages list:
			rewrite_installed_packages();
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x3430
leaq 0xbffb(%rip), %rsi      # 0x103e0
leaq -0x320(%rbp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x34a0
leaq -0x100(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x110(%rbp), %r14
leaq -0x50(%rbp), %r15
movq -0x320(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3370
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3620
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x445b
movq %r15, %rdi
movq %r14, %rsi
callq 0x741a
jmp 0x441a
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x47b1
movq 0xbb60(%rip), %rbx      # 0xffd0
leaq 0x7bec(%rip), %rsi      # 0xc063
movl $0x28, %edx
movq %rbx, %rdi
callq 0x3400
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3370
movsbl %al, %esi
movq 0xbb2e(%rip), %rbx      # 0xffd0
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3280
movq -0x50(%rbp), %r12
cmpq -0x48(%rbp), %r12
je 0x4508
movq 0xbb0d(%rip), %r14      # 0xffd0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r14, %rdi
callq 0x3400
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3370
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3280
addq $0x20, %r12
cmpq -0x48(%rbp), %r12
jne 0x44c3
leaq 0x7b7d(%rip), %r14      # 0xc08c
movq 0xbaca(%rip), %r15      # 0xffe0
leaq -0x29(%rbp), %r12
movabsq $0x80100000801, %r13    # imm = 0x80100000801
movl $0x14, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3400
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3370
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3280
movq %r15, %rdi
movq %r12, %rsi
callq 0x3470
movzbl -0x29(%rbp), %eax
leal -0x4e(%rax), %ecx
cmpl $0x2b, %ecx
ja 0x4524
btq %rcx, %r13
jae 0x4524
andb $0x5f, %al
cmpb $0x4e, %al
je 0x4836
movq -0x50(%rbp), %rbx
cmpq -0x48(%rbp), %rbx
je 0x47f7
leaq -0x80(%rbp), %r14
leaq -0xe0(%rbp), %r12
leaq -0x90(%rbp), %r15
leaq 0xc017(%rip), %r13      # 0x105c0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x812c
movq %r13, %rdi
movq %rax, %rsi
callq 0x8b72
movq (%rbx), %rdi
callq 0x4916
movq %r14, -0x90(%rbp)
movq 0xbdcb(%rip), %rsi      # 0x103a0
movq 0xbdcc(%rip), %rdx      # 0x103a8
addq %rsi, %rdx
movq %r15, %rdi
callq 0x8092
movq %r15, %rdi
leaq 0x7ab0(%rip), %rsi      # 0xc0a1
callq 0x3650
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %rdi
callq 0x3140
movq %r12, -0xf0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x462e
movq %rdx, -0xf0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xe0(%rbp)
jmp 0x4636
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0xe8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xf0(%rbp), %rdi
leaq 0x7e19(%rip), %rsi      # 0xc477
callq 0x3650
leaq -0x60(%rbp), %rsi
movq %rsi, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4687
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x468d
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
je 0x46b5
callq 0x3360
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x46c6
callq 0x3360
leaq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %rdi
callq 0x8092
leaq -0xb0(%rbp), %rdi
callq 0xa12e
movq %rax, %r13
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x4712
callq 0x3360
movq %r14, -0x90(%rbp)
movq 0x40(%r13), %rsi
movq 0x48(%r13), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x8092
leaq -0xf0(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x8028
leaq 0xbe78(%rip), %rdi      # 0x105c0
movq %r13, %rsi
callq 0x8be2
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x4768
callq 0x3360
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4779
callq 0x3360
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x478a
callq 0x3360
callq 0xaca1
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x47a1
callq 0x3360
addq $0x20, %rbx
cmpq -0x48(%rbp), %rbx
jne 0x45a2
jmp 0x47f7
movq 0xb818(%rip), %rbx      # 0xffd0
leaq 0x788e(%rip), %rsi      # 0xc04d
movl $0x15, %edx
movq %rbx, %rdi
callq 0x3400
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3370
movsbl %al, %esi
movq 0xb7e6(%rip), %rdi      # 0xffd0
callq 0x3030
movq %rax, %rdi
callq 0x3280
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x480f
callq 0x3360
leaq -0x320(%rbp), %rdi
callq 0x30d0
leaq -0x50(%rbp), %rdi
callq 0x7466
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x3440
movq %rax, %rbx
jmp 0x48f9
movq %rax, %rbx
jmp 0x4905
jmp 0x48de
jmp 0x48de
jmp 0x4859
movq %rax, %rbx
jmp 0x4872
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4872
callq 0x3360
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
jne 0x48d1
jmp 0x48e1
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
jne 0x48ba
jmp 0x48c4
jmp 0x48c1
movq %rax, %rbx
jmp 0x48ae
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x74b4
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x48c4
callq 0x3360
jmp 0x48c4
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x48e1
callq 0x3360
jmp 0x48e1
jmp 0x48de
jmp 0x48de
jmp 0x48de
movq %rax, %rbx
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x48f9
callq 0x3360
leaq -0x320(%rbp), %rdi
callq 0x30d0
leaq -0x50(%rbp), %rdi
callq 0x7466
movq %rbx, %rdi
callq 0x35c0