// File: /workspace/github_cpp_makefile_star2_O2/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, %r12d
movq %r8, 0x80(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, 0x88(%rsp)
movq %rdi, %rbx
andl $0x0, 0x138(%rdi)
movq %rsi, %r14
addq $0x140, %rdi            # imm = 0x140
xorps %xmm0, %xmm0
leaq 0x1b0(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
movq %r15, %rsi
callq 0xed62
movq %r15, %rdi
callq 0xb290
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5a39c
movq %rbx, 0x10(%rsp)
movslq 0x138(%rbx), %rsi
testq %rsi, %rsi
je 0x5bbe4
leaq 0x1b0(%rsp), %rdx
xorps %xmm0, %xmm0
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x150(%rsp), %rcx
callq 0x4b956
leaq 0x1b0(%rsp), %r14
movq %r14, %rdi
callq 0xb290
movq 0x10(%rsp), %rax
leaq 0x30(%rax), %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
xorl %ebp, %ebp
movl %ebp, %eax
movq 0x10(%rsp), %rdx
movq 0x140(%rdx), %rcx
movq 0x148(%rdx), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x5b987
movslq (%rcx,%rax,4), %rbx
movq 0x60(%rsp), %r13
movl %ebp, 0x1b0(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x10996
imulq $0x18, %rbx, %rcx
addq %rcx, %r13
addq $0x24, %rax
movq %r13, %rdi
movq %rax, %rsi
callq 0x9434
incl %ebp
jmp 0x5b931
xorps %xmm0, %xmm0
leaq 0x120(%rsp), %rax
movaps %xmm0, 0x10(%rax)
andl $0x0, 0x20(%rax)
movaps %xmm0, (%rax)
movl %r12d, %eax
movq %rax, 0x78(%rsp)
xorl %r13d, %r13d
leaq 0x90(%rsp), %r15
leaq 0xb8(%rsp), %rbx
movq $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movq 0x10(%rsp), %rax
movslq 0x138(%rax), %r14
cmpq %r14, %rbp
jge 0x5bbbb
movq %r15, %r12
leaq 0x150(%rsp), %r14
movq %r14, %rdi
callq 0x3d70e
movq 0x60(%rsp), %rsi
addq 0x8(%rsp), %rsi
leaq 0xe8(%rsp), %r15
movq %r15, %rdi
callq 0xa6ce
movq %r15, %rdi
movq 0x88(%rsp), %rsi
movq %r14, %rdx
callq 0x3d90c
movq %r15, %rdi
callq 0xb290
andq $0x0, 0x90(%rsp)
andl $0x0, 0x98(%rsp)
andq $0x0, 0xa0(%rsp)
andl $0x0, 0xa8(%rsp)
andq $0x0, 0xb0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq %r14, %rdi
movq %r12, %r15
movq %r12, %rsi
leaq 0x20(%rsp), %rdx
callq 0x55ab0
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x5badb
movl 0x108(%rax), %r14d
movq 0x60(%rsp), %rsi
addq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xa6ce
movq 0x20(%rsp), %r8
movl $0x10c, %eax            # imm = 0x10C
addq %rax, %r8
leaq 0x1b0(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
movl %r14d, %ecx
callq 0x5f226
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x5928a
movq %r13, %rbx
movq %r12, %rdi
callq 0xb718
leaq 0xb8(%rsp), %rdi
jmp 0x5bb32
movq 0x60(%rsp), %rsi
addq 0x8(%rsp), %rsi
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
callq 0xa6ce
leaq 0x1b0(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x120(%rsp), %r8
callq 0x5f226
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x5928a
movq %r13, %rbx
movq %r12, %rdi
callq 0xb718
movq %r14, %rdi
callq 0xb290
movq 0x40(%rsp), %r14
leaq 0x100(%rsp), %r13
movq %r13, %rdi
leaq 0xa814b(%rip), %rsi     # 0x103c99
movq %r12, %rdx
callq 0x1b80e
addq %rbx, %r14
movq 0x78(%rsp), %rax
leal (%rax,%rbp), %edx
movq %r14, %rdi
movq %r13, %rsi
movq 0x80(%rsp), %rcx
callq 0x552c0
movq %r13, %rdi
callq 0x4210
leaq 0x20(%rsp), %rdi
callq 0x37062
movq %r15, %rdi
callq 0xa976
leaq 0x150(%rsp), %rdi
callq 0xae22
incq %rbp
addq $0x18, 0x8(%rsp)
addq $0x130, %rbx            # imm = 0x130
movq %rbx, %r13
leaq 0xb8(%rsp), %rbx
jmp 0x5b9c3
leaq 0x40(%rsp), %rdi
callq 0x37062
leaq 0x60(%rsp), %rdi
callq 0xad7e
movl %r14d, %eax
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xf4405(%rip), %rdi     # 0x14fff0
leaq 0xa8063(%rip), %rsi     # 0x103c55
callq 0x4480
leaq 0xa6980(%rip), %rbx     # 0x10257e
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
leaq 0xa7a12(%rip), %rsi     # 0x103622
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
pushq $0x1
popq %rdi
callq 0x524c
movq %rax, %rbx
leaq 0x1b0(%rsp), %rdi
callq 0xb290
jmp 0x5bcf4
movq %rax, %rbx
leaq 0x1b0(%rsp), %rdi
callq 0xb718
jmp 0x5bc55
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
jmp 0x5bc7e
jmp 0x5bcb4
movq %rax, %rbx
jmp 0x5bc76
movq %rax, %rbx
leaq 0x1b0(%rsp), %rdi
callq 0xb718
leaq 0xb8(%rsp), %rdi
callq 0xb290
jmp 0x5bcb7
jmp 0x5bcb4
jmp 0x5bcdd
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0xb290
jmp 0x5bcce
jmp 0x5bcb4
movq %rax, %rbx
jmp 0x5bcce
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x4210
jmp 0x5bcb7
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x37062
leaq 0x90(%rsp), %rdi
callq 0xa976
leaq 0x150(%rsp), %rdi
callq 0xae22
jmp 0x5bce0
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x37062
leaq 0x60(%rsp), %rdi
callq 0xad7e
movq %rbx, %rdi
callq 0x4780