// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../tools/arrays.c
// Function: array_search_bisect
int array_search_bisect(
                        int n_lines,
                        double * __restrict__ array,
                        double c,
                        int * __restrict__ last_index,
                        ErrorMsg errmsg) {

  int inf,sup,mid;

  inf=0;
  sup=n_lines-1;

  if (array[inf] < array[sup]){

    if (c < array[inf]) {
      class_sprintf(errmsg,"%s(L:%d) : c=%e < y_min=%e",__func__,__LINE__,c,array[inf]);
      return _FAILURE_;
    }

    if (c > array[sup]) {
      class_sprintf(errmsg,"%s(L:%d) : c=%e > y_max=%e",__func__,__LINE__,c,array[sup]);
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (c < array[mid]) {sup=mid;}
      else {inf=mid;}

    }

  }

  else {

    if (c < array[sup]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e < x_min=%e",__func__,__LINE__,c,array[sup]);
      return _FAILURE_;
    }

    if (c > array[inf]) {
      class_sprintf(errmsg,"%s(L:%d) : x=%e > x_max=%e",__func__,__LINE__,c,array[inf]);
      return _FAILURE_;
    }

    while (sup-inf > 1) {

      mid=(int)(0.5*(inf+sup));
      if (c > array[mid]) {sup=mid;}
      else {inf=mid;}

    }

  }

  *last_index = inf;

  return _SUCCESS_;
}

// Assembly:
subq $0x48, %rsp
movl %edi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movsd %xmm0, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x40(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x249e7
movsd 0x30(%rsp), %xmm1
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x248e0
jmp 0x24859
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af912(%rip), %rdx    # 0x1d418b
leaq 0x1af926(%rip), %rcx    # 0x1d41a6
movl $0x76d, %r8d            # imm = 0x76D
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af8cc(%rip), %rdx    # 0x1d418b
leaq 0x1af8e0(%rip), %rcx    # 0x1d41a6
movl $0x76d, %r8d            # imm = 0x76D
movb $0x2, %al
callq 0x8540
movl $0x1, 0x44(%rsp)
jmp 0x24b9f
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x24984
jmp 0x248fd
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af89d(%rip), %rdx    # 0x1d41ba
leaq 0x1af882(%rip), %rcx    # 0x1d41a6
movl $0x772, %r8d            # imm = 0x772
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0xc(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af857(%rip), %rdx    # 0x1d41ba
leaq 0x1af83c(%rip), %rcx    # 0x1d41a6
movl $0x772, %r8d            # imm = 0x772
movb $0x2, %al
callq 0x8540
movl $0x1, 0x44(%rsp)
jmp 0x24b9f
jmp 0x24986
movl 0x18(%rsp), %eax
subl 0x1c(%rsp), %eax
cmpl $0x1, %eax
jle 0x249e2
movl 0x1c(%rsp), %eax
addl 0x18(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ae2e1(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x14(%rsp)
movsd 0x30(%rsp), %xmm1
movq 0x38(%rsp), %rax
movslq 0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x249d8
movl 0x14(%rsp), %eax
movl %eax, 0x18(%rsp)
jmp 0x249e0
movl 0x14(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x24986
jmp 0x24b8c
movsd 0x30(%rsp), %xmm1
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x24a8f
jmp 0x24a08
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af6de(%rip), %rdx    # 0x1d4106
leaq 0x1af777(%rip), %rcx    # 0x1d41a6
movl $0x783, %r8d            # imm = 0x783
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movl 0x8(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af698(%rip), %rdx    # 0x1d4106
leaq 0x1af731(%rip), %rcx    # 0x1d41a6
movl $0x783, %r8d            # imm = 0x783
movb $0x2, %al
callq 0x8540
movl $0x1, 0x44(%rsp)
jmp 0x24b9f
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x24b30
jmp 0x24aac
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
xorl %eax, %eax
movl %eax, %esi
leaq 0x1af667(%rip), %rdx    # 0x1d4133
leaq 0x1af6d3(%rip), %rcx    # 0x1d41a6
movl $0x788, %r8d            # imm = 0x788
movq %rsi, %rdi
movb $0x2, %al
callq 0x8540
movl %eax, 0x4(%rsp)
movq 0x20(%rsp), %rdi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
leaq 0x1af621(%rip), %rdx    # 0x1d4133
leaq 0x1af68d(%rip), %rcx    # 0x1d41a6
movl $0x788, %r8d            # imm = 0x788
movb $0x2, %al
callq 0x8540
movl $0x1, 0x44(%rsp)
jmp 0x24b9f
jmp 0x24b32
movl 0x18(%rsp), %eax
subl 0x1c(%rsp), %eax
cmpl $0x1, %eax
jle 0x24b8a
movl 0x1c(%rsp), %eax
addl 0x18(%rsp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x1ae135(%rip), %xmm0   # 0x1d2c88
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x14(%rsp)
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rax
movslq 0x14(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x24b80
movl 0x14(%rsp), %eax
movl %eax, 0x18(%rsp)
jmp 0x24b88
movl 0x14(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x24b32
jmp 0x24b8c
movl 0x1c(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax,%rax)