// File: /workspace/github_c_makefile_star2_O0/markpeerdeman[P]mbemm/src/emath/do_contact.c
// Function: makeCmesh
void makeCmesh(mesh mesh1, mesh mesh2, cmesh meshC)
{ int i;
  point p, q;
  element e, f;
  restraint dt, dt2;

  /* STEP 1: Put mesh1 into the cmesh-structure: */
             meshC->merged_mesh=mesh1;

  /* STEP 2: Count the numbers of the items in mesh1 and put into cmesh: */
  /*      A: Count nodes: */
             p=(point)point_dll(mesh1->mesh_p,START,0); i=0;
             while (p!=(point)NULL) { i++; p=p->NEXT; }
             mesh1->nr_of_nodes=i; meshC->nr_of_nodes_basemesh=i;
  /*      B: Count elements: */
             e=(element)element_dll(mesh1->mesh_e,START,0); i=0;
             while (e!=(element)NULL) { i++; e=e->NEXT; }
             mesh1->nr_of_elements=i; meshC->nr_of_elements_basemesh=i;
  /*      C: Count tractions: */
             dt=(restraint)restraint_dll(mesh1->mesh_t,START,0); i=0;
             while (dt!=(restraint)NULL) { i++; dt=dt->NEXT; }
             mesh1->nr_of_tractions=i; meshC->nr_of_tractions_basemesh=i;
  /*      D: Count displacements: */
             dt=(restraint)restraint_dll(mesh1->mesh_d,START,0); i=0;
             while (dt!=(restraint)NULL) { i++; dt=dt->NEXT; }
             mesh1->nr_of_displacements=i; meshC->nr_of_displacements_basemesh=i;

  /* STEP 3: Renumber mesh 2: */
  /*      A: Renumber nodes: */
             p=(point)point_dll(mesh2->mesh_p,START,0); 
             while (p!=(point)NULL) 
             { p->label+=meshC->nr_of_nodes_basemesh;
               p=p->NEXT; 
             }
  /*      B: Renumber elements: */
             e=(element)element_dll(mesh2->mesh_e,START,0);
             while (e!=(element)NULL) 
             { e->label+=meshC->nr_of_elements_basemesh;
               e->p1+=meshC->nr_of_nodes_basemesh;
               e->p2+=meshC->nr_of_nodes_basemesh;
               e->p3+=meshC->nr_of_nodes_basemesh;
               e=e->NEXT; 
             }
  /*      C: Renumber tractions: */
             dt=(restraint)restraint_dll(mesh2->mesh_t,START,0);
             while (dt!=(restraint)NULL) 
             { dt->label+=meshC->nr_of_nodes_basemesh;
               dt=dt->NEXT; 
             }
  /*      C: Renumber displacements: */
             dt=(restraint)restraint_dll(mesh2->mesh_d,START,0);
             while (dt!=(restraint)NULL) 
             { dt->label+=meshC->nr_of_nodes_basemesh;
               dt=dt->NEXT; 
             }

  /* STEP 4: Append mesh 2 to mesh 1 in the contact mesh: */
  /*      A: Append points: */
             p=(point)point_dll(mesh1->mesh_p,END,0);
             q=(point)point_dll(mesh2->mesh_p,START,0);
             p->NEXT=q; q->PREV=p;
  /*      B: Append elements: */
             e=(element)element_dll(mesh1->mesh_e,END,0);
             f=(element)element_dll(mesh2->mesh_e,START,0);
             e->NEXT=f; f->PREV=e;
  /*      C: Append tractions: */
             dt =(restraint)restraint_dll(mesh1->mesh_t,END,0);
             dt2=(restraint)restraint_dll(mesh2->mesh_t,START,0);
             if ((dt!=(restraint)NULL)&&(dt2!=(restraint)NULL))
             { dt->NEXT=dt2; dt2->PREV=dt; }
  /*      D: Append displacements: */
             dt =(restraint)restraint_dll(mesh1->mesh_d,END,0);
             dt2=(restraint)restraint_dll(mesh2->mesh_d,START,0);
             if ((dt!=(restraint)NULL)&&(dt2!=(restraint)NULL))
             { dt->NEXT=dt2; dt2->PREV=dt; }

}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq 0x50(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x50(%rsp), %rax
movq (%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x175c0
movq %rax, 0x30(%rsp)
movl $0x0, 0x3c(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x8751
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x872e
movl 0x3c(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x20(%rax)
movl 0x3c(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x14570
movq %rax, 0x20(%rsp)
movl $0x0, 0x3c(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x87ab
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x8788
movl 0x3c(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x24(%rax)
movl 0x3c(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x17a40
movq %rax, 0x10(%rsp)
movl $0x0, 0x3c(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x8805
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x87e2
movl 0x3c(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x2c(%rax)
movl 0x3c(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x17a40
movq %rax, 0x10(%rsp)
movl $0x0, 0x3c(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x885f
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x883c
movl 0x3c(%rsp), %ecx
movq 0x50(%rsp), %rax
movl %ecx, 0x28(%rax)
movl 0x3c(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x48(%rsp), %rax
movq (%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x175c0
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x88b8
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x30(%rsp), %rax
addl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x888d
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x14570
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x8933
movq 0x40(%rsp), %rax
movl 0xc(%rax), %ecx
movq 0x20(%rsp), %rax
addl 0x14(%rax), %ecx
movl %ecx, 0x14(%rax)
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x20(%rsp), %rax
addl 0x18(%rax), %ecx
movl %ecx, 0x18(%rax)
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x20(%rsp), %rax
addl 0x1c(%rax), %ecx
movl %ecx, 0x1c(%rax)
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x20(%rsp), %rax
addl 0x20(%rax), %ecx
movl %ecx, 0x20(%rax)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x88cf
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x17a40
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x8975
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x10(%rsp), %rax
addl 0x14(%rax), %ecx
movl %ecx, 0x14(%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x894a
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x17a40
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x89b7
movq 0x40(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x10(%rsp), %rax
addl 0x14(%rax), %ecx
movl %ecx, 0x14(%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x898c
movq 0x50(%rsp), %rax
movq (%rax), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x175c0
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x175c0
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, (%rax)
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x14570
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x14570
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x17a40
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x17a40
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x8aa9
cmpq $0x0, 0x8(%rsp)
je 0x8aa9
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x17a40
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x17a40
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x8b05
cmpq $0x0, 0x8(%rsp)
je 0x8b05
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
addq $0x58, %rsp
retq
nopw (%rax,%rax)