// File: /workspace/github_c_makefile_star2_O2/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 0xbb38(%rip), %xmm7     # 0x2d0e0
movapd %xmm0, %xmm3
andpd %xmm7, %xmm3
movapd %xmm2, %xmm4
andpd %xmm7, %xmm4
ucomisd %xmm3, %xmm4
jbe 0x215d8
movl $0x3, %eax
movapd %xmm3, %xmm12
movapd %xmm4, %xmm11
movapd %xmm0, %xmm5
movapd %xmm2, %xmm10
jmp 0x215f0
movl $0x1, %eax
movapd %xmm4, %xmm12
movapd %xmm3, %xmm11
movapd %xmm2, %xmm5
movapd %xmm0, %xmm10
pushq %rbx
xorpd %xmm13, %xmm13
ucomisd %xmm13, %xmm1
jne 0x21621
jp 0x21621
movsd %xmm12, (%rdi)
movsd %xmm11, (%rsi)
movsd 0xbc26(%rip), %xmm8     # 0x2d238
movapd %xmm8, %xmm7
xorpd %xmm9, %xmm9
jmp 0x218ed
andpd %xmm1, %xmm7
ucomisd %xmm11, %xmm7
movl $0x2, %r10d
jbe 0x216e6
movapd %xmm11, %xmm8
divsd %xmm7, %xmm8
movsd 0xc550(%rip), %xmm6     # 0x2db98
ucomisd %xmm8, %xmm6
movl %r10d, %eax
jbe 0x216e6
ucomisd %xmm3, %xmm4
movsd %xmm7, (%rsi)
mulsd %xmm12, %xmm8
divsd %xmm12, %xmm7
divsd %xmm7, %xmm11
movsd 0xbbc2(%rip), %xmm9     # 0x2d238
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 0x216b5
movapd %xmm9, %xmm7
movapd %xmm5, %xmm6
cmpltsd %xmm4, %xmm3
andpd %xmm3, %xmm5
andnpd %xmm9, %xmm3
orpd %xmm5, %xmm3
ja 0x216ce
movapd %xmm10, %xmm9
movsd %xmm7, (%r9)
movsd %xmm6, (%r8)
movlpd %xmm3, (%rcx)
movsd %xmm9, (%rdx)
jmp 0x2194e
movapd %xmm11, %xmm9
subsd %xmm12, %xmm9
movapd %xmm9, %xmm7
divsd %xmm11, %xmm7
movapd %xmm9, %xmm6
cmpeqsd %xmm11, %xmm6
movsd 0xbb2a(%rip), %xmm14    # 0x2d238
andpd %xmm6, %xmm14
andnpd %xmm7, %xmm6
orpd %xmm6, %xmm14
movapd %xmm1, %xmm8
movapd %xmm10, -0x20(%rsp)
divsd %xmm10, %xmm8
movsd 0xc303(%rip), %xmm7     # 0x2da38
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 0x21780
jp 0x21780
movapd 0xb967(%rip), %xmm2     # 0x2d0e0
andpd %xmm8, %xmm2
jmp 0x21792
movapd %xmm14, %xmm2
mulsd %xmm14, %xmm2
addsd %xmm6, %xmm2
sqrtsd %xmm2, %xmm2
movapd %xmm15, %xmm10
addsd %xmm2, %xmm10
mulsd 0xba1b(%rip), %xmm10    # 0x2d1c0
divsd %xmm10, %xmm12
movsd %xmm12, (%rdi)
mulsd %xmm10, %xmm11
movsd %xmm11, (%rsi)
xorpd %xmm11, %xmm11
ucomisd %xmm11, %xmm6
jne 0x21808
jp 0x21808
ucomisd %xmm11, %xmm14
jne 0x2184c
jp 0x2184c
xorpd %xmm2, %xmm2
xorl %r11d, %r11d
movapd -0x20(%rsp), %xmm12
ucomisd %xmm12, %xmm2
setbe %r11b
leal -0x2(,%r11,4), %ebx
shll $0x2, %r11d
subl %r11d, %r10d
ucomisd %xmm1, %xmm2
cmovbel %ebx, %r10d
cvtsi2sd %r10d, %xmm2
jmp 0x2189d
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 0xb9fe(%rip), %xmm2     # 0x2d238
addsd %xmm10, %xmm2
mulsd %xmm6, %xmm2
movapd -0x20(%rsp), %xmm12
jmp 0x2189d
movapd 0xb84c(%rip), %xmm2     # 0x2d0a0
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 0xb96b(%rip), %xmm2     # 0x2d218
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 0x21911
movapd %xmm13, %xmm4
jmp 0x2191f
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 0x2194e
cmpl $0x1, %eax
jne 0x21947
movsd (%rcx), %xmm9
movapd %xmm0, %xmm1
jmp 0x2194e
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
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