// File: /workspace/github_cpp_makefile_star2_O2/spatialfruitsalad[P]volume2position/./watershed_segmentation.hpp
// Function: watershedSegmentation::Process(tomogram3d<unsigned char>&, tomogram3d<int>&, float, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
static void Process (tomogram3d<uint8_t>& binary,  tomogram3d<int>& out, float erosion_depth, std::string imagefoldername, int minimumCluster= 50000)
    {
        std::cout << "start segmentation ... " << std::endl;
        int nx = binary.get_sx();
        int ny = binary.get_sy();
        int nz = binary.get_sz();

        std::cout << "calculate edm" << std::endl;

        tomogram3d<float> edm;
        edm::create_edm(binary, edm);

        std::cout << "sqrt edm ..." << std::flush;
        for (int z = 0; z<nz; z++)
        for (int y = 0; y<ny; y++)
        for (int x = 0; x<nx; x++){
            float value = sqrt( edm.get(x,y,z) );
            edm.set(x,y,z,value);
        }
        std::cout << " done" << std::endl;

        // erodate binary image so particles don't overlap anymore. erosiondepth has to be chosen respectively
        tomogram3d<uint8_t> erodated_binary = binary;
        Erodate::erodate_binary_sphere(erodated_binary, edm, erosion_depth);
        WriteImages(erodated_binary, imagefoldername, "5_erosion", nz);
        
        // filter edm for smoother look
        gaussFilter::gauss_filter_mask_5(edm , 5, 0.8);
        
        WriteImages(edm, imagefoldername, "6_edm", nz);

        // identify individual clusters
        HoshenKopelman::Process(erodated_binary, out);
        erodated_binary.clear();
        // rename vector for HoshenKopelman
        std::vector <int> rename;

        rename.clear ();
        rename.push_back(0);

        // find max
        int ellipsoid_number = out.find_max();
        std::cout << "ellipsoid_number = " << ellipsoid_number << std::endl;
        for (int i = 1; i<= ellipsoid_number; i++)
            rename.push_back(i);

        // label previously eroded voxels
        int init = ellipsoid_number;
        for (int k = 0; k != nz; ++k)
            for (int j = 0; j != ny; ++j)
                for (int i = 0; i != nx; ++i)
                    if (binary.get(i,j,k) == 1 && out.get(i,j,k) == 0)
                    {
                        out.set (i, j, k, init);
                        rename.push_back(init);
                        init++;
                    }
    
        // check for slope in filtered edm
        for (int k = 0; k != nz; ++k)
        {
            for (int j = 0; j != ny; ++j)
            for (int i = 0; i != nx; ++i)
            {
                if (binary.get(i,j,k) == 1 && out.get(i,j,k) > ellipsoid_number)
                {
                    int imin = std::max (i-1, 0);
                    int imax = std::min (i+1, int (nx-1));
                    int jmin = std::max (j-1, 0);
                    int jmax = std::min (j+1, int (ny-1));
                    int kmin = std::max (k-1, 0);
                    int kmax = std::min (k+1, int (nz-1));

                    float grad = 0.;
                    int label = out.get(i,j,k);
                    int grad_label = out.get(i,j,k);

                    for (int ii = imin; ii <= imax; ++ii)
                    for (int jj = jmin; jj <= jmax; ++jj)
                    for (int kk = kmin; kk <= kmax; ++kk)
                    {
                        float diff = edm.get(ii,jj,kk) - edm.get(i,j,k);
                        //sweis @Fabian: Why??? pow is so slow 
                        //float distance = sqrt(pow(float(ii-i),2)+pow(float(jj-j),2)+pow(float(kk-k),2));
                        float distance = sqrt( (ii-i)*(ii-i) + (jj-j)*(jj-j) + (kk-k)*(kk-k));
                        if (distance == 0) continue;
                        float slope = diff/distance;
                        if (slope > grad)
                        {
                            grad = slope;
                            grad_label = out.get(ii,jj,kk);
                        }
                    }
                    if (grad_label != label) 
                    {
                        rename.at(label) = - grad_label;
                    }
                    else
                    {
                        rename.at(label) = grad_label;
                    }
                }
            }
        }


        int clustercount = 1;
        for (size_t i = 0; i != rename.size (); ++i)
        {
            if (rename.at(i) > 0)
            {
                rename.at(i) = clustercount;
                clustercount++;
            }
        }

        std::cout << "start checking rename vektor" << std::endl;
        int not_added = 0;
        for (unsigned int i = 1; i != rename.size (); ++i)
        {
            if (rename.at(i) == 0)
            {
                not_added++;
            }
        }
        std::cout << "not_added = " << not_added << std::endl;


        std::cout << "ellipsoid_number = " << ellipsoid_number << std::endl;
        std::cout << "clustercount = " << clustercount << std::endl;


        // resolve all indirections in the rename map
        for (int i = 0; i != (int)rename.size (); ++i)
        {
            if (watershedSegmentation::lookup_2 (i,rename) > ellipsoid_number)
                rename.at(i) = 0;
            else
                rename.at(i) = watershedSegmentation::lookup_2 (i, rename);
        }

        for (int k = 0; k != nz; ++k)
        for (int j = 0; j != ny; ++j)
        for (int i = 0; i != nx; ++i)
        {
            int newvalue = rename.at(out.get(i,j,k));
            out.set(i,j,k, newvalue);
        }

        std::cout << "                             done" << std::endl;

        // count the number of voxels in each cluster
        std::vector<int> clustersize (ellipsoid_number + 1);
        for (int k = 0; k != nz; ++k)
        for (int j = 0; j != ny; ++j)
        for (int i = 0; i != nx; ++i)
            clustersize.at(out.get(i,j,k))++;

        // remove clusters smaller than a certain threshold
        for (int k = 0; k != nz; ++k)
        for (int j = 0; j != ny; ++j)
        for (int i = 0; i != nx; ++i)
        {
            if (clustersize.at(out.get(i,j,k)) < minimumCluster) out.set(i,j,k,0);
        }

        erodated_binary = binary;
        Dilate::Process(erodated_binary, 3);
        edm::create_edm(erodated_binary, edm);

        int added_later = 0;

        for (int k = 0; k != nz; ++k)
        for (int j = 0; j != ny; ++j)
        for (int i = 0; i != nx; ++i)
        {
            if (binary.get(i,j,k) == 1 && out.get(i,j,k) == 0)
            {
                out.set(i,j,k,find_label(nx, ny, nz, i, j, k, out, edm));
                added_later++;
            }
        }
        std::cout << "added_later = " << added_later << std::endl;
        edm.clear();
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movl %ecx, 0xa0(%rsp)
movq %rdx, 0x18(%rsp)
movss %xmm0, 0x48(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
movq 0xfc84(%rip), %rbx      # 0x17fc8
leaq 0x948a(%rip), %rsi      # 0x117d5
movq %rbx, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x3110
movq 0x18(%r14), %rax
movq %rax, 0x90(%rsp)
movq 0x20(%r14), %rax
movq %rax, 0x88(%rsp)
movq 0x28(%r14), %rax
movq %rax, 0x80(%rsp)
leaq 0x9467(%rip), %rsi      # 0x117ed
movq %rbx, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x3110
xorps %xmm0, %xmm0
leaq 0x100(%rsp), %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movq %r14, 0x40(%rsp)
movq %r14, %rdi
callq 0xb2a8
movq 0xfc0b(%rip), %rdi      # 0x17fc8
leaq 0x9437(%rip), %rsi      # 0x117fb
callq 0x3260
movq %rax, %rdi
callq 0x31b0
movq 0x90(%rsp), %rcx
movl %ecx, %eax
movq %rax, 0x30(%rsp)
movq 0x88(%rsp), %rdx
movl %edx, %eax
movq %rax, 0x28(%rsp)
movq 0x80(%rsp), %rsi
movl %esi, %eax
movq %rax, 0x20(%rsp)
xorl %ebx, %ebx
testl %ecx, %ecx
movl $0x0, %ebp
cmovgl %ecx, %ebp
testl %edx, %edx
movl $0x0, %r15d
cmovgl %edx, %r15d
testl %esi, %esi
movl $0x0, %eax
cmovgl %esi, %eax
movq %rax, 0x68(%rsp)
leaq 0x100(%rsp), %r14
cmpq 0x68(%rsp), %rbx
je 0x8489
xorl %r12d, %r12d
cmpq %r15, %r12
je 0x8484
xorl %r13d, %r13d
cmpq %r13, %rbp
je 0x847f
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xb5c2
ucomiss 0x8cec(%rip), %xmm0     # 0x11148
jb 0x8464
sqrtss %xmm0, %xmm0
jmp 0x8469
callq 0x3440
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xb806
incq %r13
jmp 0x843f
incq %r12
jmp 0x8437
incq %rbx
jmp 0x842d
movq 0xfb38(%rip), %rdi      # 0x17fc8
leaq 0x93eb(%rip), %rsi      # 0x11882
callq 0x3260
movq %rax, %rdi
callq 0x3110
leaq 0xd0(%rsp), %rdi
movq 0x40(%rsp), %rbp
movq %rbp, %rsi
callq 0xba4a
leaq 0xd0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movss 0x48(%rsp), %xmm0
callq 0xba72
movq 0x8(%rsp), %rbx
movq 0x18(%rsp), %r14
leaq 0x1c8(%rsp), %rdi
movq %r14, %rsi
callq 0x3320
leaq 0x9313(%rip), %rsi      # 0x11808
leaq 0x1a8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x30d0
movslq 0x20(%rsp), %rcx
leaq 0xd0(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
movq %rcx, 0xa8(%rsp)
xorl %r8d, %r8d
callq 0x7539
leaq 0x1a8(%rsp), %rdi
callq 0x3488
leaq 0x1c8(%rsp), %rdi
callq 0x3488
leaq 0x100(%rsp), %rdi
pushq $0x5
popq %rsi
movss 0x8be3(%rip), %xmm0     # 0x11144
callq 0xbb72
leaq 0x188(%rsp), %rdi
movq %r14, %rsi
callq 0x3320
leaq 0x9295(%rip), %rsi      # 0x11812
leaq 0x168(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x30d0
leaq 0x100(%rsp), %rdi
leaq 0x188(%rsp), %rsi
leaq 0x168(%rsp), %rdx
movq 0xa8(%rsp), %rcx
xorl %r8d, %r8d
callq 0xc25e
leaq 0x168(%rsp), %rdi
callq 0x3488
leaq 0x188(%rsp), %rdi
callq 0x3488
leaq 0xd0(%rsp), %rdi
movq %rbx, %rsi
callq 0xc6fe
movq 0xd0(%rsp), %rax
cmpq %rax, 0xd8(%rsp)
je 0x85fb
movq %rax, 0xd8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0xe8(%rsp)
andq $0x0, 0xf8(%rsp)
leaq 0x50(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0xb8(%rsp), %rsi
andl $0x0, (%rsi)
callq 0xdfb2
movq %rbx, %rdi
callq 0xcb08
movl %eax, 0x14(%rsp)
movq 0xf989(%rip), %rdi      # 0x17fc8
leaq 0x91d2(%rip), %rsi      # 0x11818
callq 0x3260
movq %rax, %rdi
movl 0x14(%rsp), %esi
callq 0x3410
movq %rax, %rdi
callq 0x3110
pushq $0x1
popq %rax
leaq 0x50(%rsp), %rbx
leaq 0xb8(%rsp), %r14
movl %eax, 0xb8(%rsp)
cmpl 0x14(%rsp), %eax
jg 0x8692
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa83c
movl 0xb8(%rsp), %eax
incl %eax
jmp 0x866f
leaq 0x7c(%rsp), %rbx
movl 0x14(%rsp), %eax
movl %eax, (%rbx)
xorl %r14d, %r14d
leaq 0x50(%rsp), %r15
cmpq 0x20(%rsp), %r14
je 0x8722
xorl %r12d, %r12d
cmpq 0x28(%rsp), %r12
je 0x871d
xorl %r13d, %r13d
cmpq %r13, 0x30(%rsp)
je 0x8718
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0xad44
cmpb $0x1, %al
jne 0x8713
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x9746
testl %eax, %eax
jne 0x8713
movl 0x7c(%rsp), %r8d
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0xa85a
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa83c
incl 0x7c(%rsp)
incq %r13
jmp 0x86b9
incq %r12
jmp 0x86af
incq %r14
jmp 0x86a5
movq 0x90(%rsp), %rax
decl %eax
movq %rax, 0x90(%rsp)
movq 0x88(%rsp), %rax
decl %eax
movq %rax, 0x88(%rsp)
movq 0x80(%rsp), %rax
decl %eax
movq %rax, 0x80(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xb0(%rsp)
xorl %ecx, %ecx
pushq $0x1
popq %r12
movq 0x8(%rsp), %rbx
cmpl $0x2, %ecx
movl %r12d, %eax
cmovgel %ecx, %eax
movq %rax, 0x150(%rsp)
cmpq 0x20(%rsp), %rcx
je 0x8a4e
leaq 0x1(%rcx), %rax
movq 0x80(%rsp), %rdx
cmpl %eax, %edx
movq %rax, 0x130(%rsp)
cmovll %edx, %eax
cltq
movq %rax, 0x160(%rsp)
xorl %ebp, %ebp
movq %rcx, 0x98(%rsp)
cmpl $0x2, %ebp
movl %r12d, %eax
cmovgel %ebp, %eax
cmpq 0x28(%rsp), %rbp
je 0x8a34
decq %rax
movq %rax, 0x140(%rsp)
leaq 0x1(%rbp), %rax
movq 0x88(%rsp), %rdx
cmpl %eax, %edx
movq %rax, 0x138(%rsp)
cmovll %edx, %eax
cltq
movq %rax, 0x158(%rsp)
xorl %esi, %esi
movq %rbp, 0x48(%rsp)
cmpl $0x2, %esi
movl %r12d, %r13d
cmovgel %esi, %r13d
decq %r13
cmpq 0x30(%rsp), %rsi
je 0x8a27
movq 0x40(%rsp), %rdi
movq %rsi, 0x18(%rsp)
movq %rbp, %rdx
callq 0xad44
cmpb $0x1, %al
jne 0x8a12
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movq 0x98(%rsp), %rcx
callq 0x9746
cmpl 0x14(%rsp), %eax
jle 0x8a12
movq %rbx, %rdi
movq 0x18(%rsp), %r15
leal 0x1(%r15), %ebx
movq 0x90(%rsp), %rax
cmpl %ebx, %eax
cmovll %eax, %ebx
movq %r15, %rsi
movq %rbp, %rdx
movq 0x98(%rsp), %r14
movq %r14, %rcx
callq 0x9746
movl %eax, 0x70(%rsp)
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x9746
movl %eax, 0x74(%rsp)
movslq %ebx, %rax
movq %rax, 0x148(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x78(%rsp)
movq 0x18(%rsp), %rax
movq %r13, %r14
cmpq 0x148(%rsp), %r14
jg 0x89d9
movl %r14d, %ecx
subl %eax, %ecx
imull %ecx, %ecx
movl %ecx, 0xa4(%rsp)
movq 0x140(%rsp), %r12
cmpq 0x158(%rsp), %r12
jg 0x89cd
movl %r12d, %ebx
subl 0x48(%rsp), %ebx
imull %ebx, %ebx
addl 0xa4(%rsp), %ebx
movq 0x150(%rsp), %r13
leaq -0x1(%r13), %r15
cmpq 0x160(%rsp), %r15
jg 0x89c0
leaq 0x100(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0xb5c2
movss %xmm0, 0x68(%rsp)
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x98(%rsp), %rcx
callq 0xb5c2
movq 0xb0(%rsp), %rax
addl %r13d, %eax
imull %eax, %eax
addl %ebx, %eax
cvtsi2sd %eax, %xmm1
sqrtsd %xmm1, %xmm1
cvtsd2ss %xmm1, %xmm1
ucomiss 0x87d2(%rip), %xmm1     # 0x11148
jne 0x897a
jnp 0x89b8
movss 0x68(%rsp), %xmm2
subss %xmm0, %xmm2
divss %xmm1, %xmm2
movss %xmm2, 0x68(%rsp)
ucomiss 0x78(%rsp), %xmm2
jbe 0x89b8
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x9746
movl %eax, 0x74(%rsp)
movss 0x68(%rsp), %xmm0
movss %xmm0, 0x78(%rsp)
incq %r13
jmp 0x8908
incq %r12
movq 0x18(%rsp), %rax
jmp 0x88e1
incq %r14
pushq $0x1
popq %r12
jmp 0x88bc
movl 0x70(%rsp), %eax
movslq %eax, %rsi
movl 0x74(%rsp), %ebx
cmpl %eax, %ebx
jne 0x89fa
leaq 0x50(%rsp), %rdi
callq 0xaaee
movl 0x70(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x8a08
leaq 0x50(%rsp), %rdi
callq 0xaaee
negl %ebx
movl %ebx, (%rax)
movq 0x8(%rsp), %rbx
movq 0x48(%rsp), %rbp
movq 0x18(%rsp), %rsi
incq %rsi
movq 0x98(%rsp), %rcx
jmp 0x8802
movq 0x138(%rsp), %rbp
jmp 0x87b9
decq 0xb0(%rsp)
movq 0x130(%rsp), %rcx
movq 0x40(%rsp), %rbp
jmp 0x8770
xorl %ebx, %ebx
leaq 0x50(%rsp), %r14
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
sarq $0x2, %rax
cmpq %rax, %rbx
je 0x8a8e
movq %r14, %rdi
movq %rbx, %rsi
callq 0xaaee
cmpl $0x0, (%rax)
jle 0x8a89
movq %r14, %rdi
movq %rbx, %rsi
callq 0xaaee
movl %r12d, (%rax)
incl %r12d
incq %rbx
jmp 0x8a55
movq 0xf533(%rip), %rdi      # 0x17fc8
leaq 0x8d90(%rip), %rsi      # 0x1182c
callq 0x3260
movq %rax, %rdi
callq 0x3110
pushq $0x1
popq %r14
xorl %ebx, %ebx
leaq 0x50(%rsp), %r15
movl %r14d, %r14d
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
sarq $0x2, %rax
cmpq %r14, %rax
je 0x8ae0
movq %r15, %rdi
movq %r14, %rsi
callq 0xaaee
cmpl $0x1, (%rax)
adcl $0x0, %ebx
incl %r14d
jmp 0x8ab4
movq 0xf4e1(%rip), %rdi      # 0x17fc8
leaq 0x8d5b(%rip), %rsi      # 0x11849
callq 0x3260
movq %rax, %rdi
movl %ebx, %esi
callq 0x3410
movq %rax, %rdi
callq 0x3110
movq 0xf4bc(%rip), %rdi      # 0x17fc8
leaq 0x8d05(%rip), %rsi      # 0x11818
callq 0x3260
movq %rax, %rdi
movl 0x14(%rsp), %esi
callq 0x3410
movq %rax, %rdi
callq 0x3110
movq 0xf495(%rip), %rdi      # 0x17fc8
leaq 0x8d1c(%rip), %rsi      # 0x11856
callq 0x3260
movq %rax, %rdi
movl %r12d, %esi
callq 0x3410
movq %rax, %rdi
callq 0x3110
xorl %ebx, %ebx
leaq 0x50(%rsp), %r14
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
shrq $0x2, %rax
movl %eax, %eax
cmpq %rax, %rbx
je 0x8bb1
movl %ebx, %edi
movq %r14, %rsi
callq 0xcb1c
cmpl 0x14(%rsp), %eax
jle 0x8b8e
movq %r14, %rdi
movq %rbx, %rsi
callq 0xaaee
andl $0x0, (%rax)
jmp 0x8ba7
movl %ebx, %edi
movq %r14, %rsi
callq 0xcb1c
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
callq 0xaaee
movl %ebp, (%rax)
movq 0x40(%rsp), %rbp
incq %rbx
jmp 0x8b59
xorl %ebx, %ebx
leaq 0x50(%rsp), %r14
cmpq 0x20(%rsp), %rbx
je 0x8c16
xorl %r15d, %r15d
cmpq 0x28(%rsp), %r15
je 0x8c11
xorl %r12d, %r12d
cmpq %r12, 0x30(%rsp)
je 0x8c0c
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x9746
movslq %eax, %rsi
movq %r14, %rdi
callq 0xaaee
movl (%rax), %r8d
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0xa85a
incq %r12
jmp 0x8bcc
incq %r15
jmp 0x8bc2
incq %rbx
jmp 0x8bb8
movq 0xf3ab(%rip), %rdi      # 0x17fc8
leaq 0x8c42(%rip), %rsi      # 0x11866
callq 0x3260
movq %rax, %rdi
callq 0x3110
movl 0x14(%rsp), %eax
incl %eax
movslq %eax, %rsi
leaq 0xb8(%rsp), %rdi
leaq 0x3f(%rsp), %rdx
callq 0xaa9c
xorl %ebx, %ebx
leaq 0xb8(%rsp), %r14
cmpq 0x20(%rsp), %rbx
je 0x8ca0
xorl %r15d, %r15d
cmpq 0x28(%rsp), %r15
je 0x8c9b
xorl %r12d, %r12d
cmpq %r12, 0x30(%rsp)
je 0x8c96
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x9746
movslq %eax, %rsi
movq %r14, %rdi
callq 0xaaee
incl (%rax)
incq %r12
jmp 0x8c6a
incq %r15
jmp 0x8c60
incq %rbx
jmp 0x8c56
xorl %ebx, %ebx
leaq 0xb8(%rsp), %r14
cmpq 0x20(%rsp), %rbx
je 0x8d13
xorl %r15d, %r15d
cmpq 0x28(%rsp), %r15
je 0x8d0e
xorl %r12d, %r12d
cmpq %r12, 0x30(%rsp)
je 0x8d09
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x9746
movslq %eax, %rsi
movq %r14, %rdi
callq 0xaaee
movl 0xa0(%rsp), %ecx
cmpl %ecx, (%rax)
jge 0x8d04
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0xa85a
incq %r12
jmp 0x8cbe
incq %r15
jmp 0x8cb4
incq %rbx
jmp 0x8caa
leaq 0xd0(%rsp), %rdi
movq %rbp, %rsi
callq 0xcb5a
leaq 0xd0(%rsp), %rdi
pushq $0x3
popq %rsi
callq 0xcb86
leaq 0xd0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0xb2a8
movslq 0x30(%rsp), %r15
movslq 0x28(%rsp), %r12
xorl %r13d, %r13d
xorl %ebx, %ebx
cmpq 0x20(%rsp), %r13
je 0x8dff
xorl %ebp, %ebp
cmpq 0x28(%rsp), %rbp
je 0x8df7
xorl %r14d, %r14d
cmpq %r14, 0x30(%rsp)
je 0x8def
movq 0x40(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xad44
cmpb $0x1, %al
jne 0x8dea
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x9746
testl %eax, %eax
jne 0x8dea
movq %r15, %rdi
movq %r12, %rsi
movq 0xa8(%rsp), %rdx
movq %r14, %rcx
movq %rbp, %r8
movq %r13, %r9
leaq 0x100(%rsp), %rax
pushq %rax
pushq 0x10(%rsp)
callq 0xceb2
popq %rcx
popq %rdx
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r13, %rcx
movl %eax, %r8d
callq 0xa85a
incl %ebx
incq %r14
jmp 0x8d72
incq %rbp
jmp 0x8d64
incq %r13
jmp 0x8d57
movq 0xf1c2(%rip), %rdi      # 0x17fc8
leaq 0x8a7b(%rip), %rsi      # 0x11888
callq 0x3260
movq %rax, %rdi
movl %ebx, %esi
callq 0x3410
movq %rax, %rdi
callq 0x3110
movq 0x100(%rsp), %rax
cmpq %rax, 0x108(%rsp)
je 0x8e3e
movq %rax, 0x108(%rsp)
xorps %xmm0, %xmm0
leaq 0x100(%rsp), %rbx
movups %xmm0, 0x18(%rbx)
andq $0x0, 0x28(%rbx)
leaq 0xb8(%rsp), %rdi
callq 0xb1c8
leaq 0x50(%rsp), %rdi
callq 0xb1c8
leaq 0xd0(%rsp), %rdi
callq 0xb29a
movq %rbx, %rdi
callq 0xd6ec
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8f1f
jmp 0x8f1f
jmp 0x8f02
jmp 0x8f02
jmp 0x8f1f
jmp 0x8f1f
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x3488
jmp 0x8eb7
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
jmp 0x8ede
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
callq 0x3488
jmp 0x8ed6
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
callq 0x3488
jmp 0x8f2c
jmp 0x8f18
jmp 0x8f1f
jmp 0x8f1f
jmp 0x8f1f
jmp 0x8f1f
movq %rax, %rbx
jmp 0x8f2c
jmp 0x8f18
jmp 0x8f1f
jmp 0x8f1f
jmp 0x8f1f
jmp 0x8f1f
jmp 0x8f02
jmp 0x8f02
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xb1c8
jmp 0x8f22
jmp 0x8f1f
jmp 0x8f1f
movq %rax, %rbx
jmp 0x8f39
jmp 0x8f1f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xb1c8
leaq 0xd0(%rsp), %rdi
callq 0xb29a
leaq 0x100(%rsp), %rdi
callq 0xd6ec
movq %rbx, %rdi
callq 0x3420