// File: /workspace/github_cpp_makefile_star2_O1/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, 0x10(%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x1506
movq %rax, 0x8(%rbx)
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x11b0
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x38(%rsp,%rax)
je 0x156d
movq 0x5aa7(%rip), %rbx      # 0x6fd8
leaq 0x2afc(%rip), %rsi      # 0x4034
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x1130
testq %r15, %r15
je 0x1669
movq %r15, %rdi
callq 0x1090
movq 0x5a7b(%rip), %rdi      # 0x6fd8
movq %r15, %rsi
movq %rax, %rdx
callq 0x1130
jmp 0x1680
movq 0x18(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x38(%rsp,%rax)
jne 0x165d
leaq 0x8(%rsp), %r15
leaq 0x18(%rsp), %r12
movq %rsp, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x10c0
movq 0x18(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x38(%rsp,%rax)
jne 0x165d
movq %r12, %rdi
movq %r15, %rsi
callq 0x10c0
movsd (%rsp), %xmm0
ucomisd 0x2a43(%rip), %xmm0     # 0x4008
jne 0x15d4
jp 0x15d4
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
ucomisd 0x2a26(%rip), %xmm0     # 0x4008
jne 0x15f2
jp 0x15f2
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpb $0x1, 0x8(%r14)
jne 0x1610
movsd 0x8(%rsp), %xmm0
subsd (%rsp), %xmm0
movsd 0x10(%r14), %xmm1
ucomisd %xmm0, %xmm1
jae 0x1649
cmpb $0x1, 0x9(%r14)
jne 0x1624
movsd (%rsp), %xmm0
ucomisd 0x18(%r14), %xmm0
jae 0x1649
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x163e
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x1649
movq %rbx, %rdi
movq %r13, %rdx
callq 0x22a8
movq 0x18(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x38(%rsp,%rax)
je 0x158e
leaq 0x18(%rsp), %rdi
callq 0x1040
jmp 0x16c6
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x1190
movq 0x5951(%rip), %rbx      # 0x6fd8
leaq 0x29c2(%rip), %rsi      # 0x4050
movl $0x2e, %edx
movq %rbx, %rdi
callq 0x1130
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1100
movsbl %al, %esi
movq 0x591f(%rip), %rdi      # 0x6fd8
callq 0x1030
movq %rax, %rdi
callq 0x10d0
leaq 0x18(%rsp), %rdi
callq 0x1050
addq $0x220, %rsp            # imm = 0x220
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x16e3
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x11a0