// File: /workspace/github_c_makefile_star2_O0/markpeerdeman[P]mbemm/src/emath/singular.c
// Function: sing_int
void sing_int( const element El, const hypermatrix C, const hypermatrix E,
			   const int sourcelabel )
{ /* IN:          the element El, matrices C, E and integer sourcelabel
   * OUT:         nothing
   * USES:        theElement
   * MODIFIES:    matrices C and E
   * DESCRIPTION: This function is the entry point of this module. The kernel-
   *			  shape function products are integrated in the case when the
   *			  sourcenode P (identified by 'sourcelabel') is a part
   *			  of the element El. The hypermatrices C and E are filled. The 
   *			  Finite part integrals are all calculated analytically. For 
   *              the field nodes are chosen the nodes of the elements under
   *              consideration.
   */

double beta;
int nr_of_rotations;
vector v = (vector)newvector(3);
matrix p = (matrix)newmatrix(3,3); matrix q = (matrix)newmatrix(3,3);
matrix r = (matrix)newmatrix(3,3); matrix A = (matrix)newmatrix(3,3);
matrix B = (matrix)newmatrix(3,3); matrix D = (matrix)newmatrix(3,3);
matrix S = (matrix)newmatrix(3,3);

     theElement = (element)newelement();

  /* first make a copy of the element El in the element theElement: */
     TRILcopy(El,theElement);

  /* rotate theElement so that the singular point coincidences with node 1: */
	 nr_of_rotations = rotate_element(theElement,sourcelabel);

  /* initialize this module: */
	 init_singular();

  /* calculate the E and C matrices: */
     beta = make_v(v);
	 make_p_q_r(p,q,r);
	 make_A(p,q,r,beta,A);
	 make_B(p,q,r,beta,B);
	 make_C(A,B,v,C);
	 make_D(D,beta);
	 make_S(S,beta);
	 make_E(D,S,E); 
 
  /* rotate the results back so they apply to the original element: */
	 rotate_hypermatrix(nr_of_rotations,E);
	 rotate_hypermatrix(nr_of_rotations,C);

  /* cleanup: */
	 delelement(theElement); delvector(v);
     delmatrix(p); delmatrix(q); delmatrix(r); delmatrix(A);
     delmatrix(B); delmatrix(D); delmatrix(S); 

}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movl %ecx, 0x5c(%rsp)
movl $0x3, %edi
callq 0x15600
movq %rax, 0x40(%rsp)
movl $0x3, %esi
movl %esi, %edi
callq 0x15420
movq %rax, 0x38(%rsp)
movl $0x3, %esi
movl %esi, %edi
callq 0x15420
movq %rax, 0x30(%rsp)
movl $0x3, %esi
movl %esi, %edi
callq 0x15420
movq %rax, 0x28(%rsp)
movl $0x3, %esi
movl %esi, %edi
callq 0x15420
movq %rax, 0x20(%rsp)
movl $0x3, %esi
movl %esi, %edi
callq 0x15420
movq %rax, 0x18(%rsp)
movl $0x3, %esi
movl %esi, %edi
callq 0x15420
movq %rax, 0x10(%rsp)
movl $0x3, %esi
movl %esi, %edi
callq 0x15420
movq %rax, 0x8(%rsp)
callq 0x144e0
movq %rax, 0xec37(%rip)      # 0x1e790
movq 0x70(%rsp), %rdi
movq 0xec2b(%rip), %rsi      # 0x1e790
callq 0x17fc0
movq 0xec1f(%rip), %rdi      # 0x1e790
movl 0x5c(%rsp), %esi
callq 0xdd40
movl %eax, 0x4c(%rsp)
callq 0xdba0
movq 0x40(%rsp), %rdi
callq 0xe290
movsd %xmm0, 0x50(%rsp)
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0xe460
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
movsd 0x50(%rsp), %xmm0
movq 0x20(%rsp), %rcx
callq 0xe680
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
movsd 0x50(%rsp), %xmm0
movq 0x18(%rsp), %rcx
callq 0xe8c0
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x68(%rsp), %rcx
callq 0xec30
movq 0x10(%rsp), %rdi
movsd 0x50(%rsp), %xmm0
callq 0xf1d0
movq 0x8(%rsp), %rdi
movsd 0x50(%rsp), %xmm0
callq 0xf3e0
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x60(%rsp), %rdx
callq 0xf840
movl 0x4c(%rsp), %edi
movq 0x60(%rsp), %rsi
callq 0xe1b0
movl 0x4c(%rsp), %edi
movq 0x68(%rsp), %rsi
callq 0xe1b0
movq 0xeb3b(%rip), %rdi      # 0x1e790
callq 0x14560
movq 0x40(%rsp), %rdi
callq 0x15780
movq 0x38(%rsp), %rdi
callq 0x15690
movq 0x30(%rsp), %rdi
callq 0x15690
movq 0x28(%rsp), %rdi
callq 0x15690
movq 0x20(%rsp), %rdi
callq 0x15690
movq 0x18(%rsp), %rdi
callq 0x15690
movq 0x10(%rsp), %rdi
callq 0x15690
movq 0x8(%rsp), %rdi
callq 0x15690
addq $0x78, %rsp
retq
nop