// File: /workspace/github_c_makefile_star2_O3/zpole[P]IICV/vl/mathop.c
// Function: vl_lapack_dlasv2
void
vl_lapack_dlasv2 (double *smin,
                  double *smax,
                  double *sv,
                  double *cv,
                  double *su,
                  double *cu,
                  double f,
                  double g,
                  double h)
{
  double svt, cvt, sut, cut; /* temporary sv, cv, su, and cu */
  double ft = f, gt = g, ht = h; /* temporary f, g, h */
  double fa = fabs(f), ga = fabs(g), ha = fabs(h); /* |f|, |g|, and |h| */
  int pmax = 1 ; /* pointer to max abs entry */
  int swap = 0 ; /* is swapped */
  int glarge = 0 ; /* is g very large */
  int tsign ; /* tmp sign */
  double fmh ; /* |f| -|h| */
  double d ; /* (|f| -|h|)/|f| */
  double dd ; /* d*d */
  double q ; /* g/f */
  double qq ; /* q*q */
  double s ; /* (|f| + |h|)/|f| */
  double ss ; /* s*s */
  double spq ; /* sqrt(ss + qq) */
  double dpq ; /* sqrt(dd + qq) */
  double a ; /* (spq + dpq)/2 */
  double tmp ; /* temporaries */
  double tt;

  /* make fa >= ha */
  if (fa < ha) {
    pmax = 3 ;
    tmp =ft ; ft = ht ; ht = tmp ; /* swap ft and ht */
    tmp =fa ; fa = ha ; ha = tmp ; /* swap fa and ha */
    swap = 1 ;
  }

  if (ga == 0.0) { /* diagonal */
    *smin = ha ;
    *smax = fa ;
    /* identity matrix */
    cut = 1.0 ; sut = 0.0 ;
    cvt = 1.0 ; svt = 0.0 ;
  }
  else { /* not diagonal */
    if (ga > fa) { /* g is the largest entry */
      pmax = 2 ;
      if ((fa / ga) < VL_EPSILON_D) { /* g is very large */
        glarge = 1 ;
        *smax = ga ; /* 1 ulp */
        if (ha > 1.0) {
          *smin = fa / (ga / ha) ; /* 2 ulps */
        } else {
          *smin = (fa / ga) * ha ; /* 2 ulps */
        }
        cut = 1.0 ; sut = ht / gt ;
        cvt = 1.0 ; svt = ft / gt ;
      }
    }

    if (glarge == 0) { /* normal case */
      fmh = fa - ha ; /* 1ulp */
      if (fmh == fa) {  /* cope with infinite f or h */
        d = 1.0 ;
      } else {
        d = fmh / fa ; /* note 0<=d<=1.0, 2 ulps */
      }
      q = gt / ft ; /* note |q|<1/EPS, 1 ulp */
      s = 2.0 - d ; /* note s>=1.0, 3 ulps */
      dd = d*d ;
      qq = q*q ;
      ss = s*s ;
      spq = sqrt(ss + qq) ; /* note 1<=spq<=1+1/EPS, 5 ulps */
      if (d == 0.0) {
        dpq = fabs(q) ; /* 0 ulp */
      } else {
        dpq = sqrt(dd + qq) ; /* note 0<=dpq<=1+1/EPS, 3.5 ulps */
      }
      a = 0.5 * (spq + dpq) ; /* note 1<=a<=1 + |q|, 6 ulps */
      *smin = ha / a; /* 7 ulps */
      *smax = fa * a; /* 7 ulps */
      if (qq==0.0) { /* qq underflow */
        if (d==0.0) {
          tmp = sign(ft)*2*sign(gt); /* 0ulp */
        }
        else {
          tmp = gt/(sign(ft)*fmh) + q/s; /* 6 ulps */
        }
      } else {
        tmp = (q/(spq + s) + q/(dpq + d))*(1.0 + a);  /* 17 ulps */
      }
      /* if qq */
      tt = sqrt(tmp*tmp + 4.0) ; /* 18.5 ulps */
      cvt = 2.0 / tt ; /* 19.5 ulps */
      svt = tmp / tt ; /* 36.5 ulps */
      cut = (cvt + svt*q) / a ; /* 46.5 ulps */
      sut = (ht / ft) * svt / a ; /* 45.5 ulps */
    } /* if g not large */
  } /* if ga */
  if (swap == 1) {
    *cu = svt ; *su = cvt ;
    *cv = sut ; *sv = cut ;
  } else {
    *cu = cut ; *su = sut ;
    *cv = cvt ; *sv = svt ;
  }
  /* correct the signs of smax and smin */
  if (pmax==1) { tsign = sign(*cv) * sign(*cu) * sign(f) ; }
  if (pmax==2) { tsign = sign(*sv) * sign(*cu) * sign(g) ; }
  if (pmax==3) { tsign = sign(*sv) * sign(*su) * sign(h) ; }
  *smax = isign(tsign) * (*smax);
  *smin = isign(tsign * sign(f) * sign(h)) * (*smin) ;
}

