// File: /workspace/github_cpp_makefile_star2_O3/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
movl 0x38(%rsp,%rax), %eax
testb $0x5, %al
je 0x156e
movq 0x5aa6(%rip), %rbx      # 0x6fd8
leaq 0x2b2b(%rip), %rsi      # 0x4064
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x1130
testq %r15, %r15
je 0x1652
movq %r15, %rdi
callq 0x1090
movq 0x5a7a(%rip), %rdi      # 0x6fd8
movq %r15, %rsi
movq %rax, %rdx
callq 0x1130
jmp 0x1669
testb $0x2, %al
jne 0x1646
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 0x1646
movq %r12, %rdi
movq %r15, %rsi
callq 0x10c0
movsd (%rsp), %xmm0
ucomisd 0x2a4e(%rip), %xmm0     # 0x4008
jne 0x15c9
jp 0x15c9
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm1
ucomisd 0x2a31(%rip), %xmm1     # 0x4008
jne 0x15e7
jp 0x15e7
movsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x8(%rsp)
cmpb $0x1, 0x8(%r14)
jne 0x15fe
subsd %xmm0, %xmm1
movsd 0x10(%r14), %xmm2
ucomisd %xmm1, %xmm2
jae 0x1632
cmpb $0x1, 0x9(%r14)
jne 0x160d
ucomisd 0x18(%r14), %xmm0
jae 0x1632
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x1627
movupd (%rsp), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x1632
movq %rbx, %rdi
movq %r13, %rdx
callq 0x2294
movq 0x18(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x38(%rsp,%rax)
je 0x1583
leaq 0x18(%rsp), %rdi
callq 0x1040
jmp 0x16af
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x1190
movq 0x5968(%rip), %rbx      # 0x6fd8
leaq 0x2a09(%rip), %rsi      # 0x4080
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 0x5936(%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 0x16cc
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x11a0
nop