// File: /workspace/github_cpp_makefile_star2_O1/jamesliu516[P]amrdg2d/wall4amrdg2013.cpp
// Function: getsmtrctAB(pointxy const*, pointxy const*, pointxy const*, pointxy*, pointxy*, pointxy*)
void getsmtrctAB(const PXYZ *gst, const PXYZ *pA, const PXYZ *pB,
    PXYZ *smtrctP, PXYZ *jiaodian, PXYZ *normal)
{
    double ls1;
    double ls2;
    double b1, b2, xjd, yjd, jl;

    if(fabs(pB->y-pA->y) < 1e-10)
    {
        smtrctP->x = gst->x;
        smtrctP->y = 2.0 * pA->y - gst->y;

        normal->x = 0.0;
        normal->y = (smtrctP->y - gst->y)/fabs(smtrctP->y - gst->y);

        jiaodian->x = gst->x;
        jiaodian->y = pA->y;
    }
    else if(fabs(pA->x - pB->x) < 1e-10)
    {
        smtrctP->x = 2 * pA->x - gst->x;
        smtrctP->y = gst->y;

        jiaodian->x = pA->x;
        xjd=jiaodian->x;

        jiaodian->y = gst->y;
        yjd=jiaodian->y;

        jl = sqrt((gst->x - xjd) * (gst->x - xjd) + (gst->y - yjd) * (gst->y - yjd));

        normal->x = (xjd - gst->x)/jl;
        normal->y = (yjd - gst->y)/jl;
    }
    else
    {
        ls1 = (pA->y-pB->y)/(pA->x-pB->x);
        ls2 = - 1.0/ls1;
        b1 = pA->y - ls1 * pA->x;
        b2 = gst->y - ls2 * gst->x;

        xjd = (b2 - b1)/(ls1-ls2);
        yjd = ls1 * xjd + b1;

        jiaodian->x = xjd;
        jiaodian->y = yjd;

        smtrctP->x = 2 * xjd - gst->x;
        smtrctP->y = 2 * yjd - gst->y;	

        jl = sqrt((gst->x-xjd) * (gst->x-xjd) + (gst->y-yjd) * (gst->y-yjd));

        normal->x = (xjd - gst->x)/jl;
        normal->y = (yjd - gst->y)/jl;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movsd 0x8(%rdx), %xmm2
movsd 0x8(%rsi), %xmm0
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
andpd 0xd254(%rip), %xmm1     # 0x1e1c0
movq %rdi, %r14
movsd 0xd469(%rip), %xmm4     # 0x1e3e0
ucomisd %xmm1, %xmm4
jbe 0x10fce
movsd (%r14), %xmm1
movsd %xmm1, (%rcx)
addsd %xmm0, %xmm0
subsd 0x8(%r14), %xmm0
movsd %xmm0, 0x8(%rcx)
movq $0x0, (%rbx)
subsd 0x8(%r14), %xmm0
movapd 0xd216(%rip), %xmm1     # 0x1e1c0
andpd %xmm0, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rbx)
movsd (%r14), %xmm0
movsd %xmm0, (%r8)
movsd 0x8(%rsi), %xmm5
movq %r8, %rbx
jmp 0x11155
movsd (%rsi), %xmm1
movapd %xmm1, %xmm3
subsd (%rdx), %xmm3
movapd 0xd1de(%rip), %xmm5     # 0x1e1c0
andpd %xmm3, %xmm5
ucomisd %xmm5, %xmm4
jbe 0x1104f
addsd %xmm1, %xmm1
subsd (%r14), %xmm1
movsd %xmm1, (%rcx)
movsd 0x8(%r14), %xmm0
movsd %xmm0, 0x8(%rcx)
movsd (%rsi), %xmm2
movsd %xmm2, (%r8)
movsd 0x8(%r14), %xmm5
movsd %xmm5, 0x8(%r8)
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
subsd %xmm2, %xmm0
subsd %xmm5, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x110f9
sqrtsd %xmm0, %xmm0
jmp 0x11114
movapd %xmm0, %xmm5
subsd %xmm2, %xmm5
divsd %xmm3, %xmm5
movsd 0xd325(%rip), %xmm2     # 0x1e388
divsd %xmm5, %xmm2
movapd %xmm5, %xmm3
subsd %xmm2, %xmm3
unpcklpd %xmm5, %xmm2            # xmm2 = xmm2[0],xmm5[0]
movsd (%r14), %xmm4
movsd 0x8(%r14), %xmm6
unpcklpd %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0]
mulpd %xmm2, %xmm4
unpcklpd %xmm0, %xmm6            # xmm6 = xmm6[0],xmm0[0]
subpd %xmm4, %xmm6
movapd %xmm6, %xmm0
unpckhpd %xmm6, %xmm0            # xmm0 = xmm0[1],xmm6[1]
subsd %xmm0, %xmm6
divsd %xmm3, %xmm6
mulsd %xmm6, %xmm5
addsd %xmm0, %xmm5
movsd %xmm6, (%r8)
movsd %xmm5, 0x8(%r8)
movupd (%r14), %xmm0
movapd %xmm6, %xmm1
unpcklpd %xmm5, %xmm1            # xmm1 = xmm1[0],xmm5[0]
addpd %xmm1, %xmm1
subpd %xmm0, %xmm1
movupd %xmm1, (%rcx)
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
subsd %xmm6, %xmm0
subsd %xmm5, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x11123
sqrtsd %xmm0, %xmm0
jmp 0x1113e
movapd %xmm5, 0x10(%rsp)
movsd %xmm2, (%rsp)
callq 0x31b0
movsd (%rsp), %xmm2
movapd 0x10(%rsp), %xmm5
subsd (%r14), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, (%rbx)
jmp 0x1114b
movapd %xmm5, 0x10(%rsp)
movapd %xmm6, (%rsp)
callq 0x31b0
movapd (%rsp), %xmm6
movapd 0x10(%rsp), %xmm5
subsd (%r14), %xmm6
divsd %xmm0, %xmm6
movsd %xmm6, (%rbx)
subsd 0x8(%r14), %xmm5
divsd %xmm0, %xmm5
movsd %xmm5, 0x8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
retq