// File: tlestang[P]IW_gene/topo.cpp
// Function: Topography::FreeSlipBC(VelSite**, VelSite**)
void Topography::FreeSlipBC(VelSite **sites, VelSite **_sites)
{
  int x,y;
  int op[9] = {0, 1, 4, 3, 2, 6, 5, 8, 7};
  double dd; int cc= 0;

  // ofstream bb, lns, rns, ts;
  // bb.open("bb.dat");lns.open("lns.dat");rns.open("rns.dat");ts.open("ts.dat");
  for (int i=0;i<nbNodes;i++)
    {
      x = nodes[i][0]; y = nodes[i][1];

      if(lbl[i] == 1)
	{
	  _sites[x][y].f[6] = _sites[x][y].f[7];
	  _sites[x][y].f[2] = _sites[x][y].f[4];
	  _sites[x][y].f[5] = _sites[x][y].f[8];
	  // ts << x << " " << y << endl;
	  // cc += 1;
	}
      else if(lbl[i] == 2)
	{
	  if(nodes[i][0] == 0 || nodes[i][0] == nbNodes-1){dd = +1;}
	  else{dd = (nodes[i+1][1]-nodes[i-1][1])/2.;}

	  if(dd > 0.) // if mur gauche
	    {
	      _sites[x][y].f[3] = sites[x][y].f[4];
	      _sites[x][y].f[2] = sites[x][y].f[1];
	      _sites[x][y].f[6] = sites[x][y].f[8];
	      // _sites[x][y].f[6] = _sites[x][y].f[5];
	      // _sites[x][y].f[7] = _sites[x][y].f[8];
	      // _sites[x][y].f[3] = _sites[x][y].f[1];
	      // lns << x << " " << y << endl;
	      // cc += 1;
	    }
	  else
	    {
	      _sites[x][y].f[2] = sites[x][y].f[3];
	      _sites[x][y].f[1] = sites[x][y].f[4];
	      _sites[x][y].f[5] = sites[x][y].f[7];
	      // _sites[x][y].f[5] = _sites[x][y].f[6];
	      // _sites[x][y].f[8] = _sites[x][y].f[7];
	      // _sites[x][y].f[1] = _sites[x][y].f[3];
	      // rns << x << " " << y << endl;
	      // cc += 1;
	    }
	}
      else
	{
	  for (int k=0;k<9;k++)
	    {
	      _sites[x][y].f[k] = sites[x][y].f[op[k]];
	    }
	  // bb << x << " " << y << endl;
	  // cc += 1;
	}
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x50(%rbp), %rdi
leaq 0x40a9(%rip), %rsi      # 0x91e0
movl $0x24, %edx
callq 0x31c0
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movq -0x70(%rbp), %rcx
movl -0x60(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x54f4
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %ecx
movl %ecx, -0x1c(%rbp)
movq 0x10(%rax), %rcx
movslq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl 0x4(%rcx), %ecx
movl %ecx, -0x20(%rbp)
movq 0x18(%rax), %rax
movslq -0x60(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
jne 0x5257
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x40(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x38(%rax)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x18(%rax)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x48(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x30(%rax)
jmp 0x54e4
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x60(%rbp), %rcx
cmpl $0x2, (%rax,%rcx,4)
jne 0x547b
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, (%rax)
je 0x529e
movq -0x70(%rbp), %rcx
movq 0x10(%rcx), %rax
movslq -0x60(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movl (%rax), %eax
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x52ad
movsd 0x3d82(%rip), %xmm0     # 0x9028
movsd %xmm0, -0x58(%rbp)
jmp 0x52ee
movq -0x70(%rbp), %rcx
movq 0x10(%rcx), %rax
movl -0x60(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movl 0x4(%rax), %eax
movq 0x10(%rcx), %rcx
movl -0x60(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
subl 0x4(%rcx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x3ef3(%rip), %xmm1     # 0x91d8
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x53bf
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x18(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x48(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x38(%rax)
jmp 0x5479
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x18(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x10(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd 0x40(%rax), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x30(%rax)
jmp 0x54e2
movl $0x0, -0x64(%rbp)
cmpl $0x9, -0x64(%rbp)
jge 0x54e0
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movslq -0x64(%rbp), %rcx
movslq -0x50(%rbp,%rcx,4), %rcx
movsd 0x8(%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movslq -0x64(%rbp), %rcx
movsd %xmm0, 0x8(%rax,%rcx,8)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x5482
jmp 0x54e2
jmp 0x54e4
jmp 0x54e6
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x514f
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)