// File: /workspace/github_cpp_makefile_star2_O1/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)
movq 0x8(%rcx), %rax
testl %eax, %eax
jle 0x378e7
movq (%rcx), %rdx
movl %eax, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
movsbl (%rdx,%rdi), %r8d
addl $-0x30, %r8d
cmpl $0xa, %r8d
jae 0x37971
incq %rdi
cmpq %rdi, %rsi
jne 0x378ca
jmp 0x378e9
xorl %eax, %eax
cmpl 0x8(%rcx), %eax
jne 0x37961
leaq -0x1b8(%rbp), %r13
movq %r13, %rdi
movq %rcx, %rsi
movl $0x18, %edx
callq 0x3310
leaq -0x2c(%rbp), %rsi
movq %r13, %rdi
callq 0x3120
cmpb $0x6e, %r12b
jne 0x379e5
cmpq $0x0, 0x28(%r15)
je 0x37a27
movq 0x18(%r15), %r14
addq $0x8, %r15
movb $0x1, %r12b
cmpq %r15, %r14
je 0x37b20
leaq 0x28(%r14), %rdi
callq 0x6b44
cmpl -0x2c(%rbp), %eax
je 0x37a35
movq %r14, %rdi
callq 0x3140
movq %rax, %r14
cmpq %r15, %rax
jne 0x3793a
jmp 0x37b20
movq 0x10668(%rip), %rbx     # 0x47fd0
leaq 0x3d14(%rip), %rsi      # 0x3b683
jmp 0x3797f
movq 0x10658(%rip), %rbx     # 0x47fd0
leaq 0x3d34(%rip), %rsi      # 0x3b6b3
movl $0x16, %edx
movq %rbx, %rdi
callq 0x3250
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
xorl %r14d, %r14d
jmp 0x37b4d
cmpq $0x0, 0x28(%r14)
je 0x37a27
movq 0x18(%r14), %r15
addq $0x8, %r14
movb $0x1, %r12b
cmpq %r14, %r15
je 0x37b20
leaq 0x28(%r15), %rdi
callq 0x6ff6
cmpl -0x2c(%rbp), %eax
je 0x37aaa
movq %r15, %rdi
callq 0x3140
movq %rax, %r15
cmpq %r14, %rax
jne 0x37a00
jmp 0x37b20
movb $0x73, (%rbx)
movb $0x1, %r14b
xorl %r12d, %r12d
jmp 0x37b23
movb $0x6e, (%rbx)
movq 0x10591(%rip), %r14     # 0x47fd0
leaq 0x3c54(%rip), %rsi      # 0x3b69a
movl $0x18, %edx
movq %r14, %rdi
callq 0x3250
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq 0x1055f(%rip), %rdi     # 0x47fd0
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
jmp 0x37b1d
movb $0x6e, (%rbx)
movq 0x1051c(%rip), %r14     # 0x47fd0
leaq 0x3bdf(%rip), %rsi      # 0x3b69a
movl $0x18, %edx
movq %r14, %rdi
callq 0x3250
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq 0x104ea(%rip), %rdi     # 0x47fd0
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x10486(%rip), %rsi     # 0x47fb0
leaq -0x1b8(%rbp), %rdi
callq 0x3160
leaq -0x138(%rbp), %rdi
callq 0x30d0
testb %r12b, %r12b
je 0x37b4d
movb $0x73, (%rbx)
movb $0x1, %r14b
movl %r14d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x37b6a
jmp 0x37b6a
jmp 0x37b6a
jmp 0x37b6a
movq %rax, %rbx
movq 0x1043c(%rip), %rsi     # 0x47fb0
leaq -0x1b8(%rbp), %rdi
callq 0x3160
leaq -0x138(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3380