// File: /workspace/github_cpp_makefile_star2_O2/nataly-enne[P]pet-fera/pet_fera_editar.cpp
// Function: editar(std::map<int, TRATADOR, std::less<int>, std::allocator<std::pair<int const, TRATADOR>>>&)
void editar(map <int, TRATADOR> &tratadores){
	int id_buscado, idade,nivel_seg;
	long int cpf;
	string nome, especialidade, tipo_sang;
	char fator_rh, sucesso;
	ofstream tratador;

	cout << "Insira o ID buscado: " << endl;
	cin >> id_buscado;

	auto result = tratadores.find(id_buscado);
	
	if(result != tratadores.end()){
		cout << "ID existe!" << endl;

		cout << "Digite o nome: " << endl;
		cin.ignore();
		getline(cin, nome); 
		transform(nome.begin(), nome.end(), nome.begin(), ::toupper); //Converte a string nome para caracteres maiusculos
		cout << "Digite o cpf: " << endl;
		cin >> cpf;
		cout << "Digite a idade: " << endl;
		cin >> idade;
		cout << "Insira o tipo sanguineo: " << endl;
		cin.ignore();
		getline(cin, tipo_sang);
		cout << "Insira o fator RH: " << endl;
		cin >> fator_rh;
		cout << "Digite a especialidade: " << endl;
		cin.ignore();
		getline(cin, especialidade);
		cout << "Digite o nivel de seguranca: "<< endl;
		cin >> nivel_seg;

		(*result).second = TRATADOR(id_buscado, nome, cpf, idade, tipo_sang, fator_rh, especialidade, nivel_seg);
		sucesso = 's';
	}
	else{
		cout << "Funcionario não cadastrado!!" << endl;
		sucesso = 'n';
	}

	if(sucesso == 's'){
		tratador.open("tratadores.txt");
		for(auto it = tratadores.begin(); it != tratadores.end(); it++){
			tratador << (*it).second;
		}
		tratador.close();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x378, %rsp            # imm = 0x378
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %r13
xorl %ecx, %ecx
leaq -0xa0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq -0x3a0(%rbp), %rdi
callq 0x3350
movq 0x1338e(%rip), %rdi     # 0x30fc8
leaq 0x65e6(%rip), %rsi      # 0x24227
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x1338b(%rip), %rdi     # 0x30fe0
leaq -0x30(%rbp), %rsi
callq 0x3150
leaq -0x30(%rbp), %rsi
movq %r13, %rdi
callq 0x1e6a8
movq %rax, %rbx
leaq 0x8(%r13), %r15
cmpq %r15, %rax
je 0x1df2c
movq 0x13347(%rip), %rdi     # 0x30fc8
leaq 0x65b5(%rip), %rsi      # 0x2423d
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x1332c(%rip), %rdi     # 0x30fc8
leaq 0x6689(%rip), %rsi      # 0x2432c
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x13329(%rip), %rdi     # 0x30fe0
callq 0x3380
movq 0x1331d(%rip), %rdi     # 0x30fe0
leaq -0x70(%rbp), %rsi
callq 0x3060
movq %rbx, -0x48(%rbp)
movq -0x70(%rbp), %rbx
movq -0x68(%rbp), %r14
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x1dcf3
movsbl (%rbx,%r12), %edi
callq 0x33a0
movb %al, (%rbx,%r12)
incq %r12
jmp 0x1dcdb
movq 0x132ce(%rip), %rdi     # 0x30fc8
leaq 0x663b(%rip), %rsi      # 0x2433c
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x132cb(%rip), %rdi     # 0x30fe0
leaq -0x50(%rbp), %rsi
callq 0x3210
movq 0x132a3(%rip), %rdi     # 0x30fc8
leaq 0x5a96(%rip), %rsi      # 0x237c2
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x132a0(%rip), %rdi     # 0x30fe0
leaq -0x38(%rbp), %rsi
callq 0x3150
movq 0x13278(%rip), %rdi     # 0x30fc8
leaq 0x5aa9(%rip), %rsi      # 0x23800
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x13275(%rip), %rdi     # 0x30fe0
callq 0x3380
movq 0x13269(%rip), %rdi     # 0x30fe0
leaq -0x90(%rbp), %rsi
callq 0x3060
movq 0x1323e(%rip), %rdi     # 0x30fc8
leaq 0x5ab9(%rip), %rsi      # 0x2384a
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x1323b(%rip), %rdi     # 0x30fe0
leaq -0x29(%rbp), %rsi
callq 0x3280
movq 0x13213(%rip), %rdi     # 0x30fc8
leaq 0x5ac4(%rip), %rsi      # 0x23880
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x13210(%rip), %rdi     # 0x30fe0
callq 0x3380
movq 0x13204(%rip), %rdi     # 0x30fe0
leaq -0xb0(%rbp), %rsi
callq 0x3060
movq 0x131d9(%rip), %rdi     # 0x30fc8
leaq 0x6573(%rip), %rsi      # 0x24369
callq 0x31f0
movq %rax, %rdi
callq 0x3110
movq 0x131d6(%rip), %rdi     # 0x30fe0
leaq -0x34(%rbp), %rsi
callq 0x3150
movq %r13, -0x40(%rbp)
movl -0x30(%rbp), %ebx
leaq -0x110(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3290
movq -0x50(%rbp), %r12
movl -0x38(%rbp), %r13d
leaq -0xf0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3290
movb -0x29(%rbp), %r14b
leaq -0xd0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3290
movl -0x34(%rbp), %eax
subq $0x8, %rsp
movsbl %r14b, %r10d
leaq -0x1a0(%rbp), %rdi
leaq -0x110(%rbp), %rdx
leaq -0xf0(%rbp), %r9
movl %ebx, %esi
movq %r12, %rcx
movl %r13d, %r8d
pushq %rax
leaq -0xd0(%rbp), %rax
pushq %rax
pushq %r10
callq 0xaf6e
addq $0x20, %rsp
movq -0x48(%rbp), %rdi
addq $0x28, %rdi
leaq -0x1a0(%rbp), %rbx
movq %rbx, %rsi
callq 0x1e192
movq %rbx, %rdi
callq 0x463e
leaq -0xd0(%rbp), %rdi
callq 0x3100
leaq -0xf0(%rbp), %rdi
callq 0x3100
leaq -0x110(%rbp), %rdi
callq 0x3100
leaq 0x5b26(%rip), %rsi      # 0x23a08
leaq -0x3a0(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x3040
movq -0x40(%rbp), %rax
movq 0x18(%rax), %r14
leaq -0x3a0(%rbp), %rbx
cmpq %r15, %r14
je 0x1df1e
leaq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0xb1e6
movq %r14, %rdi
callq 0x3160
movq %rax, %r14
jmp 0x1df00
leaq -0x3a0(%rbp), %rdi
callq 0x32a0
jmp 0x1df47
movq 0x13095(%rip), %rdi     # 0x30fc8
leaq 0x6411(%rip), %rsi      # 0x2434b
callq 0x31f0
movq %rax, %rdi
callq 0x3110
leaq -0x3a0(%rbp), %rdi
callq 0x32e0
leaq -0x90(%rbp), %rdi
callq 0x3100
leaq -0xb0(%rbp), %rdi
callq 0x3100
leaq -0x70(%rbp), %rdi
callq 0x3100
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x3100
jmp 0x1df9a
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x3100
jmp 0x1dfab
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0x3100
jmp 0x1dfc7
jmp 0x1dfc4
movq %rax, %rbx
jmp 0x1dfd3
jmp 0x1dfc4
jmp 0x1dfc4
movq %rax, %rbx
leaq -0x3a0(%rbp), %rdi
callq 0x32e0
leaq -0x90(%rbp), %rdi
callq 0x3100
leaq -0xb0(%rbp), %rdi
callq 0x3100
leaq -0x70(%rbp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x3370