// Assembly:
movapd 0xc78d(%rip), %xmm7     # 0x32100
movapd %xmm0, %xmm3
andpd %xmm7, %xmm3
movapd %xmm2, %xmm4
andpd %xmm7, %xmm4
movl $0x1, %eax
ucomisd %xmm3, %xmm4
jbe 0x259a8
movl $0x3, %eax
movapd %xmm3, %xmm12
movapd %xmm4, %xmm11
movapd %xmm0, %xmm5
movapd %xmm2, %xmm10
jmp 0x259bb
movapd %xmm4, %xmm12
movapd %xmm3, %xmm11
movapd %xmm2, %xmm5
movapd %xmm0, %xmm10
pushq %rbx
xorpd %xmm13, %xmm13
ucomisd %xmm13, %xmm1
jne 0x259ec
jp 0x259ec
movsd %xmm12, (%rdi)
movsd %xmm11, (%rsi)
movsd 0xc893(%rip), %xmm8     # 0x32270
movapd %xmm8, %xmm7
xorpd %xmm9, %xmm9
jmp 0x25cc3
andpd %xmm1, %xmm7
ucomisd %xmm11, %xmm7
jbe 0x25aad
movapd %xmm11, %xmm8
divsd %xmm7, %xmm8
movl $0x2, %eax
movsd 0xd1b6(%rip), %xmm6     # 0x32bc8
ucomisd %xmm8, %xmm6
jbe 0x25aad
ucomisd %xmm3, %xmm4
movsd %xmm7, (%rsi)
mulsd %xmm12, %xmm8
divsd %xmm12, %xmm7
divsd %xmm7, %xmm11
movsd 0xc833(%rip), %xmm9     # 0x32270
movapd %xmm9, %xmm6
cmpltsd %xmm12, %xmm6
movapd %xmm6, %xmm7
andnpd %xmm8, %xmm7
andpd %xmm11, %xmm6
orpd %xmm7, %xmm6
movlpd %xmm6, (%rdi)
divsd %xmm1, %xmm5
divsd %xmm1, %xmm10
movapd %xmm10, %xmm7
movapd %xmm9, %xmm6
ja 0x25a7c
movapd %xmm9, %xmm7
movapd %xmm5, %xmm6
cmpltsd %xmm4, %xmm3
andpd %xmm3, %xmm5
andnpd %xmm9, %xmm3
orpd %xmm5, %xmm3
ja 0x25a95
movapd %xmm10, %xmm9
movsd %xmm7, (%r9)
movsd %xmm6, (%r8)
movlpd %xmm3, (%rcx)
movsd %xmm9, (%rdx)
jmp 0x25d24
movapd %xmm11, %xmm9
subsd %xmm12, %xmm9
movapd %xmm9, %xmm7
divsd %xmm11, %xmm7
movapd %xmm9, %xmm6
cmpeqsd %xmm11, %xmm6
movsd 0xc79b(%rip), %xmm14    # 0x32270
andpd %xmm6, %xmm14
andnpd %xmm7, %xmm6
orpd %xmm6, %xmm14
movapd %xmm1, %xmm8
movapd %xmm10, -0x20(%rsp)
divsd %xmm10, %xmm8
movsd 0xcf6c(%rip), %xmm7     # 0x32a68
movapd %xmm7, %xmm13
subsd %xmm14, %xmm13
movapd %xmm8, %xmm6
mulsd %xmm8, %xmm6
movapd %xmm13, %xmm10
mulsd %xmm13, %xmm10
addsd %xmm6, %xmm10
sqrtsd %xmm10, %xmm15
xorpd %xmm10, %xmm10
ucomisd %xmm10, %xmm14
movapd %xmm2, -0x10(%rsp)
jne 0x25b47
jp 0x25b47
movapd 0xc5c0(%rip), %xmm2     # 0x32100
andpd %xmm8, %xmm2
jmp 0x25b59
movapd %xmm14, %xmm2
mulsd %xmm14, %xmm2
addsd %xmm6, %xmm2
sqrtsd %xmm2, %xmm2
movapd %xmm15, %xmm10
addsd %xmm2, %xmm10
mulsd 0xc674(%rip), %xmm10    # 0x321e0
divsd %xmm10, %xmm12
movsd %xmm12, (%rdi)
mulsd %xmm10, %xmm11
movsd %xmm11, (%rsi)
xorpd %xmm11, %xmm11
ucomisd %xmm11, %xmm6
jne 0x25bde
jp 0x25bde
ucomisd %xmm11, %xmm14
jne 0x25c22
jp 0x25c22
xorpd %xmm2, %xmm2
xorl %r10d, %r10d
movapd -0x20(%rsp), %xmm12
ucomisd %xmm12, %xmm2
setbe %r10b
leal -0x2(,%r10,4), %r11d
shll $0x2, %r10d
movl $0x2, %ebx
subl %r10d, %ebx
ucomisd %xmm1, %xmm2
cmovbel %r11d, %ebx
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
jmp 0x25c73
unpcklpd %xmm14, %xmm13          # xmm13 = xmm13[0],xmm14[0]
unpcklpd %xmm2, %xmm15           # xmm15 = xmm15[0],xmm2[0]
addpd %xmm13, %xmm15
movapd %xmm8, %xmm2
unpcklpd %xmm8, %xmm2            # xmm2 = xmm2[0],xmm8[0]
divpd %xmm15, %xmm2
movapd %xmm2, %xmm6
unpckhpd %xmm2, %xmm6            # xmm6 = xmm6[1],xmm2[1]
addsd %xmm2, %xmm6
movsd 0xc660(%rip), %xmm2     # 0x32270
addsd %xmm10, %xmm2
mulsd %xmm6, %xmm2
movapd -0x20(%rsp), %xmm12
jmp 0x25c73
movapd 0xc4a6(%rip), %xmm2     # 0x320d0
xorpd %xmm9, %xmm2
xorpd %xmm6, %xmm6
movapd -0x20(%rsp), %xmm12
movapd %xmm12, %xmm11
cmpltsd %xmm6, %xmm11
andpd %xmm11, %xmm2
andnpd %xmm9, %xmm11
orpd %xmm2, %xmm11
movapd %xmm1, %xmm6
unpcklpd %xmm8, %xmm6            # xmm6 = xmm6[0],xmm8[0]
unpcklpd %xmm13, %xmm11          # xmm11 = xmm11[0],xmm13[0]
divpd %xmm11, %xmm6
movapd %xmm6, %xmm2
unpckhpd %xmm6, %xmm2            # xmm2 = xmm2[1],xmm6[1]
addsd %xmm6, %xmm2
unpcklpd %xmm2, %xmm5            # xmm5 = xmm5[0],xmm2[0]
mulsd %xmm2, %xmm2
addsd 0xc5cd(%rip), %xmm2     # 0x32250
sqrtsd %xmm2, %xmm2
divsd %xmm2, %xmm7
unpcklpd %xmm2, %xmm12           # xmm12 = xmm12[0],xmm2[0]
divpd %xmm12, %xmm5
movapd %xmm5, %xmm9
unpckhpd %xmm5, %xmm9            # xmm9 = xmm9[1],xmm5[1]
mulsd %xmm9, %xmm8
addsd %xmm7, %xmm8
divsd %xmm10, %xmm8
movapd %xmm9, %xmm13
mulsd %xmm5, %xmm13
divsd %xmm10, %xmm13
movapd -0x10(%rsp), %xmm2
ucomisd %xmm3, %xmm4
cmpltsd %xmm4, %xmm3
movapd %xmm3, %xmm4
andpd %xmm9, %xmm4
andnpd %xmm8, %xmm3
orpd %xmm4, %xmm3
ja 0x25ce7
movapd %xmm13, %xmm4
jmp 0x25cf5
movapd %xmm7, %xmm4
movapd %xmm13, %xmm7
movapd %xmm8, %xmm9
movlpd %xmm3, (%r9)
movsd %xmm4, (%r8)
movsd %xmm7, (%rcx)
movsd %xmm9, (%rdx)
cmpl $0x2, %eax
je 0x25d24
cmpl $0x1, %eax
jne 0x25d1d
movsd (%rcx), %xmm9
movapd %xmm0, %xmm1
jmp 0x25d24
movq %r8, %r9
movapd %xmm2, %xmm1
xorpd %xmm3, %xmm3
xorl %eax, %eax
ucomisd (%r9), %xmm3
setbe %al
movl $0x1, %edx
subl %eax, %edx
subl %eax, %edx
ucomisd %xmm9, %xmm3
leal -0x1(%rax,%rax), %eax
cmoval %edx, %eax
movl %eax, %ecx
negl %ecx
ucomisd %xmm1, %xmm3
cmovbel %eax, %ecx
movl %ecx, %eax
sarl $0x1f, %eax
orl $0x1, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd (%rsi), %xmm1
movl %ecx, %eax
negl %eax
ucomisd %xmm0, %xmm3
cmovbel %ecx, %eax
movl %eax, %ecx
negl %ecx
ucomisd %xmm2, %xmm3
cmovbel %eax, %ecx
sarl $0x1f, %ecx
orl $0x1, %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm1, (%rsi)
mulsd (%rdi), %xmm0
movsd %xmm0, (%rdi)
popq %rbx
retq