// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/background.c
// Function: background_at_z
int background_at_z(
                    struct background *pba,
                    double z,
                    enum vecback_format return_format,
                    enum interpolation_method inter_mode,
                    int * last_index,
                    double * pvecback /* vector with argument pvecback[index_bg] (must be already allocated with a size compatible with return_format) */
                    ) {

  /** Summary: */

  /** - define local variables */

  /* size of output vector, controlled by input parameter return_format */
  int pvecback_size;

  /* log(a) (in fact, given our normalisation conventions, this is log(a/a_0)) */
  double loga;

  /** - check that log(a) = log(1/(1+z)) = -log(1+z) is in the pre-computed range */
  loga = -log(1+z);

  class_test(loga < pba->loga_table[0],
             pba->error_message,
             "out of range: a/a_0 = %e < a_min/a_0 = %e, you should decrease the precision parameter a_ini_over_a_today_default\n",1./(1.+z),exp(pba->loga_table[0]));

  class_test(loga > pba->loga_table[pba->bt_size-1],
             pba->error_message,
             "out of range: a/a_0 = %e > a_max/a_0 = %e\n",1./(1.+z),exp(pba->loga_table[pba->bt_size-1]));

  /** - deduce length of returned vector from format mode */

  if (return_format == normal_info) {
    pvecback_size=pba->bg_size_normal;
  }
  else {
    if (return_format == short_info) {
      pvecback_size=pba->bg_size_short;
    }
    else {
      pvecback_size=pba->bg_size;
    }
  }


  /** - interpolate from pre-computed table with array_interpolate()
      or array_interpolate_growing_closeby() (depending on
      interpolation mode) */

  if (inter_mode == inter_normal) {
    class_call(array_interpolate_spline(
                                        pba->loga_table,
                                        pba->bt_size,
                                        pba->background_table,
                                        pba->d2background_dloga2_table,
                                        pba->bg_size,
                                        loga,
                                        last_index,
                                        pvecback,
                                        pvecback_size,
                                        pba->error_message),
               pba->error_message,
               pba->error_message);
  }
  if (inter_mode == inter_closeby) {
    class_call(array_interpolate_spline_growing_closeby(
                                                        pba->loga_table,
                                                        pba->bt_size,
                                                        pba->background_table,
                                                        pba->d2background_dloga2_table,
                                                        pba->bg_size,
                                                        loga,
                                                        last_index,
                                                        pvecback,
                                                        pvecback_size,
                                                        pba->error_message),
               pba->error_message,
               pba->error_message);
  }

  return _SUCCESS_;
}

// Assembly:
subq $0x3088, %rsp           # imm = 0x3088
movq %rdi, 0x3078(%rsp)
movsd %xmm0, 0x3070(%rsp)
movl %esi, 0x306c(%rsp)
movl %edx, 0x3068(%rsp)
movq %rcx, 0x3060(%rsp)
movq %r8, 0x3058(%rsp)
movsd 0x133d5a(%rip), %xmm0   # 0x1d2248
addsd 0x3070(%rsp), %xmm0
callq 0x82f0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x3048(%rsp)
movsd 0x3048(%rsp), %xmm1
movq 0x3078(%rsp), %rax
movq 0x448(%rax), %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x9e60c
leaq 0x2840(%rsp), %rax
movq %rax, 0x30(%rsp)
movsd 0x133cf1(%rip), %xmm1   # 0x1d2248
addsd 0x3070(%rsp), %xmm1
movsd 0x133ce0(%rip), %xmm0   # 0x1d2248
divsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x3078(%rsp), %rax
movq 0x448(%rax), %rax
movsd (%rax), %xmm0
callq 0x8670
movq 0x30(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
leaq 0x1501e1(%rip), %rsi    # 0x1ee780
movb $0x2, %al
callq 0x5b9c0
leaq 0x2040(%rsp), %rdi
leaq 0x2840(%rsp), %rcx
leaq 0x133ac5(%rip), %rsi    # 0x1d2082
leaq 0x15022f(%rip), %rdx    # 0x1ee7f3
movb $0x0, %al
callq 0x5b9c0
movq 0x3078(%rsp), %rdi
addq $0xd1c, %rdi            # imm = 0xD1C
leaq 0x2040(%rsp), %r8
leaq 0x133a4b(%rip), %rsi    # 0x1d2034
leaq 0x15021d(%rip), %rdx    # 0x1ee80d
movl $0x9f, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3084(%rsp)
jmp 0x9e999
movsd 0x3048(%rsp), %xmm0
movq 0x3078(%rsp), %rax
movq 0x448(%rax), %rax
movq 0x3078(%rsp), %rcx
movl 0x440(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x9e722
leaq 0x1840(%rsp), %rax
movq %rax, 0x20(%rsp)
movsd 0x133bf0(%rip), %xmm1   # 0x1d2248
addsd 0x3070(%rsp), %xmm1
movsd 0x133bdf(%rip), %xmm0   # 0x1d2248
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x3078(%rsp), %rax
movq 0x448(%rax), %rax
movq 0x3078(%rsp), %rcx
movl 0x440(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x8670
movq 0x20(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
leaq 0x150168(%rip), %rsi    # 0x1ee81d
movb $0x2, %al
callq 0x5b9c0
leaq 0x1040(%rsp), %rdi
leaq 0x1840(%rsp), %rcx
leaq 0x1339af(%rip), %rsi    # 0x1d2082
leaq 0x15016e(%rip), %rdx    # 0x1ee848
movb $0x0, %al
callq 0x5b9c0
movq 0x3078(%rsp), %rdi
addq $0xd1c, %rdi            # imm = 0xD1C
leaq 0x1040(%rsp), %r8
leaq 0x133935(%rip), %rsi    # 0x1d2034
leaq 0x150107(%rip), %rdx    # 0x1ee80d
movl $0xa3, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3084(%rsp)
jmp 0x9e999
cmpl $0x1, 0x306c(%rsp)
jne 0x9e743
movq 0x3078(%rsp), %rax
movl 0x438(%rax), %eax
movl %eax, 0x3054(%rsp)
jmp 0x9e77b
cmpl $0x0, 0x306c(%rsp)
jne 0x9e764
movq 0x3078(%rsp), %rax
movl 0x434(%rax), %eax
movl %eax, 0x3054(%rsp)
jmp 0x9e779
movq 0x3078(%rsp), %rax
movl 0x43c(%rax), %eax
movl %eax, 0x3054(%rsp)
jmp 0x9e77b
cmpl $0x0, 0x3068(%rsp)
jne 0x9e889
movq 0x3078(%rsp), %rax
movq 0x448(%rax), %rdi
movq 0x3078(%rsp), %rax
movl 0x440(%rax), %esi
movq 0x3078(%rsp), %rax
movq 0x460(%rax), %rdx
movq 0x3078(%rsp), %rax
movq 0x478(%rax), %rcx
movq 0x3078(%rsp), %rax
movl 0x43c(%rax), %r8d
movsd 0x3048(%rsp), %xmm0
movq 0x3060(%rsp), %r9
movq 0x3058(%rsp), %r11
movl 0x3054(%rsp), %r10d
movq 0x3078(%rsp), %rax
addq $0xd1c, %rax            # imm = 0xD1C
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x24220
cmpl $0x1, %eax
jne 0x9e887
leaq 0x840(%rsp), %rdi
movq 0x3078(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x133ba0(%rip), %rsi    # 0x1d23d8
leaq 0x150030(%rip), %rdx    # 0x1ee86f
movb $0x0, %al
callq 0x5b9c0
movq 0x3078(%rsp), %rdi
addq $0xd1c, %rdi            # imm = 0xD1C
leaq 0x840(%rsp), %r8
leaq 0x1337d0(%rip), %rsi    # 0x1d2034
leaq 0x14ffa2(%rip), %rdx    # 0x1ee80d
movl $0xc5, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3084(%rsp)
jmp 0x9e999
jmp 0x9e889
cmpl $0x1, 0x3068(%rsp)
jne 0x9e98e
movq 0x3078(%rsp), %rax
movq 0x448(%rax), %rdi
movq 0x3078(%rsp), %rax
movl 0x440(%rax), %esi
movq 0x3078(%rsp), %rax
movq 0x460(%rax), %rdx
movq 0x3078(%rsp), %rax
movq 0x478(%rax), %rcx
movq 0x3078(%rsp), %rax
movl 0x43c(%rax), %r8d
movsd 0x3048(%rsp), %xmm0
movq 0x3060(%rsp), %r9
movq 0x3058(%rsp), %r11
movl 0x3054(%rsp), %r10d
movq 0x3078(%rsp), %rax
addq $0xd1c, %rax            # imm = 0xD1C
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x27300
cmpl $0x1, %eax
jne 0x9e98c
leaq 0x40(%rsp), %rdi
movq 0x3078(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x133a95(%rip), %rsi    # 0x1d23d8
leaq 0x14ffe2(%rip), %rdx    # 0x1ee92c
movb $0x0, %al
callq 0x5b9c0
movq 0x3078(%rsp), %rdi
addq $0xd1c, %rdi            # imm = 0xD1C
leaq 0x40(%rsp), %r8
leaq 0x1336c8(%rip), %rsi    # 0x1d2034
leaq 0x14fe9a(%rip), %rdx    # 0x1ee80d
movl $0xd4, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3084(%rsp)
jmp 0x9e999
jmp 0x9e98e
movl $0x0, 0x3084(%rsp)
movl 0x3084(%rsp), %eax
addq $0x3088, %rsp           # imm = 0x3088
retq
nopl (%rax,%rax)