// File: /workspace/github_c_makefile_star2_O2/markpeerdeman[P]mbemm/src/emath/post.c
// Function: write_distribution
void write_distribution(mesh theMesh)
{ point p;
  element e;
  int cnodes;
  int edgeels; 
  int vertexels;
  double fx, fy, fz;
  double tex, tey, tez; /* total force components on an edge element */
  double tvx, tvy, tvz;
  
  printf("Force distribution:\n");
  printf("nodelabel, x, y, z, fx, fy, fz\n");

  p=(point)point_dll(theMesh->mesh_p,START,0);
  while (p!=(point)NULL)
  { if (p->type==CNODE)
    { vertexels=0; edgeels=0;
      tex=0.0; tey=0.0; tez=0.0; tvx=0.0; tvy=0.0; tvz=0.0;
      e=(element)element_dll(theMesh->mesh_e,START,0);
      while (e!=(element)NULL)
      { if ( (e->p1==p->label)||(e->p2==p->label)||(e->p3==p->label) )
        { cnodes=cnodesonelement(e, theMesh); 
          elforce(e,&fx,&fy,&fz,theMesh);
          if (cnodes==1) { edgeels++; tex+=fx; tey+=fy; tez+=fz; }
          if (cnodes==2) { vertexels++; tvx+=fx; tvy+=fy; tvz+=fz; }
          if (cnodes==3) printf("Three contact nodes on an element?\n");
        }
        e=e->NEXT;
      }
      tvx+=0.5*tex; tvy+=0.5*tey; tvz+=0.5*tez;
      printf("%d % 8.8E % 8.8E % 8.8E % 8.8E %8.8E % 8.8E\n",
			  p->label,p->x, p->y, p->z ,tvx,tvy,tvz);
    }
    p=p->NEXT;
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0xa537(%rip), %rdi      # 0xdbaf
callq 0x1060
leaq 0xa53f(%rip), %rdi      # 0xdbc3
callq 0x1060
movq (%rbx), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xc14c
movq %rax, %r14
leaq 0x38(%rsp), %r13
leaq 0x30(%rsp), %rbp
testq %r14, %r14
je 0x382d
cmpl $0xf, 0x14(%r14)
jne 0x3824
movq 0x8(%rbx), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xad45
movq %rax, %r15
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd %xmm0, 0x20(%rsp)
movsd %xmm0, 0x18(%rsp)
movsd %xmm0, (%rsp)
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
testq %r15, %r15
je 0x37c9
movl 0x10(%r14), %eax
cmpl %eax, 0x18(%r15)
je 0x3710
cmpl %eax, 0x1c(%r15)
je 0x3710
cmpl %eax, 0x20(%r15)
jne 0x37c0
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3379
movl %eax, %r12d
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x343e
cmpl $0x3, %r12d
je 0x37b4
cmpl $0x2, %r12d
je 0x377e
cmpl $0x1, %r12d
jne 0x37c0
movsd 0x28(%rsp), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x20(%rsp), %xmm0
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x37c0
movsd (%rsp), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x37c0
leaq 0xa427(%rip), %rdi      # 0xdbe2
callq 0x1060
movq 0x8(%r15), %r15
jmp 0x36ed
movsd 0x9c8f(%rip), %xmm0     # 0xd460
movsd 0x28(%rsp), %xmm3
mulsd %xmm0, %xmm3
addsd (%rsp), %xmm3
movsd 0x20(%rsp), %xmm4
mulsd %xmm0, %xmm4
addsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm5
mulsd %xmm0, %xmm5
addsd 0x10(%rsp), %xmm5
movl 0x10(%r14), %esi
movsd 0x20(%r14), %xmm0
movsd 0x28(%r14), %xmm1
movsd 0x30(%r14), %xmm2
leaq 0x9d81(%rip), %rdi      # 0xd59e
movb $0x6, %al
callq 0x1090
movq 0x8(%r14), %r14
jmp 0x36a2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq