// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
leaq 0x13ffa(%rip), %rdi     # 0x1997a
movb $0x0, %al
callq 0x1070
leaq 0x14001(%rip), %rdi     # 0x1998f
movb $0x0, %al
callq 0x1070
movq 0x70(%rsp), %rax
movq (%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x175c0
movq %rax, 0x68(%rsp)
cmpq $0x0, 0x68(%rsp)
je 0x5c13
movq 0x68(%rsp), %rax
cmpl $0xf, 0x14(%rax)
jne 0x5c00
movl $0x0, 0x54(%rsp)
movl $0x0, 0x58(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x70(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x14570
movq %rax, 0x60(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x5b54
movq 0x60(%rsp), %rax
movl 0x18(%rax), %eax
movq 0x68(%rsp), %rcx
cmpl 0x10(%rcx), %eax
je 0x5a69
movq 0x60(%rsp), %rax
movl 0x1c(%rax), %eax
movq 0x68(%rsp), %rcx
cmpl 0x10(%rcx), %eax
je 0x5a69
movq 0x60(%rsp), %rax
movl 0x20(%rax), %eax
movq 0x68(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x5b41
movq 0x60(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x5490
movl %eax, 0x5c(%rsp)
movq 0x60(%rsp), %rdi
movq 0x70(%rsp), %r8
leaq 0x48(%rsp), %rsi
leaq 0x40(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0x5600
cmpl $0x1, 0x5c(%rsp)
jne 0x5ae2
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
movsd 0x48(%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x40(%rsp), %xmm0
addsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x38(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
cmpl $0x2, 0x5c(%rsp)
jne 0x5b2a
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
movsd 0x48(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x40(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x38(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl $0x3, 0x5c(%rsp)
jne 0x5b3f
leaq 0x13e77(%rip), %rdi     # 0x199af
movb $0x0, %al
callq 0x1070
jmp 0x5b41
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
jmp 0x5a23
movsd 0x30(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd 0x138c8(%rip), %xmm2    # 0x19430
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x28(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x138a6(%rip), %xmm2    # 0x19430
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x20(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd 0x13884(%rip), %xmm2    # 0x19430
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x68(%rsp), %rax
movl 0x10(%rax), %esi
movq 0x68(%rsp), %rax
movsd 0x20(%rax), %xmm0
movq 0x68(%rsp), %rax
movsd 0x28(%rax), %xmm1
movq 0x68(%rsp), %rax
movsd 0x30(%rax), %xmm2
movsd 0x18(%rsp), %xmm3
movsd 0x10(%rsp), %xmm4
movsd 0x8(%rsp), %xmm5
leaq 0x13dda(%rip), %rdi     # 0x199d3
movb $0x6, %al
callq 0x1070
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x68(%rsp)
jmp 0x59ab
addq $0x78, %rsp
retq
nopl (%rax,%rax)