// File: /workspace/github_cpp_makefile_star2_O2/brashi[P]PetFera/src/./banco_dados.cpp
// Function: BancoDados::lerFuncionarios()
void BancoDados::lerFuncionarios() {
    if(!fs::exists(funcArq)) {
        cout << "Arquivo de funcionarios ainda não criado." << endl;
        cout << "Leitura cancelada..." << endl;
        return;
    }
    if(fs::is_empty(funcArq)) {
        cout << "Arquivo de funcionarios vazio." << endl;
        cout << "Leitura cancelada..." << endl;
        return;
    }

    ifstream arqDados(funcArq);
    if(arqDados.bad() || arqDados.fail()){
        throw "Arquivo de funcionarios inexistente ou corrompido.";
    }
    int count = 0;
    string temp;
    string linha;
    string palavra;
    vector<string> tokens;

    while(!arqDados.eof()) {
        tokens.clear();

        getline(arqDados, linha);
        stringstream s(linha);
        while(getline(s, palavra, ';')) {
            tokens.push_back(palavra);
        }

        if(tokens.size()) {
            if(tokens.at(0) == "vet") {
                petshop->adicionarVeterinario(make_shared<Veterinario>(
                    tokens.at(1),
                    tokens.at(2),
                    tokens.at(3),
                    tokens.at(4))
                );
            }
            if(tokens.at(0) == "trt") {
                petshop->adicionarTratador(make_shared<Tratador>(
                    tokens.at(1),
                    tokens.at(2),
                    tokens.at(3),
                    static_cast<Uniforme>(stoi(tokens.at(4)))
                ));
            }
            count++;
        }
    }

    arqDados.close();
    cout << "Arquivo de funcionários carregado com sucesso." << endl;
    cout << "Foram carregados " << count << " funcionários." << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rdi, 0x28(%rsp)
leaq 0x10(%rdi), %rbx
leaq 0xc8(%rsp), %r14
pushq $0x2
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7cce
movq %r14, %rdi
callq 0x7cb2
movl %eax, %ebp
leaq 0xc8(%rsp), %rdi
callq 0x7d36
testb %bpl, %bpl
je 0x6aa0
leaq 0xc8(%rsp), %r14
pushq $0x2
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7cce
movq %r14, %rdi
callq 0x5470
movl %eax, %ebp
leaq 0xc8(%rsp), %rdi
callq 0x7d36
testb %bpl, %bpl
je 0x6ada
movq 0x1f531(%rip), %rbx     # 0x25fc8
leaq 0x10710(%rip), %rsi     # 0x171ae
jmp 0x6aae
movq 0x1f521(%rip), %rbx     # 0x25fc8
leaq 0x106c0(%rip), %rsi     # 0x1716e
movq %rbx, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5160
leaq 0x106d4(%rip), %rsi     # 0x17199
movq %rbx, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5160
jmp 0x6ddf
leaq 0xc8(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x53e0
movq (%r14), %rax
movq -0x18(%rax), %rcx
testb $0x5, 0xe8(%rsp,%rcx)
jne 0x6df1
leaq 0xb8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %esi, %esi
leaq 0x78(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %sil, (%rcx)
movb %sil, (%rdx)
leaq 0x98(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movq $0x0, 0x18(%rsp)
movb %sil, (%rcx)
leaq 0x50(%rsp), %r12
andq $0x0, 0x10(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
leaq 0x68(%rsp), %r14
leaq 0x2d0(%rsp), %r13
leaq 0x88(%rsp), %rbp
pushq $0x3b
popq %rbx
movq -0x18(%rax), %rax
testb $0x2, 0xe8(%rsp,%rax)
jne 0x6d45
movq %r12, %rdi
callq 0x8040
leaq 0xc8(%rsp), %rdi
movq %r14, %rsi
callq 0x5060
movq %r13, %rdi
movq %r14, %rsi
pushq $0x18
popq %rdx
callq 0x53d0
movq %r13, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq 0x5450
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x6bd4
movq %r12, %rdi
movq %rbp, %rsi
callq 0x8048
jmp 0x6bac
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x6d2b
movq %r12, %rdi
xorl %esi, %esi
callq 0x8082
movq %rax, %rdi
leaq 0x10608(%rip), %rsi     # 0x17200
callq 0x8074
testb %al, %al
je 0x6c76
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
pushq $0x1
popq %rsi
callq 0x8082
movq %rax, 0x10(%rsp)
movq %r12, %rdi
pushq $0x2
popq %rsi
callq 0x8082
movq %rax, %r15
movq %r12, %rdi
pushq $0x3
popq %rsi
callq 0x8082
movq %rax, %r14
movq %r12, %rdi
pushq $0x4
popq %rsi
callq 0x8082
leaq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x80a3
movq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xb0ca
leaq 0x48(%rsp), %rdi
callq 0x8466
movq %r12, %rdi
xorl %esi, %esi
callq 0x8082
movq %rax, %rdi
leaq 0x1057a(%rip), %rsi     # 0x17204
callq 0x8074
testb %al, %al
je 0x6d1f
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
pushq $0x1
popq %rsi
callq 0x8082
movq %rax, 0x10(%rsp)
movq %r12, %rdi
pushq $0x2
popq %rsi
callq 0x8082
movq %rax, %r15
movq %r12, %rdi
pushq $0x3
popq %rsi
callq 0x8082
movq %rax, %r14
movq %r12, %rdi
pushq $0x4
popq %rsi
callq 0x8082
movq %rax, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x80f1
movl %eax, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
leaq 0x24(%rsp), %r8
callq 0x80ca
movq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xb0d4
leaq 0x38(%rsp), %rdi
callq 0x8466
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
movq %r13, %rdi
callq 0x51f0
movq 0xc8(%rsp), %rax
leaq 0x68(%rsp), %r14
jmp 0x6b74
leaq 0xc8(%rsp), %rdi
callq 0x5080
movq 0x1f26f(%rip), %rdi     # 0x25fc8
leaq 0x104a8(%rip), %rsi     # 0x17208
callq 0x5270
movq %rax, %rdi
callq 0x5160
movq 0x1f254(%rip), %rdi     # 0x25fc8
leaq 0x104bd(%rip), %rsi     # 0x17238
callq 0x5270
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x5420
leaq 0x102e4(%rip), %rsi     # 0x17078
movq %rax, %rdi
callq 0x5270
movq %rax, %rdi
callq 0x5160
leaq 0x50(%rsp), %rdi
callq 0x810e
leaq 0x88(%rsp), %rdi
callq 0x54c8
leaq 0x68(%rsp), %rdi
callq 0x54c8
leaq 0xa8(%rsp), %rdi
callq 0x54c8
leaq 0xc8(%rsp), %rdi
callq 0x50a0
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x5170
leaq 0x103cd(%rip), %rcx     # 0x171cd
movq %rcx, (%rax)
movq 0x1f1a6(%rip), %rsi     # 0x25fb0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5410
movq %rax, %rbx
jmp 0x6e91
jmp 0x6e1b
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x7d36
jmp 0x6e9e
jmp 0x6e4c
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x6e41
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x8466
jmp 0x6e56
jmp 0x6e53
jmp 0x6e4c
movq %rax, %rbx
jmp 0x6e63
jmp 0x6e53
movq %rax, %rbx
leaq 0x2d0(%rsp), %rdi
callq 0x51f0
leaq 0x50(%rsp), %rdi
callq 0x810e
leaq 0x88(%rsp), %rdi
callq 0x54c8
leaq 0x68(%rsp), %rdi
callq 0x54c8
leaq 0xa8(%rsp), %rdi
callq 0x54c8
leaq 0xc8(%rsp), %rdi
callq 0x50a0
movq %rbx, %rdi
callq 0x5430