// File: Kingsford-Group[P]ghost2/include/Eigen/src/Jacobi/Jacobi.h
// Function: Eigen::JacobiRotation<double>::makeGivens(double const&, double const&, double*, Eigen::internal::false_type)
void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type)
{
  using std::sqrt;
  using std::abs;
  if(q==Scalar(0))
  {
    m_c = p<Scalar(0) ? Scalar(-1) : Scalar(1);
    m_s = Scalar(0);
    if(r) *r = abs(p);
  }
  else if(p==Scalar(0))
  {
    m_c = Scalar(0);
    m_s = q<Scalar(0) ? Scalar(1) : Scalar(-1);
    if(r) *r = abs(q);
  }
  else if(abs(p) > abs(q))
  {
    Scalar t = q/p;
    Scalar u = sqrt(Scalar(1) + numext::abs2(t));
    if(p<Scalar(0))
      u = -u;
    m_c = Scalar(1)/u;
    m_s = -t * m_c;
    if(r) *r = p * u;
  }
  else
  {
    Scalar t = p/q;
    Scalar u = sqrt(Scalar(1) + numext::abs2(t));
    if(q<Scalar(0))
      u = -u;
    m_s = -Scalar(1)/u;
    m_c = -t * m_s;
    if(r) *r = q * u;
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x7fd63
jp 0x7fd63
movq -0x50(%rbp), %rax
movq -0x18(%rbp), %rcx
movsd (%rcx), %xmm0
movsd 0x3c361(%rip), %xmm3    # 0xbc078
movsd 0x3c351(%rip), %xmm2    # 0xbc070
xorps %xmm1, %xmm1
cmpltsd %xmm1, %xmm0
movaps %xmm0, %xmm1
andpd %xmm3, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movsd %xmm0, (%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x7fd5e
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
callq 0x4dd00
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x7ff89
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x7fdd6
jp 0x7fdd6
movq -0x50(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rcx
movsd (%rcx), %xmm0
movsd 0x3c2df(%rip), %xmm3    # 0xbc070
movsd 0x3c2df(%rip), %xmm2    # 0xbc078
xorps %xmm1, %xmm1
cmpltsd %xmm1, %xmm0
movaps %xmm0, %xmm1
andpd %xmm3, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movsd %xmm0, 0x8(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x7fdd1
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
callq 0x4dd00
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x7ff87
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
callq 0x4dd00
movsd %xmm0, -0x58(%rbp)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
callq 0x4dd00
movaps %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7fec7
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movq -0x18(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4cb90
movaps %xmm0, %xmm1
movsd 0x3c240(%rip), %xmm0    # 0xbc070
addsd %xmm1, %xmm0
callq 0x10560
movsd %xmm0, -0x38(%rbp)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x7fe6c
movsd -0x38(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x50(%rbp), %rax
movsd 0x3c1f8(%rip), %xmm0    # 0xbc070
divsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x30(%rbp), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, 0x8(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x7fec2
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x38(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x7ff85
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
movq -0x20(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4cb90
movaps %xmm0, %xmm1
movsd 0x3c180(%rip), %xmm0    # 0xbc070
addsd %xmm1, %xmm0
callq 0x10560
movsd %xmm0, -0x48(%rbp)
movq -0x20(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jbe 0x7ff2c
movsd -0x48(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x50(%rbp), %rax
movsd 0x3c140(%rip), %xmm0    # 0xbc078
divsd -0x48(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
movsd -0x40(%rbp), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd 0x8(%rax), %xmm0
movsd %xmm0, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x7ff83
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x48(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x7ff85
jmp 0x7ff87
jmp 0x7ff89
addq $0x60, %rsp
popq %rbp
retq
nop