// File: /workspace/github_cpp_makefile_star2_O3/nataly-enne[P]pet-fera/pet_fera_checagem.cpp
// Function: verifica_ID(std::map<int, VETERINARIO, std::less<int>, std::allocator<std::pair<int const, VETERINARIO>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char&)
bool verifica_ID(map <int, VETERINARIO> &vets, 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(vets.empty()){
			sucesso = 's';
			return 1;
		}
		else{
			for(auto it = vets.begin(); it != vets.end();it++){
				if(it->second.getId() == id){
					sucesso = 'n';
					cout << "ERRO: id já cadastrado!" << endl << endl;
					return 0;				
				}
			}		
		}		
	}
	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 %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdx, %rbx
movq %rdi, %r14
movb $0x6e, (%rdx)
movq 0x8(%rsi), %rax
testl %eax, %eax
jle 0x370b9
movq (%rsi), %rcx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
movsbl (%rcx,%rdx), %edi
addl $-0x30, %edi
cmpl $0xa, %edi
jae 0x370bb
incq %rdx
cmpq %rdx, %rax
jne 0x370a3
jmp 0x3712e
je 0x3712e
movq 0x10f0e(%rip), %rbx     # 0x47fd0
leaq 0x45ba(%rip), %rsi      # 0x3b683
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 %eax, %eax
jmp 0x371c8
leaq -0x1a8(%rbp), %r15
movq %r15, %rdi
movl $0x18, %edx
callq 0x3310
leaq -0x1c(%rbp), %rsi
movq %r15, %rdi
callq 0x3120
cmpq $0x0, 0x28(%r14)
je 0x371a4
movq 0x18(%r14), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0x37180
leaq 0x28(%r15), %rdi
callq 0xf312
cmpl -0x1c(%rbp), %eax
je 0x371d6
movq %r15, %rdi
callq 0x3140
movq %rax, %r15
cmpq %r14, %rax
jne 0x37162
movq 0x10e29(%rip), %rsi     # 0x47fb0
leaq -0x1a8(%rbp), %rdi
callq 0x3160
leaq -0x128(%rbp), %rdi
callq 0x30d0
movb $0x73, (%rbx)
jmp 0x371c6
movb $0x73, (%rbx)
movq 0x10e02(%rip), %rsi     # 0x47fb0
leaq -0x1a8(%rbp), %rdi
callq 0x3160
leaq -0x128(%rbp), %rdi
callq 0x30d0
movb $0x1, %al
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movb $0x6e, (%rbx)
movq 0x10df0(%rip), %rbx     # 0x47fd0
leaq 0x44b3(%rip), %rsi      # 0x3b69a
movl $0x18, %edx
movq %rbx, %rdi
callq 0x3250
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq 0x10dbe(%rip), %rdi     # 0x47fd0
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
movq 0x10d60(%rip), %rsi     # 0x47fb0
leaq -0x1a8(%rbp), %rdi
callq 0x3160
leaq -0x128(%rbp), %rdi
callq 0x30d0
jmp 0x37127
jmp 0x37271
jmp 0x37271
movq %rax, %rbx
movq 0x10d35(%rip), %rsi     # 0x47fb0
leaq -0x1a8(%rbp), %rdi
callq 0x3160
leaq -0x128(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3380