// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdx, %rbx
movq %rdi, %r14
movb $0x6e, (%rdx)
movq 0x8(%rsi), %rax
testl %eax, %eax
jle 0x372dc
movq (%rsi), %rcx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
movsbl (%rcx,%rdx), %edi
addl $-0x30, %edi
cmpl $0xa, %edi
jae 0x372de
incq %rdx
cmpq %rdx, %rax
jne 0x372c6
jmp 0x37351
je 0x37351
movq 0x10ceb(%rip), %rbx     # 0x47fd0
leaq 0x4397(%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 0x373eb
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 0x373c7
movq 0x18(%r14), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0x373a3
leaq 0x28(%r15), %rdi
callq 0xfafa
cmpl -0x1c(%rbp), %eax
je 0x373f9
movq %r15, %rdi
callq 0x3140
movq %rax, %r15
cmpq %r14, %rax
jne 0x37385
movq 0x10c06(%rip), %rsi     # 0x47fb0
leaq -0x1a8(%rbp), %rdi
callq 0x3160
leaq -0x128(%rbp), %rdi
callq 0x30d0
movb $0x73, (%rbx)
jmp 0x373e9
movb $0x73, (%rbx)
movq 0x10bdf(%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 0x10bcd(%rip), %rbx     # 0x47fd0
leaq 0x4290(%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 0x10b9b(%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 0x10b3d(%rip), %rsi     # 0x47fb0
leaq -0x1a8(%rbp), %rdi
callq 0x3160
leaq -0x128(%rbp), %rdi
callq 0x30d0
jmp 0x3734a
jmp 0x37494
jmp 0x37494
movq %rax, %rbx
movq 0x10b12(%rip), %rsi     # 0x47fb0
leaq -0x1a8(%rbp), %rdi
callq 0x3160
leaq -0x128(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3380