// File: Cell-veto[P]postlhc/io.cpp
// Function: add_data(AbstractParticleSink*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void add_data (AbstractParticleSink *sink, string_ref filename)
{
    Extrema <double> particle_coords[MAX_DIM];

    if (ends_with (filename, ".dat"))
    {
        std::ifstream ifs (filename);
        unsigned N = 0;
        string line;
        while (std::getline (ifs, line))
        {
            MostGeneralParticle part = parse_line_from_file (N, line);
            for (unsigned n = 0; n != MAX_DIM; ++n)
                particle_coords[n].add (part.coords[n]);
            sink->put (part);
            ++N;
        }

        if (ifs.eof ())
        {
            std::cerr << "npart " << N << " particles read successfully\n";
            std::cerr << "coord_min";
            for (unsigned n = 0; n != MAX_DIM; ++n)
                std::cerr << ' ' << particle_coords[n].min ();
            std::cerr << "\ncoord_max";
            for (unsigned n = 0; n != MAX_DIM; ++n)
                std::cerr << ' ' << particle_coords[n].max ();
            std::cerr << "\n";
            return;
        }

        if (!ifs)
        {
            rt_error ("error reading input file " + filename);
        }
    }
    else
    {
        rt_error ("Not implemented");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3b0, %rsp            # imm = 0x3B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x48, %rcx
movq %rcx, -0x340(%rbp)
movq %rax, -0x338(%rbp)
movq -0x338(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x465120
movq -0x348(%rbp), %rax
movq -0x340(%rbp), %rcx
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x338(%rbp)
jne 0x46401c
movq -0x10(%rbp), %rdi
leaq 0x1974de(%rip), %rsi    # 0x5fb536
callq 0x465140
testb $0x1, %al
jne 0x464066
jmp 0x46440b
movq -0x10(%rbp), %rsi
leaq -0x268(%rbp), %rdi
movl $0x8, %edx
callq 0x4be090
movl $0x0, -0x26c(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x4f1d30
leaq -0x268(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x4f4690
movq %rax, -0x350(%rbp)
jmp 0x4640ad
movq -0x350(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x4c24f0
movb %al, -0x351(%rbp)
jmp 0x4640cb
movb -0x351(%rbp), %al
testb $0x1, %al
jne 0x4640da
jmp 0x464191
movl -0x26c(%rbp), %esi
leaq -0x2d8(%rbp), %rdi
leaq -0x290(%rbp), %rdx
callq 0x4644a0
jmp 0x4640f5
movl $0x0, -0x2dc(%rbp)
cmpl $0x3, -0x2dc(%rbp)
je 0x464167
movl -0x2dc(%rbp), %eax
movl %eax, %esi
leaq (%rsi,%rsi,2), %rax
leaq -0x60(%rbp,%rax,8), %rax
movq %rax, -0x360(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x419310
movq -0x360(%rbp), %rdi
movq %rax, %rsi
callq 0x465170
jmp 0x46413d
jmp 0x46413f
movl -0x2dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2dc(%rbp)
jmp 0x4640ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0x4643ee
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0x2d8(%rbp), %rsi
callq *%rax
jmp 0x46417d
movl -0x26c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x26c(%rbp)
jmp 0x464091
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x268(%rbp,%rax), %rdi
callq 0x4c25a0
movb %al, -0x361(%rbp)
jmp 0x4641b1
movb -0x361(%rbp), %al
testb $0x1, %al
jne 0x4641c0
jmp 0x464343
movq $0x698ac0, %rdi         # imm = 0x698AC0
leaq 0x19f179(%rip), %rsi    # 0x603347
callq 0x4e1b60
movq %rax, -0x370(%rbp)
jmp 0x4641dc
movq -0x370(%rbp), %rdi
movl -0x26c(%rbp), %esi
callq 0x4e2190
movq %rax, -0x378(%rbp)
jmp 0x4641f7
movq -0x378(%rbp), %rdi
leaq 0x19f149(%rip), %rsi    # 0x60334e
callq 0x4e1b60
jmp 0x46420c
movq $0x698ac0, %rdi         # imm = 0x698AC0
leaq 0x19f152(%rip), %rsi    # 0x60336c
callq 0x4e1b60
jmp 0x464221
movl $0x0, -0x2e0(%rbp)
cmpl $0x3, -0x2e0(%rbp)
je 0x464297
movq $0x698ac0, %rdi         # imm = 0x698AC0
movl $0x20, %esi
callq 0x4e1a90
movq %rax, -0x380(%rbp)
jmp 0x46424e
movl -0x2e0(%rbp), %eax
leaq (%rax,%rax,2), %rax
leaq -0x60(%rbp,%rax,8), %rdi
callq 0x4651f0
movq %rax, -0x388(%rbp)
jmp 0x46426b
movq -0x380(%rbp), %rdi
movq -0x388(%rbp), %rax
movsd (%rax), %xmm0
callq 0x4e2ad0
jmp 0x464284
jmp 0x464286
movl -0x2e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2e0(%rbp)
jmp 0x46422b
movq $0x698ac0, %rdi         # imm = 0x698AC0
leaq 0x19f0d1(%rip), %rsi    # 0x603376
callq 0x4e1b60
jmp 0x4642ac
movl $0x0, -0x2e4(%rbp)
cmpl $0x3, -0x2e4(%rbp)
je 0x464322
movq $0x698ac0, %rdi         # imm = 0x698AC0
movl $0x20, %esi
callq 0x4e1a90
movq %rax, -0x390(%rbp)
jmp 0x4642d9
movl -0x2e4(%rbp), %eax
leaq (%rax,%rax,2), %rax
leaq -0x60(%rbp,%rax,8), %rdi
callq 0x465200
movq %rax, -0x398(%rbp)
jmp 0x4642f6
movq -0x390(%rbp), %rdi
movq -0x398(%rbp), %rax
movsd (%rax), %xmm0
callq 0x4e2ad0
jmp 0x46430f
jmp 0x464311
movl -0x2e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2e4(%rbp)
jmp 0x4642b6
movq $0x698ac0, %rdi         # imm = 0x698AC0
leaq 0x1aa0da(%rip), %rsi    # 0x60e40a
callq 0x4e1b60
jmp 0x464337
movl $0x1, -0x2e8(%rbp)
jmp 0x4643c0
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x268(%rbp,%rax), %rdi
callq 0x4c2500
movb %al, -0x399(%rbp)
jmp 0x464363
movb -0x399(%rbp), %al
testb $0x1, %al
jne 0x46436f
jmp 0x4643b6
movq -0x10(%rbp), %rdx
leaq 0x19f007(%rip), %rsi    # 0x603381
leaq -0x308(%rbp), %rdi
callq 0x407fd0
jmp 0x464388
leaq -0x308(%rbp), %rdi
callq 0x46d330
jmp 0x464396
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x4f1e40
jmp 0x4643ee
movl $0x0, -0x2e8(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x4f1e40
leaq -0x268(%rbp), %rdi
callq 0x4bedc0
movl -0x2e8(%rbp), %eax
testl %eax, %eax
je 0x4643e9
jmp 0x4643e4
jmp 0x464488
jmp 0x464488
leaq -0x290(%rbp), %rdi
callq 0x4f1e40
leaq -0x268(%rbp), %rdi
callq 0x4bedc0
jmp 0x464491
leaq -0x329(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x4771f0
movq -0x3a8(%rbp), %rdx
leaq 0x19ef6f(%rip), %rsi    # 0x60339b
leaq -0x328(%rbp), %rdi
callq 0x407bd0
jmp 0x46443a
leaq -0x328(%rbp), %rdi
callq 0x46d330
jmp 0x464448
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0x46447a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x4f1e40
leaq -0x329(%rbp), %rdi
callq 0x477210
jmp 0x464491
addq $0x3b0, %rsp            # imm = 0x3B0
popq %rbp
retq
movq -0x298(%rbp), %rdi
callq 0x5283c0
nopl (%rax)