// File: /workspace/github_cpp_makefile_star2_O2/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 0x3100
leaq 0x280(%rsp), %r13
movl $0xc0, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x3100
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), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x290(%r14), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x288(%r15), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x290(%r15), %xmm0
movsd %xmm0, 0x20(%rsp)
cmpq $0x30, %rbx
je 0xcd92
movups 0x20(%rbp,%rbx), %xmm0
movaps %xmm0, 0x1e0(%rsp,%rbx)
addq $0x10, %rbx
jmp 0xcd79
cmpb $0x0, 0x1b4(%r14)
je 0xce31
cmpb $0x0, 0x1b4(%r15)
je 0xce31
movzwl 0x1b0(%r14), %eax
cmpw $0x2, %ax
setne %cl
movzwl 0x1b0(%r15), %ebx
cmpw $0x2, %bx
sete %dl
cmpb %dl, %cl
je 0xce81
addq $0x30, %r14
addq $0x30, %r15
leaq 0x280(%rsp), %rax
leaq 0x340(%rsp), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0xcef6
xorl %esi, %esi
cmpq $0x30, %rsi
je 0xce1c
movsd (%r14,%rsi), %xmm0
movsd %xmm0, (%rcx,%rsi)
movsd (%r15,%rsi), %xmm0
movsd %xmm0, (%rax,%rsi)
addq $0x8, %rsi
jmp 0xcdfa
incq %rdx
addq $0x30, %rax
addq $0x30, %r15
addq $0x30, %rcx
addq $0x30, %r14
jmp 0xcdee
addq $0x30, %r14
addq $0x30, %r15
xorl %eax, %eax
cmpq $0x4, %rax
je 0xcef6
xorl %ecx, %ecx
cmpq $0x30, %rcx
je 0xce6c
movsd (%r14,%rcx), %xmm0
movsd %xmm0, (%r12,%rcx)
movsd (%r15,%rcx), %xmm0
movsd %xmm0, (%r13,%rcx)
addq $0x8, %rcx
jmp 0xce47
incq %rax
addq $0x30, %r13
addq $0x30, %r15
addq $0x30, %r12
addq $0x30, %r14
jmp 0xce3b
cmpw $0x2, %ax
jne 0xce8f
movq %r14, %rdi
callq 0x122b8
cmpw $0x2, %bx
jne 0xce9d
movq %r15, %rdi
callq 0x122b8
addq $0x30, %r14
addq $0x30, %r15
leaq 0x280(%rsp), %rax
leaq 0x340(%rsp), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0xcef6
xorl %esi, %esi
cmpq $0x30, %rsi
je 0xcee1
movsd (%r14,%rsi), %xmm0
movsd %xmm0, (%rcx,%rsi)
movsd (%r15,%rsi), %xmm0
movsd %xmm0, (%rax,%rsi)
addq $0x8, %rsi
jmp 0xcebf
incq %rdx
addq $0x30, %rax
addq $0x30, %r15
addq $0x30, %rcx
addq $0x30, %r14
jmp 0xceb7
movq %rbp, 0x10(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x180(%rsp), %r15
xorl %eax, %eax
pushq $0x6
popq %rbp
cmpq $0x4, %rax
je 0xcfbc
movq %rax, 0x18(%rsp)
imulq $0x30, %rax, %rax
leaq (%rsp,%rax), %r12
addq $0x340, %r12            # imm = 0x340
leaq (%rsp,%rax), %r13
addq $0x280, %r13            # imm = 0x280
leaq 0x1e0(%rsp), %rbx
xorl %r14d, %r14d
cmpq $0x3, %r14
je 0xcfa5
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
movsd 0x38(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movq %r12, %rdx
movl %ebp, %ecx
callq 0xcb4c
movsd %xmm0, (%r15,%r14,8)
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movq %r13, %rdx
movl %ebp, %ecx
callq 0xcb4c
movq 0x8(%rsp), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
addq $0x10, %rbx
jmp 0xcf49
movq 0x18(%rsp), %rax
incq %rax
addq $0x18, 0x8(%rsp)
addq $0x18, %r15
jmp 0xcf15
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
movq 0x10(%rsp), %r15
cmpq $0x18, %rax
je 0xd0b7
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
jmp 0xd020
movups 0x10(%r15), %xmm0
leaq 0x270(%rsp), %rbx
movaps %xmm0, (%rbx)
xorps %xmm0, %xmm0
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 %r14d, %r14d
cmpq $0x60, %r14
je 0xd12f
leaq (%rsp,%r14), %rdi
addq $0xc0, %rdi
leaq (%rsp,%r14), %rsi
addq $0x60, %rsi
leaq (%rsp,%r14), %rcx
addq $0x210, %rcx            # imm = 0x210
movq %rbx, %rdx
callq 0xe7db
addq $0x20, %r14
jmp 0xd0fd
addq $0x50, %r15
leaq 0x210(%rsp), %rax
xorl %ecx, %ecx
cmpq $0x3, %rcx
je 0xd168
xorl %edx, %edx
cmpq $0x4, %rdx
je 0xd15b
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, (%r15,%rdx,8)
incq %rdx
jmp 0xd145
incq %rcx
addq $0x20, %r15
addq $0x20, %rax
jmp 0xd13d
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq