// File: /workspace/github_cpp_makefile_star2_O1/jamesliu516[P]amrdg2d/riemannWallBound.cpp
// Function: reflectionRie(double, double, double, double*, pointxy*, privariables*)
void reflectionRie(double hr,double hg, double vw,double U[4], PXYZ *nml, JBBL *jbugst)
{
    double tx,ty,nx,ny;
    nx=nml->x;
    ny=nml->y;
    tx=ny;
    ty=-nx;
    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=U[3];
 //   jbugst->q=U[0];
    jbugst->p=pw+hg/hr*(pw-U[3]);
    jbugst->q=dw+hg/hr*(dw-U[0]);
  //  jbugst->p=pw;
   // jbugst->q=dw;
    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 $0xa0, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movsd %xmm2, 0x18(%rsp)
movaps %xmm1, (%rsp)
movsd %xmm0, 0x10(%rsp)
movsd (%rsi), %xmm0
movaps %xmm0, 0x50(%rsp)
movsd 0x8(%rsi), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, %xmm2
xorps 0x1267(%rip), %xmm2     # 0x1e0a0
movaps %xmm2, 0x30(%rsp)
leaq 0x90(%rsp), %r15
movq %r15, %rdi
callq 0xd250
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
callq 0xd250
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
leaq 0x70(%rsp), %r13
movq %r13, %rdi
callq 0xd250
movq %r13, %rdi
movq %r15, %rsi
callq 0xd25a
movapd %xmm0, 0x40(%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0xd25a
movapd (%rsp), %xmm1
divsd 0x10(%rsp), %xmm1
movapd %xmm1, (%rsp)
movapd 0x11eb(%rip), %xmm4     # 0x1e0a0
xorpd %xmm4, %xmm1
movapd 0x40(%rsp), %xmm7
mulsd %xmm7, %xmm1
movapd 0x50(%rsp), %xmm5
movapd %xmm5, %xmm2
mulsd %xmm5, %xmm2
movapd 0x20(%rsp), %xmm6
movapd %xmm6, %xmm3
mulsd %xmm6, %xmm3
addsd %xmm2, %xmm3
unpcklpd %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0]
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
unpcklpd 0x30(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
mulpd %xmm5, %xmm1
movapd %xmm6, %xmm2
unpcklpd %xmm6, %xmm2            # xmm2 = xmm2[0],xmm6[0]
mulpd %xmm0, %xmm2
addpd %xmm1, %xmm2
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
divpd %xmm3, %xmm2
movupd %xmm2, 0x8(%rbx)
movapd %xmm7, %xmm1
xorpd %xmm4, %xmm1
movsd (%r14), %xmm0
movsd 0x18(%r14), %xmm2
leaq 0x68(%rsp), %r15
leaq 0x60(%rsp), %r12
movsd 0x18(%rsp), %xmm3
movq %r15, %rdi
movq %r12, %rsi
callq 0x1cc74
movsd (%r12), %xmm0
movapd %xmm0, %xmm4
subsd 0x18(%r14), %xmm4
movapd (%rsp), %xmm2
mulsd %xmm2, %xmm4
addsd %xmm0, %xmm4
movsd %xmm4, 0x18(%rbx)
movsd (%r15), %xmm1
movapd %xmm1, %xmm3
subsd (%r14), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, (%rbx)
movsd 0x182c(%rip), %xmm2     # 0x1e7b0
ucomisd %xmm4, %xmm2
jbe 0x1cfa0
movsd 0x18(%r14), %xmm0
movsd %xmm0, 0x18(%rbx)
movsd (%r14), %xmm0
movsd %xmm0, (%rbx)
jmp 0x1cfb2
ucomisd %xmm3, %xmm2
ja 0x1cf8a
ucomisd %xmm0, %xmm2
ja 0x1cf8a
ucomisd %xmm1, %xmm2
ja 0x1cf8a
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq