// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
cvtsi2sdl 0xc7c(%rdi), %xmm1
cvtsi2sdl 0xc78(%rdi), %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
addq $0x80, %rdi
callq 0x83b30
movsd %xmm0, 0x8(%rsp)
movapd %xmm0, %xmm1
cvtsi2sdl 0xc80(%r14), %xmm2
mulsd (%rsp), %xmm1
movsd %xmm1, 0x28(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0xc78(%r14), %xmm0
divsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
movq %r14, %rdi
callq 0x3c5a8
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm1
movsd %xmm1, 0x38(%rsp)
movapd %xmm2, %xmm1
movsd %xmm0, 0x20(%rsp)
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
leaq 0x113664(%rip), %rsi    # 0x154ce5
movl $0x2, %edx
movq %rbx, %rdi
callq 0x44e0
testq %r15, %r15
je 0x416ab
movq %r15, %rdi
callq 0x41e0
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x44e0
jmp 0x416c2
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x4710
leaq 0x113f0d(%rip), %r15    # 0x1555d6
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x1101d2(%rip), %rsi    # 0x1518b2
movl $0x11, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x46b0
movq %rax, %r12
leaq 0x1101bf(%rip), %rsi    # 0x1518c4
movl $0xc, %edx
movq %rax, %rdi
callq 0x44e0
movq %r12, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x46b0
leaq 0x10bdb7(%rip), %rsi    # 0x14d4de
movl $0x3, %edx
movq %rax, %rdi
callq 0x44e0
leaq 0x110252(%rip), %rsi    # 0x15198d
movl $0x8, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
movsd 0x28(%rsp), %xmm0
callq 0x46b0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x110229(%rip), %rsi    # 0x151999
movl $0x14, %edx
movq %r12, %rdi
callq 0x44e0
movq %r12, %rdi
movsd (%rsp), %xmm0
callq 0x46b0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x11020d(%rip), %rsi    # 0x1519b1
movl $0xb, %edx
movq %r12, %rdi
callq 0x44e0
movq %r12, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x46b0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x1101b3(%rip), %rsi    # 0x15198c
movl $0x9, %edx
movq %r12, %rdi
callq 0x44e0
movq %r12, %rdi
movsd 0x38(%rsp), %xmm0
callq 0x46b0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x11018a(%rip), %rsi    # 0x151998
movl $0x15, %edx
movq %r12, %rdi
callq 0x44e0
movq %r12, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x46b0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
leaq 0x11016d(%rip), %rsi    # 0x1519b0
movl $0xc, %edx
movq %r12, %rdi
callq 0x44e0
movq %r12, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x46b0
cmpb $0x1, 0xc8c(%r14)
jne 0x4193c
cvtsi2sdl 0xc84(%r14), %xmm1
xorps %xmm0, %xmm0
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 0x20(%rsp), %xmm0
movsd %xmm0, (%rsp)
leaq 0x110020(%rip), %rsi    # 0x1518d1
movl $0xc, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x46b0
movq %rax, %r15
leaq 0x113d00(%rip), %r12    # 0x1555d6
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x44e0
leaq 0x10fff1(%rip), %rsi    # 0x1518de
movl $0x17, %edx
movq %r15, %rdi
callq 0x44e0
movq %r15, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x46b0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x44e0
leaq 0x10ffd4(%rip), %rsi    # 0x1518f6
movl $0xe, %edx
movq %r15, %rdi
callq 0x44e0
movq %r15, %rdi
movsd (%rsp), %xmm0
callq 0x46b0
leaq 0x111cdb(%rip), %rsi    # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x44e0
leaq 0x10ffae(%rip), %rsi    # 0x151905
movl $0x14, %edx
movq %rbx, %rdi
callq 0x44e0
movq 0xcf8(%r14), %rsi
subq 0xcf0(%r14), %rsi
sarq $0x2, %rsi
movq %rbx, %rdi
callq 0x42b0
leaq 0x10ff95(%rip), %rsi    # 0x15191a
movl $0x15, %edx
movq %rax, %rdi
callq 0x44e0
movq 0xcf0(%r14), %rax
cmpq %rax, 0xcf8(%r14)
je 0x41a10
movl $0x1, %ebp
xorl %ecx, %ecx
leaq 0x10bb2f(%rip), %r15    # 0x14d4df
xorps %xmm1, %xmm1
cvtsi2sdl (%rax,%rcx,4), %xmm1
xorps %xmm2, %xmm2
cvtsi2sdl 0xc78(%r14), %xmm2
movsd 0x10b68c(%rip), %xmm0   # 0x14d058
divsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x46b0
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
movl %ebp, %ecx
movq 0xcf0(%r14), %rax
movq 0xcf8(%r14), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x419b0
leaq 0x10ff19(%rip), %rsi    # 0x151930
movl $0x14, %edx
movq %rbx, %rdi
callq 0x44e0
movq 0xd10(%r14), %rsi
subq 0xd08(%r14), %rsi
sarq $0x2, %rsi
movq %rbx, %rdi
callq 0x42b0
leaq 0x10ff00(%rip), %rsi    # 0x151945
movl $0x14, %edx
movq %rax, %rdi
callq 0x44e0
movq 0xd08(%r14), %rax
cmpq %rax, 0xd10(%r14)
je 0x41ad0
movl $0x1, %ebp
xorl %ecx, %ecx
leaq 0x10ba6f(%rip), %r15    # 0x14d4df
xorps %xmm1, %xmm1
cvtsi2sdl (%rax,%rcx,4), %xmm1
xorps %xmm2, %xmm2
cvtsi2sdl 0xc78(%r14), %xmm2
movsd 0x10b5cc(%rip), %xmm0   # 0x14d058
divsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
movq %rbx, %rdi
callq 0x46b0
movl $0x2, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x44e0
movl %ebp, %ecx
movq 0xd08(%r14), %rax
movq 0xd10(%r14), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x41a70
leaq 0x111b47(%rip), %rsi    # 0x15361e
movl $0x1, %edx
movq %rbx, %rdi
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x44e0