// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
leaq 0x158d3(%rip), %rax     # 0x1e3f8
movl $0x0, (%rax)
leaq 0x158ca(%rip), %rax     # 0x1e3fc
movl $0x0, (%rax)
leaq 0x158c5(%rip), %rax     # 0x1e404
movl $0x0, (%rax)
movl $0x50, %edi
callq 0x10f0
movq %rax, 0x40(%rsp)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x175c0
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x14570
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x8(%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x17a40
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movl $0x0, 0x10(%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x17a40
movq %rax, %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movl $0x1, 0x10(%rax)
movl $0x50, %edi
callq 0x10f0
movq %rax, 0x38(%rsp)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x175c0
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x14570
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x8(%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x17a40
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rax
movl $0x0, 0x10(%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x17a40
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movl $0x1, 0x10(%rax)
movl $0x18, %edi
callq 0x10f0
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x9770
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x9770
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x86f0
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x9a70
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x101b0
movq 0x30(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x111d9(%rip), %rdi     # 0x19ec6
movb $0x0, %al
callq 0x1070
movq 0x30(%rsp), %rax
movl 0xc(%rax), %esi
leaq 0x111dc(%rip), %rdi     # 0x19edf
movb $0x0, %al
callq 0x1070
movq 0x30(%rsp), %rdi
callq 0x8430
movq 0x30(%rsp), %rdi
callq 0xda40
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
imull $0x3, 0x8(%rax), %eax
movl %eax, 0x14(%rsp)
leaq 0x156ce(%rip), %rax     # 0x1e410
movq (%rax), %rax
movl 0x4(%rax), %eax
subl 0x14(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %edi
addl 0x14(%rsp), %edi
callq 0x14b00
movq %rax, 0x20(%rsp)
movl 0x14(%rsp), %edi
movl 0x18(%rsp), %esi
leaq 0x1569f(%rip), %rax     # 0x1e410
movq (%rax), %rdx
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %r8
callq 0x170b0
leaq 0x1567a(%rip), %rax     # 0x1e404
cmpl $0x0, (%rax)
jne 0x8dcb
leaq 0x1567a(%rip), %rax     # 0x1e410
movq (%rax), %rdi
movl 0x14(%rsp), %esi
movl 0x18(%rsp), %edx
leaq 0x15670(%rip), %rax     # 0x1e418
movq (%rax), %rcx
movq 0x20(%rsp), %r8
callq 0x1450
leaq 0x1565c(%rip), %rax     # 0x1e418
movq (%rax), %rdi
leaq 0x10305(%rip), %rsi     # 0x190cb
callq 0x16620
leaq 0x15632(%rip), %rax     # 0x1e404
cmpl $0x1, (%rax)
jne 0x8e1b
movq 0x1521a(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1032a(%rip), %rsi     # 0x19112
movb $0x0, %al
callq 0x10d0
movq 0x50(%rsp), %rdi
leaq 0x1561d(%rip), %rax     # 0x1e418
movq (%rax), %rsi
callq 0x9be0
movq 0x151ee(%rip), %rax     # 0x1dff8
movq (%rax), %rdi
leaq 0x1031a(%rip), %rsi     # 0x1912e
movb $0x0, %al
callq 0x10d0
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x30(%rsp), %rax
movl 0x8(%rax), %esi
callq 0x82a0
movq 0x20(%rsp), %rdi
callq 0x14cb0
leaq 0x155cf(%rip), %rax     # 0x1e410
movq (%rax), %rdi
callq 0x15690
leaq 0x155c8(%rip), %rax     # 0x1e418
movq (%rax), %rdi
callq 0x15780
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rdi
movl $0x5, %esi
xorl %edx, %edx
callq 0x175c0
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
movl $0x5, %esi
xorl %edx, %edx
callq 0x14570
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
movl $0x5, %esi
xorl %edx, %edx
callq 0x17a40
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
movl $0x5, %esi
xorl %edx, %edx
callq 0x17a40
movq 0x40(%rsp), %rdi
callq 0x1030
movq 0x38(%rsp), %rdi
callq 0x1030
movq 0x30(%rsp), %rdi
callq 0x1030
movl $0x4, %edi
movl $0x29, %esi
callq 0x15200
movl $0x1, %eax
addq $0x58, %rsp
retq
nop