// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/tred2.c
// Function: tred2
void tred2(double **a, int n, double d[], double e[])
{
  int l,k,j,i;
  double scale,hh,h,g,f;

  for (i=n;i>=2;i--) {
    l=i-1;
    h=scale=0.0;
    if (l > 1) {
      for (k=1;k<=l;k++)
	scale += fabs(a[i][k]);
      if (scale == 0.0)
	e[i]=a[i][l];
      else {
	for (k=1;k<=l;k++) {
	  a[i][k] /= scale;
	  h += a[i][k]*a[i][k];
	}
	f=a[i][l];
	g=(f >= 0.0 ? -sqrt(h) : sqrt(h));
	e[i]=scale*g;
	h -= f*g;
	a[i][l]=f-g;
	f=0.0;
	for (j=1;j<=l;j++) {
	  a[j][i]=a[i][j]/h;
	  g=0.0;
	  for (k=1;k<=j;k++)
	    g += a[j][k]*a[i][k];
	  for (k=j+1;k<=l;k++)
	    g += a[k][j]*a[i][k];
	  e[j]=g/h;
	  f += e[j]*a[i][j];
	}
	hh=f/(h+h);
	for (j=1;j<=l;j++) {
	  f=a[i][j];
	  e[j]=g=e[j]-hh*f;
	  for (k=1;k<=j;k++)
	    a[j][k] -= (f*e[k]+g*a[i][k]);
	}
      }
    } else
      e[i]=a[i][l];
    d[i]=h;
  }
  d[1]=0.0;
  e[1]=0.0;
  /* Contents of this loop can be omitted if eigenvectors not
     wanted except for statement d[i]=a[i][i]; */
  for (i=1;i<=n;i++) {
    l=i-1;
    if (d[i]) {
      for (j=1;j<=l;j++) {
	g=0.0;
	for (k=1;k<=l;k++)
	  g += a[i][k]*a[k][j];
	for (k=1;k<=l;k++)
	  a[k][j] -= g*a[k][i];
      }
    }
    d[i]=a[i][i];
    a[i][i]=1.0;
    for (j=1;j<=l;j++) a[j][i]=a[i][j]=0.0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, %rbx
movq %rdi, %r15
movq %rsi, (%rsp)
cmpl $0x2, %esi
jl 0x4b914
movabsq $0x100000000, %rbp      # imm = 0x100000000
movl (%rsp), %r13d
leaq 0x10(%r15), %rax
movq %rax, 0x20(%rsp)
movapd 0xbc55(%rip), %xmm5     # 0x572f0
xorpd %xmm6, %xmm6
movapd 0x59e9(%rip), %xmm7     # 0x51090
cmpq $0x2, %r13
je 0x4b8fc
leaq -0x1(%r13), %r14
movq (%r15,%r13,8), %rax
xorpd %xmm4, %xmm4
movl $0x1, %ecx
movsd (%rax,%rcx,8), %xmm0
andpd %xmm5, %xmm0
addsd %xmm0, %xmm4
incq %rcx
cmpq %rcx, %r13
jne 0x4b6c2
ucomisd %xmm6, %xmm4
movq (%r15,%r13,8), %rax
jne 0x4b6f9
jp 0x4b6f9
movsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%r12,%r13,8)
xorpd %xmm8, %xmm8
jmp 0x4b8e7
xorpd %xmm8, %xmm8
movl $0x1, %ecx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm4, %xmm0
movsd %xmm0, (%rax,%rcx,8)
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm8
incq %rcx
cmpq %rcx, %r13
jne 0x4b703
movsd (%rax,%r14,8), %xmm9
ucomisd %xmm6, %xmm8
jb 0x4b739
xorps %xmm0, %xmm0
sqrtsd %xmm8, %xmm0
jmp 0x4b77f
movapd %xmm8, %xmm0
movsd %xmm8, 0x18(%rsp)
movsd %xmm4, 0x10(%rsp)
movsd %xmm9, 0x8(%rsp)
callq 0x22a0
movsd 0x8(%rsp), %xmm9
movsd 0x10(%rsp), %xmm4
movsd 0x18(%rsp), %xmm8
movapd 0x591d(%rip), %xmm7     # 0x51090
xorpd %xmm6, %xmm6
movapd 0xbb71(%rip), %xmm5     # 0x572f0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
cmpnlesd %xmm9, %xmm2
movapd %xmm2, %xmm3
andpd %xmm0, %xmm3
xorpd %xmm7, %xmm0
andnpd %xmm0, %xmm2
orpd %xmm3, %xmm2
mulsd %xmm2, %xmm4
movsd %xmm4, (%r12,%r13,8)
movapd %xmm9, %xmm0
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm8
subsd %xmm2, %xmm9
movq (%r15,%r13,8), %rax
movsd %xmm9, (%rax,%r14,8)
leaq 0x10(%rax), %rcx
movl $0x1, %r8d
movabsq $0x300000000, %rdx      # imm = 0x300000000
movq 0x20(%rsp), %rsi
movq %r8, %rdi
movsd (%rax,%r8,8), %xmm0
divsd %xmm8, %xmm0
movq (%r15,%r8,8), %r8
movsd %xmm0, (%r8,%r13,8)
xorl %r9d, %r9d
xorpd %xmm0, %xmm0
movsd 0x8(%r8,%r9,8), %xmm2
mulsd 0x8(%rax,%r9,8), %xmm2
addsd %xmm2, %xmm0
incq %r9
cmpq %r9, %rdi
jne 0x4b800
leaq 0x1(%rdi), %r8
cmpq %r13, %r8
jge 0x4b850
movq %rdx, %r9
xorl %r10d, %r10d
movq (%rsi,%r10), %r11
movsd (%r11,%rdi,8), %xmm2
mulsd (%rcx,%r10), %xmm2
addsd %xmm2, %xmm0
movq %r9, %r11
sarq $0x20, %r11
addq $0x8, %r10
addq %rbp, %r9
cmpq %r13, %r11
jl 0x4b829
divsd %xmm8, %xmm0
movsd %xmm0, (%r12,%rdi,8)
mulsd (%rax,%rdi,8), %xmm0
addsd %xmm0, %xmm1
addq $0x8, %rcx
addq $0x8, %rsi
addq %rbp, %rdx
cmpq %r13, %r8
jne 0x4b7e1
movapd %xmm8, %xmm0
addsd %xmm8, %xmm0
xorpd %xmm7, %xmm1
divsd %xmm0, %xmm1
movl $0x1, %ecx
movsd (%rax,%rcx,8), %xmm0
movapd %xmm1, %xmm2
mulsd %xmm0, %xmm2
addsd (%r12,%rcx,8), %xmm2
movsd %xmm2, (%r12,%rcx,8)
movq (%r15,%rcx,8), %rdx
xorl %esi, %esi
movsd 0x8(%rax,%rsi,8), %xmm3
mulsd %xmm2, %xmm3
movsd 0x8(%r12,%rsi,8), %xmm4
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd 0x8(%rdx,%rsi,8), %xmm3
subsd %xmm4, %xmm3
movsd %xmm3, 0x8(%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x4b8ae
incq %rcx
cmpq %r13, %rcx
jne 0x4b88f
movsd %xmm8, (%rbx,%r13,8)
cmpq $0x2, %r13
movq %r14, %r13
jg 0x4b6a7
jmp 0x4b914
movq 0x10(%r15), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x10(%r12)
movq $0x0, (%rbx,%r13,8)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rax, 0x8(%r12)
movq (%rsp), %r11
testl %r11d, %r11d
jle 0x4ba0c
incl %r11d
movl $0x1, %eax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movapd 0x574e(%rip), %xmm1     # 0x51090
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
xorl %esi, %esi
ucomisd (%rbx,%rax,8), %xmm0
setnp %dil
sete %r8b
andb %dil, %r8b
cmpq $0x2, %rax
setb %r9b
movq (%r15,%rax,8), %rdi
orb %r8b, %r9b
jne 0x4b9ce
movl $0x1, %r8d
xorpd %xmm2, %xmm2
xorl %r9d, %r9d
movsd 0x8(%rdi,%r9), %xmm3
movq 0x8(%r15,%r9), %r10
mulsd (%r10,%r8,8), %xmm3
addsd %xmm3, %xmm2
addq $0x8, %r9
cmpq %r9, %rsi
jne 0x4b97c
xorpd %xmm1, %xmm2
xorl %r9d, %r9d
movq 0x8(%r15,%r9), %r10
movsd (%r10,%rax,8), %xmm3
mulsd %xmm2, %xmm3
addsd (%r10,%r8,8), %xmm3
movsd %xmm3, (%r10,%r8,8)
addq $0x8, %r9
cmpq %r9, %rsi
jne 0x4b9a2
incq %r8
cmpq %rax, %r8
jne 0x4b975
movsd (%rdi,%rax,8), %xmm2
movsd %xmm2, (%rbx,%rax,8)
movq %rdx, (%rdi,%rax,8)
cmpq $0x2, %rax
jb 0x4b9fc
xorl %r8d, %r8d
movq %rcx, 0x8(%rdi,%r8)
movq 0x8(%r15,%r8), %r9
movq %rcx, (%r9,%rax,8)
addq $0x8, %r8
cmpq %r8, %rsi
jne 0x4b9e5
incq %rax
addq $0x8, %rsi
cmpq %r11, %rax
jne 0x4b94e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop