// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/jacobi.c
// Function: jacobi
void jacobi(double **a, int n, double d[], double **v, int *nrot)
{
  int j,iq,ip,i;
  double tresh,theta,tau,t,sm,s,h,g,c,*b,*z;

  b=dvector(1,n);
  z=dvector(1,n);
  for (ip=1;ip<=n;ip++) {
    for (iq=1;iq<=n;iq++) v[ip][iq]=0.0;
    v[ip][ip]=1.0;
  }
  for (ip=1;ip<=n;ip++) {
    b[ip]=d[ip]=a[ip][ip];
    z[ip]=0.0;
  }
  *nrot=0;
  for (i=1;i<=50;i++) {
    sm=0.0;
    for (ip=1;ip<=n-1;ip++) {
      for (iq=ip+1;iq<=n;iq++)
	sm += fabs(a[ip][iq]);
    }
    if (sm == 0.0) {
      free_dvector(z,1,n);
      free_dvector(b,1,n);
      return;
    }
    if (i < 4)
      tresh=0.2*sm/(n*n);
    else
      tresh=0.0;
    for (ip=1;ip<=n-1;ip++) {
      for (iq=ip+1;iq<=n;iq++) {
	g=100.0*fabs(a[ip][iq]);
	if (i > 4 && (double)(fabs(d[ip])+g) == (double)fabs(d[ip])
	    && (double)(fabs(d[iq])+g) == (double)fabs(d[iq]))
	  a[ip][iq]=0.0;
	else if (fabs(a[ip][iq]) > tresh) {
	  h=d[iq]-d[ip];
	  if ((double)(fabs(h)+g) == (double)fabs(h))
	    t=(a[ip][iq])/h;
	  else {
	    theta=0.5*h/(a[ip][iq]);
	    t=1.0/(fabs(theta)+sqrt(1.0+theta*theta));
	    if (theta < 0.0) t = -t;
	  }
	  c=1.0/sqrt(1+t*t);
	  s=t*c;
	  tau=s/(1.0+c);
	  h=t*a[ip][iq];
	  z[ip] -= h;
	  z[iq] += h;
	  d[ip] -= h;
	  d[iq] += h;
	  a[ip][iq]=0.0;
	  for (j=1;j<=ip-1;j++) {
	    ROTATE(a,j,ip,j,iq)
	      }
	  for (j=ip+1;j<=iq-1;j++) {
	    ROTATE(a,ip,j,j,iq)
	      }
	  for (j=iq+1;j<=n;j++) {
	    ROTATE(a,ip,j,iq,j)
	      }
	  for (j=1;j<=n;j++) {
	    ROTATE(v,j,ip,j,iq)
	      }
	  ++(*nrot);
	}
      }
    }
    for (ip=1;ip<=n;ip++) {
      b[ip] += z[ip];
      d[ip]=b[ip];
      z[ip]=0.0;
    }
  }
  int NSHOW=30; if(NSHOW>n)NSHOW=n;
  for(i=1; i<=NSHOW; i++){
    for(j=1; j<=NSHOW; j++)printf("%.5f ", a[i][j]);
    printf("\n");
  }
  nrerror("Too many iterations in routine jacobi");
}
#undef ROTATE
#undef NRANSI


// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, 0x58(%rsp)
movq %rcx, %rbp
movq %rdx, 0x38(%rsp)
movl %esi, %r15d
movq %rdi, 0x28(%rsp)
movslq %esi, %r14
movl $0x1, %ebx
movl $0x1, %edi
movq %r14, %rsi
callq 0x4aeb9
movq %rax, %r13
movl $0x1, %edi
movq %r14, %rsi
callq 0x4aeb9
movq %rax, 0x10(%rsp)
movq %r15, 0x20(%rsp)
movl %r15d, %eax
movq %rax, 0x30(%rsp)
movq %r14, 0x50(%rsp)
testl %r14d, %r14d
jle 0x4ba56
movq 0x30(%rsp), %rax
leaq (,%rax,8), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
leal 0x1(%rax), %r14d
movabsq $0x3ff0000000000000, %r15 # imm = 0x3FF0000000000000
movq (%rbp,%rbx,8), %r12
leaq 0x8(%r12), %rdi
xorl %esi, %esi
movq 0x18(%rsp), %rdx
callq 0x2110
movq %r15, (%r12,%rbx,8)
incq %rbx
cmpq %rbx, %r14
jne 0x4ba34
movq 0x20(%rsp), %r9
testl %r9d, %r9d
movq 0x28(%rsp), %r8
movq 0x38(%rsp), %r10
movq 0x10(%rsp), %rsi
jle 0x4ba9e
leal 0x1(%r9), %eax
movl $0x1, %ecx
movq (%r8,%rcx,8), %rdx
movsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%r10,%rcx,8)
movsd %xmm0, (%r13,%rcx,8)
movq $0x0, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x4ba78
movq 0x58(%rsp), %rax
movl $0x0, (%rax)
movl %r9d, %eax
imull %r9d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x88(%rsp)
leal 0x1(%r9), %r12d
leaq 0x10(%r8), %rax
movq %rax, 0x80(%rsp)
movl $0x1, %edi
movapd 0xb853(%rip), %xmm6     # 0x57330
xorpd %xmm7, %xmm7
movsd 0xb436(%rip), %xmm8     # 0x56f20
movsd 0x554d(%rip), %xmm9     # 0x51040
movapd 0x5594(%rip), %xmm10    # 0x51090
movq %r13, 0x90(%rsp)
movq 0x30(%rsp), %rbx
movl %edi, 0xc(%rsp)
xorpd %xmm11, %xmm11
cmpl $0x2, %r9d
jl 0x4bb55
movl $0x1, %eax
movq %r12, %rcx
xorl %edx, %edx
movq (%r8,%rax,8), %rsi
addq %rdx, %rsi
incq %rax
movl $0x2, %r11d
movsd (%rsi,%r11,8), %xmm0
andpd %xmm6, %xmm0
addsd %xmm0, %xmm11
incq %r11
cmpq %r11, %rcx
jne 0x4bb32
addq $0x8, %rdx
decq %rcx
cmpq %rbx, %rax
jne 0x4bb22
ucomisd %xmm7, %xmm11
jne 0x4bb62
jnp 0x4c09d
mulsd 0xe1b5(%rip), %xmm11    # 0x59d20
movl 0xc(%rsp), %edi
cmpl $0x4, %edi
jb 0x4bb7b
xorpd %xmm11, %xmm11
jmp 0x4bb85
divsd 0x88(%rsp), %xmm11
cmpl $0x2, %r9d
jl 0x4bfda
movl $0x2, %r14d
movl $0x1, %r15d
movl $0x10, %eax
movq %rax, 0x40(%rsp)
movl $0x18, %eax
movq 0x80(%rsp), %rcx
xorl %esi, %esi
movsd %xmm11, 0x48(%rsp)
movq %rcx, 0x60(%rsp)
leaq 0x1(%r15), %rcx
movq %rcx, 0x68(%rsp)
movq %rax, 0x98(%rsp)
movq %rax, %rbx
xorl %r13d, %r13d
movq %r14, 0xa0(%rsp)
movq %rsi, 0x18(%rsp)
movq (%r8,%r15,8), %rax
movsd (%rax,%r14,8), %xmm4
movapd %xmm4, %xmm1
andpd %xmm6, %xmm1
movapd %xmm1, %xmm0
mulsd %xmm8, %xmm0
cmpl $0x5, %edi
jb 0x4bc45
movsd (%r10,%r15,8), %xmm2
andpd %xmm6, %xmm2
movapd %xmm0, %xmm3
addsd %xmm2, %xmm3
ucomisd %xmm2, %xmm3
jne 0x4bc45
jp 0x4bc45
movsd (%r10,%r14,8), %xmm2
andpd %xmm6, %xmm2
movapd %xmm0, %xmm3
addsd %xmm2, %xmm3
ucomisd %xmm2, %xmm3
jne 0x4bc45
jp 0x4bc45
movq $0x0, (%rax,%r14,8)
jmp 0x4bf8a
ucomisd %xmm11, %xmm1
jbe 0x4bf8a
movsd (%r10,%r14,8), %xmm2
subsd (%r10,%r15,8), %xmm2
movapd %xmm2, %xmm1
andpd %xmm6, %xmm1
addsd %xmm1, %xmm0
ucomisd %xmm1, %xmm0
jne 0x4bc79
jp 0x4bc79
divsd %xmm2, %xmm4
jmp 0x4bd11
mulsd 0x53d7(%rip), %xmm2     # 0x51058
divsd %xmm4, %xmm2
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm9, %xmm0
ucomisd %xmm7, %xmm0
jb 0x4bc9e
sqrtsd %xmm0, %xmm0
jmp 0x4bcf5
movapd %xmm2, 0x70(%rsp)
callq 0x2290
movapd 0x70(%rsp), %xmm2
movq 0x18(%rsp), %rsi
movsd 0x48(%rsp), %xmm11
movapd 0x53cc(%rip), %xmm10    # 0x51090
movsd 0x5373(%rip), %xmm9     # 0x51040
movsd 0xb24a(%rip), %xmm8     # 0x56f20
xorpd %xmm7, %xmm7
movapd 0xb64e(%rip), %xmm6     # 0x57330
movl 0xc(%rsp), %edi
movq 0x38(%rsp), %r10
movq 0x20(%rsp), %r9
movq 0x28(%rsp), %r8
ucomisd %xmm2, %xmm7
andpd %xmm6, %xmm2
addsd %xmm0, %xmm2
movapd %xmm9, %xmm4
divsd %xmm2, %xmm4
jbe 0x4bd11
xorpd %xmm10, %xmm4
movapd %xmm4, %xmm0
mulsd %xmm4, %xmm0
addsd %xmm9, %xmm0
ucomisd %xmm7, %xmm0
jb 0x4bd2f
sqrtsd %xmm0, %xmm0
movq 0x10(%rsp), %rcx
jmp 0x4bd8b
movapd %xmm4, 0x70(%rsp)
callq 0x2290
movapd 0x70(%rsp), %xmm4
movq 0x18(%rsp), %rsi
movsd 0x48(%rsp), %xmm11
movapd 0x533b(%rip), %xmm10    # 0x51090
movsd 0x52e2(%rip), %xmm9     # 0x51040
movsd 0xb1b9(%rip), %xmm8     # 0x56f20
xorpd %xmm7, %xmm7
movapd 0xb5bd(%rip), %xmm6     # 0x57330
movl 0xc(%rsp), %edi
movq 0x10(%rsp), %rcx
movq 0x38(%rsp), %r10
movq 0x20(%rsp), %r9
movq 0x28(%rsp), %r8
movapd %xmm9, %xmm2
divsd %xmm0, %xmm2
movapd %xmm4, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm9, %xmm2
movq (%r8,%r15,8), %rax
mulsd (%rax,%r14,8), %xmm4
movsd (%rcx,%r15,8), %xmm1
subsd %xmm4, %xmm1
movsd %xmm1, (%rcx,%r15,8)
movsd (%rcx,%r14,8), %xmm1
addsd %xmm4, %xmm1
movsd %xmm1, (%rcx,%r14,8)
movsd (%r10,%r15,8), %xmm1
subsd %xmm4, %xmm1
movsd %xmm1, (%r10,%r15,8)
movapd %xmm0, %xmm1
addsd (%r10,%r14,8), %xmm4
divsd %xmm2, %xmm1
movsd %xmm4, (%r10,%r14,8)
movq $0x0, (%rax,%r14,8)
cmpq $0x2, %r15
jb 0x4be56
movapd %xmm0, %xmm2
xorpd %xmm10, %xmm2
xorl %ecx, %ecx
movq 0x8(%r8,%rcx), %rdx
movsd (%rdx,%r15,8), %xmm3
movsd (%rdx,%r14,8), %xmm4
movapd %xmm3, %xmm5
mulsd %xmm1, %xmm5
addsd %xmm4, %xmm5
mulsd %xmm2, %xmm5
addsd %xmm3, %xmm5
movsd %xmm5, (%rdx,%r15,8)
movapd %xmm4, %xmm5
mulsd %xmm1, %xmm5
subsd %xmm5, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rdx,%r14,8)
addq $0x8, %rcx
cmpq %rcx, %rsi
jne 0x4be08
cmpq %r14, 0x68(%rsp)
movq 0x60(%rsp), %r11
jae 0x4bebf
movapd %xmm0, %xmm2
xorpd %xmm10, %xmm2
movq 0x40(%rsp), %rcx
addq %rax, %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm3
movq (%r11,%rdx,8), %rsi
movsd (%rsi,%r14,8), %xmm4
movapd %xmm3, %xmm5
mulsd %xmm1, %xmm5
addsd %xmm4, %xmm5
mulsd %xmm2, %xmm5
addsd %xmm3, %xmm5
movsd %xmm5, (%rcx,%rdx,8)
movapd %xmm4, %xmm5
mulsd %xmm1, %xmm5
subsd %xmm5, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rsi,%r14,8)
incq %rdx
cmpq %rdx, %r13
jne 0x4be75
cmpq 0x50(%rsp), %r14
jge 0x4bf23
movapd %xmm0, %xmm2
xorpd %xmm10, %xmm2
movq (%r8,%r14,8), %rcx
addq %rbx, %rcx
addq %rbx, %rax
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm3
movsd (%rcx,%rdx,8), %xmm4
movapd %xmm3, %xmm5
mulsd %xmm1, %xmm5
addsd %xmm4, %xmm5
mulsd %xmm2, %xmm5
addsd %xmm3, %xmm5
movsd %xmm5, (%rax,%rdx,8)
movapd %xmm4, %xmm5
mulsd %xmm1, %xmm5
subsd %xmm5, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rcx,%rdx,8)
incq %rdx
leal (%rdx,%r14), %esi
cmpl %r9d, %esi
jl 0x4bedb
movapd %xmm0, %xmm2
xorpd %xmm10, %xmm2
movl $0x1, %eax
movq (%rbp,%rax,8), %rcx
movsd (%rcx,%r15,8), %xmm3
movsd (%rcx,%r14,8), %xmm4
movapd %xmm3, %xmm5
mulsd %xmm1, %xmm5
addsd %xmm4, %xmm5
mulsd %xmm2, %xmm5
addsd %xmm3, %xmm5
movsd %xmm5, (%rcx,%r15,8)
movapd %xmm4, %xmm5
mulsd %xmm1, %xmm5
subsd %xmm5, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rcx,%r14,8)
incq %rax
cmpq %rax, %r12
jne 0x4bf31
movq 0x58(%rsp), %rax
incl (%rax)
movq 0x18(%rsp), %rsi
incq %r14
incq %r13
addq $0x8, %rbx
cmpq %r12, %r14
jne 0x4bbe4
movq 0xa0(%rsp), %r14
incq %r14
addq $0x8, %rsi
movq 0x60(%rsp), %rcx
addq $0x8, %rcx
addq $0x8, 0x40(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq 0x30(%rsp), %rbx
movq 0x68(%rsp), %r15
cmpq %rbx, %r15
jne 0x4bbbb
testl %r9d, %r9d
movq 0x90(%rsp), %r13
movq 0x10(%rsp), %rcx
jle 0x4c01a
movl $0x1, %eax
movsd (%rcx,%rax,8), %xmm0
addsd (%r13,%rax,8), %xmm0
movsd %xmm0, (%r13,%rax,8)
movsd %xmm0, (%r10,%rax,8)
movq $0x0, (%rcx,%rax,8)
incq %rax
cmpq %rax, %r12
jne 0x4bff1
incl %edi
cmpl $0x33, %edi
jne 0x4bb09
testl %r9d, %r9d
jle 0x4c080
cmpl $0x1e, %r9d
movl $0x1e, %ebx
cmovll %r9d, %ebx
incl %ebx
movl $0x1, %r15d
leaq 0x121f9(%rip), %r14     # 0x5e23f
movq 0x28(%rsp), %r13
movl $0x1, %r12d
movq (%r13,%r15,8), %rax
movsd (%rax,%r12,8), %xmm0
movq %r14, %rdi
movb $0x1, %al
callq 0x20f0
incq %r12
cmpq %r12, %rbx
jne 0x4c051
movl $0xa, %edi
callq 0x2060
incq %r15
cmpq %rbx, %r15
jne 0x4c04b
leaq 0x121be(%rip), %rdi     # 0x5e245
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4ad9c
movl $0x1, %esi
movq 0x10(%rsp), %rdi
movq 0x50(%rsp), %rbx
movq %rbx, %rdx
callq 0x4b481
movl $0x1, %esi
movq %r13, %rdi
movq %rbx, %rdx
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4b481
nopl (%rax)