// File: cjlin1[P]liblinear/blas/dnrm2.c
// Function: dnrm2_
double dnrm2_(int *n, double *x, int *incx)
{
  long int ix, nn, iincx;
  double norm, scale, absxi, ssq, temp;

/*  DNRM2 returns the euclidean norm of a vector via the function
    name, so that

       DNRM2 := sqrt( x'*x )

    -- This version written on 25-October-1982.
       Modified on 14-October-1993 to inline the call to SLASSQ.
       Sven Hammarling, Nag Ltd.   */

  /* Dereference inputs */
  nn = *n;
  iincx = *incx;

  if( nn > 0 && iincx > 0 )
  {
    if (nn == 1)
    {
      norm = fabs(x[0]);
    }
    else
    {
      scale = 0.0;
      ssq = 1.0;

      /* The following loop is equivalent to this call to the LAPACK
         auxiliary routine:   CALL SLASSQ( N, X, INCX, SCALE, SSQ ) */

      for (ix=(nn-1)*iincx; ix>=0; ix-=iincx)
      {
        if (x[ix] != 0.0)
        {
          absxi = fabs(x[ix]);
          if (scale < absxi)
          {
            temp = scale / absxi;
            ssq = ssq * (temp * temp) + 1.0;
            scale = absxi;
          }
          else
          {
            temp = absxi / scale;
            ssq += temp * temp;
          }
        }
      }
      norm = scale * sqrt(ssq);
    }
  }
  else
    norm = 0.0;

  return norm;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
jle 0x11918
cmpq $0x0, -0x30(%rbp)
jle 0x11918
cmpq $0x1, -0x28(%rbp)
jne 0x117f4
movq -0x10(%rbp), %rax
movsd (%rax), %xmm0
movaps 0x14ba(%rip), %xmm1     # 0x12ca0
pand %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x11916
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x824(%rip), %xmm0      # 0x12028
movsd %xmm0, -0x50(%rbp)
movq -0x28(%rbp), %rax
subq $0x1, %rax
imulq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jl 0x118f1
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x11842
jp 0x11842
jmp 0x118db
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movaps 0x144a(%rip), %xmm1     # 0x12ca0
pand %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x40(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x118ae
movsd -0x40(%rbp), %xmm0
divsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x50(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
mulsd -0x58(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x78f(%rip), %xmm1      # 0x12028
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
jmp 0x118d9
movsd -0x48(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
movsd -0x58(%rbp), %xmm2
movsd -0x50(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0x118db
jmp 0x118dd
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x1181a
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x50(%rbp), %xmm0
callq 0x20d0
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x11920
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)