// File: /workspace/github_c_makefile_star2_O3/markpeerdeman[P]mbemm/src/emath/singular.c
// Function: make_C
void make_C( const matrix A, const matrix B, const vector v, const hypermatrix C )
{ /* IN:          matrices A, B, hypermatrix C, vector v 
   * OUT:         nothing
   * MODIFIES:    hypermatrix C
   * USES:        data from theElement
   * DESCRIPTION: 
   * This function calculates the hypermatrix C_kij
   */

int  k, i; /* counters */
double scalefactor;

     /*scalefactor=theElement->z1/(1.0-NU);
	 scalefactor=theElement->area/scalefactor; */

	 scalefactor = theElement->area*(1.0+NU)/theElement->z1;

     for (k=1; k<=3; k++)
	 { for (i=1; i<=3; i++)
	   { H(C,k,i,1) = M(A,k,i);
		 H(C,k,i,2) = M(A,k,i)*cosA3 + M(B,k,i)*sinA3;
		 H(C,k,i,2) = H(C,k,i,2) * theElement->z2/theElement->z1;
		 H(C,k,i,3) = M(A,k,i)*cosA2 - M(B,k,i)*sinA2;
		 H(C,k,i,3) = H(C,k,i,3) * theElement->z3/theElement->z1;
		 if (k==i)
		 { H(C,k,i,1) += (3.0-4.0*NU)*V(v,1);
		   H(C,k,i,2) += (3.0-4.0*NU)*V(v,2);
		   H(C,k,i,3) += (3.0-4.0*NU)*V(v,3);
		 } 
		 H(C,k,i,1)=H(C,k,i,1)*scalefactor;
		 H(C,k,i,2)=H(C,k,i,2)*scalefactor;
		 H(C,k,i,3)=H(C,k,i,3)*scalefactor;
	   } /* for i */
	 } /* for k */

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0xc757(%rip), %rax      # 0x157c0
leaq 0xc3a0(%rip), %r8       # 0x15410
movsd (%r8), %xmm0
addsd 0x4f8b(%rip), %xmm0     # 0xe008
mulsd 0xb8(%rax), %xmm0
divsd 0x88(%rax), %xmm0
movq 0x8(%rdi), %rdi
movq %rdi, -0x8(%rsp)
movq 0x8(%rcx), %rdi
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %r9
movq 0x8(%rcx), %rcx
movq %rcx, -0x10(%rsp)
movq 0x8(%rsi), %rsi
movq 0x8(%r9), %r9
movq 0x18(%rdi), %rdi
movq 0x8(%rdi), %r10
movl $0x1, %r11d
xorl %ebx, %ebx
movsd 0x616d(%rip), %xmm1     # 0xf238
movsd 0x5385(%rip), %xmm2     # 0xe458
movq -0x8(%rsp), %rcx
movq -0x8(%rcx,%r11,8), %r14
movq -0x10(%rsp), %rcx
movq -0x8(%rcx,%r11,8), %r15
movq -0x8(%rsi,%r11,8), %r12
movq -0x8(%r9,%r11,8), %r13
movq -0x8(%r10,%r11,8), %rbp
xorl %edi, %edi
movsd (%r14,%rdi), %xmm3
movsd %xmm3, (%r15,%rdi)
movsd (%r12,%rdi), %xmm4
mulsd 0xc6d6(%rip), %xmm4     # 0x157e8
mulsd 0xc6d6(%rip), %xmm3     # 0x157f0
addsd %xmm4, %xmm3
movsd %xmm3, (%r13,%rdi)
mulsd 0x90(%rax), %xmm3
divsd 0x88(%rax), %xmm3
movsd %xmm3, (%r13,%rdi)
movsd (%r14,%rdi), %xmm3
movsd 0xc68e(%rip), %xmm4     # 0x157d8
mulsd (%r12,%rdi), %xmm4
mulsd 0xc688(%rip), %xmm3     # 0x157e0
subsd %xmm4, %xmm3
movsd %xmm3, (%rbp,%rdi)
mulsd 0x98(%rax), %xmm3
divsd 0x88(%rax), %xmm3
movsd %xmm3, (%rbp,%rdi)
cmpq %rdi, %rbx
jne 0x91dc
movsd (%r8), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
movq 0x8(%rdx), %rcx
mulsd (%rcx), %xmm3
addsd (%r15,%rdi), %xmm3
movsd %xmm3, (%r15,%rdi)
movsd (%r8), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd 0x8(%rcx), %xmm3
addsd (%r13,%rdi), %xmm3
movsd %xmm3, (%r13,%rdi)
movsd (%r8), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd 0x10(%rcx), %xmm3
addsd (%rbp,%rdi), %xmm3
movsd %xmm3, (%rbp,%rdi)
movsd (%r15,%rdi), %xmm3
mulsd %xmm0, %xmm3
movsd %xmm3, (%r15,%rdi)
movsd (%r13,%rdi), %xmm3
mulsd %xmm0, %xmm3
movsd %xmm3, (%r13,%rdi)
movsd (%rbp,%rdi), %xmm3
mulsd %xmm0, %xmm3
movsd %xmm3, (%rbp,%rdi)
addq $0x8, %rdi
cmpq $0x18, %rdi
jne 0x90f8
incq %r11
addq $0x8, %rbx
cmpq $0x4, %r11
jne 0x90d3
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq