// File: /workspace/github_cpp_makefile_star2_O1/jamesliu516[P]amrdg2d/face_flux_all.cpp
// Function: kxrcf_relate()
void kxrcf_relate()
{
    Node *current;
    current = HeadListAllGrid;  
    OctCell *pcell0;
    double rtp, rtm;
    double uapp[4][3][3];
    double pre[3][3]={0.0};
    while(current != NULL)
    {		
        pcell0 = current->cell;
        if(pcell0->flag  == 0 && current->flg<=2 ) {
            pcell0->kxq=0.0;
            pcell0->inlen=0.0;
            rtp=1.0e-13;
            for(short j=0; j<4; j++) {
                for(short imm=0; imm<3;imm++) {
                    for(short jmm=0; jmm<3; jmm++) {
                        uapp[j][jmm][imm]=approx_sol(gspt[jmm],
                            gspt[imm], pcell0->dof[j], nDOF);  //u(x,y)
                       // if(rtp<uapp[jmm][imm]) rtp=uapp[0][jmm][imm];
                       // density
                    }
                }
            }
            //entropy
            for(short imm=0; imm<3;imm++) {
                for(short jmm=0; jmm<3; jmm++) {
                    pre[jmm][imm]=GAM11 *(uapp[3][jmm][imm]-0.5*(uapp[1][jmm][imm]*uapp[1][jmm][imm]/uapp[0][jmm][imm]
                            + uapp[2][jmm][imm]*uapp[2][jmm][imm]/uapp[0][jmm][imm]));	          
                    rtm=pre[jmm][imm]/pow(uapp[0][jmm][imm],GAMMA);
                    if(rtp<rtm) rtp=rtm;
                }
            }
            pcell0->maxqp=rtp;
        }
        current = current->next;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
leaq 0x1b954(%rip), %rax     # 0x2a610
movq (%rax), %rax
testq %rax, %rax
je 0xee56
leaq 0xfaf1(%rip), %rbp      # 0x1e7c0
movq 0x8(%rax), %rcx
cmpw $0x0, 0x1b0(%rcx)
jne 0xee49
cmpw $0x2, (%rax)
jg 0xee49
movq %rax, 0x28(%rsp)
xorl %eax, %eax
movq %rax, 0x220(%rcx)
movq %rax, 0x230(%rcx)
movq %rcx, 0x20(%rsp)
leaq 0x30(%rcx), %rax
movq %rax, 0x30(%rsp)
leaq 0x40(%rsp), %r14
xorl %eax, %eax
movq %rax, 0x38(%rsp)
leaq (%rax,%rax,2), %rbx
shlq $0x4, %rbx
addq 0x30(%rsp), %rbx
movq %r14, 0x10(%rsp)
xorl %r13d, %r13d
movsd (%rbp,%r13,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r14, %r12
xorl %r15d, %r15d
movsd (%r15,%rbp), %xmm0
movsd 0x8(%rsp), %xmm1
movq %rbx, %rdi
movl $0x6, %esi
callq 0xdc4c
movsd %xmm0, (%r12)
addq $0x8, %r15
addq $0x18, %r12
cmpq $0x18, %r15
jne 0xed42
incq %r13
addq $0x8, %r14
cmpq $0x3, %r13
jne 0xed2f
movq 0x38(%rsp), %rax
incq %rax
movq 0x10(%rsp), %r14
addq $0x48, %r14
cmpq $0x4, %rax
jne 0xed15
leaq 0x118(%rsp), %rbx
xorl %r12d, %r12d
movsd 0xfa0a(%rip), %xmm1     # 0x1e7b0
movq $-0x48, %r15
movsd %xmm1, 0x8(%rsp)
movsd -0x48(%rbx,%r15), %xmm1
movhpd (%rbx,%r15), %xmm1      # xmm1 = xmm1[0],mem[0]
movsd -0x90(%rbx,%r15), %xmm0
mulpd %xmm1, %xmm1
movapd %xmm0, %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
divpd %xmm2, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd 0xf352(%rip), %xmm2     # 0x1e140
addsd 0x48(%rbx,%r15), %xmm2
mulsd 0xf3ab(%rip), %xmm2     # 0x1e1a8
movapd %xmm2, 0x10(%rsp)
movsd 0xf3a5(%rip), %xmm1     # 0x1e1b0
callq 0x3360
movapd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
maxsd 0x8(%rsp), %xmm1
addq $0x18, %r15
jne 0xedad
incq %r12
addq $0x8, %rbx
cmpq $0x3, %r12
jne 0xeda6
movq 0x20(%rsp), %rax
movsd %xmm1, 0x228(%rax)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xeccf
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq