// File: 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
movq %rsp, %rbp
subq $0x700, %rsp            # imm = 0x700
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x6b0(%rbp)
movslq 0x1b8(%rax), %rax
movq %rax, -0x6a8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0x6a0(%rbp)
callq 0xd0d0
leaq -0x51(%rbp), %rdi
movq %rdi, -0x698(%rbp)
callq 0x12b40
movq -0x6a8(%rbp), %rsi
movq -0x6a0(%rbp), %rdx
movq -0x698(%rbp), %rcx
leaq -0x30(%rbp), %rdi
callq 0xaedd0
jmp 0xde00f
leaq -0x51(%rbp), %rdi
callq 0x13770
leaq -0x50(%rbp), %rdi
callq 0xec80
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x52a0
leaq -0x80(%rbp), %rdi
callq 0xe0540
movl $0x0, -0x84(%rbp)
movq -0x6b0(%rbp), %rdi
movl -0x84(%rbp), %eax
movq %rax, -0x6b8(%rbp)
addq $0x1d8, %rdi            # imm = 0x1D8
callq 0x10090
movq %rax, %rcx
movq -0x6b8(%rbp), %rax
cmpq %rcx, %rax
jae 0xde14a
movq -0x6b0(%rbp), %rdi
addq $0x1d8, %rdi            # imm = 0x1D8
movl -0x84(%rbp), %eax
movl %eax, %esi
callq 0xed60
movslq (%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x10890
movq -0x6b0(%rbp), %rdi
movq %rax, -0x6c8(%rbp)
addq $0x30, %rdi
movl -0x84(%rbp), %eax
movl %eax, -0x94(%rbp)
leaq -0x94(%rbp), %rsi
callq 0x102e0
movq %rax, -0x6c0(%rbp)
jmp 0xde0d1
movq -0x6c0(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x10350
movq -0x6c8(%rbp), %rdi
movq %rax, %rsi
addq $0x4, %rsi
callq 0xd1b0
jmp 0xde100
jmp 0xde102
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0xde044
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x13770
leaq -0x50(%rbp), %rdi
callq 0xec80
jmp 0xde4f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xde4e5
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x24, %edx
callq 0x52a0
movl $0x0, -0xc4(%rbp)
movq -0x6b0(%rbp), %rcx
movl -0xc4(%rbp), %eax
cmpl 0x1b8(%rcx), %eax
jge 0xde4ca
leaq -0x128(%rbp), %rdi
callq 0x94790
jmp 0xde18e
movslq -0xc4(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x10890
movq %rax, %rsi
leaq -0x140(%rbp), %rdi
callq 0xeec0
jmp 0xde1af
movq -0x10(%rbp), %rsi
leaq -0x140(%rbp), %rdi
leaq -0x128(%rbp), %rdx
callq 0x94c30
jmp 0xde1c8
leaq -0x140(%rbp), %rdi
callq 0xec80
leaq -0x168(%rbp), %rdi
movq %rdi, -0x6d8(%rbp)
callq 0xf670
leaq -0x180(%rbp), %rdi
movq %rdi, -0x6d0(%rbp)
callq 0x84dd0
movq -0x6d8(%rbp), %rsi
movq -0x6d0(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xc9b80
jmp 0xde216
leaq -0x180(%rbp), %rdi
callq 0xd62c0
cmpq $0x0, %rax
je 0xde361
xorl %eax, %eax
movl %eax, %esi
leaq -0x180(%rbp), %rdi
callq 0xe0560
movl 0x108(%rax), %eax
movl %eax, -0x184(%rbp)
movslq -0xc4(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x10890
movq %rax, %rsi
leaq -0x408(%rbp), %rdi
callq 0xeec0
jmp 0xde269
movq -0x18(%rbp), %rax
movq %rax, -0x6e8(%rbp)
movl -0x184(%rbp), %eax
movl %eax, -0x6dc(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x180(%rbp), %rdi
callq 0xe0560
movq -0x6e8(%rbp), %rdx
movl -0x6dc(%rbp), %ecx
movq %rax, %r8
addq $0x10c, %r8             # imm = 0x10C
leaq -0x3f0(%rbp), %rdi
leaq -0x408(%rbp), %rsi
callq 0xe05b0
jmp 0xde2bc
leaq -0x80(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
callq 0xe0580
jmp 0xde2ce
leaq -0x3f0(%rbp), %rdi
callq 0xe06f0
leaq -0x408(%rbp), %rdi
callq 0xec80
jmp 0xde411
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xde4bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xec80
jmp 0xde4bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xde4a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xde350
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0xe06f0
leaq -0x408(%rbp), %rdi
callq 0xec80
jmp 0xde4a4
movl $0x0, -0x184(%rbp)
movslq -0xc4(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x10890
movq %rax, %rsi
leaq -0x688(%rbp), %rdi
callq 0xeec0
jmp 0xde38c
movq -0x18(%rbp), %rdx
leaq -0x670(%rbp), %rdi
leaq -0x688(%rbp), %rsi
xorl %ecx, %ecx
leaq -0xc0(%rbp), %r8
callq 0xe05b0
jmp 0xde3ae
leaq -0x80(%rbp), %rdi
leaq -0x670(%rbp), %rsi
callq 0xe0580
jmp 0xde3c0
leaq -0x670(%rbp), %rdi
callq 0xe06f0
leaq -0x688(%rbp), %rdi
callq 0xec80
jmp 0xde411
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xde400
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x670(%rbp), %rdi
callq 0xe06f0
leaq -0x688(%rbp), %rdi
callq 0xec80
jmp 0xde4a4
movq -0x6b0(%rbp), %rax
addq $0x220, %rax            # imm = 0x220
movq %rax, -0x6f8(%rbp)
movslq -0xc4(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x89b70
movq %rax, %rdi
callq 0xd8b00
movsd %xmm0, -0x6f0(%rbp)
jmp 0xde447
movq -0x6f8(%rbp), %rdi
movsd -0x6f0(%rbp), %xmm0
movsd %xmm0, -0x690(%rbp)
leaq -0x690(%rbp), %rsi
callq 0xf6d0
jmp 0xde46c
leaq -0x180(%rbp), %rdi
callq 0x84ee0
leaq -0x168(%rbp), %rdi
callq 0xf9b0
leaq -0x128(%rbp), %rdi
callq 0xf840
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0xde167
leaq -0x180(%rbp), %rdi
callq 0x84ee0
leaq -0x168(%rbp), %rdi
callq 0xf9b0
leaq -0x128(%rbp), %rdi
callq 0xf840
jmp 0xde4e5
leaq -0x80(%rbp), %rdi
callq 0xe07d0
leaq -0x30(%rbp), %rdi
callq 0x108b0
addq $0x700, %rsp            # imm = 0x700
popq %rbp
retq
leaq -0x80(%rbp), %rdi
callq 0xe07d0
leaq -0x30(%rbp), %rdi
callq 0x108b0
movq -0x60(%rbp), %rdi
callq 0x58f0