// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/distortions.c
// Function: distortions_interpolate_sd_data
int distortions_interpolate_sd_data(struct distortions* psd,
                                    double nu,
                                    double * G_T,
                                    double * Y_SZ,
                                    double * M_mu,
                                    double * S,
                                    int * index){

  /** Define local variables */
  int last_index = *index;
  int index_k;
  double h,a,b;
  double nu_round;

  /** Find z position */
  nu_round = round(nu*pow(10.,3))/pow(10.,3); // The rounding is necessary for the interpolation with the external file
  class_call(array_spline_hunt(psd->PCA_nu,
                               psd->PCA_Nnu,
                               nu_round,
                               &last_index,
                               &h,&a,&b,
                               psd->error_message),
             psd->error_message,
             psd->error_message);

  /** Evaluate corresponding values for the branching ratios */
  *G_T = array_spline_eval(psd->PCA_G_T,
                           psd->ddPCA_G_T,
                           last_index,
                           last_index+1,
                           h,a,b);
  *Y_SZ = array_spline_eval(psd->PCA_Y_SZ,
                            psd->ddPCA_Y_SZ,
                            last_index,
                            last_index+1,
                            h,a,b);
  *M_mu = array_spline_eval(psd->PCA_M_mu,
                            psd->ddPCA_M_mu,
                            last_index,
                            last_index+1,
                            h,a,b);

  for (index_k=0; index_k<psd->sd_PCA_size; ++index_k){
    S[index_k] = array_spline_eval(psd->S_vec+index_k*psd->PCA_Nnu,
                                   psd->ddS_vec+index_k*psd->PCA_Nnu,
                                   last_index,
                                   last_index+1,
                                   h,a,b);
  }

  *index = last_index;

  return _SUCCESS_;
}

// Assembly:
subq $0x888, %rsp            # imm = 0x888
movq %rdi, 0x878(%rsp)
movsd %xmm0, 0x870(%rsp)
movq %rsi, 0x868(%rsp)
movq %rdx, 0x860(%rsp)
movq %rcx, 0x858(%rsp)
movq %r8, 0x850(%rsp)
movq %r9, 0x848(%rsp)
movq 0x848(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x844(%rsp)
movsd 0x870(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x3b7f8(%rip), %xmm0    # 0x1d27e0
movsd 0x3c6a8(%rip), %xmm1    # 0x1d3698
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x8180
movsd %xmm0, 0x18(%rsp)
movsd 0x3b7cb(%rip), %xmm0    # 0x1d27e0
movsd 0x3c67b(%rip), %xmm1    # 0x1d3698
callq 0x8610
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x820(%rsp)
movq 0x878(%rsp), %rax
movq 0xc70(%rax), %rdi
movq 0x878(%rsp), %rax
movl 0xc78(%rax), %esi
movsd 0x820(%rsp), %xmm0
movq 0x878(%rsp), %rax
addq $0x1602, %rax           # imm = 0x1602
leaq 0x844(%rsp), %rdx
leaq 0x838(%rsp), %rcx
leaq 0x830(%rsp), %r8
leaq 0x828(%rsp), %r9
movq %rax, (%rsp)
callq 0x27de0
cmpl $0x1, %eax
jne 0x197101
leaq 0x20(%rsp), %rdi
movq 0x878(%rsp), %rcx
addq $0x1602, %rcx           # imm = 0x1602
leaq 0x3b323(%rip), %rsi     # 0x1d23d8
leaq 0x754f4(%rip), %rdx     # 0x20c5b0
movb $0x0, %al
callq 0x5b9c0
movq 0x878(%rsp), %rdi
addq $0x1602, %rdi           # imm = 0x1602
leaq 0x20(%rsp), %r8
leaq 0x3af56(%rip), %rsi     # 0x1d2034
leaq 0x7552d(%rip), %rdx     # 0x20c612
movl $0x71f, %ecx            # imm = 0x71F
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x884(%rsp)
jmp 0x19771f
movsd 0x830(%rsp), %xmm0
movq 0x878(%rsp), %rax
movq 0xc80(%rax), %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x828(%rsp), %xmm1
movq 0x878(%rsp), %rax
movq 0xc80(%rax), %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x830(%rsp), %xmm1
mulsd 0x830(%rsp), %xmm1
movsd 0x830(%rsp), %xmm3
movsd 0x830(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x878(%rsp), %rax
movq 0xc88(%rax), %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x828(%rsp), %xmm2
mulsd 0x828(%rsp), %xmm2
movsd 0x828(%rsp), %xmm5
movsd 0x828(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x878(%rsp), %rax
movq 0xc88(%rax), %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x838(%rsp), %xmm1
mulsd 0x838(%rsp), %xmm1
movsd 0x3c44b(%rip), %xmm2    # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x868(%rsp), %rax
movsd %xmm0, (%rax)
movsd 0x830(%rsp), %xmm0
movq 0x878(%rsp), %rax
movq 0xc90(%rax), %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x828(%rsp), %xmm1
movq 0x878(%rsp), %rax
movq 0xc90(%rax), %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x830(%rsp), %xmm1
mulsd 0x830(%rsp), %xmm1
movsd 0x830(%rsp), %xmm3
movsd 0x830(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x878(%rsp), %rax
movq 0xc98(%rax), %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x828(%rsp), %xmm2
mulsd 0x828(%rsp), %xmm2
movsd 0x828(%rsp), %xmm5
movsd 0x828(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x878(%rsp), %rax
movq 0xc98(%rax), %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x838(%rsp), %xmm1
mulsd 0x838(%rsp), %xmm1
movsd 0x3c2fb(%rip), %xmm2    # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x860(%rsp), %rax
movsd %xmm0, (%rax)
movsd 0x830(%rsp), %xmm0
movq 0x878(%rsp), %rax
movq 0xca0(%rax), %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x828(%rsp), %xmm1
movq 0x878(%rsp), %rax
movq 0xca0(%rax), %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x830(%rsp), %xmm1
mulsd 0x830(%rsp), %xmm1
movsd 0x830(%rsp), %xmm3
movsd 0x830(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x878(%rsp), %rax
movq 0xca8(%rax), %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x828(%rsp), %xmm2
mulsd 0x828(%rsp), %xmm2
movsd 0x828(%rsp), %xmm5
movsd 0x828(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x878(%rsp), %rax
movq 0xca8(%rax), %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x838(%rsp), %xmm1
mulsd 0x838(%rsp), %xmm1
movsd 0x3c1ab(%rip), %xmm2    # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x858(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x0, 0x840(%rsp)
movl 0x840(%rsp), %eax
movq 0x878(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x197703
movsd 0x830(%rsp), %xmm0
movq 0x878(%rsp), %rax
movq 0xcb0(%rax), %rax
movl 0x840(%rsp), %ecx
movq 0x878(%rsp), %rdx
imull 0xc78(%rdx), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd 0x828(%rsp), %xmm1
movq 0x878(%rsp), %rax
movq 0xcb0(%rax), %rax
movl 0x840(%rsp), %ecx
movq 0x878(%rsp), %rdx
imull 0xc78(%rdx), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x830(%rsp), %xmm1
mulsd 0x830(%rsp), %xmm1
movsd 0x830(%rsp), %xmm3
movsd 0x830(%rsp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
movq 0x878(%rsp), %rax
movq 0xcb8(%rax), %rax
movl 0x840(%rsp), %ecx
movq 0x878(%rsp), %rdx
imull 0xc78(%rdx), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq 0x844(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm3
movsd 0x828(%rsp), %xmm2
mulsd 0x828(%rsp), %xmm2
movsd 0x828(%rsp), %xmm5
movsd 0x828(%rsp), %xmm4
movq %xmm4, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm4
mulsd %xmm5, %xmm2
addsd %xmm4, %xmm2
movq 0x878(%rsp), %rax
movq 0xcb8(%rax), %rax
movl 0x840(%rsp), %ecx
movq 0x878(%rsp), %rdx
imull 0xc78(%rdx), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movl 0x844(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
mulsd (%rax,%rcx,8), %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd 0x838(%rsp), %xmm1
mulsd 0x838(%rsp), %xmm1
movsd 0x3bfb8(%rip), %xmm2    # 0x1d3688
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq 0x850(%rsp), %rax
movslq 0x840(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x840(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x840(%rsp)
jmp 0x1974fc
movl 0x844(%rsp), %ecx
movq 0x848(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x884(%rsp)
movl 0x884(%rsp), %eax
addq $0x888, %rsp            # imm = 0x888
retq
nop