// File: /workspace/github_cpp_makefile_star2_O2/nataly-enne[P]pet-fera/pet_fera_checagem.cpp
// Function: check_tratador(bool, 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 check_tratador(bool venenoso, map <int, TRATADOR> &tratadores, string nome, char tipo){
	int cont_nome = 0; // cont_nivel = 0;
	transform(nome.begin(), nome.end(), nome.begin(), ::toupper); // Converte a string nome para caracteres maiúsculos.
	if(tipo == 'v'){
		for(auto it = tratadores.begin(); it != tratadores.end();it++){
			if(it->second.getNome() == nome && (it->second.getNivel_seguranca() == 0 || it->second.getNivel_seguranca() == 1)){
				cont_nome++;
			}
		}
		if(cont_nome == 1){
			return 1;
		}
		else return 0;
	}
	else if(tipo == 'r' && venenoso == 1){ 
		for(auto it = tratadores.begin(); it != tratadores.end();it++){
			if(it->second.getNome() == nome && it->second.getNivel_seguranca() == 2){
				cont_nome++;
			}
		}
		if(cont_nome == 1){
			return 1;
		}
		else return 0;


	}
	else{
		for(auto it = tratadores.begin(); it != tratadores.end();it++){
			if(it->second.getNome() == nome &&(it->second.getNivel_seguranca() == 1)){
				cont_nome++;
			}
		}
		if(cont_nome == 1 ){ 
			return 1;
		}
		else return 0;
	}		
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r12d
movq %rsi, %r14
movl %edi, -0x34(%rbp)
movq (%rdx), %rbx
movq %rdx, -0x30(%rbp)
movq 0x8(%rdx), %r13
xorl %r15d, %r15d
cmpq %r15, %r13
je 0x20ef7
movsbl (%rbx,%r15), %edi
callq 0x33a0
movb %al, (%rbx,%r15)
incq %r15
jmp 0x20edf
movsbl %r12b, %eax
cmpl $0x72, %eax
je 0x20f8b
cmpl $0x76, %eax
jne 0x20ffb
movq 0x18(%r14), %r15
addq $0x8, %r14
xorl %ebx, %ebx
leaq -0x58(%rbp), %r12
cmpq %r14, %r15
je 0x21061
leaq 0x28(%r15), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xaa16
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0x20d72
testb %al, %al
je 0x20f6a
movq %r13, %rdi
callq 0xaf58
testl %eax, %eax
je 0x20f74
movq %r13, %rdi
callq 0xaf58
movl %eax, %r13d
movq %r12, %rdi
callq 0x3100
cmpl $0x1, %r13d
je 0x20f7c
jmp 0x20f7e
movq %r12, %rdi
callq 0x3100
jmp 0x20f7e
movq %r12, %rdi
callq 0x3100
incl %ebx
movq %r15, %rdi
callq 0x3160
movq %rax, %r15
jmp 0x20f1b
cmpb $0x0, -0x34(%rbp)
je 0x20ffb
movq 0x18(%r14), %r15
addq $0x8, %r14
xorl %ebx, %ebx
leaq -0x58(%rbp), %r12
cmpq %r14, %r15
je 0x21061
leaq 0x28(%r15), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xaa16
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0x20d72
testb %al, %al
je 0x20fe6
movq %r13, %rdi
callq 0xaf58
xorl %r13d, %r13d
cmpl $0x2, %eax
sete %r13b
movq %r12, %rdi
callq 0x3100
addl %r13d, %ebx
jmp 0x20fee
movq %r12, %rdi
callq 0x3100
movq %r15, %rdi
callq 0x3160
movq %rax, %r15
jmp 0x20f9f
movq 0x18(%r14), %r15
addq $0x8, %r14
xorl %ebx, %ebx
leaq -0x58(%rbp), %r12
cmpq %r14, %r15
je 0x21061
leaq 0x28(%r15), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xaa16
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0x20d72
testb %al, %al
je 0x2104c
movq %r13, %rdi
callq 0xaf58
xorl %r13d, %r13d
cmpl $0x1, %eax
sete %r13b
movq %r12, %rdi
callq 0x3100
addl %r13d, %ebx
jmp 0x21054
movq %r12, %rdi
callq 0x3100
movq %r15, %rdi
callq 0x3160
movq %rax, %r15
jmp 0x21009
cmpl $0x1, %ebx
sete %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2107a
jmp 0x2107a
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x3370