// File: /workspace/github_c_makefile_star2_O3/markpeerdeman[P]mbemm/src/emath/singular.c
// Function: make_S
void make_S( const matrix S, const double beta )
{ /* IN:          Matrix S, beta
   * OUT:         nothing
   * MODIFIES:    matrix S
   * USES:        data from theElement, beta as calculated in make_D()
   * DESCRIPTION: Fills matrix S
   */

int  i;    /* counter */
double i312, /* :temporary storage: */
	 i321;

   for (i=1; i<=3; i++)
   { i312 = (n3[i]-n1[i])/theElement->z2;
	 i321 = (n3[i]-n2[i])/theElement->z1;

	/* first component: */
	 M(S,i,1) = i312 * (cosA2 + cosA3)
			  - i321 * (1.0 - cosA1);
     M(S,i,1) = M(S,i,1) / sinA3;

	/* second component: */
     M(S,i,2) = cos(theElement->alpha3-theElement->alpha1);
	 M(S,i,2) = cosA3 - M(S,i,2) + beta*sinA3*sinA3;
	 M(S,i,2) = i321 * M(S,i,2);
	 M(S,i,2) = -i312 * (1.0-cosA1) + M(S,i,2);
	 M(S,i,2) = M(S,i,2) * theElement->z2 / theElement->z1 / sinA3;

	/* third component: */
	 M(S,i,3) = cosA3 + cosA2 - beta*sinA2*sinA3;
	 M(S,i,3) = M(S,i,3) * i321;
	 M(S,i,3) = -i312 * (1.0-cosA1) + M(S,i,3);
	 M(S,i,3) = M(S,i,3) * theElement->z2 / theElement->z1 / sinA2;

   } /* for i */

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movsd %xmm0, (%rsp)
movq %rdi, %rbx
movq 0xc4bd(%rip), %rcx      # 0x157c0
movsd 0xc4d5(%rip), %xmm2     # 0x157e0
movsd 0xc4dd(%rip), %xmm1     # 0x157f0
movsd 0xc4b5(%rip), %xmm0     # 0x157d0
movq 0x8(%rdi), %rax
xorl %r14d, %r14d
leaq 0xc517(%rip), %r15      # 0x15840
leaq 0xc4d0(%rip), %r12      # 0x15800
leaq 0xc4e9(%rip), %r13      # 0x15820
movsd 0x8(%r14,%r15), %xmm3
movapd %xmm3, %xmm4
subsd 0x8(%r14,%r12), %xmm4
divsd 0x90(%rcx), %xmm4
movapd %xmm4, 0x10(%rsp)
subsd 0x8(%r14,%r13), %xmm3
addsd %xmm2, %xmm1
divsd 0x88(%rcx), %xmm3
movsd %xmm3, 0x8(%rsp)
movsd 0x4c90(%rip), %xmm2     # 0xe008
subsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
mulsd %xmm4, %xmm1
subsd %xmm2, %xmm1
movq (%rax,%r14), %rax
movsd %xmm1, (%rax)
divsd 0xc450(%rip), %xmm1     # 0x157e8
movsd %xmm1, (%rax)
movsd 0x80(%rcx), %xmm0
subsd 0x70(%rcx), %xmm0
callq 0x10d0
movq 0x8(%rbx), %rax
movq (%rax,%r14), %rdx
movsd 0xc432(%rip), %xmm1     # 0x157f0
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
movsd 0xc41a(%rip), %xmm3     # 0x157e8
movapd %xmm3, %xmm4
movsd (%rsp), %xmm8
mulsd %xmm8, %xmm4
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
movapd 0x10(%rsp), %xmm2
xorpd 0x4c2d(%rip), %xmm2     # 0xe020
movsd 0xc3d5(%rip), %xmm0     # 0x157d0
movsd 0x8(%rsp), %xmm9
mulsd %xmm9, %xmm4
movsd 0x4bf9(%rip), %xmm5     # 0xe008
subsd %xmm0, %xmm5
mulsd %xmm2, %xmm5
addsd %xmm5, %xmm4
movsd %xmm4, 0x8(%rdx)
movq 0xc399(%rip), %rcx      # 0x157c0
mulsd 0x90(%rcx), %xmm4
divsd 0x88(%rcx), %xmm4
divsd %xmm3, %xmm4
movsd %xmm4, 0x8(%rdx)
movapd %xmm1, %xmm4
movsd 0xc38c(%rip), %xmm6     # 0x157d8
movsd 0xc38c(%rip), %xmm2     # 0x157e0
movapd %xmm6, %xmm7
mulsd %xmm8, %xmm7
mulsd %xmm3, %xmm7
addsd %xmm2, %xmm4
subsd %xmm7, %xmm4
mulsd %xmm9, %xmm4
addsd %xmm5, %xmm4
movsd %xmm4, 0x10(%rdx)
mulsd 0x90(%rcx), %xmm4
divsd 0x88(%rcx), %xmm4
divsd %xmm6, %xmm4
movsd %xmm4, 0x10(%rdx)
addq $0x8, %r14
cmpq $0x18, %r14
jne 0x9337
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq