// File: nataly-enne[P]pet-fera/pet_fera_checagem.cpp
// Function: verifica_ID(std::map<int, MAMIFERO_NATIVO, std::less<int>, std::allocator<std::pair<int const, MAMIFERO_NATIVO>>>&, std::map<int, MAMIFERO_EXOTICO, std::less<int>, std::allocator<std::pair<int const, MAMIFERO_EXOTICO>>>&, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char&)
bool verifica_ID(map <int, MAMIFERO_NATIVO> &mamiferos_nat, map <int, MAMIFERO_EXOTICO> &mamiferos_ex, char tipo, string id_string, char &sucesso){
	int cont = 0, id, verificacao;
	char c;
	sucesso = 'n';
	for(int i=0; i < (int)id_string.size(); i++){
		c = id_string[i];
		verificacao = isdigit(c);
		if(!verificacao){
			cout << "Erro: valor inválido!" << endl << endl;
			return 0;
		}
		else cont++;
	}
	if(cont == (int) id_string.size()){
		stringstream ss(id_string);
		ss >> id;
		if(tipo == 'n'){
			if(mamiferos_nat.empty()){
				sucesso = 's';
				return 1;
			}
			else{
				for(auto it = mamiferos_nat.begin(); it != mamiferos_nat.end();it++){
					if(it->second.getId() == id){
						sucesso = 'n';
						cout << "ERRO: id já cadastrado!" << endl << endl;
						return 0;				
					}
				}		
			}
		} // Mamifero_nat
		else{
			if(mamiferos_ex.empty()){
				sucesso = 's';
				return 1;
			}
			else{
				for(auto it = mamiferos_ex.begin(); it != mamiferos_ex.end();it++){
					if(it->second.getId() == id){
						sucesso = 'n';
						cout << "ERRO: id já cadastrado!" << endl << endl;
						return 0;				
					}
				}	
			}
		} // Mamifero_ex 
			
	}
	else{
		cout << "ERRO: valor inválido!" << endl << endl;
		return 0;
	}
	
	sucesso = 's';
	return 1;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rcx, -0x218(%rbp)
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movl $0x0, -0x44(%rbp)
movq -0x218(%rbp), %rdi
movl -0x44(%rbp), %eax
movl %eax, -0x21c(%rbp)
callq 0x31a0
movq %rax, %rcx
movl -0x21c(%rbp), %eax
cmpl %ecx, %eax
jge 0x3e788
movq -0x218(%rbp), %rdi
movslq -0x44(%rbp), %rsi
callq 0x3430
movb (%rax), %al
movb %al, -0x3d(%rbp)
movsbl -0x3d(%rbp), %edi
callq 0x3220
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x3e76f
movq 0x1287c(%rip), %rdi     # 0x50fb8
leaq 0x3f30(%rip), %rsi      # 0x42673
callq 0x3240
movq %rax, %rdi
movq 0x1284e(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x1283f(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3eab1
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3e77a
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3e6ec
movq -0x218(%rbp), %rdi
movl -0x34(%rbp), %eax
movl %eax, -0x220(%rbp)
callq 0x31a0
movq %rax, %rcx
movl -0x220(%rbp), %eax
cmpl %ecx, %eax
jne 0x3ea6f
movl $0x10, %edi
movl $0x8, %esi
callq 0x13c90
movq -0x218(%rbp), %rsi
movl %eax, %edx
leaq -0x1d0(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x3370
movq -0x228(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3170
jmp 0x3e7eb
movsbl -0x19(%rbp), %eax
cmpl $0x6e, %eax
jne 0x3e935
movq -0x10(%rbp), %rdi
callq 0x1fd60
testb $0x1, %al
jne 0x3e807
jmp 0x3e844
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ea53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x31b0
jmp 0x3eabf
movq -0x10(%rbp), %rdi
callq 0x13eb0
movq %rax, -0x1e8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x13f10
movq %rax, -0x1f0(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x13ee0
testb $0x1, %al
jne 0x3e880
jmp 0x3e92e
leaq -0x1e8(%rbp), %rdi
callq 0x13f40
movq %rax, %rdi
addq $0x8, %rdi
callq 0xa040
movl %eax, -0x22c(%rbp)
jmp 0x3e8a0
movl -0x22c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x3e912
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movq 0x126ff(%rip), %rdi     # 0x50fb8
leaq 0x3d9a(%rip), %rsi      # 0x4265a
callq 0x3240
movq %rax, -0x238(%rbp)
jmp 0x3e8ce
movq -0x238(%rbp), %rdi
movq 0x126c4(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, -0x240(%rbp)
jmp 0x3e8ea
movq -0x240(%rbp), %rdi
movq 0x126a8(%rip), %rsi     # 0x50fa0
callq 0x3280
jmp 0x3e8ff
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ea53
jmp 0x3e914
leaq -0x1e8(%rbp), %rdi
xorl %esi, %esi
callq 0x13f70
movq %rax, -0x1f8(%rbp)
jmp 0x3e854
jmp 0x3e930
jmp 0x3ea49
movq -0x18(%rbp), %rdi
callq 0x1fda0
testb $0x1, %al
jne 0x3e944
jmp 0x3e95e
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ea53
movq -0x18(%rbp), %rdi
callq 0x13fb0
movq %rax, -0x200(%rbp)
movq -0x18(%rbp), %rdi
callq 0x14010
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x13fe0
testb $0x1, %al
jne 0x3e99a
jmp 0x3ea45
leaq -0x200(%rbp), %rdi
callq 0x14040
movq %rax, %rdi
addq $0x8, %rdi
callq 0xa500
movl %eax, -0x244(%rbp)
jmp 0x3e9ba
movl -0x244(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x3ea29
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movq 0x125e5(%rip), %rdi     # 0x50fb8
leaq 0x3c80(%rip), %rsi      # 0x4265a
callq 0x3240
movq %rax, -0x250(%rbp)
jmp 0x3e9e8
movq -0x250(%rbp), %rdi
movq 0x125aa(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, -0x258(%rbp)
jmp 0x3ea04
movq -0x258(%rbp), %rdi
movq 0x1258e(%rip), %rsi     # 0x50fa0
callq 0x3280
jmp 0x3ea19
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ea53
jmp 0x3ea2b
leaq -0x200(%rbp), %rdi
xorl %esi, %esi
callq 0x14070
movq %rax, -0x210(%rbp)
jmp 0x3e96e
jmp 0x3ea47
jmp 0x3ea49
movl $0x0, -0x1e0(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x31b0
movl -0x1e0(%rbp), %eax
testl %eax, %eax
je 0x3ea6d
jmp 0x3ea6b
jmp 0x3eab1
jmp 0x3eaa6
movq 0x12542(%rip), %rdi     # 0x50fb8
leaq 0x3bc6(%rip), %rsi      # 0x42643
callq 0x3240
movq %rax, %rdi
movq 0x12514(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x12505(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3eab1
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq -0x1d8(%rbp), %rdi
callq 0x33d0
nopl (%rax,%rax)