// File: /workspace/github_cpp_makefile_star2_O2/jamesliu516[P]amrdg2d/farfield_boundary.cpp
// Function: getInletOutletBndry_1(bodygridclass*, int)
void getInletOutletBndry_1(OctCell *ghostcell, int in2out)
{
    double nx,ny;
    double speed, a, vbn=0.0;
    PXYZ symtrcpt; 
    PXYZ ghostpt, plsA, plsB;
    int i1,j1;

    //Rieman problem������
    //    double dil,dir,ui,prei;
    JBBL jb1,jb2; 

    SHBL sh;

    //	OctCell *leafp;
    OctCell *pincell=NULL;
    vector< OctCell * > grid;


    ghostpt.x = ghostcell->xc1;
    ghostpt.y = ghostcell->yc1;	
    if(in2out==0){
        symtrcpt.x=2.0*xInlet-ghostpt.x;
        symtrcpt.y=ghostpt.y;
        nx=1.0;
        ny=0.0;
    }
    else {
        symtrcpt.x=2.0*xOutlet-ghostpt.x;
        symtrcpt.y=ghostpt.y;
        nx=-1.0;
        ny=0.0;
    }
    getGridIndex2(ghostcell, &symtrcpt, pincell);
    findIntpltCell(pincell, ghostpt, symtrcpt, grid);
    chazhi4smtrictPshbl(grid, symtrcpt, jb1); 

    a = sqrt(GAMMA * jb1.p / jb1.q);

    speed = jb1.u * nx + jb1.v * ny;

    if(speed > 0.0 && fabs(speed) >= a)  //inflow
    {
        jb2.q=initQ;
        jb2.p=initP;
        jb2.u=uFree;
        jb2.v=vFree;

        jbblToShbl(&jb2, &sh);

        ghostcell->dof[0][0] = sh.q;
        ghostcell->dof[1][0]= sh.qu;
        ghostcell->dof[2][0]= sh.qv;
        ghostcell->dof[3][0]= sh.te;
        for( i1=0; i1<4; ++i1) 
            for(j1=1; j1<nDOF; ++j1)
                ghostcell->dof[i1][j1]=0.0;

    }
    else if(speed > 0.0 && fabs(speed) < a) //inflow
    {

        jb2.p = 0.5 * (initP + jb1.p) + 0.5 * jb1.q * a * (nx * (uFree - jb1.u) + ny * (vFree - jb1.v));
        vbn = 0.5 / (jb1.q * a) *  (initP - jb1.p) + 0.5 * (nx * (uFree + jb1.u) + ny * (vFree + jb1.v));

        jb2.q = initQ * pow(jb2.p/initP, 1./GAMMA);

        jb2.u = uFree + (vbn - (uFree * nx + vFree * ny )) * nx;
        jb2.v = vFree + (vbn - (uFree * nx + vFree * ny )) * ny;

        jbblToShbl(&jb2, &sh);

        ghostcell->dof[0][0] = sh.q;
        ghostcell->dof[1][0]= sh.qu;
        ghostcell->dof[2][0]= sh.qv;
        ghostcell->dof[3][0]= sh.te;
        for(i1=0; i1<4; ++i1) 
            for(j1=1; j1<nDOF; ++j1)
                ghostcell->dof[i1][j1]=0.0;

    }
    else if(speed <= 0.0 && fabs(speed) >= a) //outflow
    {
        jb2.q=jb1.q;
        jb2.p=jb1.p;
        jb2.u=jb1.u;
        jb2.v=jb1.v;

        jbblToShbl(&jb2, &sh);

        ghostcell->dof[0][0] = sh.q;
        ghostcell->dof[1][0]= sh.qu;
        ghostcell->dof[2][0]= sh.qv;
        ghostcell->dof[3][0]= sh.te;
        for(i1=0; i1<4; ++i1) 
            for(j1=1; j1<nDOF; ++j1)
                ghostcell->dof[i1][j1]=0.0;

    }
    else if(speed <= 0.0 && fabs(speed) < a) //outflow
    {

        jb2.p = 0.5 * (initP + jb1.p) + 0.5 * jb1.q * a * (nx * (uFree - jb1.u) + ny * (vFree - jb1.v));
        vbn = 0.5 / (jb1.q * a) *  (initP - jb1.p) + 0.5 * (nx * (uFree + jb1.u) + ny * (vFree + jb1.v));
        jb2.q = jb1.q * pow(jb2.p/jb1.p, 1./GAMMA);

        jb2.u = jb1.u + (vbn - (jb1.u * nx + jb1.v * ny)) * nx;

        jb2.v = jb1.v + (vbn - (jb1.u * nx + jb1.v * ny)) * ny;


        jbblToShbl(&jb2, &sh);

        ghostcell->dof[0][0] = sh.q;
        ghostcell->dof[1][0]= sh.qu;
        ghostcell->dof[2][0]= sh.qv;
        ghostcell->dof[3][0]= sh.te;
        for(i1=0; i1<4; ++i1) 
            for( j1=1; j1<nDOF; ++j1)
                ghostcell->dof[i1][j1]=0.0;

    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
leaq 0x68(%rsp), %rdx
andq $0x0, (%rdx)
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movupd 0x278(%rdi), %xmm0
movapd %xmm0, 0x80(%rsp)
xorl %r14d, %r14d
testl %esi, %esi
sete %r14b
shll $0x3, %r14d
leaq 0x7f0b(%rip), %rax      # 0x1b980
movsd (%r14,%rax), %xmm1
subsd %xmm0, %xmm1
leaq 0x70(%rsp), %rsi
movsd %xmm1, (%rsi)
movhpd %xmm0, 0x8(%rsi)
callq 0x11446
movq 0x68(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0x1171f
leaq 0x40(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x11f43
leaq 0x7ec7(%rip), %rax      # 0x1b990
movsd 0x38(%rsp), %xmm0
mulsd 0x7759(%rip), %xmm0     # 0x1b230
divsd 0x20(%rsp), %xmm0
movsd (%r14,%rax), %xmm8
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jb 0x13af3
sqrtsd %xmm0, %xmm0
jmp 0x13b0a
movsd %xmm8, 0x8(%rsp)
callq 0x3180
xorpd %xmm4, %xmm4
movsd 0x8(%rsp), %xmm8
movsd 0x28(%rsp), %xmm7
movsd 0x30(%rsp), %xmm1
movapd %xmm1, %xmm3
mulsd %xmm4, %xmm3
movapd %xmm7, %xmm2
mulsd %xmm8, %xmm2
addsd %xmm3, %xmm2
ucomisd %xmm4, %xmm2
jbe 0x13ba6
ucomisd %xmm0, %xmm2
jb 0x13ba6
movsd 0x22a69(%rip), %xmm0    # 0x365a8
divsd 0x76e1(%rip), %xmm0     # 0x1b228
addsd 0x7d61(%rip), %xmm0     # 0x1b8b0
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x30(%rbx)
movabsq $0x4024000000000000, %rax # imm = 0x4024000000000000
movq %rax, 0x60(%rbx)
andq $0x0, 0x90(%rbx)
movsd %xmm0, 0xc0(%rbx)
addq $0x38, %rbx
xorl %eax, %eax
cmpq $0x4, %rax
je 0x13fc4
xorl %ecx, %ecx
cmpq $0x5, %rcx
je 0x13b9d
andq $0x0, (%rbx,%rcx,8)
incq %rcx
jmp 0x13b8d
incq %rax
addq $0x30, %rbx
jmp 0x13b81
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x13d5b
ucomisd %xmm2, %xmm0
jbe 0x13d5b
movsd 0x229e2(%rip), %xmm2    # 0x365a8
movsd 0x20(%rsp), %xmm4
movsd 0x38(%rsp), %xmm3
movapd %xmm2, %xmm9
addsd %xmm3, %xmm9
movsd 0x7593(%rip), %xmm10    # 0x1b178
movapd %xmm4, %xmm5
mulsd %xmm10, %xmm5
mulsd %xmm0, %xmm5
movsd 0x7da5(%rip), %xmm11    # 0x1b9a0
movapd %xmm11, %xmm6
movapd %xmm11, %xmm13
subsd %xmm7, %xmm6
xorpd %xmm12, %xmm12
movapd %xmm7, %xmm11
xorpd %xmm7, %xmm7
subsd %xmm1, %xmm7
mulsd %xmm12, %xmm7
mulsd %xmm8, %xmm6
addsd %xmm7, %xmm6
mulsd %xmm5, %xmm6
mulsd %xmm10, %xmm9
addsd %xmm6, %xmm9
movsd %xmm9, 0x10(%rsp)
mulsd %xmm4, %xmm0
movapd %xmm10, %xmm4
divsd %xmm0, %xmm4
movapd %xmm9, %xmm0
divsd %xmm2, %xmm0
subsd %xmm3, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm13, %xmm11
xorpd %xmm3, %xmm3
addsd %xmm3, %xmm1
mulsd %xmm3, %xmm1
mulsd %xmm8, %xmm11
addsd %xmm1, %xmm11
mulsd %xmm10, %xmm11
addsd %xmm2, %xmm11
movsd %xmm11, 0x18(%rsp)
movsd 0x7be8(%rip), %xmm1     # 0x1b878
movsd %xmm8, 0x8(%rsp)
callq 0x3340
movsd 0x8(%rsp), %xmm4
movapd %xmm4, %xmm1
movsd 0x7cf2(%rip), %xmm2     # 0x1b9a0
mulsd %xmm2, %xmm1
xorpd %xmm5, %xmm5
addsd %xmm5, %xmm1
movsd 0x18(%rsp), %xmm3
subsd %xmm1, %xmm3
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
mulsd %xmm5, %xmm3
xorpd %xmm1, %xmm1
addsd %xmm1, %xmm3
movapd %xmm3, %xmm5
movapd %xmm0, %xmm1
movsd 0x7490(%rip), %xmm2     # 0x1b178
mulsd %xmm0, %xmm2
movsd %xmm0, 0x30(%rbx)
mulsd %xmm4, %xmm0
mulsd %xmm3, %xmm1
movsd 0x10(%rsp), %xmm3
divsd 0x7521(%rip), %xmm3     # 0x1b228
mulsd %xmm5, %xmm5
mulsd %xmm4, %xmm4
addsd %xmm5, %xmm4
mulsd %xmm2, %xmm4
addsd %xmm3, %xmm4
movsd %xmm0, 0x60(%rbx)
movsd %xmm1, 0x90(%rbx)
movsd %xmm4, 0xc0(%rbx)
addq $0x38, %rbx
xorl %eax, %eax
cmpq $0x4, %rax
je 0x13fc4
xorl %ecx, %ecx
cmpq $0x5, %rcx
je 0x13d52
andq $0x0, (%rbx,%rcx,8)
incq %rcx
jmp 0x13d42
incq %rax
addq $0x30, %rbx
jmp 0x13d36
ucomisd %xmm2, %xmm3
movapd 0x74d9(%rip), %xmm3     # 0x1b240
andpd %xmm2, %xmm3
jb 0x13e04
ucomisd %xmm0, %xmm3
jb 0x13e04
movsd 0x20(%rsp), %xmm0
movsd 0x38(%rsp), %xmm2
movapd %xmm7, %xmm3
mulsd %xmm0, %xmm3
movapd %xmm1, %xmm4
mulsd %xmm0, %xmm4
divsd 0x7489(%rip), %xmm2     # 0x1b228
movsd 0x73d1(%rip), %xmm5     # 0x1b178
mulsd %xmm0, %xmm5
mulsd %xmm1, %xmm1
mulsd %xmm7, %xmm7
addsd %xmm1, %xmm7
mulsd %xmm5, %xmm7
addsd %xmm2, %xmm7
movsd %xmm0, 0x30(%rbx)
movsd %xmm3, 0x60(%rbx)
movsd %xmm4, 0x90(%rbx)
movsd %xmm7, 0xc0(%rbx)
addq $0x38, %rbx
xorl %eax, %eax
cmpq $0x4, %rax
je 0x13fc4
xorl %ecx, %ecx
cmpq $0x5, %rcx
je 0x13dfb
andq $0x0, (%rbx,%rcx,8)
incq %rcx
jmp 0x13deb
incq %rax
addq $0x30, %rbx
jmp 0x13ddf
ucomisd %xmm2, %xmm4
jb 0x13fc4
ucomisd %xmm3, %xmm0
jbe 0x13fc4
movsd 0x22788(%rip), %xmm3    # 0x365a8
movsd 0x20(%rsp), %xmm5
movsd 0x38(%rsp), %xmm2
movapd %xmm3, %xmm9
addsd %xmm2, %xmm9
movsd 0x7339(%rip), %xmm10    # 0x1b178
movapd %xmm5, %xmm4
movapd %xmm5, %xmm13
movsd %xmm5, 0x60(%rsp)
mulsd %xmm10, %xmm4
mulsd %xmm0, %xmm4
movsd 0x7b41(%rip), %xmm5     # 0x1b9a0
movapd %xmm5, %xmm6
subsd %xmm7, %xmm6
xorpd %xmm12, %xmm12
movapd %xmm7, %xmm11
xorpd %xmm7, %xmm7
subsd %xmm1, %xmm7
mulsd %xmm12, %xmm7
mulsd %xmm8, %xmm6
addsd %xmm7, %xmm6
mulsd %xmm4, %xmm6
mulsd %xmm10, %xmm9
addsd %xmm6, %xmm9
movsd %xmm9, 0x10(%rsp)
mulsd %xmm13, %xmm0
movapd %xmm10, %xmm4
divsd %xmm0, %xmm4
subsd %xmm2, %xmm3
mulsd %xmm4, %xmm3
addsd %xmm5, %xmm11
xorpd %xmm0, %xmm0
addsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm8, %xmm11
addsd %xmm1, %xmm11
mulsd %xmm10, %xmm11
addsd %xmm3, %xmm11
movsd %xmm11, 0x18(%rsp)
movapd %xmm9, %xmm0
divsd %xmm2, %xmm0
movsd 0x7989(%rip), %xmm1     # 0x1b878
movsd %xmm8, 0x8(%rsp)
callq 0x3340
mulsd 0x60(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movapd %xmm2, %xmm3
xorpd %xmm6, %xmm6
mulsd %xmm6, %xmm3
movapd %xmm1, %xmm4
movsd 0x8(%rsp), %xmm5
mulsd %xmm5, %xmm4
addsd %xmm3, %xmm4
movsd 0x18(%rsp), %xmm3
subsd %xmm4, %xmm3
mulsd %xmm3, %xmm5
addsd %xmm1, %xmm5
mulsd %xmm6, %xmm3
addsd %xmm2, %xmm3
movapd %xmm3, %xmm4
movapd %xmm0, %xmm1
movsd 0x7223(%rip), %xmm3     # 0x1b178
mulsd %xmm0, %xmm3
movsd %xmm0, 0x30(%rbx)
mulsd %xmm5, %xmm0
mulsd %xmm4, %xmm1
movsd 0x10(%rsp), %xmm2
divsd 0x72b4(%rip), %xmm2     # 0x1b228
mulsd %xmm4, %xmm4
mulsd %xmm5, %xmm5
addsd %xmm4, %xmm5
mulsd %xmm3, %xmm5
addsd %xmm2, %xmm5
movsd %xmm0, 0x60(%rbx)
movsd %xmm1, 0x90(%rbx)
movsd %xmm5, 0xc0(%rbx)
addq $0x38, %rbx
xorl %eax, %eax
cmpq $0x4, %rax
je 0x13fc4
xorl %ecx, %ecx
cmpq $0x5, %rcx
je 0x13fbb
andq $0x0, (%rbx,%rcx,8)
incq %rcx
jmp 0x13fab
incq %rax
addq $0x30, %rbx
jmp 0x13fa3
leaq 0x40(%rsp), %rdi
callq 0x4cba
addq $0x98, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4cba
movq %rbx, %rdi
callq 0x3350