// File: 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
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 0x3eba8
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 0x3eb8f
movq 0x1245c(%rip), %rdi     # 0x50fb8
leaq 0x3b10(%rip), %rsi      # 0x42673
callq 0x3240
movq %rax, %rdi
movq 0x1242e(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x1241f(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3eed1
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3eb9a
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3eb0c
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 0x3ee8f
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 0x3ec0b
movsbl -0x19(%rbp), %eax
cmpl $0x6e, %eax
jne 0x3ed55
movq -0x10(%rbp), %rdi
callq 0x1ff60
testb $0x1, %al
jne 0x3ec27
jmp 0x3ec64
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ee73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x31b0
jmp 0x3eedf
movq -0x10(%rbp), %rdi
callq 0x140b0
movq %rax, -0x1e8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14110
movq %rax, -0x1f0(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x140e0
testb $0x1, %al
jne 0x3eca0
jmp 0x3ed4e
leaq -0x1e8(%rbp), %rdi
callq 0x14140
movq %rax, %rdi
addq $0x8, %rdi
callq 0xaab0
movl %eax, -0x22c(%rbp)
jmp 0x3ecc0
movl -0x22c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x3ed32
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movq 0x122df(%rip), %rdi     # 0x50fb8
leaq 0x397a(%rip), %rsi      # 0x4265a
callq 0x3240
movq %rax, -0x238(%rbp)
jmp 0x3ecee
movq -0x238(%rbp), %rdi
movq 0x122a4(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, -0x240(%rbp)
jmp 0x3ed0a
movq -0x240(%rbp), %rdi
movq 0x12288(%rip), %rsi     # 0x50fa0
callq 0x3280
jmp 0x3ed1f
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ee73
jmp 0x3ed34
leaq -0x1e8(%rbp), %rdi
xorl %esi, %esi
callq 0x14170
movq %rax, -0x1f8(%rbp)
jmp 0x3ec74
jmp 0x3ed50
jmp 0x3ee69
movq -0x18(%rbp), %rdi
callq 0x1ffa0
testb $0x1, %al
jne 0x3ed64
jmp 0x3ed7e
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ee73
movq -0x18(%rbp), %rdi
callq 0x141b0
movq %rax, -0x200(%rbp)
movq -0x18(%rbp), %rdi
callq 0x14210
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x141e0
testb $0x1, %al
jne 0x3edba
jmp 0x3ee65
leaq -0x200(%rbp), %rdi
callq 0x14240
movq %rax, %rdi
addq $0x8, %rdi
callq 0xafd0
movl %eax, -0x244(%rbp)
jmp 0x3edda
movl -0x244(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x3ee49
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movq 0x121c5(%rip), %rdi     # 0x50fb8
leaq 0x3860(%rip), %rsi      # 0x4265a
callq 0x3240
movq %rax, -0x250(%rbp)
jmp 0x3ee08
movq -0x250(%rbp), %rdi
movq 0x1218a(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, -0x258(%rbp)
jmp 0x3ee24
movq -0x258(%rbp), %rdi
movq 0x1216e(%rip), %rsi     # 0x50fa0
callq 0x3280
jmp 0x3ee39
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3ee73
jmp 0x3ee4b
leaq -0x200(%rbp), %rdi
xorl %esi, %esi
callq 0x14270
movq %rax, -0x210(%rbp)
jmp 0x3ed8e
jmp 0x3ee67
jmp 0x3ee69
movl $0x0, -0x1e0(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x31b0
movl -0x1e0(%rbp), %eax
testl %eax, %eax
je 0x3ee8d
jmp 0x3ee8b
jmp 0x3eed1
jmp 0x3eec6
movq 0x12122(%rip), %rdi     # 0x50fb8
leaq 0x37a6(%rip), %rsi      # 0x42643
callq 0x3240
movq %rax, %rdi
movq 0x120f4(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x120e5(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3eed1
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)