// File: /workspace/github_cpp_makefile_star2_O1/jamesliu516[P]amrdg2d/riemannWallBound.cpp
// Function: reflectionRieQVLV(double, double, double, double*, pointxy*, pointxy const*, privariables*)
void reflectionRieQVLV(double hr,double hg, double vw,double U[4], PXYZ *nml, const PXYZ *wpt, JBBL *jbugst)
{
    double rd,tx,ty,nx,ny;
    nx=nml->x;
    ny=nml->y;
    tx=ny;
    ty=-nx;
    rd=getWallCurvatureRadius(wpt);
    Vec2D ndir(nx,ny);
    Vec2D tdir(tx,ty);
    Vec2D ur(U[1],U[2]);
    double un1,ut1,un2,ut2;
    un1=ur.dot(ndir);
    ut1=ur.dot(tdir);
    un2=-(hg/hr)*un1;
    ut2=ut1;

    jbugst->u = (ny * ut2 - ty * un2)/(tx * ny - nx * ty);
    jbugst->v = (tx * un2 - nx * ut2)/(tx * ny - nx * ty);			
    double dw,pw;

    solveERS(U[0],-un1,U[3],vw,&dw,&pw);

    jbugst->p=pw+hg*((pw-U[3])/hr-dw*ut2*ut2/rd);
    jbugst->q=dw+hg/hr*(dw-U[0]);
    if(jbugst->p<1.0e-13|| jbugst->q<1.0e-13
        || pw<1.0e-13||dw<1.0e-13){
        jbugst->p=U[3];
        jbugst->q=U[0];
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movq %rcx, %rbx
movq %rdi, %r14
movsd %xmm2, 0x28(%rsp)
movsd %xmm1, 0x8(%rsp)
movaps %xmm0, 0x50(%rsp)
movsd (%rsi), %xmm1
movaps %xmm1, 0x30(%rsp)
movsd 0x8(%rsi), %xmm0
movaps %xmm0, 0x10(%rsp)
xorps 0x109c(%rip), %xmm1     # 0x1e0a0
movaps %xmm1, 0x40(%rsp)
movq %rdx, %rdi
callq 0x11886
movaps %xmm0, 0x90(%rsp)
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x10(%rsp), %xmm1
callq 0xd250
leaq 0xc0(%rsp), %r12
movq %r12, %rdi
movaps 0x10(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
callq 0xd250
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
leaq 0xb0(%rsp), %r13
movq %r13, %rdi
callq 0xd250
movq %r13, %rdi
movq %r15, %rsi
callq 0xd25a
movapd %xmm0, 0x60(%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0xd25a
movapd %xmm0, %xmm6
movapd %xmm0, 0x70(%rsp)
movsd 0x8(%rsp), %xmm0
divsd 0x50(%rsp), %xmm0
movapd %xmm0, 0x80(%rsp)
movapd 0xff4(%rip), %xmm4      # 0x1e0a0
xorpd %xmm4, %xmm0
movapd 0x60(%rsp), %xmm7
mulsd %xmm7, %xmm0
movapd 0x30(%rsp), %xmm5
movapd %xmm5, %xmm1
mulsd %xmm5, %xmm1
movapd 0x10(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
unpcklpd %xmm6, %xmm5            # xmm5 = xmm5[0],xmm6[0]
unpcklpd %xmm0, %xmm6            # xmm6 = xmm6[0],xmm0[0]
unpcklpd 0x40(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
mulpd %xmm5, %xmm0
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm6, %xmm3
addpd %xmm0, %xmm3
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
divpd %xmm2, %xmm3
movupd %xmm3, 0x8(%rbx)
movapd %xmm7, %xmm1
xorpd %xmm4, %xmm1
movsd (%r14), %xmm0
movsd 0x18(%r14), %xmm2
leaq 0xa8(%rsp), %r15
leaq 0xa0(%rsp), %r12
movsd 0x28(%rsp), %xmm3
movq %r15, %rdi
movq %r12, %rsi
callq 0x1cc74
movsd (%r12), %xmm1
movapd %xmm1, %xmm4
subsd 0x18(%r14), %xmm4
movsd (%r15), %xmm0
movapd 0x70(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
unpcklpd %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0]
movapd 0x50(%rsp), %xmm2
unpcklpd 0x90(%rsp), %xmm2       # xmm2 = xmm2[0],mem[0]
divpd %xmm2, %xmm4
movapd %xmm4, %xmm2
unpckhpd %xmm4, %xmm2            # xmm2 = xmm2[1],xmm4[1]
subsd %xmm2, %xmm4
mulsd 0x8(%rsp), %xmm4
addsd %xmm1, %xmm4
movsd %xmm4, 0x18(%rbx)
movapd %xmm0, %xmm3
subsd (%r14), %xmm3
mulsd 0x80(%rsp), %xmm3
addsd %xmm0, %xmm3
movsd %xmm3, (%rbx)
movsd 0x15fc(%rip), %xmm2     # 0x1e7b0
ucomisd %xmm4, %xmm2
jbe 0x1d1d0
movsd 0x18(%r14), %xmm0
movsd %xmm0, 0x18(%rbx)
movsd (%r14), %xmm0
movsd %xmm0, (%rbx)
jmp 0x1d1e2
ucomisd %xmm3, %xmm2
ja 0x1d1ba
ucomisd %xmm1, %xmm2
ja 0x1d1ba
ucomisd %xmm0, %xmm2
ja 0x1d1ba
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq