// File: /workspace/github_cpp_makefile_star2_O2/nataly-enne[P]pet-fera/pet_fera_checagem.cpp
// Function: verifica_CRMV(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_CRMV(map <int, VETERINARIO> &vets, string crmv, char &sucesso){
	int cont = 0, verificacao, contador_de_traco = 0;
	char c;
	sucesso = 'n';
	transform(crmv.begin(), crmv.end(), crmv.begin(), ::toupper);
	for(int i = 0; i < (int) crmv.size(); i++){
		c = crmv[i];
		verificacao = isalnum(c);
		if(c == '-'){
			contador_de_traco++;
		}
		if(!verificacao && c != ' ' && c != '-'){
			sucesso = 'n';
			cout << "ERRO: valor inválido!" << endl << endl;
			return 0;
		}
		else cont++;	
	}
	
	if((cont == (int)crmv.size()) && (contador_de_traco >= 1)){
		transform(crmv.begin(), crmv.end(), crmv.begin(), ::tolower);
		if(vets.empty()){
			sucesso = 's';
			return 1;
		}
		else{
			for(auto it = vets.begin(); it != vets.end();it++){
				if(it->second.getCrmv() == crmv){
					cout << "ERRO: Crmv já cadastrado!" << endl << endl;
					sucesso = 'n';
					return 0;				
				}
			}
		}
	}
	sucesso = 's';
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, -0x40(%rbp)
movq %rdx, -0x30(%rbp)
movb $0x6e, (%rdx)
movq (%rsi), %rbx
movq %rsi, -0x38(%rbp)
movq 0x8(%rsi), %r14
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x2203f
movsbl (%rbx,%r15), %edi
callq 0x33a0
movb %al, (%rbx,%r15)
incq %r15
jmp 0x22027
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
xorl %r13d, %r13d
testl %eax, %eax
movl $0x0, %ecx
movq %rax, -0x48(%rbp)
cmovgl %eax, %ecx
movq %rcx, -0x50(%rbp)
xorl %r15d, %r15d
cmpq %r13, -0x50(%rbp)
je 0x220a4
movq -0x38(%rbp), %rax
movq (%rax), %rax
movsbl (%rax,%r13), %r12d
xorl %r14d, %r14d
cmpl $0x2d, %r12d
sete %bl
movl %r12d, %edi
callq 0x3220
testl %eax, %eax
jne 0x22099
movzbl %r12b, %eax
cmpl $0x20, %eax
je 0x22099
cmpl $0x2d, %eax
jne 0x2212e
movb %bl, %r14b
addl %r14d, %r15d
incq %r13
jmp 0x2205f
movq -0x48(%rbp), %r12
testl %r12d, %r12d
js 0x22123
testl %r15d, %r15d
je 0x22123
movq -0x38(%rbp), %rax
movq (%rax), %rbx
xorl %r14d, %r14d
cmpq %r14, %r12
je 0x220d4
movsbl (%rbx,%r14), %edi
callq 0x32c0
movb %al, (%rbx,%r14)
incq %r14
jmp 0x220bc
movq -0x40(%rbp), %r14
cmpq $0x0, 0x28(%r14)
je 0x22123
movq 0x18(%r14), %r13
addq $0x8, %r14
leaq -0x70(%rbp), %r12
cmpq %r14, %r13
je 0x22123
leaq 0x28(%r13), %rsi
movq %r12, %rdi
callq 0xaa9a
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x20d72
movl %eax, %ebx
movq %r12, %rdi
callq 0x3100
testb %bl, %bl
jne 0x2215a
movq %r13, %rdi
callq 0x3160
movq %rax, %r13
jmp 0x220eb
movq -0x30(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, %al
jmp 0x22186
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
movq 0xee8c(%rip), %rdi      # 0x30fc8
leaq 0x2500(%rip), %rsi      # 0x24643
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3110
jmp 0x22184
movq 0xee67(%rip), %rdi      # 0x30fc8
leaq 0x253e(%rip), %rsi      # 0x246a6
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3110
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq