// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x260(%rdi)
je 0x71a3
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x730d
movq 0x258(%rbx,%r14,8), %rdi
callq 0x7170
incq %r14
jmp 0x7187
movsd 0x13fcd(%rip), %xmm0    # 0x1b178
movsd 0x288(%rbx), %xmm1
mulsd %xmm0, %xmm1
mulsd 0x290(%rbx), %xmm0
movsd 0x278(%rbx), %xmm2
movsd 0x280(%rbx), %xmm3
xorl %eax, %eax
leaq 0x141e8(%rip), %rcx     # 0x1b3c0
leaq 0x14201(%rip), %rdx     # 0x1b3e0
cmpq $0x20, %rax
je 0x7210
movsd (%rax,%rdx), %xmm4
mulsd %xmm1, %xmm4
addsd %xmm2, %xmm4
movsd %xmm4, 0x20(%rsp,%rax)
movsd (%rax,%rcx), %xmm4
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rsp,%rax)
addq $0x8, %rax
jmp 0x71df
movl 0x1c012(%rip), %esi     # 0x23228
movslq 0x1c00f(%rip), %rax     # 0x2322c
movq %rax, %rcx
shlq $0x4, %rcx
addq 0x2175d(%rip), %rcx     # 0x28988
movq 0x2174e(%rip), %rdx     # 0x28980
xorl %edi, %edi
pushq $0x2
popq %r8
movapd 0x14000(%rip), %xmm0    # 0x1b240
movsd 0x13f38(%rip), %xmm1    # 0x1b180
cmpq $0x4, %rdi
je 0x7305
cmpl $0x1, %esi
je 0x72d4
movq 0x21722(%rip), %r9      # 0x28980
leal -0x1(%rsi), %r10d
movq %r10, %r11
shlq $0x4, %r11
addq %r9, %r11
leal 0x1(%r10), %ebx
cmpl $0x2, %ebx
jl 0x72ce
movsd 0x20(%rsp,%rdi,8), %xmm2
movsd (%rsp,%rdi,8), %xmm3
movupd (%r11), %xmm4
movapd %xmm2, %xmm5
unpcklpd %xmm3, %xmm5            # xmm5 = xmm5[0],xmm3[0]
subpd %xmm4, %xmm5
andpd %xmm0, %xmm5
pshufd $0xee, %xmm5, %xmm4     # xmm4 = xmm5[2,3,2,3]
addsd %xmm5, %xmm4
ucomisd %xmm4, %xmm1
ja 0x72ce
addq $-0x10, %r11
decl %r10d
jne 0x726c
movslq %esi, %r10
shlq $0x4, %r10
movsd %xmm2, (%r9,%r10)
movsd %xmm3, 0x8(%r9,%r10)
movl %esi, (%rcx,%rdi,4)
incl %esi
movl %esi, 0x1bf5c(%rip)     # 0x23228
jmp 0x72fd
movl %r10d, (%rcx,%rdi,4)
jmp 0x72fd
movsd 0x20(%rsp,%rdi,8), %xmm2
movsd %xmm2, 0x10(%rdx)
movsd (%rsp,%rdi,8), %xmm2
movsd %xmm2, 0x18(%rdx)
movl $0x1, (%rcx,%rdi,4)
movl $0x2, 0x1bf2e(%rip)     # 0x23228
movl %r8d, %esi
incq %rdi
jmp 0x7248
incl %eax
movl %eax, 0x1bf1f(%rip)     # 0x2322c
addq $0x48, %rsp
popq %rbx
popq %r14
retq