// File: /workspace/github_cpp_makefile_star2_O2/redpony[P]libpopt/./lbfgs.h
// Function: scitbx::lbfgs::minimizer<double, unsigned long>::generic_run(double*, double, double const*, bool, double const*)
bool minimizer<FloatType, SizeType>::generic_run(
    FloatType* x,
    FloatType f,
    const FloatType* g,
    bool diagco,
    const FloatType* diag)
  {
    bool execute_entire_while_loop = false;
    if (!(requests_f_and_g_ || requests_diag_)) {
      execute_entire_while_loop = true;
    }
    requests_f_and_g_ = false;
    requests_diag_ = false;
    FloatType* w = &(*(w_.begin()));
    if (iflag_ == 0) { // Initialize.
      nfun_ = 1;
      if (diagco) {
        for (SizeType i = 0; i < n_; i++) {
          if (diag[i] <= FloatType(0)) {
            throw_diagonal_element_not_positive(i);
          }
        }
      }
      else {
        std::fill_n(scratch_array_.begin(), n_, FloatType(1));
        diag = &(*(scratch_array_.begin()));
      }
      for (SizeType i = 0; i < n_; i++) {
        w[ispt + i] = -g[i] * diag[i];
      }
      FloatType gnorm = std::sqrt(detail::ddot(n_, g, g));
      if (gnorm == FloatType(0)) return false;
      stp1 = FloatType(1) / gnorm;
      execute_entire_while_loop = true;
    }
    if (execute_entire_while_loop) {
      bound = iter_;
      iter_++;
      info = 0;
      if (iter_ != 1) {
        if (iter_ > m_) bound = m_;
        ys = detail::ddot(
          n_, w, iypt + npt, SizeType(1), w, ispt + npt, SizeType(1));
        if (!diagco) {
          FloatType yy = detail::ddot(
            n_, w, iypt + npt, SizeType(1), w, iypt + npt, SizeType(1));
          std::fill_n(scratch_array_.begin(), n_, ys / yy);
          diag = &(*(scratch_array_.begin()));
        }
        else {
          iflag_ = 2;
          requests_diag_ = true;
          return true;
        }
      }
    }
    if (execute_entire_while_loop || iflag_ == 2) {
      if (iter_ != 1) {
        if (diag == 0) {
          throw error_internal_error(__FILE__, __LINE__);
        }
        if (diagco) {
          for (SizeType i = 0; i < n_; i++) {
            if (diag[i] <= FloatType(0)) {
              throw_diagonal_element_not_positive(i);
            }
          }
        }
        SizeType cp = point;
        if (point == 0) cp = m_;
        w[n_ + cp -1] = 1 / ys;
        SizeType i;
        for (i = 0; i < n_; i++) {
          w[i] = -g[i];
        }
        cp = point;
        for (i = 0; i < bound; i++) {
          if (cp == 0) cp = m_;
          cp--;
          FloatType sq = detail::ddot(
            n_, w, ispt + cp * n_, SizeType(1), w, SizeType(0), SizeType(1));
          SizeType inmc=n_+m_+cp;
          SizeType iycn=iypt+cp*n_;
          w[inmc] = w[n_ + cp] * sq;
          detail::daxpy(n_, -w[inmc], w, iycn, w);
        }
        for (i = 0; i < n_; i++) {
          w[i] *= diag[i];
        }
        for (i = 0; i < bound; i++) {
          FloatType yr = detail::ddot(
            n_, w, iypt + cp * n_, SizeType(1), w, SizeType(0), SizeType(1));
          FloatType beta = w[n_ + cp] * yr;
          SizeType inmc=n_+m_+cp;
          beta = w[inmc] - beta;
          SizeType iscn=ispt+cp*n_;
          detail::daxpy(n_, beta, w, iscn, w);
          cp++;
          if (cp == m_) cp = 0;
        }
        std::copy(w, w+n_, w+(ispt + point * n_));
      }
      stp_ = FloatType(1);
      if (iter_ == 1) stp_ = stp1;
      std::copy(g, g+n_, w);
    }
    mcsrch_instance.run(
      gtol_, stpmin_, stpmax_, n_, x, f, g, w, ispt + point * n_,
      stp_, ftol, xtol_, maxfev_, info, nfev, &(*(scratch_array_.begin())));
    if (info == -1) {
      iflag_ = 1;
      requests_f_and_g_ = true;
      return true;
    }
    if (info != 1) {
      throw error_internal_error(__FILE__, __LINE__);
    }
    nfun_ += nfev;
    npt = point*n_;
    for (SizeType i = 0; i < n_; i++) {
      w[ispt + npt + i] = stp_ * w[ispt + npt + i];
      w[iypt + npt + i] = g[i] - w[i];
    }
    point++;
    if (point == m_) point = 0;
    return false;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r13
movl %ecx, %ebp
movq %rdx, %r14
movsd %xmm0, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
movb 0xb4(%rdi), %dl
movb 0xb5(%rdi), %al
andw $0x0, 0xb4(%rdi)
movq 0x120(%rdi), %r15
movl 0xb0(%rdi), %ecx
movabsq $0x3ff0000000000000, %r8 # imm = 0x3FF0000000000000
testl %ecx, %ecx
je 0x5a75
testb %dl, %dl
jne 0x5a67
testb $0x1, %al
je 0x5b4b
cmpl $0x2, %ecx
je 0x5c35
jmp 0x5eaf
movq $0x1, 0xc0(%rbx)
testb %bpl, %bpl
je 0x5aaf
xorl %r12d, %r12d
xorpd %xmm0, %xmm0
movq 0x78(%rbx), %rdi
cmpq %rdi, %r12
jae 0x5ad2
ucomisd (%r13,%r12,8), %xmm0
jb 0x5aaa
movq %r12, %rdi
callq 0x6040
xorpd %xmm0, %xmm0
incq %r12
jmp 0x5a8c
movq 0x78(%rbx), %rsi
movq 0x138(%rbx), %rdi
leaq 0x20(%rsp), %rdx
movq %r8, (%rdx)
callq 0x6bdb
movq 0x78(%rbx), %rdi
movq 0x138(%rbx), %r13
movq 0xf8(%rbx), %rax
leaq (%r15,%rax,8), %rax
xorl %ecx, %ecx
movapd 0x2539(%rip), %xmm0     # 0x8020
cmpq %rcx, %rdi
je 0x5b07
movsd (%r14,%rcx,8), %xmm1
xorpd %xmm0, %xmm1
mulsd (%r13,%rcx,8), %xmm1
movsd %xmm1, (%rax,%rcx,8)
incq %rcx
jmp 0x5ae7
movq %r14, %rsi
movq %r14, %rdx
callq 0x4545
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x5b22
sqrtsd %xmm0, %xmm0
jmp 0x5b2b
callq 0x3140
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x5b37
jnp 0x5c7a
movsd 0x2549(%rip), %xmm1     # 0x8088
divsd %xmm0, %xmm1
movsd %xmm1, 0xd0(%rbx)
movq 0xb8(%rbx), %rcx
movq %rcx, 0x110(%rbx)
leaq 0x1(%rcx), %rax
movq %rax, 0xb8(%rbx)
andl $0x0, 0x108(%rbx)
testq %rcx, %rcx
je 0x5c35
movq 0x80(%rbx), %rcx
cmpq %rcx, %rax
jbe 0x5b87
movq %rcx, 0x110(%rbx)
movq 0x78(%rbx), %rdi
movq 0xf0(%rbx), %r9
movq 0x100(%rbx), %rdx
addq %r9, %rdx
addq 0xf8(%rbx), %r9
subq $0x8, %rsp
pushq $0x1
popq %rcx
movq %r15, %rsi
movq %r15, %r8
pushq $0x1
callq 0x4560
popq %rax
popq %rcx
movsd %xmm0, 0xe0(%rbx)
testb %bpl, %bpl
je 0x5bdc
movl $0x2, 0xb0(%rbx)
movb $0x1, 0xb5(%rbx)
jmp 0x5f52
movq 0x78(%rbx), %rdi
movq 0xf0(%rbx), %rdx
addq 0x100(%rbx), %rdx
subq $0x8, %rsp
pushq $0x1
popq %rcx
movq %r15, %rsi
movq %r15, %r8
movq %rdx, %r9
pushq $0x1
callq 0x4560
addq $0x10, %rsp
movq 0x78(%rbx), %rsi
movq 0x138(%rbx), %rdi
movsd 0xe0(%rbx), %xmm1
divsd %xmm0, %xmm1
leaq 0x20(%rsp), %rdx
movsd %xmm1, (%rdx)
callq 0x6bdb
movq 0x138(%rbx), %r13
cmpq $0x1, 0xb8(%rbx)
je 0x5e87
testq %r13, %r13
je 0x600b
testb %bpl, %bpl
je 0x5c81
xorl %ebp, %ebp
xorpd %xmm0, %xmm0
movq 0x78(%rbx), %rax
cmpq %rax, %rbp
jae 0x5c85
ucomisd (%r13,%rbp,8), %xmm0
jb 0x5c75
movq %rbp, %rdi
callq 0x6040
xorpd %xmm0, %xmm0
incq %rbp
jmp 0x5c57
xorl %eax, %eax
jmp 0x5fe3
movq 0x78(%rbx), %rax
movq 0xe8(%rbx), %r12
movq %r12, %rcx
testq %r12, %r12
jne 0x5c9b
movq 0x80(%rbx), %rcx
movsd 0x23e5(%rip), %xmm0     # 0x8088
divsd 0xe0(%rbx), %xmm0
leaq (%r15,%rax,8), %rdx
movsd %xmm0, -0x8(%rdx,%rcx,8)
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x5cd5
movsd (%r14,%rcx,8), %xmm0
xorpd 0x2356(%rip), %xmm0     # 0x8020
movlpd %xmm0, (%r15,%rcx,8)
incq %rcx
jmp 0x5cb7
movq %r13, 0x8(%rsp)
xorl %ebp, %ebp
movq 0x110(%rbx), %rax
cmpq %rax, %rbp
jae 0x5d7c
movq %r14, %r13
testq %r12, %r12
jne 0x5cfb
movq 0x80(%rbx), %r12
leaq -0x1(%r12), %r14
movq 0x78(%rbx), %rdi
movq %r14, %rdx
imulq %rdi, %rdx
addq 0xf8(%rbx), %rdx
subq $0x8, %rsp
movq %r15, %rsi
pushq $0x1
popq %rcx
movq %r15, %r8
xorl %r9d, %r9d
pushq $0x1
callq 0x4560
addq $0x10, %rsp
movq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rax
movq %rdi, %rdx
imulq %r14, %rdx
addq 0x100(%rbx), %rdx
leaq (%r15,%rdi,8), %rcx
leaq (%rcx,%r12,8), %rcx
addq $-0x8, %rcx
mulsd (%rcx), %xmm0
movsd %xmm0, (%rcx,%rax,8)
xorpd 0x22bd(%rip), %xmm0     # 0x8020
movq %r15, %rsi
movq %r15, %rcx
callq 0x61f2
incq %rbp
movq %r14, %r12
movq %r13, %r14
jmp 0x5cdc
movq 0x78(%rbx), %rcx
xorl %edx, %edx
movq 0x8(%rsp), %rsi
cmpq %rdx, %rcx
je 0x5da2
movsd (%rsi,%rdx,8), %xmm0
mulsd (%r15,%rdx,8), %xmm0
movsd %xmm0, (%r15,%rdx,8)
incq %rdx
jmp 0x5d87
pushq $0x1
popq %r13
xorl %ebp, %ebp
movq 0x78(%rbx), %rdi
cmpq %rax, %rbp
jae 0x5e3d
movq %rdi, %rdx
imulq %r12, %rdx
addq 0x100(%rbx), %rdx
subq $0x8, %rsp
movq %r15, %rsi
movq %r13, %rcx
movq %r15, %r8
xorl %r9d, %r9d
pushq $0x1
callq 0x4560
addq $0x10, %rsp
movq 0x78(%rbx), %rdi
movq 0x80(%rbx), %rax
leaq (%r15,%rdi,8), %rcx
leaq (%rcx,%r12,8), %rcx
mulsd (%rcx), %xmm0
movsd (%rcx,%rax,8), %xmm1
subsd %xmm0, %xmm1
movq %rdi, %rdx
imulq %r12, %rdx
addq 0xf8(%rbx), %rdx
movapd %xmm1, %xmm0
movq %r15, %rsi
movq %r15, %rcx
callq 0x61f2
incq %r12
cmpq 0x80(%rbx), %r12
movl $0x0, %eax
cmoveq %rax, %r12
incq %rbp
movq 0x110(%rbx), %rax
jmp 0x5da8
testq %rdi, %rdi
je 0x5e69
leaq (,%rdi,8), %rdx
movq 0xf8(%rbx), %rax
leaq (%r15,%rax,8), %rax
imulq 0xe8(%rbx), %rdi
leaq (%rax,%rdi,8), %rdi
movq %r15, %rsi
callq 0x3280
movq 0xb8(%rbx), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0xc8(%rbx)
cmpq $0x1, %rax
jne 0x5e97
movsd 0xd0(%rbx), %xmm0
movsd %xmm0, 0xc8(%rbx)
movq 0x78(%rbx), %rdx
testq %rdx, %rdx
je 0x5eaf
shlq $0x3, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3280
leaq 0x90(%rbx), %rsi
leaq 0xa0(%rbx), %rdx
leaq 0xa8(%rbx), %rcx
movq 0x78(%rbx), %r8
movq 0xe8(%rbx), %rax
imulq %r8, %rax
addq 0xf8(%rbx), %rax
leaq 0xc8(%rbx), %r12
movsd 0xd8(%rbx), %xmm1
movsd 0x98(%rbx), %xmm2
leaq 0x108(%rbx), %r10
leaq 0x118(%rbx), %r11
movq %rbx, %rdi
movq 0x10(%rsp), %r9
movsd 0x18(%rsp), %xmm0
pushq 0x138(%rbx)
pushq %r11
pushq %r10
pushq 0x88(%rbx)
pushq %r12
pushq %rax
pushq %r15
pushq %r14
callq 0x620c
addq $0x40, %rsp
movl 0x108(%rbx), %eax
cmpl $0x1, %eax
je 0x5f59
cmpl $-0x1, %eax
jne 0x5ff2
movl $0x1, 0xb0(%rbx)
movb $0x1, 0xb4(%rbx)
movb $0x1, %al
jmp 0x5fe3
movq 0x118(%rbx), %rax
addq %rax, 0xc0(%rbx)
movq 0x78(%rbx), %rax
movq 0xe8(%rbx), %rcx
movq %rax, %rdx
imulq %rcx, %rdx
movq %rdx, 0xf0(%rbx)
leaq (%r15,%rdx,8), %rsi
movq 0xf8(%rbx), %rdx
leaq (%rsi,%rdx,8), %rdx
movq 0x100(%rbx), %rdi
leaq (%rsi,%rdi,8), %rsi
xorl %edi, %edi
cmpq %rdi, %rax
je 0x5fc7
movsd (%r12), %xmm0
mulsd (%rdx,%rdi,8), %xmm0
movsd %xmm0, (%rdx,%rdi,8)
movsd (%r14,%rdi,8), %xmm0
subsd (%r15,%rdi,8), %xmm0
movsd %xmm0, (%rsi,%rdi,8)
incq %rdi
jmp 0x5f9c
incq %rcx
xorl %eax, %eax
cmpq 0x80(%rbx), %rcx
movl $0x0, %edx
cmovneq %rcx, %rdx
movq %rdx, 0xe8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x28
popq %rdi
callq 0x30d0
movq %rax, %rbx
leaq 0x2532(%rip), %rsi      # 0x8536
movl $0x557, %edx            # imm = 0x557
jmp 0x6022
pushq $0x28
popq %rdi
callq 0x30d0
movq %rax, %rbx
leaq 0x2519(%rip), %rsi      # 0x8536
movl $0x51f, %edx            # imm = 0x51F
movq %rax, %rdi
callq 0x60fa
leaq 0x5c47(%rip), %rsi      # 0xbc78
leaq -0x1c82(%rip), %rdx     # 0x43b6
movq %rbx, %rdi
callq 0x32c0