// File: spatialfruitsalad[P]volume2position/label2color.cpp
// Function: main
int main( int argc, char *argv[] )
{

///////////////////////////////
// Parse command line arguments
///////////////////////////////
    if (argc != 5)
    {
        std::cerr << "wrong number of Command line arguments" << std::endl;
        std::cerr << "label2color [inFileName] [nx] [ny] [nz]";
        return 0;
    }

    std::string inFileName = argv[1];

    // the size of the tomogram
    unsigned long  nx = atoi(argv[2]);
    unsigned long  ny = atoi(argv[3]);
    unsigned long  nz = atoi(argv[4]);

///////////////////////////////
// Load Tomogram
///////////////////////////////
    std::cout << "loading tomogram from " << inFileName << std::endl;

    tomogram3d<uint16_t> original;
    original.read_raw(inFileName, "uint16_t", nx, ny, nz);

    std::cout << "tomogram successfully loaded" << std::endl;
    
    original.write_ppm(inFileName + "_51.ppm", 51);    
    original.write_ppm(inFileName + "_100.ppm", 100);    
    original.write_ppm(inFileName + "_255.ppm", 255);    
    original.write_ppm(inFileName + "_400.ppm", 400);    

    
    return 0;
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movl $0x0, 0x184(%rsp)
movl %edi, 0x180(%rsp)
movq %rsi, 0x178(%rsp)
cmpl $0x5, 0x180(%rsp)
je 0x2520
movq 0x7b06(%rip), %rdi      # 0x9fe8
leaq 0x4ba7(%rip), %rsi      # 0x7090
callq 0x21e0
movq %rax, %rdi
movq 0x7aa8(%rip), %rsi      # 0x9fa0
callq 0x2200
movq 0x7ae4(%rip), %rdi      # 0x9fe8
leaq 0x4bac(%rip), %rsi      # 0x70b7
callq 0x21e0
movl $0x0, 0x184(%rsp)
jmp 0x2950
movq 0x178(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
leaq 0x157(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x2330
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq 0x158(%rsp), %rdi
callq 0x2240
jmp 0x255c
leaq 0x157(%rsp), %rdi
callq 0x2210
movq 0x178(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x22a0
cltq
movq %rax, 0x138(%rsp)
movq 0x178(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x22a0
cltq
movq %rax, 0x130(%rsp)
movq 0x178(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x22a0
cltq
movq %rax, 0x128(%rsp)
movq 0x79ff(%rip), %rdi      # 0x9fc0
leaq 0x4b17(%rip), %rsi      # 0x70df
callq 0x21e0
movq %rax, 0x18(%rsp)
jmp 0x25d4
movq 0x18(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x21c0
movq %rax, 0x10(%rsp)
jmp 0x25ed
movq 0x10(%rsp), %rdi
movq 0x79a7(%rip), %rsi      # 0x9fa0
callq 0x2200
jmp 0x2600
leaq 0xf8(%rsp), %rdi
callq 0x2be0
leaq 0xd8(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x2100
jmp 0x2624
leaq 0xb7(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x2330
movq 0x8(%rsp), %rdx
leaq 0x4ab4(%rip), %rsi      # 0x70f6
leaq 0xb8(%rsp), %rdi
callq 0x2240
jmp 0x2651
movq 0x138(%rsp), %rcx
movq 0x130(%rsp), %r8
movq 0x128(%rsp), %r9
leaq 0xf8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0x2bf0
jmp 0x2688
leaq 0xb8(%rsp), %rdi
callq 0x2378
leaq 0xb7(%rsp), %rdi
callq 0x2210
leaq 0xd8(%rsp), %rdi
callq 0x2378
movq 0x790a(%rip), %rdi      # 0x9fc0
leaq 0x4a42(%rip), %rsi      # 0x70ff
callq 0x21e0
movq %rax, (%rsp)
jmp 0x26c8
movq (%rsp), %rdi
movq 0x78cd(%rip), %rsi      # 0x9fa0
callq 0x2200
jmp 0x26da
leaq 0x4a3b(%rip), %rdx      # 0x711c
leaq 0x90(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x3c70
jmp 0x26f8
leaq 0xf8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movl $0x33, %edx
callq 0x3410
jmp 0x2714
leaq 0x90(%rsp), %rdi
callq 0x2378
leaq 0x49fc(%rip), %rdx      # 0x7124
leaq 0x70(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x3c70
jmp 0x273c
leaq 0xf8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movl $0x64, %edx
callq 0x3410
jmp 0x2755
leaq 0x70(%rsp), %rdi
callq 0x2378
leaq 0x49c7(%rip), %rdx      # 0x712d
leaq 0x50(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x3c70
jmp 0x277a
leaq 0xf8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0xff, %edx
callq 0x3410
jmp 0x2793
leaq 0x50(%rsp), %rdi
callq 0x2378
leaq 0x4992(%rip), %rdx      # 0x7136
leaq 0x30(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x3c70
jmp 0x27b8
leaq 0xf8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movl $0x190, %edx            # imm = 0x190
callq 0x3410
jmp 0x27d1
leaq 0x30(%rsp), %rdi
callq 0x2378
movl $0x0, 0x184(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x3d00
leaq 0x158(%rsp), %rdi
callq 0x2378
jmp 0x2950
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x157(%rsp), %rdi
callq 0x2210
jmp 0x295f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0x2941
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0x2934
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0x2894
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x2378
leaq 0xb7(%rsp), %rdi
callq 0x2210
leaq 0xd8(%rsp), %rdi
callq 0x2378
jmp 0x2934
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x2378
jmp 0x2934
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x2378
jmp 0x2934
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x2378
jmp 0x2934
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x2378
leaq 0xf8(%rsp), %rdi
callq 0x3d00
leaq 0x158(%rsp), %rdi
callq 0x2378
jmp 0x295f
movl 0x184(%rsp), %eax
addq $0x188, %rsp            # imm = 0x188
retq
movq 0x148(%rsp), %rdi
callq 0x2320
nopl (%rax)