// File: tlestang[P]IW_gene/topo.cpp
// Function: Topography::HalfWayFreeSlipBC(VelSite**, VelSite**)
void Topography::HalfWayFreeSlipBC(VelSite **sites, VelSite **_sites)
{  int x,y, xm, xp;
  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];
      xp = (x + 1 + nbNodes)%nbNodes; 
      xm = (x - 1 + nbNodes)%nbNodes; 
      //flat wall
      if(lbl[i] == 1)
	{
	  _sites[x][y].f[6] = sites[xm][y].f[7];
	  _sites[x][y].f[2] = sites[x][y].f[4];
	  _sites[x][y].f[5] = sites[xp][y].f[8];
	}

      //External corner
       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[6] = sites[x][y].f[8];
	    }
	  else
	    {
	      _sites[x][y].f[5] = sites[x][y].f[7];
	    }
	}
      
      // internal corner
       else{
	 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.)
	   {
	     _sites[x][y].f[2] = sites[x][y].f[4];
	     _sites[x][y].f[3] = sites[x][y].f[1];
	     _sites[x][y].f[6] = sites[x][y].f[8];
	     _sites[x][y].f[5] = sites[xm][y].f[8];
	   }
	 else
	   {
	     _sites[x][y].f[2] = sites[x][y].f[4];
	     _sites[x][y].f[1] = sites[x][y].f[3];
	     _sites[x][y].f[5] = sites[x][y].f[7];
	     _sites[x][y].f[6] = sites[xp][y].f[7];
	   }
       }
    }
}

// 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, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
leaq 0x3ce9(%rip), %rsi      # 0x9210
movl $0x24, %edx
callq 0x31c0
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rcx
movl -0x60(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x5a2f
movq -0x68(%rbp), %rcx
movq 0x10(%rcx), %rax
movslq -0x60(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movq 0x10(%rcx), %rax
movslq -0x60(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
addl 0x8(%rcx), %eax
cltd
idivl 0x8(%rcx)
movl %edx, -0x28(%rbp)
movl -0x1c(%rbp), %eax
subl $0x1, %eax
addl 0x8(%rcx), %eax
cltd
idivl 0x8(%rcx)
movq -0x68(%rbp), %rax
movl %edx, -0x24(%rbp)
movq 0x18(%rax), %rax
movslq -0x60(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
jne 0x566b
movq -0x10(%rbp), %rax
movslq -0x24(%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 -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, 0x18(%rax)
movq -0x10(%rbp), %rax
movslq -0x28(%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 0x5a1f
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x60(%rbp), %rcx
cmpl $0x2, (%rax,%rcx,4)
jne 0x5793
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, (%rax)
je 0x56b2
movq -0x68(%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 0x56c1
movsd 0x396e(%rip), %xmm0     # 0x9028
movsd %xmm0, -0x58(%rbp)
jmp 0x5702
movq -0x68(%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 0x3adf(%rip), %xmm1     # 0x91d8
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5750
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 0x578e
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 0x5a1d
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, (%rax)
je 0x57c4
movq -0x68(%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 0x57d3
movsd 0x385c(%rip), %xmm0     # 0x9028
movsd %xmm0, -0x58(%rbp)
jmp 0x5814
movq -0x68(%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 0x39cd(%rip), %xmm1     # 0x91d8
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x5923
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, 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 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, 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 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)
movq -0x10(%rbp), %rax
movslq -0x24(%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 0x5a1b
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, 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 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, 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)
movq -0x10(%rbp), %rax
movslq -0x28(%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)
jmp 0x5a1d
jmp 0x5a1f
jmp 0x5a21
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x553f
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)