// File: /workspace/github_c_makefile_star2_O2/markpeerdeman[P]mbemm/src/emath/post.c
// Function: write_edge_force
void write_edge_force(mesh theMesh)
{ point p;
  element e;
  double t1x, t1y, t1z, t2x, t2y, t2z, t3x, t3y, t3z;
  double fx, fy, fz;
  double fxt, fyt, fzt;
  int cnodes;
  int p1iscnode;
  int p2iscnode;
  int p3iscnode;
  /* double force1, force2; */

  printf("\n{---------------------------------------------------------------}\n");
  printf("{ POST output of the edge element forces.\n");
  printf("  format:\n");
  printf("  element_label force_x force_y force_z\n");
  printf("}\n");
  printf("edge_element_forces\n");
  fxt=0.0; fyt=0.0; fzt=0.0;

  /* the calculated tractions: */
  e = (element)element_dll(theMesh->mesh_e,START,0);
  while (e!=(element)NULL)
  { cnodes=0; p1iscnode=0; p2iscnode=0; p3iscnode=0;   
    /* get the traction forces at the three nodes of the element: */ 
	/* NODE 1: */
	p=(point)point_dll(theMesh->mesh_p,SEARCH,e->p1);
        if (p->type==CNODE) { cnodes++; p1iscnode=1; }
	t1x=p->fx; t1y=p->fy; t1z=p->fz;
	/* NODE 2: */
	p=(point)point_dll(theMesh->mesh_p,SEARCH,e->p2);
        if (p->type==CNODE) { cnodes++; p2iscnode=1; }
	t2x=p->fx; t2y=p->fy; t2z=p->fz;
	/* NODE 3: */
	p=(point)point_dll(theMesh->mesh_p,SEARCH,e->p3);
        if (p->type==CNODE) { cnodes++; p3iscnode=1; }
	t3x=p->fx; t3y=p->fy; t3z=p->fz;
  
	fx= 1.0/3.0*(t1x+t2x+t3x)*e->area*theMesh->G_SCALE;
	fy= 1.0/3.0*(t1y+t2y+t3y)*e->area*theMesh->G_SCALE;
	fz= 1.0/3.0*(t1z+t2z+t3z)*e->area*theMesh->G_SCALE;
	fxt+=fx; fyt+=fy; fzt+=fz;
        if (cnodes==2)
        { if ( (p1iscnode==1) && (p2iscnode==1) )
          { fx=fx/e->z3*theMesh->G_SCALE;
            fy=fy/e->z3*theMesh->G_SCALE;
            fz=fz/e->z3*theMesh->G_SCALE;
          }
          if ( (p1iscnode==1) && (p3iscnode==1) )
          { fx=fx/e->z2*theMesh->G_SCALE;
            fy=fy/e->z2*theMesh->G_SCALE;
            fz=fz/e->z2*theMesh->G_SCALE;
          }
          if ( (p2iscnode==1) && (p3iscnode==1) )
          { fx=fx/e->z1*theMesh->G_SCALE;
            fy=fy/e->z1*theMesh->G_SCALE;
            fz=fz/e->z1*theMesh->G_SCALE;
          }

	  printf("%4d % 8.8E % 8.8E % 8.8E (per unit length)\n", e->label,fx,fy,fz);
        }
    e=e->NEXT;
  }

  printf("end_edge_element_forces\n");

  printf("\n{---------------------------------------------------------------}\n");
  printf("{ POST output of the resulting force vector.\n");
  printf(" Force: %5.8E %5.8E %5.8E\n",fxt,fyt,fzt);
  printf(" Modulus: %5.8E\n",sqrt((double)(fxt*fxt+fyt*fyt+fzt*fzt)));

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq 0xaaf1(%rip), %rdi      # 0xdad4
callq 0x1060
leaq 0xaa4e(%rip), %rdi      # 0xda3d
callq 0x1060
leaq 0xab49(%rip), %rdi      # 0xdb44
callq 0x1060
leaq 0xaa60(%rip), %rdi      # 0xda67
callq 0x1060
leaq 0xab02(%rip), %rdi      # 0xdb15
callq 0x1060
leaq 0xaa74(%rip), %rdi      # 0xda93
callq 0x1060
movq %rbx, 0x50(%rsp)
movq 0x8(%rbx), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xad45
movq %rax, %r14
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x50(%rsp), %r12
pushq $0x2
popq %rbx
testq %r14, %r14
je 0x3240
movq (%r12), %rdi
movl 0x18(%r14), %edx
movl %ebx, %esi
callq 0xc14c
movl 0x14(%rax), %r13d
xorl %ebp, %ebp
cmpl $0xf, %r13d
sete %bpl
movsd 0x48(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq (%r12), %rdi
movl 0x1c(%r14), %edx
leal 0x1(%rbp), %r15d
movups 0x38(%rax), %xmm0
movaps %xmm0, 0x30(%rsp)
movl %ebx, %esi
callq 0xc14c
movl 0x14(%rax), %ecx
movl %ecx, 0x2c(%rsp)
cmpl $0xf, %ecx
cmovnel %ebp, %r15d
movupd 0x38(%rax), %xmm0
addpd 0x30(%rsp), %xmm0
movapd %xmm0, 0x30(%rsp)
movq (%r12), %rdi
movl 0x20(%r14), %edx
movsd 0x10(%rsp), %xmm0
addsd 0x48(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl %ebx, %esi
callq 0xc14c
movsd 0x10(%rsp), %xmm5
movl 0x14(%rax), %ecx
xorl %edx, %edx
cmpl $0xf, %ecx
sete %dl
addl %r15d, %edx
movupd 0x38(%rax), %xmm0
addpd 0x30(%rsp), %xmm0
movsd 0xb8(%r14), %xmm2
movsd 0x30(%r12), %xmm1
mulpd 0xa318(%rip), %xmm0     # 0xd430
addsd 0x48(%rax), %xmm5
mulsd 0xa32b(%rip), %xmm5     # 0xd450
mulsd %xmm2, %xmm5
movapd %xmm2, %xmm6
unpcklpd %xmm2, %xmm6            # xmm6 = xmm6[0],xmm2[0]
mulpd %xmm0, %xmm6
movapd %xmm1, %xmm3
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd %xmm3, %xmm6
mulsd %xmm1, %xmm5
cmpl $0x2, %edx
jne 0x3217
movapd %xmm5, %xmm2
movapd %xmm6, %xmm0
cmpl $0xf, %r13d
movl 0x2c(%rsp), %eax
jne 0x3196
movapd %xmm5, %xmm2
movapd %xmm6, %xmm0
cmpl $0xf, %eax
jne 0x3196
movsd 0x98(%r14), %xmm0
movapd %xmm5, %xmm2
divsd %xmm0, %xmm2
movapd %xmm0, %xmm4
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
movapd %xmm6, %xmm0
divpd %xmm4, %xmm0
mulpd %xmm3, %xmm0
mulsd %xmm1, %xmm2
cmpl $0xf, %r13d
jne 0x31be
cmpl $0xf, %ecx
jne 0x31be
movsd 0x90(%r14), %xmm4
divsd %xmm4, %xmm2
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
divpd %xmm4, %xmm0
mulpd %xmm3, %xmm0
mulsd %xmm1, %xmm2
cmpl $0xf, %eax
movsd %xmm5, 0x10(%rsp)
movapd %xmm6, 0x30(%rsp)
jne 0x31f1
cmpl $0xf, %ecx
jne 0x31f1
movsd 0x88(%r14), %xmm4
divsd %xmm4, %xmm2
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
divpd %xmm4, %xmm0
mulpd %xmm3, %xmm0
mulsd %xmm1, %xmm2
movl 0x14(%r14), %esi
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
leaq 0xa345(%rip), %rdi      # 0xd549
movb $0x3, %al
callq 0x1090
movsd 0x10(%rsp), %xmm5
movapd 0x30(%rsp), %xmm6
movapd 0x40(%rsp), %xmm0
addpd %xmm6, %xmm0
movapd %xmm0, 0x40(%rsp)
movsd 0x8(%rsp), %xmm0
addsd %xmm5, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x8(%r14), %r14
jmp 0x3055
leaq 0xa848(%rip), %rdi      # 0xda8f
callq 0x1060
leaq 0xa881(%rip), %rdi      # 0xdad4
callq 0x1060
leaq 0xa848(%rip), %rdi      # 0xdaa7
callq 0x1060
movaps 0x40(%rsp), %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
movaps %xmm1, 0x10(%rsp)
leaq 0xa267(%rip), %rdi      # 0xd4e3
movsd 0x8(%rsp), %xmm2
movb $0x3, %al
callq 0x1090
movapd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm1
movapd 0x40(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
sqrtsd %xmm1, %xmm0
leaq 0xa244(%rip), %rdi      # 0xd4fe
movb $0x1, %al
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1090