// File: /workspace/github_cpp_makefile_star2_O2/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 $0x4b8, %rsp            # imm = 0x4B8
movq %rdi, %r15
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)
movaps %xmm0, 0x260(%rsp)
movaps %xmm0, 0x250(%rsp)
movaps %xmm0, 0x240(%rsp)
leaq 0x3f0(%rsp), %r12
xorl %ebx, %ebx
movl $0xc0, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x3100
leaq 0x330(%rsp), %r13
movl $0xc0, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x3100
movq (%r15), %rbp
movq 0x8(%r15), %r14
movups 0x278(%rbp), %xmm0
movaps %xmm0, 0x170(%rsp)
movups 0x278(%r14), %xmm0
movaps %xmm0, 0x160(%rsp)
movsd 0x288(%rbp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x290(%rbp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x288(%r14), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x290(%r14), %xmm0
movsd %xmm0, 0x20(%rsp)
cmpq $0x30, %rbx
je 0xd2b2
movups 0x20(%r15,%rbx), %xmm0
movaps %xmm0, 0x240(%rsp,%rbx)
addq $0x10, %rbx
jmp 0xd298
cmpb $0x0, 0x1b4(%rbp)
je 0xd352
cmpb $0x0, 0x1b4(%r14)
je 0xd352
movzwl 0x1b0(%rbp), %eax
cmpw $0x2, %ax
setne %cl
movzwl 0x1b0(%r14), %ebx
cmpw $0x2, %bx
sete %dl
cmpb %dl, %cl
je 0xd3a0
leaq 0x30(%rbp), %rax
leaq 0x30(%r14), %rcx
leaq 0x330(%rsp), %rdx
leaq 0x3f0(%rsp), %rsi
xorl %edi, %edi
cmpq $0x4, %rdi
je 0xd41c
xorl %r8d, %r8d
cmpq $0x30, %r8
je 0xd33d
movsd (%rax,%r8), %xmm0
movsd %xmm0, (%rsi,%r8)
movsd (%rcx,%r8), %xmm0
movsd %xmm0, (%rdx,%r8)
addq $0x8, %r8
jmp 0xd319
incq %rdi
addq $0x30, %rdx
addq $0x30, %rcx
addq $0x30, %rsi
addq $0x30, %rax
jmp 0xd30c
leaq 0x30(%rbp), %rax
leaq 0x30(%r14), %rcx
xorl %edx, %edx
cmpq $0x4, %rdx
je 0xd41c
xorl %esi, %esi
cmpq $0x30, %rsi
je 0xd38b
movsd (%rax,%rsi), %xmm0
movsd %xmm0, (%r12,%rsi)
movsd (%rcx,%rsi), %xmm0
movsd %xmm0, (%r13,%rsi)
addq $0x8, %rsi
jmp 0xd368
incq %rdx
addq $0x30, %r13
addq $0x30, %rcx
addq $0x30, %r12
addq $0x30, %rax
jmp 0xd35c
cmpw $0x2, %ax
jne 0xd3b0
movq %rbp, %rdi
xorl %esi, %esi
callq 0x120b2
cmpw $0x2, %bx
jne 0xd3c0
movq %r14, %rdi
xorl %esi, %esi
callq 0x120b2
leaq 0x30(%rbp), %rax
leaq 0x30(%r14), %rcx
leaq 0x330(%rsp), %rdx
leaq 0x3f0(%rsp), %rsi
xorl %edi, %edi
cmpq $0x4, %rdi
je 0xd41c
xorl %r8d, %r8d
cmpq $0x30, %r8
je 0xd407
movsd (%rax,%r8), %xmm0
movsd %xmm0, (%rsi,%r8)
movsd (%rcx,%r8), %xmm0
movsd %xmm0, (%rdx,%r8)
addq $0x8, %r8
jmp 0xd3e3
incq %rdi
addq $0x30, %rdx
addq $0x30, %rcx
addq $0x30, %rsi
addq $0x30, %rax
jmp 0xd3da
movq %rbp, 0x38(%rsp)
movq %r15, 0x50(%rsp)
movq %r14, 0x58(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x100(%rsp), %r13
xorl %eax, %eax
pushq $0x6
popq %rbp
cmpq $0x4, %rax
je 0xd4f2
movq %rax, 0x18(%rsp)
imulq $0x30, %rax, %rax
leaq (%rsp,%rax), %rbx
addq $0x3f0, %rbx            # imm = 0x3F0
leaq (%rsp,%rax), %r15
addq $0x330, %r15            # imm = 0x330
leaq 0x240(%rsp), %r14
xorl %r12d, %r12d
cmpq $0x3, %r12
je 0xd4db
movq %r14, %rdi
leaq 0x170(%rsp), %rsi
movsd (%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movq %rbx, %rdx
movl %ebp, %ecx
callq 0xcb4c
movsd %xmm0, (%r13,%r12,8)
movq %r14, %rdi
leaq 0x160(%rsp), %rsi
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movq %r15, %rdx
movl %ebp, %ecx
callq 0xcb4c
movq 0x8(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
addq $0x10, %r14
jmp 0xd479
movq 0x18(%rsp), %rax
incq %rax
addq $0x18, 0x8(%rsp)
addq $0x18, %r13
jmp 0xd445
xorps %xmm0, %xmm0
movaps %xmm0, 0x230(%rsp)
movaps %xmm0, 0x220(%rsp)
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)
xorl %eax, %eax
movq 0x58(%rsp), %r13
movq 0x50(%rsp), %rbp
cmpq $0x18, %rax
je 0xd604
movsd 0x100(%rsp,%rax), %xmm0
movsd 0x118(%rsp,%rax), %xmm1
movsd %xmm0, 0x1e0(%rsp,%rax,4)
movsd %xmm1, 0x1e8(%rsp,%rax,4)
movsd 0x130(%rsp,%rax), %xmm0
movsd %xmm0, 0x1f0(%rsp,%rax,4)
movsd 0x148(%rsp,%rax), %xmm0
movsd %xmm0, 0x1f8(%rsp,%rax,4)
movsd 0xa0(%rsp,%rax), %xmm0
movsd 0xb8(%rsp,%rax), %xmm1
movsd %xmm0, 0x180(%rsp,%rax,4)
movsd %xmm1, 0x188(%rsp,%rax,4)
movsd 0xd0(%rsp,%rax), %xmm0
movsd %xmm0, 0x190(%rsp,%rax,4)
movsd 0xe8(%rsp,%rax), %xmm0
movsd %xmm0, 0x198(%rsp,%rax,4)
addq $0x8, %rax
jmp 0xd561
movsd 0x10(%rbp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x18(%rbp), %xmm0
movsd %xmm0, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x320(%rsp)
movaps %xmm0, 0x310(%rsp)
movaps %xmm0, 0x300(%rsp)
movaps %xmm0, 0x2f0(%rsp)
movaps %xmm0, 0x2e0(%rsp)
movaps %xmm0, 0x2d0(%rsp)
movaps %xmm0, 0x2c0(%rsp)
movaps %xmm0, 0x2b0(%rsp)
movaps %xmm0, 0x2a0(%rsp)
movaps %xmm0, 0x290(%rsp)
movaps %xmm0, 0x280(%rsp)
movaps %xmm0, 0x270(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpq $0x60, %r12
je 0xd6eb
leaq (%rsp,%r12), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
leaq (%rsp,%r12), %rbx
addq $0x2d0, %rbx            # imm = 0x2D0
movq %rbx, %rsi
callq 0xdcdc
leaq (%rsp,%r12), %rdi
addq $0x180, %rdi            # imm = 0x180
leaq (%rsp,%r12), %r14
addq $0x270, %r14            # imm = 0x270
movq %r14, %rsi
callq 0xdcdc
movsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x80(%rsp,%r15)
movsd 0x18(%r14), %xmm0
movsd %xmm0, 0x60(%rsp,%r15)
addq $0x20, %r12
addq $0x8, %r15
jmp 0xd683
movsd 0x3f0(%rsp), %xmm0
movsd 0x420(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x48(%rsp)
movsd 0x450(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0x330(%rsp), %xmm0
movsd 0x360(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x390(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x100(%rsp), %xmm0
movsd 0xdac7(%rip), %xmm1     # 0x1b230
callq 0x3340
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x60(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0xa0(%rsp), %xmm0
movsd 0xda96(%rip), %xmm1     # 0x1b230
callq 0x3340
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 0x108(%rsp), %xmm0
movsd 0xda59(%rip), %xmm1     # 0x1b230
callq 0x3340
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xa8(%rsp), %xmm0
movsd 0xda29(%rip), %xmm1     # 0x1b230
callq 0x3340
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd (%rsp), %xmm0
subsd %xmm1, %xmm0
mulsd 0xdf79(%rip), %xmm0     # 0x1b7a0
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd 0xdf6f(%rip), %xmm0     # 0x1b7a8
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x90(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x110(%rsp), %xmm0
movsd 0xd9ce(%rip), %xmm1     # 0x1b230
callq 0x3340
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xb0(%rsp), %xmm0
movsd 0xd99e(%rip), %xmm1     # 0x1b230
callq 0x3340
movsd (%rsp), %xmm5
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
subsd %xmm1, %xmm5
mulsd 0xdef6(%rip), %xmm5     # 0x1b7a8
addsd 0x8(%rsp), %xmm5
movsd 0xb0(%rbp), %xmm0
mulsd %xmm0, %xmm5
mulsd 0xd8ac(%rip), %xmm5     # 0x1b178
movsd 0x30(%rsp), %xmm3
movsd 0x40(%rsp), %xmm2
mulsd %xmm3, %xmm2
movsd 0x28(%rsp), %xmm4
movsd 0x48(%rsp), %xmm1
mulsd %xmm4, %xmm1
addsd %xmm2, %xmm1
movapd %xmm1, %xmm2
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
jbe 0xd92b
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 0x18(%rsp), %xmm3
movsd 0x20(%rsp), %xmm2
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
jbe 0xd96d
movsd 0x220(%r13), %xmm1
subsd %xmm5, %xmm1
movsd %xmm1, 0x220(%r13)
addsd 0x230(%r13), %xmm0
movsd %xmm0, 0x230(%r13)
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq