// File: /workspace/github_c_makefile_star2_O1/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 0x12fca(%rip), %rax     # 0x15428
andl $0x0, (%rax)
leaq 0x12fc4(%rip), %rax     # 0x1542c
andl $0x0, (%rax)
leaq 0x12fc2(%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 0xcf07
movq %rax, (%r15)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xb834
movq %rax, 0x8(%r15)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xd1d1
movq %rax, 0x18(%r15)
andl $0x0, 0x10(%rax)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xd1d1
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 0xcf07
movq %rax, (%r14)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xb834
movq %rax, 0x8(%r14)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xd1d1
movq %rax, 0x18(%r14)
andl $0x0, 0x10(%rax)
xorl %edi, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0xd1d1
movq %rax, 0x10(%r14)
movl %ebx, 0x10(%rax)
pushq $0x18
popq %rdi
callq 0x1130
movq %rax, %r12
movq %r13, %rdi
movq %r15, %rsi
callq 0x6bfc
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x6bfc
movq %r15, (%rsp)
movq %r15, %rdi
movq %r14, 0x10(%rsp)
movq %r14, %rsi
movq %r12, %rdx
callq 0x630c
movq %r13, 0x8(%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0x2727
movq (%r12), %rdi
callq 0x98f8
movl 0x8(%r12), %esi
leaq 0xc957(%rip), %rdi      # 0xeece
xorl %eax, %eax
callq 0x1090
movl 0xc(%r12), %esi
leaq 0xc95d(%rip), %rdi      # 0xeee7
xorl %eax, %eax
callq 0x1090
movq %r12, %rdi
callq 0x2276
movq %r12, %rdi
callq 0x2b6c
movq (%r12), %rax
movq (%rax), %rbx
imull $0x3, 0x8(%r12), %ebp
leaq 0x12e8b(%rip), %r14     # 0x15440
movq (%r14), %rax
movl 0x4(%rax), %edi
movl %edi, %r15d
subl %ebp, %r15d
callq 0xbae0
movq %rax, %r13
movq (%r14), %rdx
movl %ebp, %edi
movl %r15d, %esi
movq %rax, %rcx
movq %rbx, %r8
callq 0xccbb
leaq 0x12e51(%rip), %rax     # 0x15434
xorl %ecx, %ecx
cmpl %ecx, (%rax)
jne 0x261f
leaq 0x12e50(%rip), %rcx     # 0x15440
movq (%rcx), %rdi
leaq 0x12e4e(%rip), %rbx     # 0x15448
movq (%rbx), %rcx
movl %ebp, %esi
movl %r15d, %edx
movq %r13, %r8
movq %rax, %r15
callq 0x121a
movq (%rbx), %rdi
leaq 0xbabf(%rip), %rsi      # 0xe0d6
callq 0xc8e4
movq %r15, %rax
cmpl $0x1, (%rax)
je 0x26da
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x62b3
movq %r13, %rdi
callq 0xbc0c
leaq 0x12dfb(%rip), %rax     # 0x15440
movq (%rax), %rdi
callq 0xbe4b
leaq 0x12df4(%rip), %rax     # 0x15448
movq (%rax), %rdi
callq 0xbef3
movq (%r12), %rax
movq (%rax), %rdi
pushq $0x5
popq %rbx
movl %ebx, %esi
xorl %edx, %edx
callq 0xcf07
movq (%r12), %rax
movq 0x8(%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xb834
movq (%r12), %rax
movq 0x18(%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xd1d1
movq (%r12), %rax
movq 0x10(%rax), %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0xd1d1
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 0xbc50
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12917(%rip), %r15     # 0x14ff8
movq (%r15), %rcx
leaq 0xba32(%rip), %rdi      # 0xe11d
pushq $0x1b
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11a0
leaq 0x12d48(%rip), %rax     # 0x15448
movq (%rax), %rsi
movq 0x8(%rsp), %rdi
callq 0x6fc4
movq (%r15), %rcx
leaq 0xba22(%rip), %rdi      # 0xe139
pushq $0x16
popq %rsi
movq %rbx, %rdx
callq 0x11a0
jmp 0x2628