// File: /workspace/github_cpp_makefile_star2_O1/jamesliu516[P]amrdg2d/face_flux_all.cpp
// Function: face_flux(Face&)
void face_flux(Face &fc)
{
     double uxl[4][3]={0.0},uxr[4][3]={0.0};
     
     OctCell *lsbl, *lsbl0;
     double xc0[2],xc1[2];
     
     double xii0[3][2]={0.0};
          
     double dx0,dy0,dx1,dy1;
     double dofp[4][6]={0.0};
     double dofn[4][6]={0.0};
     bool pflag2,nflag2; 
     lsbl0=fc.parent;
     lsbl=fc.neighbor;
     xc0[0]=lsbl0->xc1;
     xc0[1]=lsbl0->yc1;
     
     xc1[0]=lsbl->xc1;
     xc1[1]=lsbl->yc1;
     
     dx0=lsbl0->dx;
     dy0=lsbl0->dy;
     dx1=lsbl->dx;
     dy1=lsbl->dy;
      
     for(short j=0; j<3;++j){
        xii0[j][0]=fc.gs_pt[j][0];
        xii0[j][1]=fc.gs_pt[j][1];                 
      }

     if((!lsbl0->mvflg)||(!lsbl->mvflg)){
         for(short i1=0;i1<4;++i1){
             for(short j1=0;j1<6;++j1){
                 dofp[i1][j1]=lsbl0->dof[i1][j1];
                 dofn[i1][j1]=lsbl->dof[i1][j1];
             }
         }
     }
     else{
         pflag2=(lsbl0->flag==2);
         nflag2=(lsbl->flag==2);
         if((pflag2&& !nflag2) || (!pflag2&& nflag2)){
             //.....
             if(b_ARS){
                 if(pflag2) getGhostValueRiemann(lsbl0);
                 if(nflag2) getGhostValueRiemann(lsbl);
             }
             else{
                 if(pflag2) getGhostValueMagazine(lsbl0,mv_qvlvModify);
                 if(nflag2) getGhostValueMagazine(lsbl,mv_qvlvModify);
             }
             for(short i1=0;i1<4;++i1){
                 for(short j1=0;j1<6;++j1){
                     dofp[i1][j1]=lsbl0->dof[i1][j1];
                     dofn[i1][j1]=lsbl->dof[i1][j1];
                 }
             }
         }
         else {
             for(short i1=0;i1<4;++i1){
                 for(short j1=0;j1<6;++j1){
                     dofp[i1][j1]=lsbl0->dof[i1][j1];
                     dofn[i1][j1]=lsbl->dof[i1][j1];
                 }
             }
         }
     }

     /*
        for(short i1=0;i1<4;++i1){
        for(short j1=0;j1<6;++j1){
        dofp[i1][j1]=lsbl0->dof[i1][j1];
        dofn[i1][j1]=lsbl->dof[i1][j1];
        }
        }
        */
     for(short i=0; i< 4; i++)  {
         for(short j=0;j<3;j++) {
	    uxl[i][j]= n_approx_sol(xii0[j], xc0, dx0, dy0, dofp[i], nDOF );
	    uxr[i][j]= n_approx_sol(xii0[j], xc1, dx1, dy1, dofn[i], nDOF );
	    }
     }     
     
     SHBL ushl[3], ushr[3];
   //  JBBL ujbl[3], ujbr[3];     
     
     for(short j=0; j<3;j++) {
          ushl[j].q=uxl[0][j];
          ushl[j].qu=uxl[1][j];
          ushl[j].qv=uxl[2][j];         
          ushl[j].te=uxl[3][j];
          
          ushr[j].q=uxr[0][j];
          ushr[j].qu=uxr[1][j];
          ushr[j].qv=uxr[2][j];         
          ushr[j].te=uxr[3][j];
      }     
     
     PXYZ normal;
     
     normal.x=fc.nml[0];
     normal.y=fc.nml[1];
     
     double flx[3][4]={0.0};
     for(short j=0; j<3;++j) {
      //    shblToJbbl(&ushl[j], &ujbl[j]);
      //    shblToJbbl(&ushr[j], &ujbr[j]); 
  //        HLLC_flux(ujbl+j, ujbr+j, &normal, flx[j]); 

  //void HLLC_flux(SHBL &wl, SHBL &wr, PXYZ &normal, double flxface[4])  
         if(HLLCFLUX==0)
             GLF_flux(ushl[j], ushr[j], normal, flx[j]); 
         else
             HLLC_flux(ushl[j], ushr[j], normal, flx[j]); 
     }
     
     for(short j=0;j<3; ++j) {
        for(short i=0; i<4; ++i) {
           fc.faceflux[j][i]=flx[j][i];
         }
     }
/*
#ifdef KXRCF_LIM
     double u1,v1,u0,v0;
     double rtmp;
     JBBL uljb[3],urjb[3];
     double prel[3], prer[3];

     for(short j=0; j<3;++j) {
          shblToJbbl(&ushl[j], &uljb[j]);
          shblToJbbl(&ushr[j], &urjb[j]); 
          prel[j]=uljb[j].p;
          prer[j]=urjb[j].p;
     }
     u0=dofp[1][0]/dofp[0][0];
     v0=dofp[2][0]/dofp[0][0];
     u1=dofn[1][0]/dofn[0][0];
     v1=dofn[2][0]/dofn[0][0];
//den
 //    rtmp=(wei[0]*(uxl[0][0]-uxr[0][0])+wei[1]*(uxl[0][1]-uxr[0][1])
   //      +wei[2]*(uxl[0][2]-uxr[0][2]))*fc.area*0.5;
     //    
     //entropy
     rtmp=(wei[0]*(prel[0]/pow(uxl[0][0],GAMMA)-prer[0]/pow(uxr[0][0],GAMMA))
         +wei[1]*(prel[1]/pow(uxl[0][1],GAMMA)-prer[1]/pow(uxr[0][1],GAMMA)) 
         +wei[2]*(prel[2]/pow(uxl[0][2],GAMMA)-prer[2]/pow(uxr[0][2],GAMMA)) )*fc.area*0.5;
     if(u0*normal.x+v0*normal.y<0.0){
         lsbl0->kxq+=rtmp;
         lsbl0->inlen+=fc.area;
     }

     if(u1*normal.x+v1*normal.y>0.0){
         lsbl->kxq-=rtmp;
         lsbl->inlen+=fc.area;
     }

#endif
*/

 }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdi, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x1d0(%rsp)
movaps %xmm0, 0x1c0(%rsp)
movaps %xmm0, 0x1b0(%rsp)
movaps %xmm0, 0x1a0(%rsp)
movaps %xmm0, 0x190(%rsp)
movaps %xmm0, 0x180(%rsp)
movaps %xmm0, 0x170(%rsp)
movaps %xmm0, 0x160(%rsp)
movaps %xmm0, 0x150(%rsp)
movaps %xmm0, 0x140(%rsp)
movaps %xmm0, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
movaps %xmm0, 0x200(%rsp)
movaps %xmm0, 0x1f0(%rsp)
movaps %xmm0, 0x1e0(%rsp)
leaq 0x340(%rsp), %r12
xorl %ebx, %ebx
movl $0xc0, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x3120
leaq 0x280(%rsp), %r13
movl $0xc0, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x3120
movq (%rbp), %r14
movq 0x8(%rbp), %r15
movups 0x278(%r14), %xmm0
movaps %xmm0, 0x50(%rsp)
movups 0x278(%r15), %xmm0
movaps %xmm0, 0x40(%rsp)
movsd 0x288(%r14), %xmm2
movsd 0x290(%r14), %xmm1
movsd 0x288(%r15), %xmm3
movsd 0x290(%r15), %xmm4
movups 0x20(%rbp,%rbx), %xmm0
movaps %xmm0, 0x1e0(%rsp,%rbx)
addq $0x10, %rbx
cmpq $0x30, %rbx
jne 0xdfe1
cmpb $0x0, 0x1b4(%r14)
movsd %xmm3, 0x30(%rsp)
movsd %xmm4, 0x28(%rsp)
movq %rbp, 0x18(%rsp)
movsd %xmm2, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
je 0xe0aa
cmpb $0x0, 0x1b4(%r15)
je 0xe0aa
movzwl 0x1b0(%r14), %eax
cmpw $0x2, %ax
setne %cl
movzwl 0x1b0(%r15), %ebx
cmpw $0x2, %bx
sete %dl
cmpb %dl, %cl
je 0xe361
addq $0x30, %r14
addq $0x30, %r15
leaq 0x340(%rsp), %rax
leaq 0x280(%rsp), %rcx
xorl %edx, %edx
xorl %esi, %esi
movsd (%r14,%rsi), %xmm0
movsd %xmm0, (%rax,%rsi)
movsd (%r15,%rsi), %xmm0
movsd %xmm0, (%rcx,%rsi)
addq $0x8, %rsi
cmpq $0x30, %rsi
jne 0xe06f
incq %rdx
addq $0x30, %r14
addq $0x30, %rax
addq $0x30, %r15
addq $0x30, %rcx
cmpq $0x4, %rdx
jne 0xe06d
jmp 0xe0f2
addq $0x30, %r14
addq $0x30, %r15
xorl %eax, %eax
xorl %ecx, %ecx
movsd (%r14,%rcx), %xmm0
movsd %xmm0, (%r12,%rcx)
movsd (%r15,%rcx), %xmm0
movsd %xmm0, (%r13,%rcx)
addq $0x8, %rcx
cmpq $0x30, %rcx
jne 0xe0b6
incq %rax
addq $0x30, %r14
addq $0x30, %r12
addq $0x30, %r15
addq $0x30, %r13
cmpq $0x4, %rax
jne 0xe0b4
leaq 0x180(%rsp), %r14
leaq 0x120(%rsp), %r12
xorl %eax, %eax
leaq 0x50(%rsp), %rbx
movq %rax, 0x20(%rsp)
shlq $0x4, %rax
leaq (%rax,%rax,2), %rax
leaq (%rsp,%rax), %rdx
addq $0x340, %rdx            # imm = 0x340
movq %rdx, 0x38(%rsp)
leaq (%rsp,%rax), %r13
addq $0x280, %r13            # imm = 0x280
leaq 0x1e0(%rsp), %rbp
xorl %r15d, %r15d
movq %rbp, %rdi
movq %rbx, %rsi
movaps %xmm2, %xmm0
movq 0x38(%rsp), %rdx
movl $0x6, %ecx
callq 0xddcc
movsd %xmm0, (%r14,%r15,8)
movq %rbp, %rdi
leaq 0x40(%rsp), %rsi
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movq %r13, %rdx
movl $0x6, %ecx
callq 0xddcc
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movsd %xmm0, (%r12,%r15,8)
incq %r15
addq $0x10, %rbp
cmpq $0x3, %r15
jne 0xe13c
movq 0x20(%rsp), %rax
incq %rax
addq $0x18, %r14
addq $0x18, %r12
cmpq $0x4, %rax
jne 0xe109
xorps %xmm0, %xmm0
movaps %xmm0, 0x110(%rsp)
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
xorl %eax, %eax
movsd 0x180(%rsp,%rax), %xmm0
movsd 0x198(%rsp,%rax), %xmm1
movsd %xmm0, 0xc0(%rsp,%rax,4)
movsd %xmm1, 0xc8(%rsp,%rax,4)
movsd 0x1b0(%rsp,%rax), %xmm0
movsd %xmm0, 0xd0(%rsp,%rax,4)
movsd 0x1c8(%rsp,%rax), %xmm0
movsd %xmm0, 0xd8(%rsp,%rax,4)
movsd 0x120(%rsp,%rax), %xmm0
movsd 0x138(%rsp,%rax), %xmm1
movsd %xmm0, 0x60(%rsp,%rax,4)
movsd %xmm1, 0x68(%rsp,%rax,4)
movsd 0x150(%rsp,%rax), %xmm0
movsd %xmm0, 0x70(%rsp,%rax,4)
movsd 0x168(%rsp,%rax), %xmm0
movsd %xmm0, 0x78(%rsp,%rax,4)
addq $0x8, %rax
cmpq $0x18, %rax
jne 0xe213
xorps %xmm0, %xmm0
leaq 0x270(%rsp), %r14
movaps %xmm0, (%r14)
movq 0x18(%rsp), %r15
movups 0x10(%r15), %xmm1
movaps %xmm1, (%r14)
movaps %xmm0, 0x260(%rsp)
movaps %xmm0, 0x250(%rsp)
movaps %xmm0, 0x240(%rsp)
movaps %xmm0, 0x230(%rsp)
movaps %xmm0, 0x220(%rsp)
movaps %xmm0, 0x210(%rsp)
xorl %ebx, %ebx
leaq (%rsp,%rbx), %rdi
addq $0xc0, %rdi
leaq (%rsp,%rbx), %rsi
addq $0x60, %rsi
leaq (%rsp,%rbx), %rcx
addq $0x210, %rcx            # imm = 0x210
movq %r14, %rdx
callq 0xfabc
addq $0x20, %rbx
cmpq $0x60, %rbx
jne 0xe2f4
addq $0x50, %r15
xorl %eax, %eax
movups 0x210(%rsp,%rax), %xmm0
movups 0x220(%rsp,%rax), %xmm1
movups %xmm1, 0x10(%r15,%rax)
movups %xmm0, (%r15,%rax)
addq $0x20, %rax
cmpq $0x60, %rax
jne 0xe32a
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpw $0x2, %ax
jne 0xe37b
movq %r14, %rdi
callq 0x14247
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
cmpw $0x2, %bx
jne 0xe395
movq %r15, %rdi
callq 0x14247
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
addq $0x30, %r14
addq $0x30, %r15
leaq 0x340(%rsp), %rax
leaq 0x280(%rsp), %rcx
xorl %edx, %edx
xorl %esi, %esi
movsd (%r14,%rsi), %xmm0
movsd %xmm0, (%rax,%rsi)
movsd (%r15,%rsi), %xmm0
movsd %xmm0, (%rcx,%rsi)
addq $0x8, %rsi
cmpq $0x30, %rsi
jne 0xe3b1
incq %rdx
addq $0x30, %r14
addq $0x30, %rax
addq $0x30, %r15
addq $0x30, %rcx
cmpq $0x4, %rdx
jne 0xe3af
jmp 0xe0f2