// File: /workspace/github_cpp_makefile_star2_O1/jamesliu516[P]amrdg2d/face_flux_all.cpp
// Function: face_kxrcf(Face&)
void face_kxrcf(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(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 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;
     }

 }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rdi, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x210(%rsp)
movaps %xmm0, 0x200(%rsp)
movaps %xmm0, 0x1f0(%rsp)
movaps %xmm0, 0x1e0(%rsp)
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, 0x260(%rsp)
movaps %xmm0, 0x250(%rsp)
movaps %xmm0, 0x240(%rsp)
leaq 0x330(%rsp), %r12
xorl %ebx, %ebx
movl $0xc0, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x3120
leaq 0x270(%rsp), %r13
movl $0xc0, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x3120
movq (%r15), %rsi
movq 0x8(%r15), %r14
movups 0x278(%rsi), %xmm0
movaps %xmm0, 0x230(%rsp)
movups 0x278(%r14), %xmm0
movaps %xmm0, 0x220(%rsp)
movsd 0x288(%rsi), %xmm2
movsd 0x290(%rsi), %xmm1
movsd 0x288(%r14), %xmm3
movsd 0x290(%r14), %xmm4
movups 0x20(%r15,%rbx), %xmm0
movaps %xmm0, 0x240(%rsp,%rbx)
addq $0x10, %rbx
cmpq $0x30, %rbx
jne 0xe4f6
cmpb $0x0, 0x1b4(%rsi)
movsd %xmm3, 0x30(%rsp)
movsd %xmm4, 0x28(%rsp)
movq %r15, 0x50(%rsp)
movq %rsi, 0x38(%rsp)
movsd %xmm2, (%rsp)
movsd %xmm1, 0x10(%rsp)
je 0xe5c5
cmpb $0x0, 0x1b4(%r14)
je 0xe5c5
movzwl 0x1b0(%rsi), %eax
cmpw $0x2, %ax
setne %cl
movzwl 0x1b0(%r14), %ebx
cmpw $0x2, %bx
sete %dl
cmpb %dl, %cl
je 0xeb46
leaq 0x30(%rsi), %rax
leaq 0x30(%r14), %rcx
leaq 0x330(%rsp), %rdx
leaq 0x270(%rsp), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movsd (%rax,%r8), %xmm0
movsd %xmm0, (%rdx,%r8)
movsd (%rcx,%r8), %xmm0
movsd %xmm0, (%rsi,%r8)
addq $0x8, %r8
cmpq $0x30, %r8
jne 0xe588
incq %rdi
addq $0x30, %rax
addq $0x30, %rdx
addq $0x30, %rcx
addq $0x30, %rsi
cmpq $0x4, %rdi
jne 0xe585
jmp 0xe60b
leaq 0x30(%rsi), %rax
leaq 0x30(%r14), %rcx
xorl %edx, %edx
xorl %esi, %esi
movsd (%rax,%rsi), %xmm0
movsd %xmm0, (%r12,%rsi)
movsd (%rcx,%rsi), %xmm0
movsd %xmm0, (%r13,%rsi)
addq $0x8, %rsi
cmpq $0x30, %rsi
jne 0xe5d1
incq %rdx
addq $0x30, %rax
addq $0x30, %r12
addq $0x30, %rcx
addq $0x30, %r13
cmpq $0x4, %rdx
jne 0xe5cf
movq %r14, 0x58(%rsp)
leaq 0x1c0(%rsp), %r12
leaq 0x160(%rsp), %rbp
xorl %eax, %eax
leaq 0x230(%rsp), %r14
movq %rax, 0x20(%rsp)
shlq $0x4, %rax
leaq (%rax,%rax,2), %rax
leaq (%rsp,%rax), %rdx
addq $0x330, %rdx            # imm = 0x330
movq %rdx, 0x8(%rsp)
leaq (%rsp,%rax), %rbx
addq $0x270, %rbx            # imm = 0x270
leaq 0x240(%rsp), %r15
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
movapd %xmm2, %xmm0
movq 0x8(%rsp), %rdx
movl $0x6, %ecx
callq 0xddcc
movsd %xmm0, (%r12,%r13,8)
movq %r15, %rdi
leaq 0x220(%rsp), %rsi
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movq %rbx, %rdx
movl $0x6, %ecx
callq 0xddcc
movsd 0x10(%rsp), %xmm1
movsd (%rsp), %xmm2
movsd %xmm0, (%rbp,%r13,8)
incq %r13
addq $0x10, %r15
cmpq $0x3, %r13
jne 0xe65d
movq 0x20(%rsp), %rax
incq %rax
addq $0x18, %r12
addq $0x18, %rbp
cmpq $0x4, %rax
jne 0xe62a
xorps %xmm0, %xmm0
movaps %xmm0, 0x150(%rsp)
movaps %xmm0, 0x140(%rsp)
movaps %xmm0, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
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)
xorl %eax, %eax
movsd 0x1c0(%rsp,%rax), %xmm0
movsd 0x1d8(%rsp,%rax), %xmm1
movsd %xmm0, 0x100(%rsp,%rax,4)
movsd %xmm1, 0x108(%rsp,%rax,4)
movsd 0x1f0(%rsp,%rax), %xmm0
movsd %xmm0, 0x110(%rsp,%rax,4)
movsd 0x208(%rsp,%rax), %xmm0
movsd %xmm0, 0x118(%rsp,%rax,4)
movsd 0x160(%rsp,%rax), %xmm0
movsd 0x178(%rsp,%rax), %xmm1
movsd %xmm0, 0xa0(%rsp,%rax,4)
movsd %xmm1, 0xa8(%rsp,%rax,4)
movsd 0x190(%rsp,%rax), %xmm0
movsd %xmm0, 0xb0(%rsp,%rax,4)
movsd 0x1a8(%rsp,%rax), %xmm0
movsd %xmm0, 0xb8(%rsp,%rax,4)
addq $0x8, %rax
cmpq $0x18, %rax
jne 0xe73e
movq 0x50(%rsp), %r14
movsd 0x10(%r14), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x18(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
xorl %eax, %eax
movsd 0xf93d(%rip), %xmm0     # 0x1e140
movsd 0xf99d(%rip), %xmm1     # 0x1e1a8
movq 0x58(%rsp), %rbx
movsd 0x100(%rsp,%rax,4), %xmm2
movsd 0x108(%rsp,%rax,4), %xmm3
divsd %xmm2, %xmm3
movsd 0x110(%rsp,%rax,4), %xmm4
divsd %xmm2, %xmm4
mulsd %xmm4, %xmm4
mulsd %xmm3, %xmm3
addsd %xmm4, %xmm3
mulsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
addsd 0x118(%rsp,%rax,4), %xmm2
mulsd %xmm1, %xmm2
movsd 0xa0(%rsp,%rax,4), %xmm3
movsd 0xa8(%rsp,%rax,4), %xmm4
divsd %xmm3, %xmm4
movsd 0xb0(%rsp,%rax,4), %xmm5
divsd %xmm3, %xmm5
mulsd %xmm5, %xmm5
mulsd %xmm4, %xmm4
addsd %xmm5, %xmm4
mulsd %xmm0, %xmm3
mulsd %xmm4, %xmm3
addsd 0xb8(%rsp,%rax,4), %xmm3
mulsd %xmm1, %xmm3
movsd %xmm2, 0x80(%rsp,%rax)
movsd %xmm3, 0x60(%rsp,%rax)
addq $0x8, %rax
cmpq $0x18, %rax
jne 0xe810
movsd 0x330(%rsp), %xmm0
movsd 0x360(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x48(%rsp)
movsd 0x390(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0x270(%rsp), %xmm0
movsd 0x2a0(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x2d0(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x1c0(%rsp), %xmm0
movsd 0xf87d(%rip), %xmm1     # 0x1e1b0
callq 0x3360
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x60(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x160(%rsp), %xmm0
movsd 0xf84c(%rip), %xmm1     # 0x1e1b0
callq 0x3360
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x88(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1c8(%rsp), %xmm0
movsd 0xf80f(%rip), %xmm1     # 0x1e1b0
callq 0x3360
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x168(%rsp), %xmm0
movsd 0xf7df(%rip), %xmm1     # 0x1e1b0
callq 0x3360
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd (%rsp), %xmm0
subsd %xmm1, %xmm0
mulsd 0xfdaf(%rip), %xmm0     # 0x1e7a0
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd 0xfda5(%rip), %xmm0     # 0x1e7a8
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x90(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x1d0(%rsp), %xmm0
movsd 0xf784(%rip), %xmm1     # 0x1e1b0
callq 0x3360
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x170(%rsp), %xmm0
movsd 0xf754(%rip), %xmm1     # 0x1e1b0
callq 0x3360
movsd (%rsp), %xmm5
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
subsd %xmm1, %xmm5
mulsd 0xfd2c(%rip), %xmm5     # 0x1e7a8
addsd 0x8(%rsp), %xmm5
movsd 0xb0(%r14), %xmm0
mulsd %xmm0, %xmm5
mulsd 0xf6b1(%rip), %xmm5     # 0x1e148
movsd 0x10(%rsp), %xmm3
movsd 0x40(%rsp), %xmm2
mulsd %xmm3, %xmm2
movsd 0x30(%rsp), %xmm4
movsd 0x48(%rsp), %xmm1
mulsd %xmm4, %xmm1
addsd %xmm2, %xmm1
movapd %xmm1, %xmm2
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
jbe 0xeaf6
movq 0x38(%rsp), %rax
movsd 0x220(%rax), %xmm2
addsd %xmm5, %xmm2
movsd %xmm2, 0x220(%rax)
movsd 0x230(%rax), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0x230(%rax)
mulsd 0x20(%rsp), %xmm3
movsd 0x28(%rsp), %xmm2
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
jbe 0xeb34
movsd 0x220(%rbx), %xmm1
subsd %xmm5, %xmm1
movsd %xmm1, 0x220(%rbx)
addsd 0x230(%rbx), %xmm0
movsd %xmm0, 0x230(%rbx)
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpw $0x2, %ax
jne 0xeb67
movq %rsi, %r12
movq %rsi, %rdi
xorl %esi, %esi
callq 0x13fab
movsd 0x10(%rsp), %xmm1
movsd (%rsp), %xmm2
movq %r12, %rsi
cmpw $0x2, %bx
jne 0xeb88
movq %rsi, %rbx
movq %r14, %rdi
xorl %esi, %esi
callq 0x13fab
movsd 0x10(%rsp), %xmm1
movsd (%rsp), %xmm2
movq %rbx, %rsi
leaq 0x30(%rsi), %rax
leaq 0x30(%r14), %rcx
leaq 0x330(%rsp), %rdx
leaq 0x270(%rsp), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movsd (%rax,%r8), %xmm0
movsd %xmm0, (%rdx,%r8)
movsd (%rcx,%r8), %xmm0
movsd %xmm0, (%rsi,%r8)
addq $0x8, %r8
cmpq $0x30, %r8
jne 0xeba5
incq %rdi
addq $0x30, %rax
addq $0x30, %rdx
addq $0x30, %rcx
addq $0x30, %rsi
cmpq $0x4, %rdi
jne 0xeba2
jmp 0xe60b