// File: /workspace/github_cpp_makefile_star2_O1/jamesliu516[P]amrdg2d/wall4amrdg2013.cpp
// Function: getGridIndex(bodygridclass*, pointxy const*, bodygridclass*&)
void getGridIndex(OctCell *parent00, const PXYZ *p_sm, ptrOctCell &pcell)
{
   OctCell *pp[8]={NULL};
  find_sol_refp(pp,bodygrid+parent00->NOparent);
/*
    OctCell *pp[24]={NULL}, *parent; 
    parent=bodygrid+parent00->NOparent;
    pp[0]=EastNeighbor(parent);
    pp[1]=NorthNeighbor(pp[0]);
    pp[2]=NorthNeighbor(parent);
    pp[3]=WestNeighbor(pp[2]);
    pp[4]=WestNeighbor(parent);
    pp[5]=SouthNeighbor(pp[4]);
    pp[6]=SouthNeighbor(parent);
    pp[7]=EastNeighbor(pp[6]);

    pp[8]=NorthNeighbor(pp[1]);

    pp[9]=WestNeighbor(pp[8]);
    pp[10]=WestNeighbor(pp[9]);
    pp[11]=WestNeighbor(pp[10]);
    pp[12]=WestNeighbor(pp[3]);
    pp[13]=WestNeighbor(pp[4]);
    pp[14]=WestNeighbor(pp[5]);
    pp[15]=SouthNeighbor(pp[14]);
    pp[16]=EastNeighbor(pp[15]);
    pp[17]=EastNeighbor(pp[16]);
    pp[18]=EastNeighbor(pp[17]);
    pp[19]=EastNeighbor(pp[18]);
    pp[20]=NorthNeighbor(pp[19]);
    pp[21]=NorthNeighbor(pp[20]);
    pp[22]=NorthNeighbor(pp[21]);
    pp[23]=NorthNeighbor(pp[22]);
    */
    /*
    //================
    pp[24]= NorthNeighbor(pp[23]);
    pp[25]=WestNeighbor(pp[24]);
    pp[26]=WestNeighbor(pp[25]);
    pp[27]=WestNeighbor(pp[26]);  
    pp[28]=WestNeighbor(pp[27]);  
    pp[29]=WestNeighbor(pp[28]);    

    pp[30]=WestNeighbor(pp[11]);
    pp[31]=WestNeighbor(pp[12]);
    pp[32]=WestNeighbor(pp[13]);  
    pp[33]=WestNeighbor(pp[14]);  
    pp[34]=WestNeighbor(pp[15]);    

    pp[35]=SouthNeighbor(pp[34]);

    pp[36]=SouthNeighbor(pp[15]);
    pp[37]=SouthNeighbor(pp[16]);
    pp[38]=SouthNeighbor(pp[17]);
    pp[39]=SouthNeighbor(pp[18]);
    pp[40]=SouthNeighbor(pp[19]);
    pp[41]=EastNeighbor(pp[40]);
    pp[42]=NorthNeighbor(pp[41]);
    pp[43]=NorthNeighbor(pp[42]);  
    pp[44]=NorthNeighbor(pp[43]);  
    pp[45]=NorthNeighbor(pp[44]);  
    pp[46]=NorthNeighbor(pp[45]); 
    pp[47]=NorthNeighbor(pp[46]);  */

    OctCell *smInCell=NULL;//�ԳƵ����ڵ�cell

    smInCell=findPointInCell(p_sm, bodygrid+parent00->NOparent);
    if(smInCell==NULL){ 
        for(int ii=0; ii<8; ++ii) {
            if(pp[ii]!=NULL) {
                smInCell=findPointInCell(p_sm, pp[ii]);
                if(smInCell!=NULL) break;
            }
        } 
    }
#ifdef DEBUG  
    if(smInCell==NULL){
        cout<<"010wrong find symitric point cell\n";
        cout<<parent00->xc1<<","<<parent00->yc1<<endl;
        cout<<p_sm->x<<","<<p_sm->y<<endl;
    }

#endif   
    pcell= smInCell;
//    if(smInCell==NULL)pcell=parent; //2012/3/36
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
leaq 0x128d9(%rip), %r15     # 0x252e0
movl 0x200(%r12), %eax
imulq $0x360, %rax, %rsi      # imm = 0x360
addq (%r15), %rsi
callq 0x1b8a2
movl 0x200(%r12), %eax
imulq $0x360, %rax, %rsi      # imm = 0x360
addq (%r15), %rsi
movq %r14, %rdi
callq 0x128ea
testq %rax, %rax
je 0x12a42
movq %rax, %r15
jmp 0x12a67
xorl %r13d, %r13d
movq (%rsp,%r13,8), %rsi
testq %rsi, %rsi
je 0x12a5b
movq %r14, %rdi
callq 0x128ea
testq %rax, %rax
jne 0x12a3d
incq %r13
cmpq $0x8, %r13
jne 0x12a45
xorl %r15d, %r15d
testq %r15, %r15
jne 0x12b4c
movq 0x12551(%rip), %r13     # 0x24fc8
leaq 0xbe2a(%rip), %rsi      # 0x1e8a8
movl $0x22, %edx
movq %r13, %rdi
callq 0x3250
movsd 0x278(%r12), %xmm0
movq %r13, %rdi
callq 0x3300
movq %rax, %rbp
leaq 0xb60b(%rip), %rsi      # 0x1e0b2
movl $0x1, %edx
movq %rax, %rdi
callq 0x3250
movsd 0x280(%r12), %xmm0
movq %rbp, %rdi
callq 0x3300
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movsd (%r14), %xmm0
movq %r13, %rdi
callq 0x3300
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0xb5a3(%rip), %rsi      # 0x1e0b2
callq 0x3250
movsd 0x8(%r14), %xmm0
movq %r12, %rdi
callq 0x3300
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq %r15, (%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq