// File: /workspace/github_c_makefile_star2_O3/markpeerdeman[P]mbemm/src/emath/post.c
// Function: U_write_mises_analytical
void U_write_mises_analytical(mesh themesh)
{ double zx, zy, zz; /* midpoint coordinates */
  matrix stress;
  double s1, s2, s3, mises;
  element e; point node1, node2, node3;

  stress = (matrix)newmatrix(3,3);

  printf("    -1\n");
  printf("  2414\n");
  printf("         4\n");
  printf(" von Mises stresses (analytical)\n");
  printf("         2\n");
  printf("ElastoMath BEM results\n");
  printf("ELASTOMATH_SOLVE\n");
  printf("LOAD SET 1\n");
  printf("Analysis time was     8-May-66       14:24:27\n");
  printf("NONE\n");
  printf("         1         1         1         2         2         1\n");
  printf("       -10         0         1         1         1         0");
  printf("         0         0\n");
  printf("         2         0\n");
  printf("  0.00000E+00  0.00000E+00  0.00000E+00  0.00000E+00  0.00000E+00");
  printf("  0.00000E+00\n");
  printf("  0.00000E+00  0.00000E+00  0.00000E+00  0.00000E+00  0.00000E+00");
  printf("  0.00000E+00\n");


e=(element)element_dll(themesh->mesh_e,START,0);
while (e!=(element)NULL)
{
  node1 = (point)point_dll(themesh->mesh_p,SEARCH,e->p1);
  node2 = (point)point_dll(themesh->mesh_p,SEARCH,e->p2);
  node3 = (point)point_dll(themesh->mesh_p,SEARCH,e->p3);

  zx = 1.0/3.0 * ( node1->x + node2->x + node3->x );
  zy = 1.0/3.0 * ( node1->y + node2->y + node3->y );
  zz = 1.0/3.0 * ( node1->z + node2->z + node3->z );

  M(stress,1,1) = zx;
  M(stress,2,2) = zy;
  M(stress,1,2) = M(stress,2,1) = zy;

  /* calculate the von Mises stress for this element: */

  s2 = 0.0;
  s1 = 0.5*(M(stress,1,1)+M(stress,2,2)+sqrt( (M(stress,1,1)-M(stress,2,2))*(M(stress,1,1)-M(stress,2,2)) +
       4.0*(M(stress,1,2)*M(stress,1,2))));
  s3 = 0.5*(M(stress,1,1)+M(stress,2,2)-sqrt( (M(stress,1,1)-M(stress,2,2))*(M(stress,1,1)-M(stress,2,2)) +
       4.0*(M(stress,1,2)*M(stress,1,2))));

  mises = 1.0/sqrt(2.0)*sqrt( (s1-s2)*(s1-s2)+(s1-s3)*(s1-s3)+(s2-s3)*(s2-s3) );

  printf("%10d%10d\n",e->label,1);
  printf(" % 1.5E\n",(double)mises);

  e=e->NEXT;
}

  printf("    -1\n");

  delmatrix(stress);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x3, %edi
movl $0x3, %esi
callq 0xb9e0
movq %rax, %r14
leaq 0x956f(%rip), %rdi      # 0xeda0
callq 0x1060
leaq 0x9473(%rip), %rdi      # 0xecb0
callq 0x1060
leaq 0x93db(%rip), %rdi      # 0xec24
callq 0x1060
leaq 0x93da(%rip), %rdi      # 0xec2f
callq 0x1060
leaq 0x9456(%rip), %rdi      # 0xecb7
callq 0x1060
leaq 0x9466(%rip), %rdi      # 0xecd3
callq 0x1060
leaq 0x9471(%rip), %rdi      # 0xecea
callq 0x1060
leaq 0x9476(%rip), %rdi      # 0xecfb
callq 0x1060
leaq 0x9475(%rip), %rdi      # 0xed06
callq 0x1060
leaq 0x9497(%rip), %rdi      # 0xed34
callq 0x1060
leaq 0x93a7(%rip), %rdi      # 0xec50
callq 0x1060
leaq 0x8d16(%rip), %rdi      # 0xe5cb
xorl %eax, %eax
callq 0x1090
leaq 0x94b3(%rip), %rdi      # 0xed76
callq 0x1060
leaq 0x94bc(%rip), %rdi      # 0xed8b
callq 0x1060
leaq 0x8d2d(%rip), %r15      # 0xe608
movq %r15, %rdi
xorl %eax, %eax
callq 0x1090
leaq 0x8d50(%rip), %r12      # 0xe63c
movq %r12, %rdi
callq 0x1060
movq %r15, %rdi
xorl %eax, %eax
callq 0x1090
movq %r12, %rdi
callq 0x1060
movq 0x8(%rbx), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xb570
testq %rax, %rax
je 0x5af2
movq %rax, %r15
leaq 0x8d24(%rip), %r13      # 0xe64a
movq (%rbx), %rdi
movl 0x18(%r15), %edx
movl $0x2, %esi
callq 0xcc2f
movq %rax, %rbp
movq (%rbx), %rdi
movl 0x1c(%r15), %edx
movl $0x2, %esi
callq 0xcc2f
movq %rax, %r12
movq (%rbx), %rdi
movl 0x20(%r15), %edx
movl $0x2, %esi
callq 0xcc2f
movsd 0x20(%rbp), %xmm0
addsd 0x20(%r12), %xmm0
addsd 0x20(%rax), %xmm0
movsd 0x28(%rbp), %xmm1
movsd 0x8ad3(%rip), %xmm2     # 0xe450
mulsd %xmm2, %xmm0
addsd 0x28(%r12), %xmm1
addsd 0x28(%rax), %xmm1
mulsd %xmm2, %xmm1
movq 0x8(%r14), %rax
movq (%rax), %rcx
movsd %xmm0, (%rcx)
movq 0x8(%rax), %rax
movsd %xmm1, 0x8(%rax)
movsd %xmm1, (%rax)
movsd %xmm1, 0x8(%rcx)
movsd (%rcx), %xmm2
movsd 0x8(%rax), %xmm3
movapd %xmm2, %xmm0
subsd %xmm3, %xmm0
mulsd %xmm1, %xmm1
mulsd 0x8aad(%rip), %xmm1     # 0xe478
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x8aa5(%rip), %xmm0     # 0xe480
jb 0x59e3
sqrtsd %xmm0, %xmm0
jmp 0x59fe
movsd %xmm2, (%rsp)
movsd %xmm3, 0x8(%rsp)
callq 0x11b0
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm2
addsd %xmm3, %xmm2
addsd %xmm0, %xmm2
mulsd 0x8a52(%rip), %xmm2     # 0xe460
movq 0x8(%r14), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm4
movsd (%rcx), %xmm3
movsd 0x8(%rcx), %xmm1
movapd %xmm3, %xmm0
subsd %xmm4, %xmm0
mulsd %xmm1, %xmm1
mulsd 0x8a3d(%rip), %xmm1     # 0xe478
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x8a35(%rip), %xmm0     # 0xe480
jb 0x5a53
sqrtsd %xmm0, %xmm0
jmp 0x5a7a
movsd %xmm2, (%rsp)
movsd %xmm3, 0x8(%rsp)
movsd %xmm4, 0x10(%rsp)
callq 0x11b0
movsd 0x10(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
movsd (%rsp), %xmm2
addsd %xmm4, %xmm3
subsd %xmm0, %xmm3
mulsd 0x89d6(%rip), %xmm3     # 0xe460
movapd %xmm2, %xmm0
subsd %xmm3, %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
subsd %xmm3, %xmm0
mulsd %xmm0, %xmm0
addsd %xmm2, %xmm0
sqrtsd %xmm0, %xmm0
mulsd 0x89b6(%rip), %xmm0     # 0xe470
movsd %xmm0, (%rsp)
movl 0x14(%r15), %esi
leaq 0x8bd4(%rip), %rdi      # 0xe69e
movl $0x1, %edx
xorl %eax, %eax
callq 0x1090
movq %r13, %rdi
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x1090
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x5926
leaq 0x92a7(%rip), %rdi      # 0xeda0
callq 0x1060
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbb7b