// File: jamesliu516[P]amrdg2d/outputgrid.cpp
// Function: PrintNode_bk(bodygridclass*)
void PrintNode_bk(OctCell* parent)
{
	int i,j;
	int ix,jy,kz,m;
//	double plevel;
	double x[4],y[4];//网格顶点的坐标
	double hcx,xc,yc,hcy;
	
	if(parent->children[1]==NULL)
	{   
	//	if(parent->flag>0)
		//{
		//	plevel=parent->level+1.0;		    
			//hc=h/pow(2.0,plevel);//子网格的步长	
			hcx=0.5*parent->dx;
			hcy=0.5*parent->dy;	   
			xc=parent->xc1;	    
			yc=parent->yc1;		
			//printf("xc=%15.8e,yc=%15.8e\n",parent->xc1,parent->yc1);
		//	cout<<"xc= "<<xc<<", yc= "<<yc<<endl;		
			for(m=0;m<4;m++)		
			{				
				switch(m)					
				{				
				case 0: ix=-1;jy=-1;kz=-1;break;				
				case 1: ix=1;jy=-1;kz=-1;break;				
				case 2: ix=1;jy=1;kz=-1;break;				
				case 3: ix=-1;jy=1;kz=-1;break;								
				}         
				x[m]=xc+ix*hcx;			
				y[m]=yc+jy*hcy;
		
			}
	
			for(j=0;j<4;j++)		
			{		
				if(Np==1)		
				{								
					pointOutput[Np].x=x[j];                   			
					pointOutput[Np].y=y[j];	
							
					cellOutput[NU].cpoint[j]=Np;								
					Np++; 		
				}					
				else		
				{													
					//for(i=1;i<Np;i++)	
					for(i=Np-1;i>0;i--)				
					{												
						if(fabs(x[j]-pointOutput[i].x)+fabs(y[j]-pointOutput[i].y)<1.0e-8) break;					
					//	if(i==Np-1) goto loop1;
					      if(i==1) goto loop1;				
					}								
					cellOutput[NU].cpoint[j]=i;				
					goto loop2;
loop1:
					{					
						pointOutput[Np].x=x[j];          														
						pointOutput[Np].y=y[j];					
						cellOutput[NU].cpoint[j]=Np;								
						Np++;  					
//					printf("point[%d].x=%f,point[%d].y=%f\n",Np-1,point[Np-1].x,Np-1,point[Np-1].y);		
//					getch();			
					}														    								          			
				}
loop2: 			continue;					
			}				
			NU++;		
     //   }
	}
	else 
	{
		for(int im=0;im<4;im++)
		{
			PrintNode_bk(parent->children[im]);
		}
	}
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq 0x90(%rsp), %rax
cmpq $0x0, 0x260(%rax)
jne 0xefeb
movq 0x90(%rsp), %rax
movsd 0x3050b(%rip), %xmm0    # 0x3f140
mulsd 0x288(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x90(%rsp), %rax
movsd 0x304ed(%rip), %xmm0    # 0x3f140
mulsd 0x290(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x90(%rsp), %rax
movsd 0x278(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x90(%rsp), %rax
movsd 0x280(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movl $0x0, 0x78(%rsp)
cmpl $0x4, 0x78(%rsp)
jge 0xeda4
movl 0x78(%rsp), %eax
movq %rax, (%rsp)
subq $0x3, %rax
ja 0xed44
movq (%rsp), %rax
leaq 0x30553(%rip), %rcx     # 0x3f210
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xffffffff, 0x84(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x80(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
jmp 0xed44
movl $0x1, 0x84(%rsp)
movl $0xffffffff, 0x80(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
jmp 0xed44
movl $0x1, 0x84(%rsp)
movl $0x1, 0x80(%rsp)
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
jmp 0xed44
movl $0xffffffff, 0x84(%rsp) # imm = 0xFFFFFFFF
movl $0x1, 0x80(%rsp)
movl $0xffffffff, 0x7c(%rsp) # imm = 0xFFFFFFFF
movsd 0x20(%rsp), %xmm1
cvtsi2sdl 0x84(%rsp), %xmm0
movsd 0x28(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movslq 0x78(%rsp), %rax
movsd %xmm0, 0x50(%rsp,%rax,8)
movsd 0x18(%rsp), %xmm1
cvtsi2sdl 0x80(%rsp), %xmm0
movsd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movslq 0x78(%rsp), %rax
movsd %xmm0, 0x30(%rsp,%rax,8)
movl 0x78(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x78(%rsp)
jmp 0xec95
movl $0x0, 0x88(%rsp)
cmpl $0x4, 0x88(%rsp)
jge 0xefda
cmpl $0x1, 0x3c4f4(%rip)     # 0x4b2b8
jne 0xee53
movslq 0x88(%rsp), %rax
movsd 0x50(%rsp,%rax,8), %xmm0
movq 0x41c31(%rip), %rax     # 0x50a10
movslq 0x3c4d2(%rip), %rcx     # 0x4b2b8
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, (%rax)
movslq 0x88(%rsp), %rax
movsd 0x30(%rsp,%rax,8), %xmm0
movq 0x41c0a(%rip), %rax     # 0x50a10
movslq 0x3c4ab(%rip), %rcx     # 0x4b2b8
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movl 0x3c499(%rip), %edx     # 0x4b2b8
movq 0x41bf2(%rip), %rax     # 0x50a18
movslq 0x3c48f(%rip), %rcx     # 0x4b2bc
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x88(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x3c473(%rip), %eax     # 0x4b2b8
addl $0x1, %eax
movl %eax, 0x3c46a(%rip)     # 0x4b2b8
jmp 0xefc0
movl 0x3c45f(%rip), %eax     # 0x4b2b8
subl $0x1, %eax
movl %eax, 0x8c(%rsp)
cmpl $0x0, 0x8c(%rsp)
jle 0xef10
movslq 0x88(%rsp), %rax
movsd 0x50(%rsp,%rax,8), %xmm1
movq 0x41b8a(%rip), %rax     # 0x50a10
movslq 0x8c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
subsd (%rax), %xmm1
movaps 0x30360(%rip), %xmm0    # 0x3f200
pand %xmm0, %xmm1
movslq 0x88(%rsp), %rax
movsd 0x30(%rsp,%rax,8), %xmm0
movq 0x41b57(%rip), %rax     # 0x50a10
movslq 0x8c(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
subsd 0x8(%rax), %xmm0
movaps 0x3032c(%rip), %xmm2    # 0x3f200
pand %xmm2, %xmm0
addsd %xmm0, %xmm1
movsd 0x30264(%rip), %xmm0    # 0x3f148
ucomisd %xmm1, %xmm0
jbe 0xeeec
jmp 0xef10
cmpl $0x1, 0x8c(%rsp)
jne 0xeef8
jmp 0xef3c
jmp 0xeefa
movl 0x8c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0xee63
movl 0x8c(%rsp), %edx
movq 0x41afa(%rip), %rax     # 0x50a18
movslq 0x3c397(%rip), %rcx     # 0x4b2bc
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x88(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xefc2
movslq 0x88(%rsp), %rax
movsd 0x50(%rsp,%rax,8), %xmm0
movq 0x41abf(%rip), %rax     # 0x50a10
movslq 0x3c360(%rip), %rcx     # 0x4b2b8
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, (%rax)
movslq 0x88(%rsp), %rax
movsd 0x30(%rsp,%rax,8), %xmm0
movq 0x41a98(%rip), %rax     # 0x50a10
movslq 0x3c339(%rip), %rcx     # 0x4b2b8
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movl 0x3c327(%rip), %edx     # 0x4b2b8
movq 0x41a80(%rip), %rax     # 0x50a18
movslq 0x3c31d(%rip), %rcx     # 0x4b2bc
shlq $0x4, %rcx
addq %rcx, %rax
movslq 0x88(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x3c301(%rip), %eax     # 0x4b2b8
addl $0x1, %eax
movl %eax, 0x3c2f8(%rip)     # 0x4b2b8
jmp 0xefc2
jmp 0xefc4
movl 0x88(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x88(%rsp)
jmp 0xedaf
movl 0x3c2dc(%rip), %eax     # 0x4b2bc
addl $0x1, %eax
movl %eax, 0x3c2d3(%rip)     # 0x4b2bc
jmp 0xf023
movl $0x0, 0xc(%rsp)
cmpl $0x4, 0xc(%rsp)
jge 0xf021
movq 0x90(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq 0x258(%rax,%rcx,8), %rdi
callq 0xec00
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xeff3
jmp 0xf023
addq $0x98, %rsp
retq
nopl (%rax,%rax)