// File: spatialfruitsalad[P]volume2position/./common.hpp
// Function: void WriteImages<unsigned short>(tomogram3d<unsigned short>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long, bool)
inline void WriteImages(tomogram3d<VALUE>& t, std::string path, std::string name, unsigned long nz, bool randomcolors = false)
{
    unsigned long sliceTenPercent = nz/10;
    unsigned long sliceFiftyPercent = nz/2;
    unsigned long sliceNinetyPercent = nz - sliceTenPercent;

    std::string Tenstring = path +    std::to_string(sliceTenPercent)   + "_" + name  + ((randomcolors)? ".ppm" : ".pgm");
    std::string Fiftystring = path +  std::to_string(sliceFiftyPercent) + "_" + name  + ((randomcolors)? ".ppm" : ".pgm");
    std::string Ninetystring = path + std::to_string(sliceNinetyPercent)+ "_" + name  + ((randomcolors)? ".ppm" : ".pgm");

    if(randomcolors)
    {
        t.write_ppm(Tenstring, sliceTenPercent);
        t.write_ppm(Fiftystring, sliceFiftyPercent);
        t.write_ppm(Ninetystring, sliceNinetyPercent);
    }
    else
    {
        t.write_pgm(Tenstring, sliceTenPercent);
        t.write_pgm(Fiftystring, sliceFiftyPercent);
        t.write_pgm(Ninetystring, sliceNinetyPercent);
    }
}

// Assembly:
subq $0x358, %rsp            # imm = 0x358
movq %rdx, 0x50(%rsp)
movq %rsi, 0x58(%rsp)
movb %r8b, %al
movq %rdi, 0x350(%rsp)
movq %rsi, 0x348(%rsp)
movq %rdx, 0x340(%rsp)
movq %rcx, 0x338(%rsp)
andb $0x1, %al
movb %al, 0x337(%rsp)
movq 0x338(%rsp), %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rcx
shrq $0x3, %rdx
movq %rdx, 0x328(%rsp)
movq 0x338(%rsp), %rax
shrq %rax
movq %rax, 0x320(%rsp)
movq 0x338(%rsp), %rax
movq 0x328(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x318(%rsp)
movq 0x328(%rsp), %rsi
leaq 0x278(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x11080
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x298(%rsp), %rdi
callq 0x1aa50
jmp 0x6a7f
leaq 0x21e30(%rip), %rdx     # 0x288b6
leaq 0x2b8(%rsp), %rdi
leaq 0x298(%rsp), %rsi
callq 0xf900
jmp 0x6a9d
movq 0x50(%rsp), %rdx
leaq 0x2d8(%rsp), %rdi
leaq 0x2b8(%rsp), %rsi
callq 0x1aa00
jmp 0x6ab9
testb $0x1, 0x337(%rsp)
je 0x6ad1
leaq 0x21dee(%rip), %rax     # 0x288b8
movq %rax, 0x48(%rsp)
jmp 0x6adf
leaq 0x21de5(%rip), %rax     # 0x288bd
movq %rax, 0x48(%rsp)
jmp 0x6adf
movq 0x48(%rsp), %rdx
leaq 0x2f8(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
callq 0xf900
jmp 0x6afb
leaq 0x2d8(%rsp), %rdi
callq 0x3538
leaq 0x2b8(%rsp), %rdi
callq 0x3538
leaq 0x298(%rsp), %rdi
callq 0x3538
leaq 0x278(%rsp), %rdi
callq 0x3538
movq 0x320(%rsp), %rsi
leaq 0x1c8(%rsp), %rdi
callq 0x11080
jmp 0x6b46
movq 0x58(%rsp), %rsi
leaq 0x1e8(%rsp), %rdi
leaq 0x1c8(%rsp), %rdx
callq 0x1aa50
jmp 0x6b62
leaq 0x21d4d(%rip), %rdx     # 0x288b6
leaq 0x208(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0xf900
jmp 0x6b80
movq 0x50(%rsp), %rdx
leaq 0x228(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x1aa00
jmp 0x6b9c
testb $0x1, 0x337(%rsp)
je 0x6bb4
leaq 0x21d0b(%rip), %rax     # 0x288b8
movq %rax, 0x40(%rsp)
jmp 0x6bc2
leaq 0x21d02(%rip), %rax     # 0x288bd
movq %rax, 0x40(%rsp)
jmp 0x6bc2
movq 0x40(%rsp), %rdx
leaq 0x248(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0xf900
jmp 0x6bde
leaq 0x228(%rsp), %rdi
callq 0x3538
leaq 0x208(%rsp), %rdi
callq 0x3538
leaq 0x1e8(%rsp), %rdi
callq 0x3538
leaq 0x1c8(%rsp), %rdi
callq 0x3538
movq 0x318(%rsp), %rsi
leaq 0x128(%rsp), %rdi
callq 0x11080
jmp 0x6c29
movq 0x58(%rsp), %rsi
leaq 0x148(%rsp), %rdi
leaq 0x128(%rsp), %rdx
callq 0x1aa50
jmp 0x6c45
leaq 0x21c6a(%rip), %rdx     # 0x288b6
leaq 0x168(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0xf900
jmp 0x6c63
movq 0x50(%rsp), %rdx
leaq 0x188(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x1aa00
jmp 0x6c7f
testb $0x1, 0x337(%rsp)
je 0x6c97
leaq 0x21c28(%rip), %rax     # 0x288b8
movq %rax, 0x38(%rsp)
jmp 0x6ca5
leaq 0x21c1f(%rip), %rax     # 0x288bd
movq %rax, 0x38(%rsp)
jmp 0x6ca5
movq 0x38(%rsp), %rdx
leaq 0x1a8(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0xf900
jmp 0x6cc1
leaq 0x188(%rsp), %rdi
callq 0x3538
leaq 0x168(%rsp), %rdi
callq 0x3538
leaq 0x148(%rsp), %rdi
callq 0x3538
leaq 0x128(%rsp), %rdi
callq 0x3538
testb $0x1, 0x337(%rsp)
je 0x7059
movq 0x350(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x108(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x3120
jmp 0x6d27
movq 0x30(%rsp), %rdi
movq 0x328(%rsp), %rdx
leaq 0x108(%rsp), %rsi
callq 0x1fa40
jmp 0x6d43
leaq 0x108(%rsp), %rdi
callq 0x3538
movq 0x350(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x3120
jmp 0x6d74
movq 0x28(%rsp), %rdi
movq 0x320(%rsp), %rdx
leaq 0xe8(%rsp), %rsi
callq 0x1fa40
jmp 0x6d90
leaq 0xe8(%rsp), %rdi
callq 0x3538
movq 0x350(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x3120
jmp 0x6dc1
movq 0x20(%rsp), %rdi
movq 0x318(%rsp), %rdx
leaq 0xc8(%rsp), %rsi
callq 0x1fa40
jmp 0x6ddd
leaq 0xc8(%rsp), %rdi
callq 0x3538
jmp 0x719f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6e6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6e5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6e52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x2d8(%rsp), %rdi
callq 0x3538
leaq 0x2b8(%rsp), %rdi
callq 0x3538
leaq 0x298(%rsp), %rdi
callq 0x3538
leaq 0x278(%rsp), %rdi
callq 0x3538
jmp 0x71f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x71e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6f14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6f07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6efa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x228(%rsp), %rdi
callq 0x3538
leaq 0x208(%rsp), %rdi
callq 0x3538
leaq 0x1e8(%rsp), %rdi
callq 0x3538
leaq 0x1c8(%rsp), %rdi
callq 0x3538
jmp 0x71e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x71db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6fbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6faf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x6fa2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x3538
leaq 0x168(%rsp), %rdi
callq 0x3538
leaq 0x148(%rsp), %rdi
callq 0x3538
leaq 0x128(%rsp), %rdi
callq 0x3538
jmp 0x71db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0x71ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x108(%rsp), %rdi
callq 0x3538
jmp 0x71ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x3538
jmp 0x71ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x3538
jmp 0x71ce
movq 0x350(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x3120
jmp 0x707d
movq 0x18(%rsp), %rdi
movq 0x328(%rsp), %rdx
leaq 0xa8(%rsp), %rsi
callq 0x202c0
jmp 0x7099
leaq 0xa8(%rsp), %rdi
callq 0x3538
movq 0x350(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x3120
jmp 0x70ca
movq 0x10(%rsp), %rdi
movq 0x320(%rsp), %rdx
leaq 0x88(%rsp), %rsi
callq 0x202c0
jmp 0x70e6
leaq 0x88(%rsp), %rdi
callq 0x3538
movq 0x350(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x3120
jmp 0x7114
movq 0x8(%rsp), %rdi
movq 0x318(%rsp), %rdx
leaq 0x68(%rsp), %rsi
callq 0x202c0
jmp 0x712d
leaq 0x68(%rsp), %rdi
callq 0x3538
jmp 0x719f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x3538
jmp 0x71ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x3538
jmp 0x71ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x3538
jmp 0x71ce
leaq 0x1a8(%rsp), %rdi
callq 0x3538
leaq 0x248(%rsp), %rdi
callq 0x3538
leaq 0x2f8(%rsp), %rdi
callq 0x3538
addq $0x358, %rsp            # imm = 0x358
retq
leaq 0x1a8(%rsp), %rdi
callq 0x3538
leaq 0x248(%rsp), %rdi
callq 0x3538
leaq 0x2f8(%rsp), %rdi
callq 0x3538
movq 0x270(%rsp), %rdi
callq 0x34a0
nopw %cs:(%rax,%rax)
nopl (%rax)