// File: /workspace/github_cpp_makefile_star2_O3/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 0x8f14
movq %rbx, %rdi
callq 0x10a108
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
movq %rax, 0x58(%rsp)
movl %eax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
movl %eax, 0x70(%rsp)
movq %rax, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x506b0
leaq 0x8c(%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x506b0
leaq 0x98(%rsp), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x506b0
movq %rbx, 0x48(%rsp)
leaq 0x8c0(%rbx), %rax
movq %rax, 0x50(%rsp)
movl $0x8, %r15d
leaq 0xa8(%rsp), %r13
leaq 0xd8(%rsp), %rbp
leaq 0x2c8(%rsp), %rbx
leaq 0x250(%rsp), %r12
movq %r12, %rdi
callq 0x55288
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 0x50(%rsp), %rdi
movq %r12, %rsi
movq %r13, %r8
movq %rbp, %r9
callq 0x81d9
movq %rbx, %rdi
callq 0x50b12
leaq 0x250(%rsp), %rdi
movq %rbx, %rsi
callq 0x50c10
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 0x3171e
leaq 0x180(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x32330
movsd 0x1e8(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x90cb
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x90d8
movq %rsp, %rdi
leaq 0x40(%rsp), %rdx
callq 0x1391c
movsd 0x1f0(%rsp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x9106
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x9115
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x1391c
movzbl 0x180(%rsp), %esi
leaq 0x58(%rsp), %rdi
callq 0xea58
leaq 0x220(%rsp), %rdi
callq 0xf206
movq 0x208(%rsp), %rdi
testq %rdi, %rdi
je 0x9151
movq 0x218(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x1c0(%rsp), %rdi
testq %rdi, %rdi
je 0x916e
movq 0x1d0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x188(%rsp), %rdi
callq 0xf10e
leaq 0x150(%rsp), %rdi
callq 0xf162
leaq 0x138(%rsp), %rdi
callq 0xf162
leaq 0x120(%rsp), %rdi
callq 0xf162
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x91bf
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0xf10e
movq %r13, %rdi
callq 0xf1b6
movq %rbp, %rdi
callq 0xf206
movq 0x2b0(%rsp), %rdi
testq %rdi, %rdi
je 0x91f4
movq 0x2c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x298(%rsp), %rdi
callq 0xf256
addq $0xc, %r15
cmpq $0x2c, %r15
jne 0x8fba
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
xorl %ebx, %ebx
subq %rax, %rcx
je 0x927c
sarq $0x3, %rcx
xorpd %xmm0, %xmm0
movq 0x20(%rsp), %rdx
xorl %esi, %esi
movq 0x48(%rsp), %r14
movsd (%rax,%rsi,8), %xmm1
testl %esi, %esi
je 0x9261
ucomisd %xmm0, %xmm1
ja 0x925d
ucomisd %xmm1, %xmm0
jne 0x9265
jp 0x9265
movslq %ebx, %rdi
movsd (%rdx,%rsi,8), %xmm1
ucomisd (%rdx,%rdi,8), %xmm1
jbe 0x9265
movapd %xmm0, %xmm1
movl %esi, %ebx
jmp 0x9269
xorl %ebx, %ebx
jmp 0x9269
movapd %xmm0, %xmm1
incq %rsi
movl %esi, %edi
movapd %xmm1, %xmm0
cmpq %rdi, %rcx
ja 0x9233
movslq %ebx, %rbx
jmp 0x9281
movq 0x48(%rsp), %r14
leaq 0xc40(%r14), %rdi
movq %rsp, %rsi
callq 0xeb50
leaq 0xc58(%r14), %rdi
leaq 0x20(%rsp), %rsi
callq 0xeb50
movq 0x50(%rsp), %rdi
callq 0x34bcb
addsd %xmm0, %xmm0
movsd %xmm0, 0xc28(%r14)
movq (%rsp), %rax
movsd (%rax,%rbx,8), %xmm0
movsd %xmm0, 0xc30(%r14)
movq 0x20(%rsp), %rdi
movsd (%rdi,%rbx,8), %xmm0
movsd %xmm0, 0xc38(%r14)
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x9301
movq 0x78(%rsp), %rsi
subq %rax, %rsi
movq %rax, %rdi
callq 0x4470
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x930e
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x9324
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 0x9350
jmp 0x9350
jmp 0x933e
jmp 0x933e
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0xeaa6
jmp 0x9366
movq %rax, %rbx
jmp 0x93a7
jmp 0x9357
movq %rax, %rbx
jmp 0x9380
jmp 0x935e
movq %rax, %rbx
jmp 0x9373
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0xeaf4
leaq 0x2c8(%rsp), %rdi
callq 0xf10e
leaq 0xa8(%rsp), %rdi
callq 0xf1b6
leaq 0xd8(%rsp), %rdi
callq 0xf206
leaq 0x250(%rsp), %rdi
callq 0xeb2a
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x93cf
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq $0x0, 0x58(%rsp)
movl $0x0, 0x60(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x93e6
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x93fc
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780