// File: /workspace/github_cpp_makefile_star2_O2/nataly-enne[P]pet-fera/pet_fera_checagem.cpp
// Function: verifica_ID(std::map<int, REPTIL_NATIVO, std::less<int>, std::allocator<std::pair<int const, REPTIL_NATIVO>>>&, std::map<int, REPTIL_EXOTICO, std::less<int>, std::allocator<std::pair<int const, REPTIL_EXOTICO>>>&, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char&)
bool verifica_ID(map <int, REPTIL_NATIVO> &repteis_nat, map <int, REPTIL_EXOTICO> &repteis_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(repteis_nat.empty()){
				sucesso = 's';
				return 1;
			}
			else{
				for(auto it = repteis_nat.begin(); it != repteis_nat.end();it++){
					if(it->second.getId() == id){
						sucesso = 'n';
						cout << "ERRO: id já cadastrado!" << endl << endl;
						return 0;				
					}
				}
					
			}
		} // Reptil_nat
		else{
			if(repteis_ex.empty()){
				sucesso = 's';
				return 1;
			}
			else{
				for(auto it = repteis_ex.begin(); it != repteis_ex.end();it++){
					if(it->second.getId() == id){
						sucesso = 'n';
						cout << "ERRO: id já cadastrado!" << endl << endl;
						return 0;				
					}
				}	
			}
		} // Reptil_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 0x216e4
movq (%rcx), %rdi
movsbl (%rdi,%rdx), %edi
addl $-0x30, %edi
incq %rdx
cmpl $0xa, %edi
jb 0x216bd
movq 0xf8ed(%rip), %rdi      # 0x30fc8
leaq 0x2f91(%rip), %rsi      # 0x24673
jmp 0x21758
testl %eax, %eax
js 0x2174a
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 0x21785
cmpq $0x0, 0x28(%r15)
je 0x217b4
movq 0x18(%r15), %r14
addq $0x8, %r15
cmpq %r15, %r14
je 0x217bf
leaq 0x28(%r14), %rdi
callq 0x6372
cmpl -0x2c(%rbp), %eax
je 0x217c4
movq %r14, %rdi
callq 0x3160
movq %rax, %r14
jmp 0x21722
movq 0xf877(%rip), %rdi      # 0x30fc8
leaq 0x2eeb(%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 0x217b4
movq 0x18(%r14), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0x217bf
leaq 0x28(%r15), %rdi
callq 0x6656
cmpl -0x2c(%rbp), %eax
je 0x217ec
movq %r15, %rdi
callq 0x3160
movq %rax, %r15
jmp 0x21794
movb $0x73, (%rbx)
movb $0x1, %r14b
xorl %r15d, %r15d
jmp 0x21818
movb $0x1, %r15b
jmp 0x21815
movb $0x6e, (%rbx)
movq 0xf7fa(%rip), %rdi      # 0x30fc8
leaq 0x2e85(%rip), %rsi      # 0x2465a
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3110
jmp 0x21812
movb $0x6e, (%rbx)
movq 0xf7d2(%rip), %rdi      # 0x30fc8
leaq 0x2e5d(%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 0x21770
movb $0x73, (%rbx)
movb $0x1, %r14b
jmp 0x21770
jmp 0x21840
jmp 0x21840
jmp 0x21840
jmp 0x21840
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3370