// File: jamesliu516[P]amrdg2d/amr_grid_treat.cpp
// Function: creatgrid()
void creatgrid()
{   
   int ir;	
   int ic,Nc;
   int kr,Nk;
   
   int i;
   
   OctCell *parent;
   
   OctCell *pp[48]={NULL};//�����ཻ�������ڽ�����Ҫ���ܵ�������Ԫ��ַ  
   Nc=Nx*Ny;
 //  kref=0; //
   re=0;
   for(ir=0;ir<Nr;ir++)
   {
	   if(ir==0)
	   {
		   for(ic=1;ic<=Nc;ic++)//�ҳ�z=0��������Ҫ���ܵ�������Ԫ
		   {			               
			   charggrid(&bodygrid[ic]);
		   }
	   }
	   
	   Nk=refcell[re].size()-1;
	//   Nk=kref-1;
	//   kref=0;
	   re++;
	   
	   for(kr=0;kr<=Nk;kr++)//Nk�������ཻ��������(ljm Nk+1)
	   {
	//	   OctCell *pp[48];//�����ཻ�������ڽ�����Ҫ���ܵ�������Ԫ��ַ  
               //  parent=refcell[re-1][kr];
                 parent=refcell[re-1][kr];
		   findrefp(pp,parent);	//�ҵ������ཻ�������ڽ�����Ҫ���ܵ�������Ԫ           
		   creatchildren(parent);
		   parent->reflag=1;
		   for(i=0;i<48;i++)
		   {                
		      creatchildren(pp[i]);
		       pp[i]->reflag=1;
		   }
	   }
   }
   
   for(int itm=0; itm<Nr+1; ++itm) 
        refcell[itm].clear();
}

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0x180, %edx            # imm = 0x180
callq 0x3150
movl $0x1f3b, 0x1ac(%rsp) # imm = 0x1F3B
movl $0x0, 0x33e2b(%rip)     # 0x50aa8
movl $0x0, 0x1b4(%rsp)
cmpl $0x3, 0x1b4(%rsp)
jge 0x1ce25
cmpl $0x0, 0x1b4(%rsp)
jne 0x1ccf1
movl $0x1, 0x1b0(%rsp)
movl 0x1b0(%rsp), %eax
cmpl 0x1ac(%rsp), %eax
jg 0x1ccef
leaq 0x2e6ae(%rip), %rax     # 0x4b370
movq (%rax), %rdi
movslq 0x1b0(%rsp), %rax
imulq $0x360, %rax, %rax      # imm = 0x360
addq %rax, %rdi
callq 0x1bfe0
movl 0x1b0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b0(%rsp)
jmp 0x1ccab
jmp 0x1ccf1
movslq 0x33db0(%rip), %rax     # 0x50aa8
leaq 0x2e681(%rip), %rdi     # 0x4b380
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x1bd50
subq $0x1, %rax
movl %eax, 0x1a4(%rsp)
movl 0x33d8c(%rip), %eax     # 0x50aa8
addl $0x1, %eax
movl %eax, 0x33d83(%rip)     # 0x50aa8
movl $0x0, 0x1a8(%rsp)
movl 0x1a8(%rsp), %eax
cmpl 0x1a4(%rsp), %eax
jg 0x1ce0d
movl 0x33d5e(%rip), %eax     # 0x50aa8
subl $0x1, %eax
cltq
leaq 0x2e62a(%rip), %rdi     # 0x4b380
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq 0x1a8(%rsp), %rsi
callq 0x1e180
movq (%rax), %rax
movq %rax, 0x198(%rsp)
leaq 0x10(%rsp), %rdi
movq 0x198(%rsp), %rsi
callq 0x1a650
movq 0x198(%rsp), %rdi
callq 0x1cb10
movq 0x198(%rsp), %rax
movw $0x1, 0x1fc(%rax)
movl $0x0, 0x1a0(%rsp)
cmpl $0x30, 0x1a0(%rsp)
jge 0x1cdf5
movslq 0x1a0(%rsp), %rax
movq 0x10(%rsp,%rax,8), %rdi
callq 0x1cb10
movslq 0x1a0(%rsp), %rax
movq 0x10(%rsp,%rax,8), %rax
movw $0x1, 0x1fc(%rax)
movl 0x1a0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a0(%rsp)
jmp 0x1cdb0
jmp 0x1cdf7
movl 0x1a8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a8(%rsp)
jmp 0x1cd30
jmp 0x1ce0f
movl 0x1b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b4(%rsp)
jmp 0x1cc88
movl $0x0, 0xc(%rsp)
cmpl $0x4, 0xc(%rsp)
jge 0x1ce59
movslq 0xc(%rsp), %rax
leaq 0x2e540(%rip), %rdi     # 0x4b380
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x1b440
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1ce2d
addq $0x1b8, %rsp            # imm = 0x1B8
retq
nopw %cs:(%rax,%rax)