// File: parth-shel[P]xpac/client.cpp
// Function: remove_orphans()
void remove_orphans(){

	std::vector<std::string> to_remove;

	for(auto itr=indegree_map.begin(); itr!=indegree_map.end(); itr++) {
		if(itr->second == 0){
			to_remove.push_back(itr->first);
		}
	}

	if(to_remove.empty()){
		std::cout<<"No orphaned packages found!";
		exit(0);
	}

	std::cout<<"The following packages will be removed from the system: "<<std::endl;
	for(auto str:to_remove) {
		std::cout<<str<<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 { //Deleting all packages:
		for(auto str:to_remove){
			remove_package(str);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
leaq -0x18(%rbp), %rdi
callq 0x9360
leaq 0x17c35(%rip), %rdi     # 0x1e5e0
callq 0x9ce0
movq %rax, -0x20(%rbp)
leaq 0x17c25(%rip), %rdi     # 0x1e5e0
callq 0x9a70
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x9a40
testb $0x1, %al
jne 0x69d7
jmp 0x6a23
leaq -0x20(%rbp), %rdi
callq 0x9aa0
cmpl $0x0, 0x20(%rax)
jne 0x6a10
leaq -0x20(%rbp), %rdi
callq 0x9aa0
movq %rax, %rsi
leaq -0x18(%rbp), %rdi
callq 0x9510
jmp 0x69fd
jmp 0x6a10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6cd6
jmp 0x6a12
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x9d10
movq %rax, -0x40(%rbp)
jmp 0x69b4
leaq -0x18(%rbp), %rdi
callq 0x9d50
testb $0x1, %al
jne 0x6a32
jmp 0x6a4e
movq 0x17597(%rip), %rdi     # 0x1dfd0
leaq 0xe6b1(%rip), %rsi      # 0x150f1
callq 0x4400
jmp 0x6a47
xorl %edi, %edi
callq 0x44c0
movq 0x1757b(%rip), %rdi     # 0x1dfd0
leaq 0xe6b1(%rip), %rsi      # 0x1510d
callq 0x4400
movq %rax, -0xe0(%rbp)
jmp 0x6a6a
movq -0xe0(%rbp), %rdi
movq 0x17540(%rip), %rsi     # 0x1dfb8
callq 0x4440
jmp 0x6a7f
leaq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x95e0
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x9650
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x9610
testb $0x1, %al
jne 0x6ab4
jmp 0x6b27
leaq -0x50(%rbp), %rdi
callq 0x9680
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x41d0
jmp 0x6acb
movq 0x174fe(%rip), %rdi     # 0x1dfd0
leaq -0x78(%rbp), %rsi
callq 0x43d0
movq %rax, -0xe8(%rbp)
jmp 0x6ae4
movq -0xe8(%rbp), %rdi
movq 0x174c6(%rip), %rsi     # 0x1dfb8
callq 0x4440
jmp 0x6af9
leaq -0x78(%rbp), %rdi
callq 0x47e8
leaq -0x50(%rbp), %rdi
callq 0x9d90
jmp 0x6aa1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x47e8
jmp 0x6cd6
jmp 0x6b29
movq 0x174a0(%rip), %rdi     # 0x1dfd0
leaq 0xe569(%rip), %rsi      # 0x150a0
callq 0x4400
movq %rax, -0xf0(%rbp)
jmp 0x6b45
movq -0xf0(%rbp), %rdi
movq 0x17465(%rip), %rsi     # 0x1dfb8
callq 0x4440
jmp 0x6b5a
movq 0x1747f(%rip), %rdi     # 0x1dfe0
leaq -0x79(%rbp), %rsi
callq 0x4530
jmp 0x6b6c
jmp 0x6b6e
movsbl -0x79(%rbp), %ecx
xorl %eax, %eax
cmpl $0x59, %ecx
movb %al, -0xf1(%rbp)
je 0x6bb1
movsbl -0x79(%rbp), %ecx
xorl %eax, %eax
cmpl $0x6e, %ecx
movb %al, -0xf1(%rbp)
je 0x6bb1
movsbl -0x79(%rbp), %ecx
xorl %eax, %eax
cmpl $0x4e, %ecx
movb %al, -0xf1(%rbp)
je 0x6bb1
movsbl -0x79(%rbp), %eax
cmpl $0x79, %eax
setne %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x6b29
movsbl -0x79(%rbp), %eax
cmpl $0x6e, %eax
je 0x6bd1
movsbl -0x79(%rbp), %eax
cmpl $0x4e, %eax
jne 0x6bd8
xorl %edi, %edi
callq 0x44c0
leaq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
callq 0x95e0
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
callq 0x9650
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x9610
testb $0x1, %al
jne 0x6c25
jmp 0x6cc2
leaq -0x90(%rbp), %rdi
callq 0x9680
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x41d0
jmp 0x6c42
leaq -0xd8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x41d0
jmp 0x6c57
leaq -0xd8(%rbp), %rdi
callq 0x6630
jmp 0x6c65
leaq -0xd8(%rbp), %rdi
callq 0x47e8
leaq -0xb8(%rbp), %rdi
callq 0x47e8
leaq -0x90(%rbp), %rdi
callq 0x9d90
jmp 0x6c09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6cb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x47e8
leaq -0xb8(%rbp), %rdi
callq 0x47e8
jmp 0x6cd6
jmp 0x6cc4
leaq -0x18(%rbp), %rdi
callq 0x96e0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x18(%rbp), %rdi
callq 0x96e0
movq -0x30(%rbp), %rdi
callq 0x46d0
nopl (%rax,%rax)