// File: /workspace/github_cpp_makefile_star2_O2/kelvinabrokwa[P]bottleneck/./CBottleneckDistance.cpp
// Function: CBottleneckDistance::LoadGeneratorsFromFile(char const*, std::vector<Generator, std::allocator<Generator>>&, double)
void CBottleneckDistance::LoadGeneratorsFromFile(
        const char* fileName, std::vector<Generator> &generators, double maxLevel)
{

    Generator gen;

    // erase generators
    generators.clear();

    // Open the file
    std::ifstream infile(fileName,  std::ifstream::in);

    //Test if the file was sucssefuly opened
    if (!infile) {
        std::cout
            << " Unable to open input file "
            << fileName
            << ". I'll work with an empty persistence diagram!"
            << std::endl;
        return;
    }

    // Read the generators from the file
    while (!infile.eof()) {
        // reads one line of the file
        infile >> gen.birth;

        // Just in case that files ends in a strange way
        if (infile.eof())
            break;
        infile >> gen.death;

        // Encorporate Vidits standard that the generator which lives till the end dies at -1
        if (gen.birth == -1)
            gen.birth = maxLevel;
        if (gen.death == -1)
            gen.death = maxLevel;

        // Test if generator should be included (length of life spam plus birth)
        if (NeglectShortGenerators && (gen.death - gen.birth <= NeglectSize))
            continue;
        if (NeglectLastGenerators && (gen.birth >=  NeglectBornAfter))
            continue;

        generators.push_back(gen);
    }

    // Close the file
    infile.close();

    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x220, %rsp            # imm = 0x220
movsd %xmm0, (%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x13d9
movq %rax, 0x8(%rbx)
leaq 0x18(%rsp), %r12
pushq $0x8
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x1160
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x38(%rsp,%rax)
je 0x1435
movq 0x5bd6(%rip), %rdi      # 0x6fd8
leaq 0x2c2b(%rip), %rsi      # 0x4034
callq 0x10d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x10d0
leaq 0x2c30(%rip), %rsi      # 0x4050
movq %rax, %rdi
callq 0x10d0
movq %rax, %rdi
callq 0x1080
jmp 0x14fc
leaq 0x10(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r13
testb $0x2, 0x38(%rsp,%rax)
jne 0x14f2
movq %r12, %rdi
movq %r13, %rsi
callq 0x10a0
movq 0x18(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x38(%rsp,%rax)
jne 0x14f2
movq %r12, %rdi
movq %r15, %rsi
callq 0x10a0
movsd 0x8(%rsp), %xmm0
ucomisd 0x2b81(%rip), %xmm0     # 0x4008
jne 0x1496
jp 0x1496
movsd (%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm1
ucomisd 0x2b64(%rip), %xmm1     # 0x4008
jne 0x14b3
jp 0x14b3
movsd (%rsp), %xmm1
movsd %xmm1, 0x10(%rsp)
cmpb $0x1, 0x8(%r14)
jne 0x14ca
subsd %xmm0, %xmm1
movsd 0x10(%r14), %xmm2
ucomisd %xmm1, %xmm2
jae 0x14e4
cmpb $0x1, 0x9(%r14)
jne 0x14d9
ucomisd 0x18(%r14), %xmm0
jae 0x14e4
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1c2e
movq 0x18(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x1444
leaq 0x18(%rsp), %rdi
callq 0x1030
leaq 0x18(%rsp), %rdi
callq 0x1040
addq $0x220, %rsp            # imm = 0x220
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x1519
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x1150