// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/feature.cc
// Function: FEATURE::calculateVolumeForAllFeatures(VORONOI_NETWORK*, DIJKSTRA_NETWORK*)
void FEATURE::calculateVolumeForAllFeatures(VORONOI_NETWORK *origVNet,DIJKSTRA_NETWORK *origDNet){

    vector< vector<int> > nodesForFeatures = vector < vector<int> > (nfeatures, vector<int> ());
    vector<FEATURE> featChannels = vector<FEATURE> ();

    for(unsigned int i = 0; i < feature_node_mapping.size(); i++){
      nodesForFeatures[feature_node_mapping[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 < nfeatures; i++){
       DIJKSTRA_NETWORK featNet;
       DIJKSTRA_NETWORK::filterDnetEdges(nodesForFeatures[i], origVNet, &featNet);
       vector<bool> infoStorage; vector<CHANNEL> channels;
       findChannels(&featNet, &infoStorage, &channels);
       int dim;
       if(channels.size() != 0){
         dim = channels[0].dimensionality;
         featChannels.push_back(FEATURE(nodesForFeatures[i], origDNet, dim, channels[0].basis));
       }
       else{
         dim = 0;
         featChannels.push_back(FEATURE(nodesForFeatures[i], origDNet, 0, zeroVecs));
       }
//       featChannels[i].writeToVMD("feature", initIndex + i, output);
       feature_volume.push_back(featChannels[i].calculateVolume());
//       cout << "Feature volume = " << featChannels[i].calculateVolume() << "\n";
    };

  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rdx, 0x18(%rsp)
movq %rsi, 0x80(%rsp)
movq %rdi, %r15
movslq 0x1b8(%rdi), %rsi
xorps %xmm0, %xmm0
leaq 0x190(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x130(%rsp), %rcx
callq 0x6757e
movq 0x190(%rsp), %rdi
testq %rdi, %rdi
je 0x7d063
movq 0x1a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x1d8(%r15), %rax
cmpq %rax, 0x1e0(%r15)
je 0x7d11b
leaq 0x38(%r15), %rbx
xorl %r14d, %r14d
movq 0x40(%r15), %rsi
movq %rbx, %rdx
testq %rsi, %rsi
je 0x7d0c8
movq %rbx, %rcx
xorl %edx, %edx
cmpl %r14d, 0x20(%rsi)
setl %dl
cmovgeq %rsi, %rcx
movq 0x10(%rsi,%rdx,8), %rsi
testq %rsi, %rsi
jne 0x7d09e
movq %rbx, %rdx
cmpq %rbx, %rcx
je 0x7d0c8
cmpl 0x20(%rcx), %r14d
cmovlq %rbx, %rcx
movq %rcx, %rdx
movslq (%rax,%r14,4), %rcx
leaq (%rcx,%rcx,2), %rdi
shlq $0x3, %rdi
addq 0x60(%rsp), %rdi
addq $0x24, %rdx
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x7d0f5
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x7d101
callq 0xf864
movq 0x1d8(%r15), %rax
incl %r14d
movq 0x1e0(%r15), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
ja 0x7d08f
xorps %xmm0, %xmm0
movaps %xmm0, 0x110(%rsp)
movaps %xmm0, 0x100(%rsp)
movl $0x0, 0x120(%rsp)
movq %r15, 0x10(%rsp)
cmpl $0x0, 0x1b8(%r15)
jle 0x7d3ae
movq 0x10(%rsp), %rax
addq $0x220, %rax            # imm = 0x220
movq %rax, 0x78(%rsp)
leaq 0x130(%rsp), %r14
leaq 0x190(%rsp), %r12
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x88(%rsp)
movq %r14, %rdi
callq 0x50b12
movq 0x60(%rsp), %rsi
addq 0x8(%rsp), %rsi
leaq 0xe8(%rsp), %rbp
movq %rbp, %rdi
callq 0xe8f8
movq %rbp, %rdi
movq 0x80(%rsp), %rsi
movq %r14, %rdx
callq 0x50ddc
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x7d1d4
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x90(%rsp)
movl %eax, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
movl %eax, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %r14, %rdi
leaq 0x90(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x739cc
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x7d2a3
movq %r13, %rbx
movq %r14, %r15
movl 0x108(%rax), %r14d
movq 0x60(%rsp), %rsi
addq 0x8(%rsp), %rsi
leaq 0xd0(%rsp), %r13
movq %r13, %rdi
callq 0xe8f8
movq 0x20(%rsp), %r8
movl $0x10c, %eax            # imm = 0x10C
addq %rax, %r8
movq %r12, %rdi
movq %r13, %rsi
movq 0x18(%rsp), %rdx
movl %r14d, %ecx
callq 0x7eb52
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x7eed4
movq %r15, %r14
movq %rbx, %r13
movq %r12, %rdi
callq 0x7ec22
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x7d309
movq 0xe0(%rsp), %rsi
jmp 0x7d301
movq 0x60(%rsp), %rsi
addq 0x8(%rsp), %rsi
leaq 0xb8(%rsp), %rbp
movq %rbp, %rdi
callq 0xe8f8
movq %r12, %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x100(%rsp), %r8
callq 0x7eb52
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x7eed4
movq %r12, %rdi
callq 0x7ec22
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x7d309
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x40(%rsp), %rdi
addq %r13, %rdi
callq 0x78b76
movsd %xmm0, 0x190(%rsp)
movq 0x10(%rsp), %rax
movq 0x228(%rax), %rsi
cmpq 0x230(%rax), %rsi
je 0x7d345
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x228(%rax)
jmp 0x7d352
movq 0x78(%rsp), %rdi
movq %r12, %rdx
callq 0x1391c
leaq 0x20(%rsp), %rdi
callq 0x48bbc
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
movq 0x88(%rsp), %rbx
je 0x7d381
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %r14, %rdi
callq 0xf10e
incq %rbx
movq 0x10(%rsp), %rax
movslq 0x1b8(%rax), %rax
addq $0x18, 0x8(%rsp)
addq $0x268, %r13            # imm = 0x268
cmpq %rax, %rbx
jl 0x7d17a
leaq 0x40(%rsp), %rdi
callq 0x7eda6
leaq 0x60(%rsp), %rdi
callq 0xf066
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x190(%rsp), %rdi
testq %rdi, %rdi
je 0x7d4d7
movq 0x1a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x7d4d7
jmp 0x7d48c
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x7ec22
jmp 0x7d417
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x7d48f
movq 0xc8(%rsp), %rsi
jmp 0x7d45c
jmp 0x7d466
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x7ec22
jmp 0x7d447
jmp 0x7d48c
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x7d48f
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x7d48f
movq %rax, %rbx
jmp 0x7d4c3
movq %rax, %rbx
jmp 0x7d4b6
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x7d4b6
movq 0xf8(%rsp), %rsi
jmp 0x7d4ae
jmp 0x7d48c
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x48bbc
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x7d4b6
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x130(%rsp), %rdi
callq 0xf10e
leaq 0x40(%rsp), %rdi
callq 0x7eda6
leaq 0x60(%rsp), %rdi
callq 0xf066
movq %rbx, %rdi
callq 0x4780
nop