// File: /workspace/github_cpp_makefile_star2_O1/nataly-enne[P]pet-fera/pet_fera_checagem.cpp
// Function: verifica_ID(std::map<int, TRATADOR, std::less<int>, std::allocator<std::pair<int const, TRATADOR>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char&)
bool verifica_ID(map <int, TRATADOR> &tratadores, 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(tratadores.empty()){
			sucesso = 's';
			return 1;
		}
		else{
			for(auto it = tratadores.begin(); it != tratadores.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 %r12
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rdx, %rbx
movq %rdi, %r14
movb $0x6e, (%rdx)
movq 0x8(%rsi), %rax
testl %eax, %eax
jle 0x3739e
movq (%rsi), %rcx
movl %eax, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %edi, %edi
movsbl (%rcx,%rdi), %r8d
addl $-0x30, %r8d
cmpl $0xa, %r8d
jae 0x37407
incq %rdi
cmpq %rdi, %rdx
jne 0x37385
jmp 0x373a0
xorl %eax, %eax
cmpl 0x8(%rsi), %eax
jne 0x37407
leaq -0x1b0(%rbp), %r15
movq %r15, %rdi
movl $0x18, %edx
callq 0x3310
leaq -0x24(%rbp), %rsi
movq %r15, %rdi
callq 0x3120
cmpq $0x0, 0x28(%r14)
je 0x3749b
movq 0x18(%r14), %r15
addq $0x8, %r14
cmpq %r14, %r15
sete %r12b
je 0x37477
leaq 0x28(%r15), %rdi
callq 0xfaf6
cmpl -0x24(%rbp), %eax
je 0x374cf
movq %r15, %rdi
callq 0x3140
movq %rax, %r15
cmpq %r14, %rax
jmp 0x373db
movq 0x10bc2(%rip), %rbx     # 0x47fd0
leaq 0x426e(%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 0x374bf
movq 0x10b32(%rip), %rsi     # 0x47fb0
leaq -0x1b0(%rbp), %rdi
callq 0x3160
leaq -0x130(%rbp), %rdi
callq 0x30d0
movb $0x73, (%rbx)
jmp 0x374bd
movb $0x73, (%rbx)
movq 0x10b0b(%rip), %rsi     # 0x47fb0
leaq -0x1b0(%rbp), %rdi
callq 0x3160
leaq -0x130(%rbp), %rdi
callq 0x30d0
movb $0x1, %al
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x6e, (%rbx)
movq 0x10af7(%rip), %r14     # 0x47fd0
leaq 0x41ba(%rip), %rsi      # 0x3b69a
movl $0x18, %edx
movq %r14, %rdi
callq 0x3250
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq 0x10ac5(%rip), %rdi     # 0x47fd0
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x31f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq 0x10a67(%rip), %rsi     # 0x47fb0
leaq -0x1b0(%rbp), %rdi
callq 0x3160
leaq -0x130(%rbp), %rdi
callq 0x30d0
testb $0x1, %r12b
je 0x37473
jmp 0x37496
jmp 0x37574
jmp 0x37574
movq %rax, %rbx
movq 0x10a32(%rip), %rsi     # 0x47fb0
leaq -0x1b0(%rbp), %rdi
callq 0x3160
leaq -0x130(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3380