// File: 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
subq $0x220, %rsp            # imm = 0x220
movq %rsi, -0x1f0(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movb $0x6e, (%rax)
movl $0x0, -0x34(%rbp)
movq -0x1f0(%rbp), %rdi
movl -0x34(%rbp), %eax
movl %eax, -0x1f4(%rbp)
callq 0x31a0
movq %rax, %rcx
movl -0x1f4(%rbp), %eax
cmpl %ecx, %eax
jge 0x3dd7f
movq -0x1f0(%rbp), %rdi
movslq -0x34(%rbp), %rsi
callq 0x3430
movb (%rax), %al
movb %al, -0x2d(%rbp)
movsbl -0x2d(%rbp), %edi
callq 0x3220
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x3dd66
movq 0x13285(%rip), %rdi     # 0x50fb8
leaq 0x4909(%rip), %rsi      # 0x42643
callq 0x3240
movq %rax, %rdi
movq 0x13257(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x13248(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3df7f
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3dd71
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3dce3
movq -0x1f0(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0x1f8(%rbp)
callq 0x31a0
movq %rax, %rcx
movl -0x1f8(%rbp), %eax
cmpl %ecx, %eax
jne 0x3df3d
movl $0x10, %edi
movl $0x8, %esi
callq 0x13c90
movq -0x1f0(%rbp), %rsi
movl %eax, %edx
leaq -0x1c0(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x3370
movq -0x200(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3170
jmp 0x3dde2
movq -0x10(%rbp), %rdi
callq 0x1f6c0
testb $0x1, %al
jne 0x3ddf1
jmp 0x3de2e
movq -0x20(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1d0(%rbp)
jmp 0x3df21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x31b0
jmp 0x3df8d
movq -0x10(%rbp), %rdi
callq 0x1f6e0
movq %rax, -0x1d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1f740
movq %rax, -0x1e0(%rbp)
leaq -0x1d8(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x1f710
testb $0x1, %al
jne 0x3de6a
jmp 0x3df15
leaq -0x1d8(%rbp), %rdi
callq 0x3d600
movq %rax, %rdi
addq $0x8, %rdi
callq 0x125a0
movl %eax, -0x204(%rbp)
jmp 0x3de8a
movl -0x204(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x3def9
movq -0x20(%rbp), %rax
movb $0x6e, (%rax)
movq 0x13115(%rip), %rdi     # 0x50fb8
leaq 0x47b0(%rip), %rsi      # 0x4265a
callq 0x3240
movq %rax, -0x210(%rbp)
jmp 0x3deb8
movq -0x210(%rbp), %rdi
movq 0x130da(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, -0x218(%rbp)
jmp 0x3ded4
movq -0x218(%rbp), %rdi
movq 0x130be(%rip), %rsi     # 0x50fa0
callq 0x3280
jmp 0x3dee9
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1d0(%rbp)
jmp 0x3df21
jmp 0x3defb
leaq -0x1d8(%rbp), %rdi
xorl %esi, %esi
callq 0x1f790
movq %rax, -0x1e8(%rbp)
jmp 0x3de3e
jmp 0x3df17
movl $0x0, -0x1d0(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x31b0
movl -0x1d0(%rbp), %eax
testl %eax, %eax
je 0x3df3b
jmp 0x3df39
jmp 0x3df7f
jmp 0x3df74
movq 0x13074(%rip), %rdi     # 0x50fb8
leaq 0x46f8(%rip), %rsi      # 0x42643
callq 0x3240
movq %rax, %rdi
movq 0x13046(%rip), %rsi     # 0x50fa0
callq 0x3280
movq %rax, %rdi
movq 0x13037(%rip), %rsi     # 0x50fa0
callq 0x3280
movb $0x0, -0x1(%rbp)
jmp 0x3df7f
movq -0x20(%rbp), %rax
movb $0x73, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x1c8(%rbp), %rdi
callq 0x33d0
nopl (%rax)