// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc7c(%rax), %xmm0
movsd 0x177465(%rip), %xmm1   # 0x1f2050
mulsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc78(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
addq $0x80, %rdi
callq 0xe9390
movsd %xmm0, -0x28(%rbp)
movsd -0x20(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc80(%rax), %xmm0
movsd 0x177414(%rip), %xmm1   # 0x1f2050
mulsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc78(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x74f60
movsd %xmm0, -0x40(%rbp)
movsd -0x20(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x38(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x38(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x180c9a(%rip), %rsi    # 0x1fb935
callq 0x5540
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x5540
movq %rax, %rdi
leaq 0x1815f8(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq -0x10(%rbp), %rdi
leaq 0x17bbbc(%rip), %rsi    # 0x1f6882
callq 0x5540
movq %rax, %rdi
movsd -0x28(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x17bbb2(%rip), %rsi    # 0x1f6894
callq 0x5540
movq %rax, %rdi
movsd -0x40(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x177789(%rip), %rsi    # 0x1f2487
callq 0x5540
movq -0x10(%rbp), %rdi
leaq 0x17bc4f(%rip), %rsi    # 0x1f695d
callq 0x5540
movq %rax, %rdi
movsd -0x30(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x181584(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, %rdi
leaq 0x17bc30(%rip), %rsi    # 0x1f6969
callq 0x5540
movq %rax, %rdi
movsd -0x20(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x181559(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, %rdi
leaq 0x17bc1d(%rip), %rsi    # 0x1f6981
callq 0x5540
movq %rax, %rdi
movsd -0x48(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x18152e(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, %rdi
leaq 0x17bbcd(%rip), %rsi    # 0x1f695c
callq 0x5540
movq %rax, %rdi
movsd -0x50(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x181503(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, %rdi
leaq 0x17bbae(%rip), %rsi    # 0x1f6968
callq 0x5540
movq %rax, %rdi
movsd -0x38(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x1814d8(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, %rdi
leaq 0x17bb9b(%rip), %rsi    # 0x1f6980
callq 0x5540
movq %rax, %rdi
movsd -0x58(%rbp), %xmm0
callq 0x5980
movq -0x8(%rbp), %rax
testb $0x1, 0xc8c(%rax)
je 0x7aec6
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc84(%rax), %xmm0
movsd 0x177234(%rip), %xmm1   # 0x1f2050
mulsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc78(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x60(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x17ba43(%rip), %rsi    # 0x1f68a1
callq 0x5540
movq %rax, %rdi
movsd -0x68(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x181434(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, %rdi
leaq 0x17ba25(%rip), %rsi    # 0x1f68ae
callq 0x5540
movq %rax, %rdi
movsd -0x60(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x181409(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, %rdi
leaq 0x17ba12(%rip), %rsi    # 0x1f68c6
callq 0x5540
movq %rax, %rdi
movsd -0x70(%rbp), %xmm0
callq 0x5980
movq -0x10(%rbp), %rdi
leaq 0x17e754(%rip), %rsi    # 0x1f9625
callq 0x5540
movq -0x10(%rbp), %rdi
leaq 0x17b9f4(%rip), %rsi    # 0x1f68d5
callq 0x5540
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
addq $0xcf0, %rdi            # imm = 0xCF0
callq 0x10090
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x5160
movq %rax, %rdi
leaq 0x17b9da(%rip), %rsi    # 0x1f68ea
callq 0x5540
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
addq $0xcf0, %rdi            # imm = 0xCF0
callq 0x10090
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
jae 0x7afb3
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
addq $0xcf0, %rdi            # imm = 0xCF0
movl -0x74(%rbp), %eax
movl %eax, %esi
callq 0xed60
movq -0x90(%rbp), %rdi
cvtsi2sdl (%rax), %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc78(%rax), %xmm2
movsd 0x1770cc(%rip), %xmm1   # 0x1f2050
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
mulsd -0x28(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x1774e8(%rip), %rsi    # 0x1f2488
callq 0x5540
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x7af1c
movq -0x10(%rbp), %rdi
leaq 0x17b942(%rip), %rsi    # 0x1f6900
callq 0x5540
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
addq $0xd08, %rdi            # imm = 0xD08
callq 0x10090
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x5160
movq %rax, %rdi
leaq 0x17b922(%rip), %rsi    # 0x1f6915
callq 0x5540
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
addq $0xd08, %rdi            # imm = 0xD08
callq 0x10090
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x7b096
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
addq $0xd08, %rdi            # imm = 0xD08
movl -0x78(%rbp), %eax
movl %eax, %esi
callq 0xed60
movq -0xa8(%rbp), %rdi
cvtsi2sdl (%rax), %xmm0
movq -0x8(%rbp), %rax
cvtsi2sdl 0xc78(%rax), %xmm2
movsd 0x176fe9(%rip), %xmm1   # 0x1f2050
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
mulsd -0x28(%rbp), %xmm0
callq 0x5980
movq %rax, %rdi
leaq 0x177405(%rip), %rsi    # 0x1f2488
callq 0x5540
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x7afff
movq -0x10(%rbp), %rdi
leaq 0x17e584(%rip), %rsi    # 0x1f9625
callq 0x5540
addq $0xb0, %rsp
popq %rbp
retq
nop