// File: Cell-veto[P]postlhc/io.cpp
// Function: save_data(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, AbstractParticleGenerator&, bool)
static
void save_data (string_ref filename, AbstractParticleGenerator &source, bool tagged)
{
    if (ends_with (filename, ".dat"))
    {
        std::ofstream ofs (filename + ".tmp");
        ofs.precision (15);

        try
        {
            if (!ofs)
                throw IoError ();

            write_mono_particles_to_stream (ofs, source, tagged);
            ofs.close ();

            if (!ofs)
                throw IoError ();
        }
        catch (IoError)
        {
            // try to unlink temporary file if writing failed
            remove_file (filename + ".tmp", true);
            rt_error ("error writing to file " + filename + ".tmp");
        }

        rename_file (filename + ".tmp", filename);
    }
    else
    {
        rt_error ("Not implemented");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x196b81(%rip), %rsi    # 0x5fb536
callq 0x465140
testb $0x1, %al
jne 0x4649c3
jmp 0x464cc1
movq -0x8(%rbp), %rsi
leaq 0x19ea47(%rip), %rdx    # 0x603415
leaq -0x238(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0x408110
movq -0x2f8(%rbp), %rsi
leaq -0x218(%rbp), %rdi
movl $0x10, %edx
callq 0x4be200
jmp 0x4649fb
leaq -0x238(%rbp), %rdi
callq 0x4f1e40
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
movl $0xf, %esi
callq 0x4133d0
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x4c2500
movb %al, -0x2f9(%rbp)
jmp 0x464a44
movb -0x2f9(%rbp), %al
testb $0x1, %al
jne 0x464a53
jmp 0x464b44
movl $0x1, %edi
callq 0x475060
movq %rax, %rdi
leaq 0x228c41(%rip), %rsi    # 0x68d6a8
xorl %eax, %eax
movl %eax, %edx
callq 0x4760b0
jmp 0x464d5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x4f1e40
jmp 0x464d47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
movl -0x244(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x464cb0
movq -0x240(%rbp), %rdi
callq 0x4751c0
movq -0x8(%rbp), %rsi
leaq 0x19e941(%rip), %rdx    # 0x603415
leaq -0x268(%rbp), %rdi
callq 0x408110
jmp 0x464ae2
leaq -0x268(%rbp), %rdi
movl $0x1, %esi
callq 0x46d530
jmp 0x464af5
leaq -0x268(%rbp), %rdi
callq 0x4f1e40
movq -0x8(%rbp), %rdx
leaq 0x19e90e(%rip), %rsi    # 0x60341a
leaq -0x2a8(%rbp), %rdi
callq 0x407fd0
jmp 0x464b1a
leaq 0x19e8f4(%rip), %rdx    # 0x603415
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x409770
jmp 0x464b36
leaq -0x288(%rbp), %rdi
callq 0x46d330
jmp 0x464b44
movq -0x10(%rbp), %rsi
movzbl -0x11(%rbp), %edx
andl $0x1, %edx
leaq -0x218(%rbp), %rdi
callq 0x464d60
jmp 0x464b5d
leaq -0x218(%rbp), %rdi
callq 0x4bea50
jmp 0x464b6b
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x4c2500
movb %al, -0x2fa(%rbp)
jmp 0x464b8b
movb -0x2fa(%rbp), %al
testb $0x1, %al
jne 0x464b97
jmp 0x464bb9
movl $0x1, %edi
callq 0x475060
movq %rax, %rdi
leaq 0x228afd(%rip), %rsi    # 0x68d6a8
xorl %eax, %eax
movl %eax, %edx
callq 0x4760b0
jmp 0x464d5b
jmp 0x464c36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x464c2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x4f1e40
jmp 0x464c2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x464c21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x4f1e40
leaq -0x2a8(%rbp), %rdi
callq 0x4f1e40
callq 0x475230
jmp 0x464c34
jmp 0x464cb0
movq -0x8(%rbp), %rsi
leaq 0x19e7d4(%rip), %rdx    # 0x603415
leaq -0x2c8(%rbp), %rdi
callq 0x408110
jmp 0x464c4f
movq -0x8(%rbp), %rsi
leaq -0x2c8(%rbp), %rdi
callq 0x46d3f0
jmp 0x464c61
leaq -0x2c8(%rbp), %rdi
callq 0x4f1e40
leaq -0x218(%rbp), %rdi
callq 0x4bec80
jmp 0x464d3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x464cb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x4f1e40
leaq -0x218(%rbp), %rdi
callq 0x4bec80
jmp 0x464d47
leaq -0x2e9(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x4771f0
movq -0x308(%rbp), %rdx
leaq 0x19e6b9(%rip), %rsi    # 0x60339b
leaq -0x2e8(%rbp), %rdi
callq 0x407bd0
jmp 0x464cf0
leaq -0x2e8(%rbp), %rdi
callq 0x46d330
jmp 0x464cfe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
jmp 0x464d30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x240(%rbp)
movl %eax, -0x244(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x4f1e40
leaq -0x2e9(%rbp), %rdi
callq 0x477210
jmp 0x464d47
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
movq -0x240(%rbp), %rdi
callq 0x5283c0
movq %rax, %rdi
callq 0x4082e0
nopl (%rax,%rax)