// File: /workspace/github_c_makefile_star2_O1/markpeerdeman[P]mbemm/src/emath/singular.c
// Function: make_B
void make_B(const matrix p, const matrix q, const matrix r, const double beta, 
			const matrix B)
{ /* IN:          matrices p, q, r, B, double beta
   * OUT:         nothing
   * MODIFIES:    matrix B
   * USES:        element data from theElement
   * DESCRIPTION: This one calculates the B matrix
   */

int  k, i; /* counters */
double B1, B2, B3;

   for (k=1; k<=3; k++)
   { for (i=1; i<=3; i++)
	 { B1 = sinA1 * sinA1 / sinA2
		  + beta * sin( 2.0*theElement->alpha3 )
		  - 2.0 * ( sinA3 + sin(2.0*theElement->alpha3+theElement->alpha2) );
       B1 = M(p,k,i) * B1;

	   B2 = beta * sin( theElement->alpha3-theElement->alpha2 )
		  - 2.0 * ( sinA3 - sinA2 );
       B2 = M(q,k,i) * B2;

	   B3 = - sinA1 * sinA1 / sinA3
		  - beta * sin( 2.0*theElement->alpha2 )
		  + 2.0 * ( sinA2 + sin(2.0*theElement->alpha2+theElement->alpha3) );
       B3 = M(r,k,i) * B3;

	   M(B,k,i) = B1 + B2 + B3;
	 } /* for i */
   } /* for k */

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movapd 0x50c1(%rip), %xmm1     # 0xe020
xorpd %xmm0, %xmm1
movapd %xmm0, 0x30(%rsp)
movapd %xmm0, %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
movl $0x1, %r13d
movapd %xmm2, 0x20(%rsp)
xorl %ebp, %ebp
movq 0xc83a(%rip), %rax      # 0x157c0
movsd 0x80(%rax), %xmm0
addsd %xmm0, %xmm0
movsd 0xc82e(%rip), %xmm1     # 0x157c8
movaps %xmm1, 0xa0(%rsp)
movsd 0xc82e(%rip), %xmm1     # 0x157d8
movaps %xmm1, 0xc0(%rsp)
callq 0x1170
movapd %xmm0, 0xb0(%rsp)
movq 0xc7f9(%rip), %rax      # 0x157c0
movsd 0x80(%rax), %xmm0
addsd %xmm0, %xmm0
addsd 0x78(%rax), %xmm0
movsd 0xc808(%rip), %xmm1     # 0x157e8
movaps %xmm1, (%rsp)
callq 0x1170
movapd %xmm0, 0x80(%rsp)
movq 0x8(%r12), %rax
movq -0x8(%rax,%r13,8), %rax
movq 0xc7bd(%rip), %rcx      # 0x157c0
movsd 0x80(%rcx), %xmm0
subsd 0x78(%rcx), %xmm0
movsd (%rax,%rbp,8), %xmm1
movaps %xmm1, 0x90(%rsp)
callq 0x1170
movsd 0xc7be(%rip), %xmm1     # 0x157e8
movapd %xmm1, 0x70(%rsp)
subsd 0xc7a0(%rip), %xmm1     # 0x157d8
mulsd 0x30(%rsp), %xmm0
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movq 0x8(%r15), %rax
movq -0x8(%rax,%r13,8), %rax
mulsd (%rax,%rbp,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0xc766(%rip), %xmm0     # 0x157c8
movaps %xmm0, 0x40(%rsp)
xorps 0x4fb2(%rip), %xmm0     # 0xe020
movaps %xmm0, 0x60(%rsp)
movq 0xc746(%rip), %rax      # 0x157c0
movsd 0x78(%rax), %xmm0
addsd %xmm0, %xmm0
callq 0x1170
movapd %xmm0, 0x50(%rsp)
movq 0xc72b(%rip), %rax      # 0x157c0
movsd 0x78(%rax), %xmm0
addsd %xmm0, %xmm0
addsd 0x80(%rax), %xmm0
movaps (%rsp), %xmm1
movhps 0xc727(%rip), %xmm1     # xmm1 = xmm1[0,1],mem[0,1]
movaps %xmm1, (%rsp)
callq 0x1170
movapd 0x20(%rsp), %xmm2
movq 0x8(%r14), %rax
movq -0x8(%rax,%r13,8), %rax
movapd 0xa0(%rsp), %xmm3
movapd %xmm3, %xmm1
unpcklpd 0x40(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
unpcklpd 0x60(%rsp), %xmm3       # xmm3 = xmm3[0],mem[0]
mulpd %xmm1, %xmm3
movapd 0x6152(%rip), %xmm1     # 0xf240
movapd 0xc0(%rsp), %xmm4
unpcklpd 0x70(%rsp), %xmm4       # xmm4 = xmm4[0],mem[0]
divpd %xmm4, %xmm3
movapd %xmm3, %xmm4
movapd 0xb0(%rsp), %xmm3
unpcklpd 0x50(%rsp), %xmm3       # xmm3 = xmm3[0],mem[0]
mulpd %xmm2, %xmm3
addpd %xmm4, %xmm3
movapd 0x80(%rsp), %xmm4
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
addpd (%rsp), %xmm4
mulpd %xmm1, %xmm4
addpd %xmm3, %xmm4
movapd 0x90(%rsp), %xmm0
movhpd (%rax,%rbp,8), %xmm0    # xmm0 = xmm0[0],mem[0]
mulpd %xmm4, %xmm0
movsd 0x18(%rsp), %xmm1
addsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x8(%rbx), %rax
movq -0x8(%rax,%r13,8), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
cmpq $0x3, %rbp
jne 0x8f7f
incq %r13
cmpq $0x4, %r13
jne 0x8f7d
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq