// File: /workspace/github_cpp_makefile_star2_O2/jamesliu516[P]amrdg2d/spatial_discretization.cpp
// Function: spatial_discretize_f(Face&)
void spatial_discretize_f(Face &fc)
{
   OctCell *un;
   OctCell *un1;
 //  OctCell *unp1x, *unp1y, *unm1x, *unm1y;

//   double tmp92=0.0;
//   double tmp93=0.0;
//   double tmp94=0.0;  
//   double tmpx=0.0, tmpy=0.0;
   
   un=fc.parent;
   un1=fc.neighbor;
   double xc1,yc1, xc2,yc2;
   double dx1,dy1,dy2,dx2;     
//   double uapp[4][3][3]={0.0};
//   double uapp1[4][3][3]={0.0};
    
   xc1=un->xc1;
   yc1=un->yc1;
   dx1=un->dx;
   dy1=un->dy;
   
   xc2=un1->xc1;
   yc2=un1->yc1;
   dx2=un1->dx;
   dy2=un1->dy;  
         
  double fflx[4][6]={0.0};
  double rfflx[4][6]={0.0};
			      	  
   for (short j=0; j<4; j++) {
       fflx[j][0]=(wei[0]*fc.faceflux[0][j]+wei[1]*fc.faceflux[1][j]+wei[2]*fc.faceflux[2][j])*fc.area*0.5;
       fflx[j][1]=(wei[0]*fc.faceflux[0][j]*phix(fc.gs_pt[0][0],xc1,dx1)+wei[1]*fc.faceflux[1][j]*phix(fc.gs_pt[1][0],xc1,dx1)
             +wei[2]*fc.faceflux[2][j]*phix(fc.gs_pt[2][0],xc1,dx1))*fc.area*0.5;       
        
       fflx[j][2]=(wei[0]*fc.faceflux[0][j]*psiy(fc.gs_pt[0][1],yc1,dy1)+wei[1]*fc.faceflux[1][j]*psiy(fc.gs_pt[1][1],yc1,dy1)
             +wei[2]*fc.faceflux[2][j]*psiy(fc.gs_pt[2][1],yc1,dy1))*fc.area*0.5;         
        
//    if(nDOF==6) {        
       fflx[j][3]=(wei[0]*fc.faceflux[0][j]*phix_psiy(fc.gs_pt[0][0], fc.gs_pt[0][1],xc1,yc1,dx1, dy1)
             +wei[1]*fc.faceflux[1][j]*phix_psiy(fc.gs_pt[1][0], fc.gs_pt[1][1],xc1,yc1,dx1,dy1)
             +wei[2]*fc.faceflux[2][j]*phix_psiy(fc.gs_pt[2][0],fc.gs_pt[2][1],xc1,yc1,dx1, dy1))*fc.area*0.5;         
             
       fflx[j][4]=(wei[0]*fc.faceflux[0][j]*phix2m(fc.gs_pt[0][0],xc1,dx1)+wei[1]*fc.faceflux[1][j]*phix2m(fc.gs_pt[1][0],xc1,dx1)
             +wei[2]*fc.faceflux[2][j]*phix2m(fc.gs_pt[2][0],xc1,dx1))*fc.area*0.5;       
          
       fflx[j][5]=(wei[0]*fc.faceflux[0][j]*psiy2m(fc.gs_pt[0][1],yc1,dy1)+wei[1]*fc.faceflux[1][j]*psiy2m(fc.gs_pt[1][1],yc1,dy1)
             +wei[2]*fc.faceflux[2][j]*psiy2m(fc.gs_pt[2][1],yc1,dy1))*fc.area*0.5;   
  //   }
//right face   
       rfflx[j][0]=fflx[j][0];
       rfflx[j][1]=(wei[0]*fc.faceflux[0][j]*phix(fc.gs_pt[0][0],xc2,dx2)+wei[1]*fc.faceflux[1][j]*phix(fc.gs_pt[1][0],xc2,dx2)
             +wei[2]*fc.faceflux[2][j]*phix(fc.gs_pt[2][0],xc2,dx2))*fc.area*0.5;       
        
       rfflx[j][2]=(wei[0]*fc.faceflux[0][j]*psiy(fc.gs_pt[0][1],yc2,dy2)+wei[1]*fc.faceflux[1][j]*psiy(fc.gs_pt[1][1],yc2,dy2)
             +wei[2]*fc.faceflux[2][j]*psiy(fc.gs_pt[2][1],yc2,dy2))*fc.area*0.5;         
        
//    if(nDOF==6) {        
       rfflx[j][3]=(wei[0]*fc.faceflux[0][j]*phix_psiy(fc.gs_pt[0][0], fc.gs_pt[0][1],xc2,yc2,dx2, dy2)
             +wei[1]*fc.faceflux[1][j]*phix_psiy(fc.gs_pt[1][0], fc.gs_pt[1][1],xc2,yc2,dx2,dy2)
             +wei[2]*fc.faceflux[2][j]*phix_psiy(fc.gs_pt[2][0],fc.gs_pt[2][1],xc2,yc2,dx2, dy2))*fc.area*0.5;         
             
       rfflx[j][4]=(wei[0]*fc.faceflux[0][j]*phix2m(fc.gs_pt[0][0],xc2,dx2)+wei[1]*fc.faceflux[1][j]*phix2m(fc.gs_pt[1][0],xc2,dx2)
             +wei[2]*fc.faceflux[2][j]*phix2m(fc.gs_pt[2][0],xc2,dx2))*fc.area*0.5;       
          
       rfflx[j][5]=(wei[0]*fc.faceflux[0][j]*psiy2m(fc.gs_pt[0][1],yc2,dy2)+wei[1]*fc.faceflux[1][j]*psiy2m(fc.gs_pt[1][1],yc2,dy2)
             +wei[2]*fc.faceflux[2][j]*psiy2m(fc.gs_pt[2][1],yc2,dy2))*fc.area*0.5;   
  //   }  
  }          
   	             
   //face flux
   for(short j=0;j<4;++j){
      for(short imm=0; imm<6;++imm) {
         un->residual[j][imm] += fflx[j][imm];   
         un1->residual[j][imm] -= rfflx[j][imm]; 
      }
  }	    

//end face flux
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x270, %rsp            # imm = 0x270
movq %rdi, %r15
movq (%rdi), %r12
movq 0x8(%rdi), %r13
leaq 0x1b0(%rsp), %rbx
movl $0xc0, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3100
leaq 0xf0(%rsp), %r14
movl $0xc0, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x3100
movupd 0x20(%r15), %xmm2
movupd 0x30(%r15), %xmm5
movupd 0x40(%r15), %xmm15
movupd 0x278(%r12), %xmm1
movupd 0x288(%r12), %xmm0
movapd %xmm2, %xmm3
subpd %xmm1, %xmm3
movapd 0xca9a(%rip), %xmm6     # 0x1b7e0
movapd %xmm3, %xmm7
mulpd %xmm6, %xmm7
movapd 0xca99(%rip), %xmm8     # 0x1b7f0
movapd %xmm7, %xmm9
unpckhpd %xmm8, %xmm9            # xmm9 = xmm9[1],xmm8[1]
mulpd %xmm3, %xmm9
mulpd %xmm3, %xmm7
movapd %xmm3, %xmm13
addsd %xmm3, %xmm13
movapd %xmm5, %xmm3
subpd %xmm1, %xmm3
movapd %xmm3, %xmm10
mulpd %xmm6, %xmm10
movapd %xmm10, %xmm11
unpckhpd %xmm8, %xmm11           # xmm11 = xmm11[1],xmm8[1]
mulpd %xmm3, %xmm11
mulpd %xmm3, %xmm10
movapd %xmm3, %xmm4
addsd %xmm3, %xmm4
movapd %xmm15, %xmm3
subpd %xmm1, %xmm3
movapd %xmm3, %xmm12
mulpd %xmm6, %xmm12
movhlps %xmm12, %xmm8           # xmm8 = xmm12[1],xmm8[1]
mulpd %xmm3, %xmm8
mulpd %xmm3, %xmm12
movapd %xmm3, %xmm1
addsd %xmm3, %xmm1
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
divsd %xmm0, %xmm13
divsd %xmm0, %xmm4
movapd %xmm4, 0x80(%rsp)
divsd %xmm0, %xmm1
movapd %xmm0, %xmm4
mulsd %xmm3, %xmm4
divpd %xmm4, %xmm9
movapd %xmm9, 0xb0(%rsp)
divpd %xmm4, %xmm11
movapd %xmm11, 0x90(%rsp)
divpd %xmm4, %xmm8
movapd %xmm8, 0xc0(%rsp)
mulpd %xmm0, %xmm0
divpd %xmm0, %xmm7
divpd %xmm0, %xmm10
divpd %xmm0, %xmm12
movupd 0x278(%r13), %xmm3
movupd 0x288(%r13), %xmm0
subpd %xmm3, %xmm2
subpd %xmm3, %xmm5
subpd %xmm3, %xmm15
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
mulsd %xmm0, %xmm3
movapd %xmm2, %xmm4
mulpd %xmm6, %xmm4
movapd %xmm4, %xmm8
unpckhpd %xmm4, %xmm8            # xmm8 = xmm8[1],xmm4[1]
mulsd %xmm2, %xmm8
divsd %xmm3, %xmm8
movapd %xmm8, 0x50(%rsp)
movapd %xmm5, %xmm8
mulpd %xmm6, %xmm8
movapd %xmm8, %xmm9
unpckhpd %xmm8, %xmm9            # xmm9 = xmm9[1],xmm8[1]
mulsd %xmm5, %xmm9
divsd %xmm3, %xmm9
movapd %xmm9, 0x30(%rsp)
mulpd %xmm15, %xmm6
movapd %xmm6, %xmm9
unpckhpd %xmm6, %xmm9            # xmm9 = xmm9[1],xmm6[1]
mulsd %xmm15, %xmm9
divsd %xmm3, %xmm9
movapd %xmm9, 0x20(%rsp)
mulpd %xmm2, %xmm4
addpd %xmm2, %xmm2
mulpd %xmm5, %xmm8
addpd %xmm5, %xmm5
mulpd %xmm15, %xmm6
addpd %xmm15, %xmm15
divpd %xmm0, %xmm2
movapd %xmm2, 0x10(%rsp)
divpd %xmm0, %xmm5
movapd %xmm5, (%rsp)
divpd %xmm0, %xmm15
mulpd %xmm0, %xmm0
divpd %xmm0, %xmm4
divpd %xmm0, %xmm8
divpd %xmm0, %xmm6
movapd 0xc8f1(%rip), %xmm0     # 0x1b800
addpd %xmm0, %xmm7
movapd %xmm7, 0xd0(%rsp)
addpd %xmm0, %xmm10
movapd %xmm10, 0xa0(%rsp)
addpd %xmm0, %xmm12
movapd %xmm12, 0x70(%rsp)
addpd %xmm0, %xmm4
movapd %xmm4, 0x60(%rsp)
addpd %xmm0, %xmm8
movapd %xmm8, 0x40(%rsp)
addpd %xmm0, %xmm6
movapd %xmm6, 0xe0(%rsp)
movsd 0xc846(%rip), %xmm3     # 0x1b7a8
movapd %xmm3, %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
unpcklpd %xmm13, %xmm3           # xmm3 = xmm3[0],xmm13[0]
leaq 0x90(%r15), %rax
movsd 0xb0(%r15), %xmm6
movapd %xmm6, %xmm1
unpcklpd %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0]
pushq $0x4
popq %rcx
movsd 0xc816(%rip), %xmm5     # 0x1b7a8
movapd 0xc676(%rip), %xmm4     # 0x1b610
cmpq $0x1c, %rcx
je 0xf185
movsd -0x40(%rax), %xmm0
movsd (%rax), %xmm13
movapd %xmm0, %xmm10
mulsd %xmm5, %xmm10
movapd %xmm13, %xmm14
mulsd %xmm5, %xmm14
movsd -0x20(%rax), %xmm11
mulsd 0xc7cf(%rip), %xmm11    # 0x1b7a0
movapd %xmm11, %xmm7
mulsd 0x80(%rsp), %xmm7
unpcklpd %xmm10, %xmm0           # xmm0 = xmm0[0],xmm10[0]
mulpd %xmm3, %xmm0
movapd %xmm11, %xmm9
unpcklpd %xmm7, %xmm9            # xmm9 = xmm9[0],xmm7[0]
addpd %xmm0, %xmm9
unpcklpd %xmm14, %xmm13          # xmm13 = xmm13[0],xmm14[0]
mulpd %xmm2, %xmm13
addpd %xmm9, %xmm13
mulpd %xmm1, %xmm13
mulpd %xmm4, %xmm13
movapd %xmm13, 0x190(%rsp,%rcx,8)
movapd %xmm11, %xmm9
unpcklpd %xmm11, %xmm9           # xmm9 = xmm9[0],xmm11[0]
movapd %xmm9, %xmm0
mulpd 0x90(%rsp), %xmm0
movapd %xmm10, %xmm8
unpcklpd %xmm10, %xmm8           # xmm8 = xmm8[0],xmm10[0]
movapd %xmm8, %xmm7
mulpd 0xb0(%rsp), %xmm7
addpd %xmm0, %xmm7
movapd %xmm14, %xmm12
unpcklpd %xmm14, %xmm12          # xmm12 = xmm12[0],xmm14[0]
movapd %xmm12, %xmm0
mulpd 0xc0(%rsp), %xmm0
addpd %xmm7, %xmm0
mulpd %xmm1, %xmm0
shufpd $0x1, %xmm0, %xmm0      # xmm0 = xmm0[1,0]
movapd %xmm4, %xmm7
shufpd $0x1, %xmm4, %xmm7      # xmm7 = xmm7[1],xmm4[0]
mulpd %xmm0, %xmm7
movapd %xmm7, 0x1a0(%rsp,%rcx,8)
movapd %xmm9, %xmm0
mulpd 0xa0(%rsp), %xmm0
movapd %xmm8, %xmm7
mulpd 0xd0(%rsp), %xmm7
addpd %xmm0, %xmm7
movapd %xmm12, %xmm0
mulpd 0x70(%rsp), %xmm0
addpd %xmm7, %xmm0
mulpd %xmm1, %xmm0
mulpd %xmm4, %xmm0
movapd %xmm0, 0x1b0(%rsp,%rcx,8)
movlpd %xmm13, 0xd0(%rsp,%rcx,8)
movapd %xmm9, %xmm0
mulpd (%rsp), %xmm0
movapd %xmm8, %xmm7
mulpd 0x10(%rsp), %xmm7
addpd %xmm0, %xmm7
movapd %xmm12, %xmm0
mulpd %xmm15, %xmm0
addpd %xmm7, %xmm0
mulpd %xmm1, %xmm0
mulpd %xmm4, %xmm0
movupd %xmm0, 0xd8(%rsp,%rcx,8)
mulsd 0x30(%rsp), %xmm11
mulsd 0x50(%rsp), %xmm10
addsd %xmm11, %xmm10
mulsd 0x20(%rsp), %xmm14
addsd %xmm10, %xmm14
mulsd %xmm6, %xmm14
mulsd 0xc040(%rip), %xmm14    # 0x1b178
movsd %xmm14, 0xe8(%rsp,%rcx,8)
mulpd 0x40(%rsp), %xmm9
mulpd 0x60(%rsp), %xmm8
addpd %xmm9, %xmm8
mulpd 0xe0(%rsp), %xmm12
addpd %xmm8, %xmm12
mulpd %xmm1, %xmm12
mulpd %xmm4, %xmm12
movapd %xmm12, 0xf0(%rsp,%rcx,8)
addq $0x6, %rcx
addq $0x8, %rax
jmp 0xef9a
movl $0x2a0, %eax            # imm = 0x2A0
addq %rax, %r12
addq %rax, %r13
xorl %eax, %eax
cmpq $0x4, %rax
je 0xf1e0
xorl %ecx, %ecx
cmpq $0x30, %rcx
je 0xf1cb
movsd (%rbx,%rcx), %xmm0
addsd (%r12,%rcx), %xmm0
movsd %xmm0, (%r12,%rcx)
movsd (%r13,%rcx), %xmm0
subsd (%r14,%rcx), %xmm0
movsd %xmm0, (%r13,%rcx)
addq $0x8, %rcx
jmp 0xf19a
incq %rax
addq $0x30, %r13
addq $0x30, %r14
addq $0x30, %r12
addq $0x30, %rbx
jmp 0xf192
addq $0x270, %rsp            # imm = 0x270
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq