// File: /workspace/github_cpp_makefile_star2_O3/jamesliu516[P]amrdg2d/wall4amrdg2013.cpp
// Function: getGridIndex3(bodygridclass*, pointxy const*, bodygridclass*&)
void getGridIndex3(OctCell *parent00, const PXYZ *p_sm, ptrOctCell &pcell)
{
 //  OctCell *pp[8]={NULL};
 
  // find_sol_refp(pp,bodygrid+parent->NOparent);

    OctCell *pp[48]={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]); 

    OctCell *smInCell=NULL;//�ԳƵ����ڵ�cell

    smInCell=findPointInCell(p_sm, bodygrid+parent00->NOparent);
    if(smInCell==NULL){ 
        for(int ii=0; ii<48; ++ii) {
            if(pp[ii]!=NULL) {
                smInCell=findPointInCell(p_sm, pp[ii]);
                if(smInCell!=NULL) break;
            }
        } 
    }
#ifdef DEBUG  
    if(smInCell==NULL){
        cout<<"020wrong find symitric point cell\n";
        cout<<parent->xc1<<","<<parent->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 $0x1c8, %rsp            # imm = 0x1C8
movq %rdx, 0x38(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x1b0(%rsp)
movaps %xmm0, 0x1a0(%rsp)
leaq 0x11dc7(%rip), %rcx     # 0x242e0
movl 0x200(%rdi), %eax
imulq $0x360, %rax, %r13      # imm = 0x360
addq (%rcx), %r13
movq %r13, %rdi
callq 0x8d37
movq %rax, 0x40(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, %r12
movq %rax, 0x48(%rsp)
movq %r13, %rdi
callq 0x8c30
movq %rax, 0x50(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, %rbx
movq %rax, 0x58(%rsp)
movq %r13, %rdi
callq 0x8cb4
movq %rax, %r14
movq %rax, 0x60(%rsp)
movq %rax, %rdi
callq 0x8db8
movq %rax, %r15
movq %rax, 0x68(%rsp)
movq %r13, 0x8(%rsp)
movq %r13, %rdi
callq 0x8db8
movq %rax, 0x70(%rsp)
movq %rax, %rdi
callq 0x8d37
movq %rax, 0x78(%rsp)
movq %r12, %rdi
callq 0x8c30
movq %rax, 0x80(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x88(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x90(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x20(%rsp)
movq %rax, 0x98(%rsp)
movq %rbx, %rdi
callq 0x8cb4
movq %rax, 0x18(%rsp)
movq %rax, 0xa0(%rsp)
movq %r14, %rdi
callq 0x8cb4
movq %rax, 0x10(%rsp)
movq %rax, 0xa8(%rsp)
movq %r15, %rdi
callq 0x8cb4
movq %rax, %r15
movq %rax, 0xb0(%rsp)
movq %rax, %rdi
callq 0x8db8
movq %rax, %r13
movq %rax, 0xb8(%rsp)
movq %rax, %rdi
callq 0x8d37
movq %rax, %rbp
movq %rax, 0xc0(%rsp)
movq %rax, %rdi
callq 0x8d37
movq %rax, %rbx
movq %rax, 0xc8(%rsp)
movq %rax, %rdi
callq 0x8d37
movq %rax, %r12
movq %rax, 0xd0(%rsp)
movq %rax, %rdi
callq 0x8d37
movq %rax, %r14
movq %rax, 0xd8(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0xe0(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0xe8(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0xf0(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0xf8(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0x100(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x108(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x110(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x118(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x120(%rsp)
movq %rax, %rdi
callq 0x8cb4
movq %rax, 0x128(%rsp)
movq 0x20(%rsp), %rdi
callq 0x8cb4
movq %rax, 0x130(%rsp)
movq 0x18(%rsp), %rdi
callq 0x8cb4
movq %rax, 0x138(%rsp)
movq 0x10(%rsp), %rdi
callq 0x8cb4
movq %rax, 0x140(%rsp)
movq %r15, %rdi
callq 0x8cb4
movq %rax, 0x148(%rsp)
movq %r13, %rdi
callq 0x8cb4
movq %rax, 0x150(%rsp)
movq %rax, %rdi
callq 0x8db8
movq %rax, 0x158(%rsp)
movq %r13, %rdi
callq 0x8db8
movq %rax, 0x160(%rsp)
movq %rbp, %rdi
callq 0x8db8
movq %rax, 0x168(%rsp)
movq %rbx, %rdi
callq 0x8db8
movq %rax, 0x170(%rsp)
movq %r12, %rdi
movq 0x28(%rsp), %r12
callq 0x8db8
movq %rax, 0x178(%rsp)
movq %r14, %rdi
callq 0x8db8
movq %rax, 0x180(%rsp)
movq %rax, %rdi
callq 0x8d37
movq %rax, 0x188(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0x190(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0x198(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0x1a0(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0x1a8(%rsp)
movq %rax, %rdi
callq 0x8c30
movq %rax, 0x1b0(%rsp)
movq 0x30(%rsp), %rax
movl 0x200(%rax), %eax
imulq $0x360, %rax, %rsi      # imm = 0x360
leaq 0x11a89(%rip), %rax     # 0x242e0
addq (%rax), %rsi
movq %r12, %rdi
callq 0x12275
testq %rax, %rax
jne 0x12973
xorl %ebx, %ebx
movq 0x8(%rsp), %r13
movq 0x40(%rsp,%rbx,8), %rsi
testq %rsi, %rsi
je 0x1288d
movq %r12, %rdi
callq 0x12275
testq %rax, %rax
jne 0x12973
incq %rbx
cmpq $0x30, %rbx
jne 0x12872
movq 0x1172b(%rip), %rbx     # 0x23fc8
leaq 0xb007(%rip), %rsi      # 0x1d8ab
movl $0x22, %edx
movq %rbx, %rdi
callq 0x3250
movsd 0x278(%r13), %xmm0
movq %rbx, %rdi
callq 0x3300
movq %rax, %r15
leaq 0xa7e6(%rip), %r14      # 0x1d0b2
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x3250
movsd 0x280(%r13), %xmm0
movq %r15, %rdi
callq 0x3300
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movsd (%r12), %xmm0
movq %rbx, %rdi
callq 0x3300
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x3250
movsd 0x8(%r12), %xmm0
movq %rbx, %rdi
callq 0x3300
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
xorl %eax, %eax
movq 0x38(%rsp), %rcx
movq %rax, (%rcx)
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq