// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %r8, %rbx
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %r15
movb $0x6e, (%r8)
movl 0x8(%rcx), %eax
xorl %edx, %edx
testl %eax, %eax
movl $0x0, %esi
cmovgl %eax, %esi
cmpq %rdx, %rsi
je 0x21517
movq (%rcx), %rdi
movsbl (%rdi,%rdx), %edi
addl $-0x30, %edi
incq %rdx
cmpl $0xa, %edi
jb 0x214f0
movq 0xfaba(%rip), %rdi      # 0x30fc8
leaq 0x315e(%rip), %rsi      # 0x24673
jmp 0x2158b
testl %eax, %eax
js 0x2157d
leaq -0x1b8(%rbp), %r13
pushq $0x18
popq %rdx
movq %r13, %rdi
movq %rcx, %rsi
callq 0x3300
leaq -0x2c(%rbp), %rsi
movq %r13, %rdi
callq 0x3150
cmpb $0x6e, %r12b
jne 0x215b8
cmpq $0x0, 0x28(%r15)
je 0x215e7
movq 0x18(%r15), %r14
addq $0x8, %r15
cmpq %r15, %r14
je 0x215f2
leaq 0x28(%r14), %rdi
callq 0x5d5e
cmpl -0x2c(%rbp), %eax
je 0x215f7
movq %r14, %rdi
callq 0x3160
movq %rax, %r14
jmp 0x21555
movq 0xfa44(%rip), %rdi      # 0x30fc8
leaq 0x30b8(%rip), %rsi      # 0x24643
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3110
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x28(%r14)
je 0x215e7
movq 0x18(%r14), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0x215f2
leaq 0x28(%r15), %rdi
callq 0x603e
cmpl -0x2c(%rbp), %eax
je 0x2161f
movq %r15, %rdi
callq 0x3160
movq %rax, %r15
jmp 0x215c7
movb $0x73, (%rbx)
movb $0x1, %r14b
xorl %r15d, %r15d
jmp 0x2164b
movb $0x1, %r15b
jmp 0x21648
movb $0x6e, (%rbx)
movq 0xf9c7(%rip), %rdi      # 0x30fc8
leaq 0x3052(%rip), %rsi      # 0x2465a
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3110
jmp 0x21645
movb $0x6e, (%rbx)
movq 0xf99f(%rip), %rdi      # 0x30fc8
leaq 0x302a(%rip), %rsi      # 0x2465a
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3110
xorl %r15d, %r15d
xorl %r14d, %r14d
leaq -0x1b8(%rbp), %rdi
callq 0x3170
testb %r15b, %r15b
je 0x215a3
movb $0x73, (%rbx)
movb $0x1, %r14b
jmp 0x215a3
jmp 0x21673
jmp 0x21673
jmp 0x21673
jmp 0x21673
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3370