// File: /workspace/github_cpp_makefile_star2_O2/brashi[P]PetFera/src/./banco_dados.cpp
// Function: BancoDados::salvarFuncionarios()
void BancoDados::salvarFuncionarios() {
    /*if(petshop->getTratadores().size() == 0 && petshop->getVeterinarios().size() == 0) {
        throw "Nenhum funcionário registrado. Geração de arquivo cancelada.";
    } */
    ofstream arqDados(funcArq);

    if(arqDados.bad() || arqDados.fail()) {
        throw "Algo deu errado na criação do arquivo de funcionários.";
    }

    for(auto& vet : petshop->getVeterinarios())
        arqDados << "vet;" << vet->getNome() << ';' << vet->getTelefone() << ';' << vet->getEmail() <<
        ';' << vet->getCRMV() << endl;

    for(auto& trt : petshop->getTratadores())
        arqDados << "trt;" << trt->getNome() << ';' << trt->getTelefone() << ';' << trt->getEmail()
            << ';' << trt->getUniforme() << endl;

    
    arqDados.close();
    if(fs::is_empty(funcArq)) {
        fs::remove(funcArq);
        return;
    }

    cout << "Arquivo de funcionários salvo com sucesso." << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, %r14
leaq 0x10(%rdi), %rsi
leaq 0xb8(%rsp), %rbx
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %rsi, 0x8(%rsp)
callq 0x54a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xd8(%rsp,%rax)
jne 0x60ab
movq %r14, 0x38(%rsp)
movq (%r14), %rsi
leaq 0x60(%rsp), %rdi
callq 0xe8e4
movq 0x60(%rsp), %r13
movq 0x68(%rsp), %rax
movq %rax, (%rsp)
leaq 0x98(%rsp), %rbx
leaq 0x78(%rsp), %r14
leaq 0x40(%rsp), %r15
cmpq (%rsp), %r13
je 0x5f02
leaq 0xb8(%rsp), %rdi
leaq 0x1124c(%rip), %rsi     # 0x17088
callq 0x5270
movq %rax, %r12
movq (%r13), %rsi
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0xfaa2
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5260
movq %rax, %rdi
pushq $0x3b
popq %rsi
callq 0x52e0
movq %rax, %r12
movq (%r13), %rsi
movq %rbx, %rdi
callq 0xfb90
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5260
movq %rax, %rdi
pushq $0x3b
popq %rsi
callq 0x52e0
movq %rax, %r12
movq (%r13), %rsi
movq %r14, %rdi
callq 0xfc7e
movq %r12, %rdi
movq %r14, %rsi
callq 0x5260
movq %rax, %rdi
pushq $0x3b
popq %rsi
callq 0x52e0
movq %rax, %r12
movq (%r13), %rsi
movq %r15, %rdi
callq 0x104ee
movq %r12, %rdi
movq %r15, %rsi
callq 0x5260
movq %rax, %rdi
callq 0x5160
movq %r15, %rdi
callq 0x54c8
movq %r14, %rdi
callq 0x54c8
movq %rbx, %rdi
callq 0x54c8
leaq 0x10(%rsp), %rdi
callq 0x54c8
addq $0x10, %r13
jmp 0x5e23
leaq 0x60(%rsp), %rdi
callq 0x7d84
movq 0x38(%rsp), %rax
movq (%rax), %rsi
leaq 0x40(%rsp), %rdi
callq 0xe8f2
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %rax
movq %rax, (%rsp)
leaq 0x10(%rsp), %r15
pushq $0x3b
popq %rbp
leaq 0x98(%rsp), %r12
leaq 0x78(%rsp), %r13
cmpq (%rsp), %r14
je 0x6006
leaq 0xb8(%rsp), %rdi
leaq 0x11133(%rip), %rsi     # 0x1708d
callq 0x5270
movq %rax, %rbx
movq (%r14), %rsi
movq %r15, %rdi
callq 0xfaa2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5260
movq %rax, %rdi
movl %ebp, %esi
callq 0x52e0
movq %rax, %rbx
movq (%r14), %rsi
movq %r12, %rdi
callq 0xfb90
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5260
movq %rax, %rdi
movl %ebp, %esi
callq 0x52e0
movq %rax, %rbx
movq (%r14), %rsi
movq %r13, %rdi
callq 0xfc7e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5260
movq %rax, %rdi
movl %ebp, %esi
callq 0x52e0
movq %rax, %rbx
movq (%r14), %rdi
callq 0xfeea
movq %rbx, %rdi
movl %eax, %esi
callq 0x5420
movq %rax, %rdi
callq 0x5160
movq %r13, %rdi
callq 0x54c8
movq %r12, %rdi
callq 0x54c8
movq %r15, %rdi
callq 0x54c8
addq $0x10, %r14
jmp 0x5f41
leaq 0x40(%rsp), %rdi
callq 0x7da6
leaq 0xb8(%rsp), %rdi
callq 0x5360
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rdx
movq 0x8(%rsp), %rsi
callq 0x7cce
leaq 0x10(%rsp), %rdi
callq 0x5470
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x7d36
testb %bl, %bl
je 0x6071
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rdx
movq 0x8(%rsp), %rsi
callq 0x7cce
leaq 0x10(%rsp), %rdi
callq 0x5220
leaq 0x10(%rsp), %rdi
callq 0x7d36
jmp 0x608c
movq 0x1ff50(%rip), %rdi     # 0x25fc8
leaq 0x11013(%rip), %rsi     # 0x17092
callq 0x5270
movq %rax, %rdi
callq 0x5160
leaq 0xb8(%rsp), %rdi
callq 0x5390
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x5170
leaq 0x10f94(%rip), %rcx     # 0x1704e
movq %rcx, (%rax)
movq 0x1feec(%rip), %rsi     # 0x25fb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5410
jmp 0x60d2
jmp 0x60ea
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x7d36
jmp 0x618e
jmp 0x60ea
jmp 0x60ea
jmp 0x60ea
movq %rax, %rbx
jmp 0x618e
jmp 0x60f8
jmp 0x6112
jmp 0x610d
movq %rax, %rbx
jmp 0x6184
jmp 0x6108
jmp 0x6126
jmp 0x6147
jmp 0x6135
movq %rax, %rbx
jmp 0x6154
movq %rax, %rbx
jmp 0x616d
movq %rax, %rbx
jmp 0x617a
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x54c8
jmp 0x6129
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x54c8
jmp 0x6138
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x54c8
jmp 0x614a
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x54c8
leaq 0x60(%rsp), %rdi
callq 0x7d84
jmp 0x618e
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x54c8
leaq 0x98(%rsp), %rdi
callq 0x54c8
leaq 0x10(%rsp), %rdi
callq 0x54c8
leaq 0x40(%rsp), %rdi
callq 0x7da6
leaq 0xb8(%rsp), %rdi
callq 0x5390
movq %rbx, %rdi
callq 0x5430
nop