// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/network.cc
// Function: NEWcalculateFreeSphereParameters(MATERIAL*)
void NEWcalculateFreeSphereParameters(MATERIAL *Mat){

  if(Mat->doneFlatVoroFlag == false)
    {
    Mat->runVoroFlat();
    };

  vector<double> freeRadResults;
  vector<double> incRadResults;
  vector<bool> NtoN;

  DELTA_POS directions [3] = {DELTA_POS(1,0,0), DELTA_POS(0,1,0), DELTA_POS(0,0,1)};
  for(unsigned int i = 0; i < 3; i++){
    VORONOI_NETWORK newNet;
    set<int> sourceNodes;
    map<int,int> idAliases;
    extendVorNet(&(Mat->vornet), &newNet, directions[i], &idAliases, &sourceNodes);
   
    DIJKSTRA_NETWORK dnet;
    DIJKSTRA_NETWORK::buildDijkstraNetwork(&newNet,&dnet);

    TRAVERSAL_NETWORK analyzeNet = TRAVERSAL_NETWORK(directions[i].x,directions[i].y,directions[i].z, &dnet);    
    pair<bool,PATH> results = analyzeNet.findMaxFreeSphere(&idAliases, &sourceNodes);
    
    freeRadResults.push_back(2*results.second.max_radius);
    incRadResults.push_back(2*results.second.max_inc_radius);
    NtoN.push_back(results.first);
  }

  double maxd=0.0; int maxdir=0;
  for(unsigned int i = 0; i < freeRadResults.size(); i++)
     {
     if(i==0) {maxd=freeRadResults[i]; maxdir=i;}
       else
       {
       if(maxd<freeRadResults[i])
         {
         maxd=freeRadResults[i]; 
         maxdir=i;
         }
       else if(maxd==freeRadResults[i])
         {
         if(incRadResults[maxdir]<incRadResults[i]) maxdir=i;
         };
       };
     };

 Mat->directionDf = freeRadResults; Mat->directionDif = incRadResults;
 Mat->Di = 2 * findMaxIncludedSphere(&(Mat->vornet));
 Mat->Df = freeRadResults[maxdir];
 Mat->Dif = incRadResults[maxdir];

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movq %rdi, %rbx
cmpb $0x0, 0xc20(%rdi)
jne 0x8de9
movq %rbx, %rdi
callq 0x10b414
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %rax, 0x48(%rsp)
movl %eax, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movl %eax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
leaq 0x80(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x509d8
leaq 0x8c(%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x509d8
leaq 0x98(%rsp), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x509d8
movq %rbx, 0x70(%rsp)
leaq 0x8c0(%rbx), %rax
movq %rax, 0x78(%rsp)
movl $0x8, %r15d
leaq 0xa8(%rsp), %r13
leaq 0xd8(%rsp), %rbp
leaq 0x2c8(%rsp), %rbx
leaq 0x250(%rsp), %r12
movq %r12, %rdi
callq 0x555c0
movl %r14d, 0xe0(%rsp)
movq %r14, 0xe8(%rsp)
leaq 0xe0(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq %rax, 0xf8(%rsp)
movq %r14, 0x100(%rsp)
movl %r14d, 0xb0(%rsp)
movq %r14, 0xb8(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
movq %r14, 0xd0(%rsp)
movq 0x78(%rsp,%r15), %rdx
movl 0x80(%rsp,%r15), %ecx
movq 0x78(%rsp), %rdi
movq %r12, %rsi
movq %r13, %r8
movq %rbp, %r9
callq 0x8057
movq %rbx, %rdi
callq 0x50e9e
leaq 0x250(%rsp), %rdi
movq %rbx, %rsi
callq 0x50fc8
movl 0x78(%rsp,%r15), %esi
movl 0x7c(%rsp,%r15), %edx
movl 0x80(%rsp,%r15), %ecx
leaq 0x108(%rsp), %r12
movq %r12, %rdi
movq %rbx, %r8
callq 0x31a1a
leaq 0x180(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x326f8
movsd 0x1e8(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x8fa0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x8fad
movq %rsp, %rdi
leaq 0x40(%rsp), %rdx
callq 0x139c2
movsd 0x1f0(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x8fdb
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x8fea
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x139c2
movzbl 0x180(%rsp), %esi
leaq 0x48(%rsp), %rdi
callq 0xe9e6
leaq 0x220(%rsp), %rdi
callq 0xf168
movq 0x208(%rsp), %rdi
testq %rdi, %rdi
je 0x9026
movq 0x218(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1c0(%rsp), %rdi
testq %rdi, %rdi
je 0x9043
movq 0x1d0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x188(%rsp), %rdi
callq 0xf07c
leaq 0x150(%rsp), %rdi
callq 0xf0ca
leaq 0x138(%rsp), %rdi
callq 0xf0ca
leaq 0x120(%rsp), %rdi
callq 0xf0ca
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x9094
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0xf07c
movq %r13, %rdi
callq 0xf118
movq %rbp, %rdi
callq 0xf168
movq 0x2b0(%rsp), %rdi
testq %rdi, %rdi
je 0x90c9
movq 0x2c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x298(%rsp), %rdi
callq 0xf1b8
addq $0xc, %r15
cmpq $0x2c, %r15
jne 0x8e8f
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
xorl %ebx, %ebx
subq %rax, %rcx
je 0x9151
sarq $0x3, %rcx
xorpd %xmm0, %xmm0
movq 0x20(%rsp), %rdx
xorl %esi, %esi
movq 0x70(%rsp), %r14
movsd (%rax,%rsi,8), %xmm1
testl %esi, %esi
je 0x9136
ucomisd %xmm0, %xmm1
ja 0x9132
ucomisd %xmm1, %xmm0
jne 0x913a
jp 0x913a
movslq %ebx, %rdi
movsd (%rdx,%rsi,8), %xmm1
ucomisd (%rdx,%rdi,8), %xmm1
jbe 0x913a
movapd %xmm0, %xmm1
movl %esi, %ebx
jmp 0x913e
xorl %ebx, %ebx
jmp 0x913e
movapd %xmm0, %xmm1
incq %rsi
movl %esi, %edi
movapd %xmm1, %xmm0
cmpq %rdi, %rcx
ja 0x9108
movslq %ebx, %rbx
jmp 0x9156
movq 0x70(%rsp), %r14
leaq 0xc40(%r14), %rdi
movq %rsp, %rsi
callq 0xeade
leaq 0xc58(%r14), %rdi
leaq 0x20(%rsp), %rsi
callq 0xeade
movq 0x78(%rsp), %rdi
callq 0x3501d
addsd %xmm0, %xmm0
movsd %xmm0, 0xc28(%r14)
movq (%rsp), %rax
movsd (%rax,%rbx,8), %xmm0
movsd %xmm0, 0xc30(%r14)
movq 0x20(%rsp), %rax
movsd (%rax,%rbx,8), %xmm0
movsd %xmm0, 0xc38(%r14)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x91e2
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movl %eax, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movl %eax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x91f9
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x920f
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x923b
jmp 0x923b
jmp 0x9229
jmp 0x9229
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0xea34
jmp 0x9251
movq %rax, %rbx
jmp 0x9292
jmp 0x9242
movq %rax, %rbx
jmp 0x926b
jmp 0x9249
movq %rax, %rbx
jmp 0x925e
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0xea82
leaq 0x2c8(%rsp), %rdi
callq 0xf07c
leaq 0xa8(%rsp), %rdi
callq 0xf118
leaq 0xd8(%rsp), %rdi
callq 0xf168
leaq 0x250(%rsp), %rdi
callq 0xeab8
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x92c2
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movl %eax, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movl %eax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x92d9
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x92ef
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780