// File: /workspace/github_c_makefile_star2_O3/markpeerdeman[P]mbemm/src/emath/do_contact.c
// Function: do_contact
int do_contact(char *name1, char *name2)
{ mesh  mesh1;  /* mesh for body 1 */
  mesh  mesh2;  /* mesh for body 2 */
  cmesh meshC;  /* contact mesh for both bodies */
  element e;
  intvector nietnul;
  int i;
  int n, m;
  point po;

  WRITE_SPECIAL = NO;
  WRITE_UNIVERSAL = NO;
  READ_SOLUTION = NO;




  /* initialize global datastructures for mesh 1: */
  mesh1=(mesh)malloc(sizeof(meshtype));
  mesh1->mesh_p = point_dll((point)NULL,NEW,0);
  mesh1->mesh_e = element_dll((element)NULL,NEW,0);
  mesh1->mesh_t = restraint_dll((restraint)NULL,NEW,0); mesh1->mesh_t->type=TRACTION;
  mesh1->mesh_d = restraint_dll((restraint)NULL,NEW,0); mesh1->mesh_d->type=DISPLACEMENT;

  /* initialize global datastructures for mesh 2: */
  mesh2=(mesh)malloc(sizeof(meshtype));
  mesh2->mesh_p = point_dll((point)NULL,NEW,0);
  mesh2->mesh_e = element_dll((element)NULL,NEW,0);
  mesh2->mesh_t = restraint_dll((restraint)NULL,NEW,0); mesh2->mesh_t->type=TRACTION;
  mesh2->mesh_d = restraint_dll((restraint)NULL,NEW,0); mesh2->mesh_d->type=DISPLACEMENT;

  /* initialize global datastructures for the contactmesh: */
  meshC=(cmesh)malloc(sizeof(cmeshtype));

  /* parse the inputdeck: */
  parse(name1,mesh1); 
  parse(name2,mesh2); 


  /* join both meshes to a contact mesh: */
  makeCmesh(mesh1,mesh2,meshC);
  /* parse contact nodes: */
  parse_contact(name1,meshC);
  /* make the system dimensionless: */
  scalemesh(meshC->merged_mesh);

  printf("nr_of_nodes_basemesh %d\n",meshC->nr_of_nodes_basemesh);
  printf("nr_of_elements_basemesh %d\n",meshC->nr_of_elements_basemesh);

  find_contactnodes(meshC);

  contact3(meshC);

  /***/  
  po=meshC->merged_mesh->mesh_p;
  m=meshC->nr_of_nodes_basemesh*3;
  n=main_E->cols-m; 
  nietnul=(intvector)newivector(n+m);
  verwijdernullen(m, n, main_E, nietnul,po);


  if (READ_SOLUTION==NO)
  { solve_4(main_E, m, n, main_f, nietnul);
    printvector(main_f,"solution vector");
  }
  if (READ_SOLUTION==YES)
  { fprintf(stderr,"Parsing solution vector...\n"); 
	parse_solution(name1,main_f);
	fprintf(stderr,"Solution vector read.\n");
  }

  post(meshC->merged_mesh,meshC->nr_of_nodes_basemesh); 

  delivector(nietnul);
  delmatrix(main_E); delvector(main_f);
  point_dll(meshC->merged_mesh->mesh_p,KILL,0);
  element_dll(meshC->merged_mesh->mesh_e,KILL,0);
  restraint_dll(meshC->merged_mesh->mesh_t,KILL,0);
  restraint_dll(meshC->merged_mesh->mesh_d,KILL,0);
  free(mesh1); free(mesh2); free(meshC);
  evaluate_level(FINISH,41);
  return (int)1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, (%rsp)
movq %rdi, %r13
leaq 0x12f6c(%rip), %rax     # 0x15428
andl $0x0, (%rax)
leaq 0x12f66(%rip), %rax     # 0x1542c
andl $0x0, (%rax)
leaq 0x12f64(%rip), %rax     # 0x15434
andl $0x0, (%rax)
pushq $0x50
popq %r14
movq %r14, %rdi
callq 0x1130
movq %rax, %r15
pushq $0x4
popq %rbp
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcc2f
movq %rax, (%r15)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xb570
movq %rax, 0x8(%r15)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcee9
movq %rax, 0x18(%r15)
andl $0x0, 0x10(%rax)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcee9
movq %rax, 0x10(%r15)
pushq $0x1
popq %rbx
movl %ebx, 0x10(%rax)
movq %r14, %rdi
callq 0x1130
movq %rax, %r14
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcc2f
movq %rax, (%r14)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xb570
movq %rax, 0x8(%r14)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcee9
movq %rax, 0x18(%r14)
andl $0x0, 0x10(%rax)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xcee9
movq %rax, 0x10(%r14)
movl %ebx, 0x10(%rax)
pushq $0x18
popq %rdi
callq 0x1130
movq %rax, %r12
movq %r13, %rdi
movq %r15, %rsi
callq 0x6b39
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x6b39
movq %r15, (%rsp)
movq %r15, %rdi
movq %r14, 0x10(%rsp)
movq %r14, %rsi
movq %r12, %rdx
callq 0x627c
movq %r13, 0x8(%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0x2788
movq (%r12), %rdi
callq 0x9818
movl 0x8(%r12), %esi
leaq 0xc8f9(%rip), %rdi      # 0xeece
xorl %eax, %eax
callq 0x1090
movl 0xc(%r12), %esi
leaq 0xc8ff(%rip), %rdi      # 0xeee7
xorl %eax, %eax
callq 0x1090
movq %r12, %rdi
callq 0x22eb
movq %r12, %rdi
callq 0x2baf
movq (%r12), %rax
movq (%rax), %rbx
imull $0x3, 0x8(%r12), %ebp
leaq 0x12e2d(%rip), %r14     # 0x15440
movq (%r14), %rax
movl 0x4(%rax), %edi
movl %edi, %r15d
subl %ebp, %r15d
callq 0xb810
movq %rax, %r13
movq (%r14), %rdx
movl %ebp, %edi
movl %r15d, %esi
movq %rax, %rcx
movq %rbx, %r8
callq 0xc9e3
leaq 0x12df3(%rip), %rax     # 0x15434
movl (%rax), %eax
testl %eax, %eax
jne 0x2680
leaq 0x12df2(%rip), %rax     # 0x15440
movq (%rax), %rdi
leaq 0x12df0(%rip), %rbx     # 0x15448
movq (%rbx), %rcx
movl %ebp, %esi
movl %r15d, %edx
movq %r13, %r8
callq 0x1220
movq (%rbx), %rdi
leaq 0xba64(%rip), %rsi      # 0xe0d6
callq 0xc610
leaq 0x12db6(%rip), %rax     # 0x15434
movl (%rax), %eax
cmpl $0x1, %eax
je 0x273b
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x6221
movq %r13, %rdi
callq 0xb93c
leaq 0x12d9a(%rip), %rax     # 0x15440
movq (%rax), %rdi
callq 0xbb7b
leaq 0x12d93(%rip), %rax     # 0x15448
movq (%rax), %rdi
callq 0xbc23
movq (%r12), %rax
movq (%rax), %rdi
pushq $0x5
popq %rbx
movl %ebx, %esi
xorl %edx, %edx
callq 0xcc2f
movq (%r12), %rax
movq 0x8(%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xb570
movq (%r12), %rax
movq 0x18(%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xcee9
movq (%r12), %rax
movq 0x10(%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xcee9
movq (%rsp), %rdi
callq 0x1030
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r12, %rdi
callq 0x1030
pushq $0x4
popq %rdi
pushq $0x29
popq %rsi
callq 0xb980
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x128b6(%rip), %r15     # 0x14ff8
movq (%r15), %rcx
leaq 0xb9d1(%rip), %rdi      # 0xe11d
pushq $0x1b
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11a0
leaq 0x12ce7(%rip), %rax     # 0x15448
movq (%rax), %rsi
movq 0x8(%rsp), %rdi
callq 0x6f01
movq (%r15), %rcx
leaq 0xb9c1(%rip), %rdi      # 0xe139
pushq $0x16
popq %rsi
movq %rbx, %rdx
callq 0x11a0
jmp 0x2689