// File: nataly-enne[P]pet-fera/pet_fera_checagem.cpp
// Function: verifica_ID(std::map<int, AVE_NATIVO, std::less<int>, std::allocator<std::pair<int const, AVE_NATIVO>>>&, std::map<int, AVE_EXOTICO, std::less<int>, std::allocator<std::pair<int const, AVE_EXOTICO>>>&, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char&)
bool verifica_ID(map <int, AVE_NATIVO> &aves_nat, map <int, AVE_EXOTICO> &aves_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(aves_nat.empty()){
				sucesso = 's';
				return 1;
			}
			else{
				for(auto it = aves_nat.begin(); it != aves_nat.end();it++){
					if(it->second.getId() == id){
						sucesso = 'n';
						cout << "ERRO: id já cadastrado!" << endl << endl;
						return 0;				
					}
				}
					
			}
		} // Aves_nat
		else{
			if(aves_ex.empty()){
				sucesso = 's';
				return 1;
			}
			else{
				for(auto it = aves_ex.begin(); it != aves_ex.end();it++){
					if(it->second.getId() == id){
						sucesso = 'n';
						cout << "ERRO: id já cadastrado!" << endl << endl;
						return 0;				
					}
				}	
			}
		} // Aves_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 0x3efc8
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 0x3efaf
movq 0x1203c(%rip), %rdi     # 0x50fb8
leaq 0x36f0(%rip), %rsi      # 0x42673
callq 0x3240
movq %rax, %rdi
movq 0x1200e(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x11fff(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3f2f1
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3efba
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3ef2c
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 0x3f2af
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 0x3f02b
movsbl -0x19(%rbp), %eax
cmpl $0x6e, %eax
jne 0x3f175
movq -0x10(%rbp), %rdi
callq 0x20160
testb $0x1, %al
jne 0x3f047
jmp 0x3f084
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3f293
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x31b0
jmp 0x3f2ff
movq -0x10(%rbp), %rdi
callq 0x142b0
movq %rax, -0x1e8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14310
movq %rax, -0x1f0(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x142e0
testb $0x1, %al
jne 0x3f0c0
jmp 0x3f16e
leaq -0x1e8(%rbp), %rdi
callq 0x14340
movq %rax, %rdi
addq $0x8, %rdi
callq 0xb4b0
movl %eax, -0x22c(%rbp)
jmp 0x3f0e0
movl -0x22c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x3f152
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movq 0x11ebf(%rip), %rdi     # 0x50fb8
leaq 0x355a(%rip), %rsi      # 0x4265a
callq 0x3240
movq %rax, -0x238(%rbp)
jmp 0x3f10e
movq -0x238(%rbp), %rdi
movq 0x11e84(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, -0x240(%rbp)
jmp 0x3f12a
movq -0x240(%rbp), %rdi
movq 0x11e68(%rip), %rsi     # 0x50fa0
callq 0x3280
jmp 0x3f13f
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3f293
jmp 0x3f154
leaq -0x1e8(%rbp), %rdi
xorl %esi, %esi
callq 0x14370
movq %rax, -0x1f8(%rbp)
jmp 0x3f094
jmp 0x3f170
jmp 0x3f289
movq -0x18(%rbp), %rdi
callq 0x201a0
testb $0x1, %al
jne 0x3f184
jmp 0x3f19e
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3f293
movq -0x18(%rbp), %rdi
callq 0x143b0
movq %rax, -0x200(%rbp)
movq -0x18(%rbp), %rdi
callq 0x14410
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x143e0
testb $0x1, %al
jne 0x3f1da
jmp 0x3f285
leaq -0x200(%rbp), %rdi
callq 0x14440
movq %rax, %rdi
addq $0x8, %rdi
callq 0xb950
movl %eax, -0x244(%rbp)
jmp 0x3f1fa
movl -0x244(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x3f269
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movq 0x11da5(%rip), %rdi     # 0x50fb8
leaq 0x3440(%rip), %rsi      # 0x4265a
callq 0x3240
movq %rax, -0x250(%rbp)
jmp 0x3f228
movq -0x250(%rbp), %rdi
movq 0x11d6a(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, -0x258(%rbp)
jmp 0x3f244
movq -0x258(%rbp), %rdi
movq 0x11d4e(%rip), %rsi     # 0x50fa0
callq 0x3280
jmp 0x3f259
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e0(%rbp)
jmp 0x3f293
jmp 0x3f26b
leaq -0x200(%rbp), %rdi
xorl %esi, %esi
callq 0x14470
movq %rax, -0x210(%rbp)
jmp 0x3f1ae
jmp 0x3f287
jmp 0x3f289
movl $0x0, -0x1e0(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x31b0
movl -0x1e0(%rbp), %eax
testl %eax, %eax
je 0x3f2ad
jmp 0x3f2ab
jmp 0x3f2f1
jmp 0x3f2e6
movq 0x11d02(%rip), %rdi     # 0x50fb8
leaq 0x3386(%rip), %rsi      # 0x42643
callq 0x3240
movq %rax, %rdi
movq 0x11cd4(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x11cc5(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3f2f1
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)