// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/area_and_volume.cc
// Function: NEWcalcAVprint(MATERIAL*, std::ostream&, char*)
void NEWcalcAVprint(MATERIAL *Mat, ostream &output, char *filename) {

  double volumeFraction = Mat->AVcount*1.0/Mat->AVnumSamples;
  double origVolume = calcDeterminant(Mat->atmnet.ucVectors);
  double av = volumeFraction * origVolume;

  // Write the results to the output stream
  double volumeFraction_inaxs = Mat->AVcount_inaxs*1.0/Mat->AVnumSamples;
  double rho_crystal = calcDensity(&(Mat->atmnet));
  double avPerMass   = volumeFraction/rho_crystal;
  double av_inaxs = volumeFraction_inaxs * origVolume;
  double avPerMass_inaxs   = volumeFraction_inaxs/rho_crystal;
 //    output << newAtomNet.name << " ";
  output << "@ " << filename << " ";
  output << "Unitcell_volume: " << origVolume << "   Density: " << rho_crystal << "   ";
  output << "AV_A^3: " << av << " "
         << "AV_Volume_fraction: " << volumeFraction << " "
         << "AV_cm^3/g: " << avPerMass << " "
         << "NAV_A^3: " << av_inaxs << " "
         << "NAV_Volume_fraction: " << volumeFraction_inaxs << " "
         << "NAV_cm^3/g: " << avPerMass_inaxs;
  if(Mat->AVwithin_rangeFlag) {
    double volumeFraction_within_range = Mat->AVcount_within_range*1.0/Mat->AVnumSamples;
    double av_within_range = volumeFraction_within_range * origVolume;
    double avPerMass_within_range   = volumeFraction_within_range/rho_crystal;
    output << " range_A^3: " << av_within_range << " "
    << "range_Volume_fraction: " << volumeFraction_within_range << " "
    << "range_cm^3/g: " << avPerMass_within_range;
  }
  output << "\n";

  output << "Number_of_channels: " << Mat->AVcount_inChannel.size()  << " Channel_volume_A^3: ";
  for(unsigned int i = 0; i < Mat->AVcount_inChannel.size(); i++)
    {
    output << Mat->AVcount_inChannel[i]*(1.0/Mat->AVnumSamples) * origVolume << "  ";
    };
  output << "\nNumber_of_pockets: " << Mat->AVcount_inPocket.size()  << " Pocket_volume_A^3: ";
  for(unsigned int i = 0; i < Mat->AVcount_inPocket.size(); i++)
    {
    output << Mat->AVcount_inPocket[i]*(1.0/Mat->AVnumSamples) * origVolume << "  ";
    };
  output << "\n";

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
cvtdq2pd 0xc78(%rdi), %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
divsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
addq $0x80, %rdi
callq 0x63835
movsd %xmm0, 0x8(%rsp)
movapd %xmm0, %xmm1
cvtsi2sdl 0xc80(%r14), %xmm2
mulsd 0x20(%rsp), %xmm1
movsd %xmm1, 0x40(%rsp)
cvtsi2sdl 0xc78(%r14), %xmm0
divsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
movq %r14, %rdi
callq 0x2d85c
movapd %xmm0, %xmm2
movsd %xmm0, 0x38(%rsp)
movapd 0x20(%rsp), %xmm0
divsd %xmm2, %xmm0
movapd %xmm0, 0x50(%rsp)
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm1
movsd %xmm1, 0x48(%rsp)
divsd %xmm2, %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0xd287b(%rip), %rsi     # 0x103c3d
movq %rbx, %rdi
callq 0x4480
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xd3136(%rip), %r15     # 0x104512
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf434(%rip), %rsi     # 0x100822
movq %rbx, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x46c0
leaq 0xcf429(%rip), %rsi     # 0x100834
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x38(%rsp), %xmm0
callq 0x46c0
leaq 0xcb0a6(%rip), %rsi     # 0xfc4ce
movq %rax, %rdi
callq 0x4480
leaq 0xcf4c6(%rip), %rsi     # 0x1008fd
movq %rbx, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x40(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf4aa(%rip), %rsi     # 0x100909
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movaps 0x20(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf49b(%rip), %rsi     # 0x100921
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movaps 0x50(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf44f(%rip), %rsi     # 0x1008fc
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x48(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf433(%rip), %rsi     # 0x100908
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf423(%rip), %rsi     # 0x100920
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x46c0
cmpb $0x1, 0xc8c(%r14)
jne 0x315d1
cvtsi2sdl 0xc84(%r14), %xmm1
cvtsi2sdl 0xc78(%r14), %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movapd %xmm1, %xmm0
divsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0xcf2dd(%rip), %rsi     # 0x100841
movq %rbx, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x46c0
leaq 0xd2f91(%rip), %r15     # 0x104512
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf2bb(%rip), %rsi     # 0x10084e
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leaq 0xcf2ab(%rip), %rsi     # 0x100866
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x46c0
leaq 0xd0fa6(%rip), %rsi     # 0x10257e
movq %rbx, %rdi
callq 0x4480
leaq 0xcf28e(%rip), %rsi     # 0x100875
movq %rbx, %rdi
callq 0x4480
movq 0xcf8(%r14), %rsi
subq 0xcf0(%r14), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x42e0
leaq 0xcf27a(%rip), %rsi     # 0x10088a
movq %rax, %rdi
callq 0x4480
xorl %eax, %eax
leaq 0xcaeae(%rip), %r15     # 0xfc4cf
movl %eax, %r12d
movq 0xcf0(%r14), %rax
movq 0xcf8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x3167d
cvtsi2sdl (%rax,%r12,4), %xmm1
cvtsi2sdl 0xc78(%r14), %xmm2
movsd 0xcaa03(%rip), %xmm0    # 0xfc058
divsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leal 0x1(%r12), %eax
jmp 0x31621
leaq 0xcf21c(%rip), %rsi     # 0x1008a0
movq %rbx, %rdi
callq 0x4480
movq 0xd10(%r14), %rsi
subq 0xd08(%r14), %rsi
sarq $0x2, %rsi
movq %rax, %rdi
callq 0x42e0
leaq 0xcf208(%rip), %rsi     # 0x1008b5
movq %rax, %rdi
callq 0x4480
xorl %eax, %eax
leaq 0xcae11(%rip), %r15     # 0xfc4cf
movl %eax, %r12d
movq 0xd08(%r14), %rax
movq 0xd10(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x3171a
cvtsi2sdl (%rax,%r12,4), %xmm1
cvtsi2sdl 0xc78(%r14), %xmm2
movsd 0xca966(%rip), %xmm0    # 0xfc058
divsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x46c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4480
leal 0x1(%r12), %eax
jmp 0x316be
leaq 0xd0e5d(%rip), %rsi     # 0x10257e
movq %rbx, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4480