// File: brashi[P]PetFera/src/./petshop.cpp
// Function: Petshop::excluirAnimal()
void Petshop::excluirAnimal() {
    string idAnimal, s;
    shared_ptr<Animal> animal;
    long unsigned int num;

    if(this->animais.size() == 0)
        throw "Não há animais para remover no sistema!";

    
    cout << endl << "Animais registrados: " << endl;
    this->listarAnimais(true);
    cout << endl << "Digite o ID do animal a ser removido: ";
    getline(cin, idAnimal);
    num = stoi(idAnimal);
    if(num >= 0 && num < this->animais.size())
        animal = this->animais[num];
    else
        throw "Animal não existe!";


    cout << endl << "Tem certeza que deseja excluir? (S/N): " << endl;
    getline(cin, s);

    if(toupper(s[0]) == 'S')
        if(this->excluirAnimal(animal))
            cout << "Operação concluída" << endl;
        else
            throw "Erro ao excluir animal, tente novamente";
    else
        cout << "Operação cancelada" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6480
leaq -0x48(%rbp), %rdi
callq 0x6480
leaq -0x58(%rbp), %rdi
callq 0xbe60
movq -0x98(%rbp), %rdi
addq $0x30, %rdi
callq 0x21d80
cmpq $0x0, %rax
jne 0x21468
movl $0x8, %edi
callq 0x61e0
movq %rax, %rdi
leaq 0x20726(%rip), %rax     # 0x41b65
movq %rax, (%rdi)
movq 0x41b5f(%rip), %rsi     # 0x62fa8
xorl %eax, %eax
movl %eax, %edx
callq 0x6570
jmp 0x21793
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2176f
movq 0x41b59(%rip), %rdi     # 0x62fc8
movq 0x41b2a(%rip), %rsi     # 0x62fa0
callq 0x6360
movq %rax, -0xa0(%rbp)
jmp 0x21484
movq -0xa0(%rbp), %rdi
leaq 0x203b4(%rip), %rsi     # 0x41846
callq 0x6310
movq %rax, -0xa8(%rbp)
jmp 0x214a0
movq -0xa8(%rbp), %rdi
movq 0x41af2(%rip), %rsi     # 0x62fa0
callq 0x6360
jmp 0x214b5
movq -0x98(%rbp), %rdi
movl $0x1, %esi
callq 0x1f300
jmp 0x214c8
movq 0x41af9(%rip), %rdi     # 0x62fc8
movq 0x41aca(%rip), %rsi     # 0x62fa0
callq 0x6360
movq %rax, -0xb0(%rbp)
jmp 0x214e4
movq -0xb0(%rbp), %rdi
leaq 0x2069d(%rip), %rsi     # 0x41b8f
callq 0x6310
jmp 0x214f9
movq 0x41ae0(%rip), %rdi     # 0x62fe0
leaq -0x28(%rbp), %rsi
callq 0x6090
jmp 0x2150b
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movl $0xa, %edx
callq 0xbdc0
movl %eax, -0xb4(%rbp)
jmp 0x21525
movl -0xb4(%rbp), %eax
cltq
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jb 0x21584
movq -0x98(%rbp), %rdi
movq -0x60(%rbp), %rax
movq %rax, -0xc0(%rbp)
addq $0x30, %rdi
callq 0x21d80
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
jae 0x21584
movq -0x98(%rbp), %rdi
addq $0x30, %rdi
movq -0x60(%rbp), %rsi
callq 0x21da0
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0x21dc0
jmp 0x215b0
movl $0x8, %edi
callq 0x61e0
movq %rax, %rdi
leaq 0x202eb(%rip), %rax     # 0x41883
movq %rax, (%rdi)
movq 0x41a06(%rip), %rsi     # 0x62fa8
xorl %eax, %eax
movl %eax, %edx
callq 0x6570
jmp 0x21793
movq 0x41a11(%rip), %rdi     # 0x62fc8
movq 0x419e2(%rip), %rsi     # 0x62fa0
callq 0x6360
movq %rax, -0xc8(%rbp)
jmp 0x215cc
movq -0xc8(%rbp), %rdi
leaq 0x204b7(%rip), %rsi     # 0x41a91
callq 0x6310
movq %rax, -0xd0(%rbp)
jmp 0x215e8
movq -0xd0(%rbp), %rdi
movq 0x419aa(%rip), %rsi     # 0x62fa0
callq 0x6360
jmp 0x215fd
movq 0x419dc(%rip), %rdi     # 0x62fe0
leaq -0x48(%rbp), %rsi
callq 0x6090
jmp 0x2160f
xorl %eax, %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdi
callq 0x6660
movq %rax, -0xd8(%rbp)
jmp 0x21625
movq -0xd8(%rbp), %rax
movsbl (%rax), %edi
callq 0x6600
cmpl $0x53, %eax
jne 0x21718
leaq -0x90(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
leaq -0x58(%rbp), %rsi
callq 0xb430
movq -0x98(%rbp), %rsi
movq -0xe0(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x20460
jmp 0x2166d
leaq -0x80(%rbp), %rdi
callq 0x22060
movb %al, -0xe1(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xb460
leaq -0x90(%rbp), %rdi
callq 0xb460
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x2169d
jmp 0x216ed
movq 0x41924(%rip), %rdi     # 0x62fc8
leaq 0x2040e(%rip), %rsi     # 0x41ab9
callq 0x6310
movq %rax, -0xf0(%rbp)
jmp 0x216b9
movq -0xf0(%rbp), %rdi
movq 0x418d9(%rip), %rsi     # 0x62fa0
callq 0x6360
jmp 0x216ce
jmp 0x21716
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xb460
jmp 0x2176f
movl $0x8, %edi
callq 0x61e0
movq %rax, %rdi
leaq 0x204b5(%rip), %rax     # 0x41bb6
movq %rax, (%rdi)
movq 0x4189d(%rip), %rsi     # 0x62fa8
xorl %eax, %eax
movl %eax, %edx
callq 0x6570
jmp 0x21793
jmp 0x2174b
movq 0x418a9(%rip), %rdi     # 0x62fc8
leaq 0x20209(%rip), %rsi     # 0x4192f
callq 0x6310
movq %rax, -0xf8(%rbp)
jmp 0x21734
movq -0xf8(%rbp), %rdi
movq 0x4185e(%rip), %rsi     # 0x62fa0
callq 0x6360
jmp 0x21749
jmp 0x2174b
leaq -0x58(%rbp), %rdi
callq 0xb460
leaq -0x48(%rbp), %rdi
callq 0x6678
leaq -0x28(%rbp), %rdi
callq 0x6678
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x58(%rbp), %rdi
callq 0xb460
leaq -0x48(%rbp), %rdi
callq 0x6678
leaq -0x28(%rbp), %rdi
callq 0x6678
movq -0x68(%rbp), %rdi
callq 0x6590
nopw %cs:(%rax,%rax)