// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/feature.cc
// Function: FEATURE::createSegments(ATOM_NETWORK*, VORONOI_NETWORK*, DIJKSTRA_NETWORK*, std::basic_fstream<char, std::char_traits<char>>&, int)
int FEATURE::createSegments(ATOM_NETWORK *uc,VORONOI_NETWORK *origVNet, DIJKSTRA_NETWORK *origDNet, std::fstream &output, int initIndex){
    nsegments = 0;
    segments = std::vector<int> ();
    segmentChannel(uc);
    if(nsegments == 0){
        std::cerr << "Error occurred during channel segmentation. No segments were found." << "\n"
        << "Exiting..." << "\n";
        exit(1);
    }
    
    std::vector< std::vector<int> > nodesForSegments = std::vector < std::vector<int> > (nsegments, std::vector<int> ());
    std::vector<CHANNEL> segChannels = std::vector<CHANNEL> ();
    for(unsigned int i = 0; i < segments.size(); i++){
        nodesForSegments[segments[i]].push_back(reverseIDMappings.find(i)->second);
    }
    
    int zeroVecs [3][3] = {{0, 0, 0},{ 0, 0, 0}, {0, 0, 0}};
    
    for(int i = 0; i < nsegments; i++){
        DIJKSTRA_NETWORK segNet;
        DIJKSTRA_NETWORK::filterDnetEdges(nodesForSegments[i], origVNet, &segNet);
        std::vector<bool> infoStorage; std::vector<CHANNEL> channels;
        findChannels(&segNet, &infoStorage, &channels);
        int dim;
        if(channels.size() != 0){
            dim = channels[0].dimensionality;
            segChannels.push_back(CHANNEL(nodesForSegments[i], origDNet, dim, channels[0].basis));
        }
        else{
            dim = 0;
            segChannels.push_back(CHANNEL(nodesForSegments[i], origDNet, 0, zeroVecs));
        }
        segChannels[i].writeToVMD("segment", initIndex + i, output);
    }
    return nsegments;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movl %r9d, %ebx
movq %r8, 0xc8(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, 0xd0(%rsp)
movq %rsi, %r14
movq %rdi, %r12
movl $0x0, 0x138(%rdi)
addq $0x140, %rdi            # imm = 0x140
xorps %xmm0, %xmm0
leaq 0x150(%rsp), %r15
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movq %r15, %rsi
callq 0x12d52
movq (%r15), %rdi
testq %rdi, %rdi
je 0x7b38b
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %r12, %rdi
movq %r14, %rsi
callq 0x79812
movslq 0x138(%r12), %rsi
testq %rsi, %rsi
je 0x7b872
xorps %xmm0, %xmm0
leaq 0x150(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x80(%rsp), %rdi
leaq 0x288(%rsp), %rcx
callq 0x67eb0
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x7b3ef
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movq 0x140(%r12), %rax
cmpq %rax, 0x148(%r12)
je 0x7b4b1
leaq 0x38(%r12), %r14
xorl %r15d, %r15d
movq 0x40(%r12), %rdx
movq %r14, %rcx
testq %rdx, %rdx
je 0x7b446
movq %r14, %rcx
xorl %esi, %esi
cmpl %r15d, 0x20(%rdx)
setl %sil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x7b42e
movq %r14, %rdx
cmpq %r14, %rcx
je 0x7b459
cmpl 0x20(%rcx), %r15d
cmovlq %r14, %rcx
movq %rcx, %rdx
movslq (%rax,%r15,4), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
addq 0x80(%rsp), %rdi
addq $0x24, %rdx
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x7b489
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x7b48e
callq 0xf7b4
incl %r15d
movq 0x140(%r12), %rax
movq 0x148(%r12), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x7b41e
xorps %xmm0, %xmm0
movaps %xmm0, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
movl $0x0, 0x140(%rsp)
movl 0x138(%r12), %r14d
testl %r14d, %r14d
jle 0x7b846
movq %r12, 0xb8(%rsp)
leaq 0x150(%rsp), %rax
addq $0xa8, %rax
movq %rax, 0x30(%rsp)
movl %ebx, %eax
movq %rax, 0xc0(%rsp)
leaq 0x288(%rsp), %r15
leaq 0xd8(%rsp), %r12
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x50e9e
movq %r15, %r14
movq 0x80(%rsp), %rsi
addq %r13, %rsi
leaq 0x108(%rsp), %r15
movq %r15, %rdi
callq 0xe886
movq %r15, %rdi
movq 0xd0(%rsp), %rsi
movq %r14, %r15
movq %r14, %rdx
callq 0x51180
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
leaq 0x150(%rsp), %r14
je 0x7b57d
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x746d0
movq 0x40(%rsp), %rax
cmpq %rax, 0x48(%rsp)
je 0x7b698
movl 0x108(%rax), %r14d
movq 0x80(%rsp), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0xe886
movq %r12, %rsi
movq 0x40(%rsp), %r8
movl $0x10c, %eax            # imm = 0x10C
addq %rax, %r8
leaq 0x150(%rsp), %r12
movq %r12, %rdi
movq 0x38(%rsp), %rdx
movl %r14d, %ecx
callq 0x7ff8e
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
callq 0x782da
movq 0x30(%rsp), %rdi
callq 0xefda
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x7b63b
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1c8(%rsp), %rdi
testq %rdi, %rdi
je 0x7b658
movq 0x1d8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x1b0(%rsp), %rdi
callq 0xf07c
leaq 0x180(%rsp), %rdi
callq 0xf118
movq %r12, %rdi
callq 0xf118
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x7b75d
movq 0xe8(%rsp), %rsi
jmp 0x7b755
movq 0x80(%rsp), %rsi
addq %r13, %rsi
leaq 0xf0(%rsp), %r12
movq %r12, %rdi
callq 0xe886
movq %r14, %rdi
movq %r12, %rsi
movq 0x38(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x120(%rsp), %r8
callq 0x7ff8e
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x782da
movq 0x30(%rsp), %rdi
callq 0xefda
movq 0x1e0(%rsp), %rdi
testq %rdi, %rdi
je 0x7b701
movq 0x1f0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1c8(%rsp), %rdi
testq %rdi, %rdi
je 0x7b71e
movq 0x1d8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x1b0(%rsp), %rdi
callq 0xf07c
leaq 0x180(%rsp), %rdi
callq 0xf118
movq %r14, %rdi
callq 0xf118
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x7b75d
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x60(%rsp), %r14
leaq 0xa8(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x98(%rsp), %r12
movq %r12, %rdi
leaq 0xdb4a5(%rip), %rsi     # 0x156c29
leaq 0xdb4a5(%rip), %rdx     # 0x156c30
callq 0x2263c
addq %rbp, %r14
movq 0xc0(%rsp), %rax
leal (%rax,%rbx), %edx
movq %r14, %rdi
movq %r12, %rsi
movq 0xc8(%rsp), %rcx
callq 0x73c72
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
leaq 0xd8(%rsp), %r12
je 0x7b7de
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x40(%rsp), %rdi
callq 0x494b0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x7b818
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq %r15, %rdi
callq 0xf07c
incq %rbx
movq 0xb8(%rsp), %rax
movslq 0x138(%rax), %r14
addq $0x18, %r13
addq $0x130, %rbp            # imm = 0x130
cmpq %r14, %rbx
jl 0x7b51c
leaq 0x60(%rsp), %rdi
callq 0x494b0
leaq 0x80(%rsp), %rdi
callq 0xefda
movl %r14d, %eax
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x11b777(%rip), %rdi    # 0x196ff0
leaq 0xdb365(%rip), %rsi     # 0x156be5
callq 0x4440
leaq 0xd9ca2(%rip), %rbx     # 0x15552e
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4440
leaq 0xdad14(%rip), %rsi     # 0x1565b2
movq %rax, %rdi
callq 0x4440
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4440
movl $0x1, %edi
callq 0x710c
movq %rax, %rbx
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x7ba08
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x7ba08
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x76cdc
jmp 0x7b8f9
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x7b9aa
movq 0x100(%rsp), %rsi
jmp 0x7b944
jmp 0x7b97d
jmp 0x7b949
jmp 0x7b97d
movq %rax, %rbx
jmp 0x7b92f
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x76cdc
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x7b9aa
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
jmp 0x7b9a5
movq %rax, %rbx
jmp 0x7b9f1
movq %rax, %rbx
jmp 0x7b9e4
movq %rax, %rbx
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x7b9e4
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x7b9e4
jmp 0x7b97d
movq %rax, %rbx
jmp 0x7b9aa
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x7b9aa
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x40(%rsp), %rdi
callq 0x494b0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x7b9e4
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
leaq 0x288(%rsp), %rdi
callq 0xf07c
leaq 0x60(%rsp), %rdi
callq 0x494b0
leaq 0x80(%rsp), %rdi
callq 0xefda
movq %rbx, %rdi
callq 0x4780