// File: Cell-veto[P]postlhc/io.cpp
// Function: write_mono_particles_to_stream(std::ostream&, AbstractParticleGenerator&, bool)
static
void write_mono_particles_to_stream (std::ostream &os, AbstractParticleGenerator &source, bool tagged)
{
    if (tagged)
    {
        // sort particles by tag to keep original order
        // also, we'll output displacements
        std::vector <MostGeneralParticle> list;
        MostGeneralParticle part;
        while (source.get (&part))
            list.push_back (part);
        std::sort (list.begin (), list.end (), MostGeneralParticle::by_tag);
        size_t tag = 0;
        for (const auto &p : list)
        {
            if (p.tag != tag++)
                std::cerr << "missing particle with tag " << (tag-1) << ABORT;
            write_mono_particle_to_stream (os, p, true);
        }
    }
    else
    {
        // just write them out in generator order
        MostGeneralParticle part;
        while (source.get (&part))
            write_mono_particle_to_stream (os, part, false);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
je 0x464f31
leaq -0x30(%rbp), %rdi
callq 0x465780
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0x68(%rbp), %rsi
callq *%rax
movb %al, -0xe9(%rbp)
jmp 0x464da6
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x464db2
jmp 0x464ddd
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4657a0
jmp 0x464dc1
jmp 0x464d8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x465970
jmp 0x464f69
leaq -0x30(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x465860
movq -0xf8(%rbp), %rdi
movq %rax, -0x80(%rbp)
callq 0x465890
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
leaq 0xaaa(%rip), %rdx       # 0x4658c0
callq 0x465810
jmp 0x464e1d
movq $0x0, -0x90(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0x465860
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdi
callq 0x465890
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4658f0
testb $0x1, %al
jne 0x464e75
jmp 0x464f26
leaq -0xa0(%rbp), %rdi
callq 0x465930
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x90(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x90(%rbp)
cmpq %rcx, %rax
je 0x464efc
movq $0x698ac0, %rdi         # imm = 0x698AC0
leaq 0x19e577(%rip), %rsi    # 0x603431
callq 0x4e1b60
movq %rax, -0x100(%rbp)
jmp 0x464ec8
movq -0x100(%rbp), %rdi
movq -0x90(%rbp), %rsi
decq %rsi
callq 0x4e2170
movq %rax, -0x108(%rbp)
jmp 0x464ee7
movq -0x108(%rbp), %rdi
leaq 0x23286c(%rip), %rsi    # 0x697761
callq 0x46d700
jmp 0x464efc
movq -0x8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movl $0x1, %edx
callq 0x464f80
jmp 0x464f13
jmp 0x464f15
leaq -0xa0(%rbp), %rdi
callq 0x465950
jmp 0x464e59
leaq -0x30(%rbp), %rdi
callq 0x465970
jmp 0x464f60
jmp 0x464f33
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
leaq -0xe8(%rbp), %rsi
callq *0x10(%rax)
testb $0x1, %al
jne 0x464f4a
jmp 0x464f5e
movq -0x8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
xorl %edx, %edx
callq 0x464f80
jmp 0x464f33
jmp 0x464f60
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x5283c0
nopw %cs:(%rax,%rax)