// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/output.c
// Function: output_distortions
int output_distortions(
                       struct distortions * psd,
                       struct output * pop
                       ) {

  /** Local variables*/
  FileName file_name_heat, file_name_distortion;
  FILE * out_heat, * out_distortion;

  char titles_heat[_MAXTITLESTRINGLENGTH_]={0};
  char titles_distortion[_MAXTITLESTRINGLENGTH_]={0};

  double * data_heat, * data_distortion;
  int size_data_heat, size_data_distortion;
  int number_of_titles_heat, number_of_titles_distortion;

  if (pop->write_distortions==_TRUE_ && psd->has_distortions == _TRUE_){

    /* File name */
    class_sprintf(file_name_heat,"%s%s",pop->root,"sd_heating.dat");

    /* Titles */
    class_call(distortions_output_heat_titles(psd,titles_heat),
               psd->error_message,
               pop->error_message);
    number_of_titles_heat = get_number_of_titles(titles_heat);

    /* Data array */
    size_data_heat = number_of_titles_heat*psd->z_size;
    class_alloc(data_heat,
                sizeof(double)*size_data_heat,
                pop->error_message);
    class_call(distortions_output_heat_data(psd,
                                            number_of_titles_heat,
                                            data_heat),
               psd->error_message,
               pop->error_message);

    /* File IO */
    class_open(out_heat,
               file_name_heat,
               "w",
               pop->error_message);

    if (pop->write_header == _TRUE_){
      fprintf(out_heat,"# Heat is d(Q/rho)/dz\n");
      fprintf(out_heat,"# LHeat is d(Q/rho)/dlnz\n");
      fprintf(out_heat,"#\n");
    }

    output_print_data(out_heat,
                      titles_heat,
                      data_heat,
                      size_data_heat);
    free(data_heat);
    fclose(out_heat);

    /* File name */
    class_sprintf(file_name_distortion,"%s%s",pop->root,"sd_distortions.dat");

    /* Titles */
    class_call(distortions_output_sd_titles(psd,titles_distortion),
               psd->error_message,
               pop->error_message);
    number_of_titles_distortion = get_number_of_titles(titles_distortion);

    /* Data array */
    size_data_distortion = number_of_titles_distortion*psd->x_size;
    class_alloc(data_distortion,
                sizeof(double)*size_data_distortion,
                pop->error_message);
    class_call(distortions_output_sd_data(psd,
                                          number_of_titles_distortion,
                                          data_distortion),
               psd->error_message,
               pop->error_message);

    /* File IO */
    class_open(out_distortion,
               file_name_distortion,
               "w",
               pop->error_message);

    if (pop->write_header == _TRUE_){
      fprintf(out_distortion,"# SD_tot is the amplitude of the overall spectral distortion (SD)\n");
      fprintf(out_distortion,"# The SD[i] are the amplitudes of the individual SDs\n");
      fprintf(out_distortion,"# The SDs are given in units [10^-26 W m^-2 Hz^-1 sr^-1] \n");
      fprintf(out_distortion,"#\n");
    }

    output_print_data(out_distortion,
                      titles_distortion,
                      data_distortion,
                      size_data_distortion);
    free(data_distortion);
    fclose(out_distortion);
  }

  return _SUCCESS_;
}

// Assembly:
subq $0x8108, %rsp           # imm = 0x8108
movq %rdi, 0x80f8(%rsp)
movq %rsi, 0x80f0(%rsp)
leaq 0x5fa0(%rsp), %rdi
xorl %esi, %esi
movl $0x1f40, %edx           # imm = 0x1F40
callq 0x8210
leaq 0x4060(%rsp), %rdi
xorl %esi, %esi
movl $0x1f40, %edx           # imm = 0x1F40
callq 0x8210
movq 0x80f0(%rsp), %rax
movswl 0x41c(%rax), %eax
cmpl $0x1, %eax
jne 0x1cf628
movq 0x80f8(%rsp), %rax
cmpl $0x1, 0xcd0(%rax)
jne 0x1cf628
jmp 0x1cef4e
movq 0x80f0(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x451a4(%rip), %rdx     # 0x214105
leaq 0x45fb8(%rip), %r8      # 0x214f20
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x403c(%rsp)
leaq 0x7ff0(%rsp), %rdi
movl 0x403c(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movq 0x80f0(%rsp), %rcx
leaq 0x45168(%rip), %rdx     # 0x214105
leaq 0x45f7c(%rip), %r8      # 0x214f20
movb $0x0, %al
callq 0x8540
movq 0x80f8(%rsp), %rdi
leaq 0x5fa0(%rsp), %rsi
callq 0x199b10
cmpl $0x1, %eax
jne 0x1cf032
leaq 0x3830(%rsp), %rdi
movq 0x80f8(%rsp), %rcx
addq $0x1602, %rcx           # imm = 0x1602
leaq 0x33f5(%rip), %rsi      # 0x1d23d8
leaq 0x45f45(%rip), %rdx     # 0x214f2f
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x3830(%rsp), %r8
leaq 0x3025(%rip), %rsi      # 0x1d2034
leaq 0x45f49(%rip), %rdx     # 0x214f5f
movl $0x5e5, %ecx            # imm = 0x5E5
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
leaq 0x5fa0(%rsp), %rdi
callq 0x5bba0
movl %eax, 0x4044(%rsp)
movl 0x4044(%rsp), %eax
movq 0x80f8(%rsp), %rcx
imull 0x330(%rcx), %eax
movl %eax, 0x404c(%rsp)
movslq 0x404c(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x4058(%rsp)
cmpq $0x0, 0x4058(%rsp)
jne 0x1cf0ff
movslq 0x404c(%rsp), %rax
shlq $0x3, %rax
movl %eax, 0x382c(%rsp)
leaq 0x3020(%rsp), %rdi
movl 0x382c(%rsp), %ecx
leaq 0x2f54(%rip), %rsi      # 0x1d2004
leaq 0x45ebb(%rip), %rdx     # 0x214f72
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x3020(%rsp), %r8
leaq 0x2f58(%rip), %rsi      # 0x1d2034
leaq 0x45e7c(%rip), %rdx     # 0x214f5f
movl $0x5ec, %ecx            # imm = 0x5EC
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
movq 0x80f8(%rsp), %rdi
movl 0x4044(%rsp), %esi
movq 0x4058(%rsp), %rdx
callq 0x199b90
cmpl $0x1, %eax
jne 0x1cf18d
leaq 0x2820(%rsp), %rdi
movq 0x80f8(%rsp), %rcx
addq $0x1602, %rcx           # imm = 0x1602
leaq 0x329a(%rip), %rsi      # 0x1d23d8
leaq 0x45e37(%rip), %rdx     # 0x214f7c
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x2820(%rsp), %r8
leaq 0x2eca(%rip), %rsi      # 0x1d2034
leaq 0x45dee(%rip), %rdx     # 0x214f5f
movl $0x5f1, %ecx            # imm = 0x5F1
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
leaq 0x7ff0(%rsp), %rdi
leaq 0x628d(%rip), %rsi      # 0x1d5429
callq 0x8410
movq %rax, 0x7ee8(%rsp)
cmpq $0x0, 0x7ee8(%rsp)
jne 0x1cf221
leaq 0x2020(%rsp), %rdi
leaq 0x7ff0(%rsp), %rcx
leaq 0x5805(%rip), %rsi      # 0x1d49d0
leaq 0x45dee(%rip), %rdx     # 0x214fc0
leaq 0x1f36f(%rip), %r8      # 0x1ee548
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x2020(%rsp), %r8
leaq 0x2e36(%rip), %rsi      # 0x1d2034
leaq 0x45d5a(%rip), %rdx     # 0x214f5f
movl $0x5f7, %ecx            # imm = 0x5F7
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
movq 0x80f0(%rsp), %rax
movswl 0x408(%rax), %eax
cmpl $0x1, %eax
jne 0x1cf277
movq 0x7ee8(%rsp), %rdi
leaq 0x45d85(%rip), %rsi     # 0x214fc9
movb $0x0, %al
callq 0x84e0
movq 0x7ee8(%rsp), %rdi
leaq 0x45d86(%rip), %rsi     # 0x214fe0
movb $0x0, %al
callq 0x84e0
movq 0x7ee8(%rsp), %rdi
leaq 0x1f381(%rip), %rsi     # 0x1ee5f1
movb $0x0, %al
callq 0x84e0
movq 0x7ee8(%rsp), %rdi
leaq 0x5fa0(%rsp), %rsi
movq 0x4058(%rsp), %rdx
movl 0x404c(%rsp), %ecx
callq 0x1d1430
movq 0x4058(%rsp), %rdi
callq 0x8420
movq 0x7ee8(%rsp), %rdi
callq 0x83c0
movq 0x80f0(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x44e3d(%rip), %rdx     # 0x214105
leaq 0x45d2b(%rip), %r8      # 0x214ffa
movq %rsi, %rdi
movb $0x0, %al
callq 0x8540
movl %eax, 0x201c(%rsp)
leaq 0x7ef0(%rsp), %rdi
movl 0x201c(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movq 0x80f0(%rsp), %rcx
leaq 0x44e01(%rip), %rdx     # 0x214105
leaq 0x45cef(%rip), %r8      # 0x214ffa
movb $0x0, %al
callq 0x8540
movq 0x80f8(%rsp), %rdi
leaq 0x4060(%rsp), %rsi
callq 0x199cb0
cmpl $0x1, %eax
jne 0x1cf399
leaq 0x1810(%rsp), %rdi
movq 0x80f8(%rsp), %rcx
addq $0x1602, %rcx           # imm = 0x1602
leaq 0x308e(%rip), %rsi      # 0x1d23d8
leaq 0x45cbc(%rip), %rdx     # 0x21500d
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x1810(%rsp), %r8
leaq 0x2cbe(%rip), %rsi      # 0x1d2034
leaq 0x45be2(%rip), %rdx     # 0x214f5f
movl $0x60c, %ecx            # imm = 0x60C
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
leaq 0x4060(%rsp), %rdi
callq 0x5bba0
movl %eax, 0x4040(%rsp)
movl 0x4040(%rsp), %eax
movq 0x80f8(%rsp), %rcx
imull 0x368(%rcx), %eax
movl %eax, 0x4048(%rsp)
movslq 0x4048(%rsp), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x4050(%rsp)
cmpq $0x0, 0x4050(%rsp)
jne 0x1cf466
movslq 0x4048(%rsp), %rax
shlq $0x3, %rax
movl %eax, 0x180c(%rsp)
leaq 0x1000(%rsp), %rdi
movl 0x180c(%rsp), %ecx
leaq 0x2bed(%rip), %rsi      # 0x1d2004
leaq 0x45c23(%rip), %rdx     # 0x215041
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x1000(%rsp), %r8
leaq 0x2bf1(%rip), %rsi      # 0x1d2034
leaq 0x45b15(%rip), %rdx     # 0x214f5f
movl $0x613, %ecx            # imm = 0x613
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
movq 0x80f8(%rsp), %rdi
movl 0x4040(%rsp), %esi
movq 0x4050(%rsp), %rdx
callq 0x199f00
cmpl $0x1, %eax
jne 0x1cf4f4
leaq 0x800(%rsp), %rdi
movq 0x80f8(%rsp), %rcx
addq $0x1602, %rcx           # imm = 0x1602
leaq 0x2f33(%rip), %rsi      # 0x1d23d8
leaq 0x45ba5(%rip), %rdx     # 0x215051
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x800(%rsp), %r8
leaq 0x2b63(%rip), %rsi      # 0x1d2034
leaq 0x45a87(%rip), %rdx     # 0x214f5f
movl $0x618, %ecx            # imm = 0x618
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
leaq 0x7ef0(%rsp), %rdi
leaq 0x5f26(%rip), %rsi      # 0x1d5429
callq 0x8410
movq %rax, 0x7ee0(%rsp)
cmpq $0x0, 0x7ee0(%rsp)
jne 0x1cf57e
movq %rsp, %rdi
leaq 0x7ef0(%rsp), %rcx
leaq 0x54a3(%rip), %rsi      # 0x1d49d0
leaq 0x45b6b(%rip), %rdx     # 0x21509f
leaq 0x1f00d(%rip), %r8      # 0x1ee548
movb $0x0, %al
callq 0x5b9c0
movq 0x80f0(%rsp), %rdi
addq $0x420, %rdi            # imm = 0x420
movq %rsp, %r8
leaq 0x2ad9(%rip), %rsi      # 0x1d2034
leaq 0x459fd(%rip), %rdx     # 0x214f5f
movl $0x61e, %ecx            # imm = 0x61E
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x8104(%rsp)
jmp 0x1cf633
movq 0x80f0(%rsp), %rax
movswl 0x408(%rax), %eax
cmpl $0x1, %eax
jne 0x1cf5ea
movq 0x7ee0(%rsp), %rdi
leaq 0x45b0d(%rip), %rsi     # 0x2150ae
movb $0x0, %al
callq 0x84e0
movq 0x7ee0(%rsp), %rdi
leaq 0x45b3a(%rip), %rsi     # 0x2150f1
movb $0x0, %al
callq 0x84e0
movq 0x7ee0(%rsp), %rdi
leaq 0x45b5a(%rip), %rsi     # 0x215127
movb $0x0, %al
callq 0x84e0
movq 0x7ee0(%rsp), %rdi
leaq 0x1f00e(%rip), %rsi     # 0x1ee5f1
movb $0x0, %al
callq 0x84e0
movq 0x7ee0(%rsp), %rdi
leaq 0x4060(%rsp), %rsi
movq 0x4050(%rsp), %rdx
movl 0x4048(%rsp), %ecx
callq 0x1d1430
movq 0x4050(%rsp), %rdi
callq 0x8420
movq 0x7ee0(%rsp), %rdi
callq 0x83c0
movl $0x0, 0x8104(%rsp)
movl 0x8104(%rsp), %eax
addq $0x8108, %rsp           # imm = 0x8108
retq
nopw %cs:(%rax,%rax)