// File: /workspace/github_cpp_makefile_star2_O2/jamesliu516[P]amrdg2d/farfield_boundary.cpp
// Function: farFieldBoundary(int)
void farFieldBoundary(int itt)
{
    int j,k;
    int i1, j1;
    double nx;
    double ny;
    SHBL sh;
    JBBL jb1, jb2;

    double speed, a, vbn;

    vbn=0.0;
    //-----------------------------------------------------------------------

    //----Զ���߽�������λ�ں�y�����ᴹֱ���²���----begin--	 
    nx=0.0;
    ny = 1.0;

    for(k=1; k <= Nx; k++)
    {
        //----�²��Ǹ���-------begin--
        sh.q = bodygrid[2*Nx +k].dof[0][0];
        sh.qu = bodygrid[2*Nx +k].dof[1][0];
        sh.qv = bodygrid[2*Nx +k].dof[2][0];
        sh.te = bodygrid[2*Nx +k].dof[3][0];

        bodygrid[Nx +k].dof[0][0] = sh.q;
        bodygrid[Nx +k].dof[1][0]= sh.qu;
        bodygrid[Nx +k].dof[2][0]= sh.qv;
        bodygrid[Nx +k].dof[3][0]= sh.te;
        for( i1=0; i1<4; ++i1) 
            for(j1=1; j1<nDOF; ++j1)
                bodygrid[Nx +k].dof[i1][j1]=0.0;


        //---������������------
        for(i1=0; i1<4; ++i1) {
            bodygrid[k].dof[i1][0] = 2.0*bodygrid[Nx+k].dof[i1][0]
                - bodygrid[2*Nx+k].dof[i1][0];
            for(j1=1; j1<nDOF;++j1)
                bodygrid[k].dof[i1][j1] = 0.0;
        }

        //----�²��Ǹ���-------end--
    }


    //////////////////////////////////////////////////////////////////////////////////---------------------2008.7.1

    //     for(j=1;j<=Ny;j++) {
    //       for(k=1;k<=Nx;k++) {	         				       		       
    //			bodygrid[(j-1)*Nx +k]

    //----Զ���߽�������λ�ں�y�����ᴹֱ���ϲ���----begin--	 
    nx=0.0;
    ny = -1.0;


    for(k=1; k <= Nx; k++)
    {
        //----�ϲ��Ǹ���-------begin--
        sh.q = bodygrid[(Ny-3)*Nx+k].dof[0][0];
        sh.qu = bodygrid[(Ny-3)*Nx+k].dof[1][0];
        sh.qv = bodygrid[(Ny-3)*Nx+k].dof[2][0];
        sh.te = bodygrid[(Ny-3)*Nx+k].dof[3][0];


        bodygrid[(Ny-2)*Nx+k].dof[0][0] = sh.q;
        bodygrid[(Ny-2)*Nx+k].dof[1][0]= sh.qu;
        bodygrid[(Ny-2)*Nx+k].dof[2][0] = sh.qv;
        bodygrid[(Ny-2)*Nx+k].dof[3][0] = sh.te;

        for(i1=0; i1<4; ++i1)
            for(j1=1; j1<nDOF; ++j1) 
                bodygrid[(Ny-2)*Nx+k].dof[i1][j1] = 0.0;

        //--������������------
        for (i1=0; i1<4; ++i1) {
            bodygrid[(Ny-1)*Nx+k].dof[i1][0] = 2.0*bodygrid[(Ny-2)*Nx+k].dof[i1][0]
                - bodygrid[(Ny-3)*Nx+k].dof[i1][0];
            for(j1=1; j1<nDOF; ++j1)
                bodygrid[(Ny-1)*Nx+k].dof[i1][j1] = 0.0;
        }
        //----------------------------------------------
        //----�ϲ��Ǹ���-------end--
    }


    //-------------------�Ҳ���---------0000000000000------begin---
    nx = -1.0;
    ny=0.0;

    for(j=1; j <= Ny; j++)
    {
        /*-----------begin--*/
        sh.q = bodygrid[(j-1)*Nx+Nx-2].dof[0][0];
        sh.qu = bodygrid[(j-1)*Nx+Nx-2].dof[1][0];
        sh.qv = bodygrid[(j-1)*Nx+Nx-2].dof[2][0];
        sh.te = bodygrid[(j-1)*Nx+Nx-2].dof[3][0];

        bodygrid[(j-1)*Nx+Nx-1].dof[0][0]= sh.q;
        bodygrid[(j-1)*Nx+Nx-1].dof[1][0] = sh.qu;
        bodygrid[(j-1)*Nx+Nx-1].dof[2][0] = sh.qv;
        bodygrid[(j-1)*Nx+Nx-1].dof[3][0] = sh.te;

        for(i1=0; i1<4; ++i1)
            for(j1=1; j1<nDOF; ++j1)
                bodygrid[(j-1)*Nx+Nx-1].dof[i1][j1]=0.0;

        //---������������------
        for(i1=0; i1<4; ++i1) {
            bodygrid[(j-1)*Nx+Nx].dof[i1][0]
                = 2.0*bodygrid[(j-1)*Nx+Nx-1].dof[i1][0] - bodygrid[(j-1)*Nx+Nx-2].dof[i1][0];
            for(j1=1; j1<nDOF; ++j1)
                bodygrid[(j-1)*Nx+Nx].dof[i1][j1]=0.0;	
        }	       

    }

    //----�Ҳ���------------------end--------

    //-------------------������----begin------
    nx = 1.0;
    ny=0.0;

    for(j=1; j <= Ny; j++)
    {
        //-----------begin--------
        sh.q = bodygrid[(j-1)*Nx+3].dof[0][0];
        sh.qu = bodygrid[(j-1)*Nx+3].dof[1][0];
        sh.qv = bodygrid[(j-1)*Nx+3].dof[2][0];
        sh.te = bodygrid[(j-1)*Nx+3].dof[3][0];


        bodygrid[(j-1)*Nx+2].dof[0][0] = sh.q;
        bodygrid[(j-1)*Nx+2].dof[1][0]= sh.qu;
        bodygrid[(j-1)*Nx+2].dof[2][0] = sh.qv;
        bodygrid[(j-1)*Nx+2].dof[3][0]= sh.te;
        for(i1=0; i1<4; ++i1) 
            for(j1=1; j1<nDOF; ++j1)
                bodygrid[(j-1)*Nx+2].dof[i1][j1]=0.0;

        //---������������------
        for(i1=0; i1<4; ++i1) {
            bodygrid[(j-1)*Nx+1].dof[i1][0]
                = 2.0*bodygrid[(j-1)*Nx+2].dof[i1][0] - bodygrid[(j-1)*Nx+3].dof[i1][0];
            for(j1=1; j1<nDOF; ++j1)
                bodygrid[(j-1)*Nx+1].dof[i1][j1]=0.0;
        }
    }

    //----������-------------------------end----
}

// Assembly:
pushq %r14
pushq %rbx
leaq 0xfd42(%rip), %rax      # 0x232e0
movq (%rax), %rax
leaq 0x1a2b8(%rax), %rcx
leaq 0x398(%rax), %rdx
movabsq $0x1, %rsi
movl $0x360, %edi            # imm = 0x360
cmpq $0x7c, %rsi
je 0x136ba
leaq 0xf6(%rsi), %r9
imulq $0x360, %rsi, %r8       # imm = 0x360
movsd 0x33e70(%r8,%rax), %xmm0
movsd 0x33ea0(%r8,%rax), %xmm1
movsd 0x33ed0(%r8,%rax), %xmm2
movsd 0x33f00(%r8,%rax), %xmm3
leaq 0x7b(%rsi), %r10
movsd %xmm0, 0x19f50(%r8,%rax)
movsd %xmm1, 0x19f80(%r8,%rax)
movsd %xmm2, 0x19fb0(%r8,%rax)
movsd %xmm3, 0x19fe0(%r8,%rax)
movq %rcx, %r11
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x13651
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x13648
andq $0x0, (%r11,%r14,8)
incq %r14
jmp 0x13638
incq %rbx
addq $0x30, %r11
jmp 0x1362f
imulq $0x360, %r10, %r10      # imm = 0x360
addq %rax, %r10
imulq $0x360, %r9, %r9        # imm = 0x360
addq %rax, %r9
addq %rax, %r8
movq %rdx, %r11
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x136ac
imulq $0x30, %rbx, %r14
movsd 0x30(%r14,%r10), %xmm0
addsd %xmm0, %xmm0
subsd 0x30(%r14,%r9), %xmm0
movsd %xmm0, 0x30(%r14,%r8)
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x136a3
andq $0x0, (%r11,%r14,8)
incq %r14
jmp 0x13693
incq %rbx
addq $0x30, %r11
jmp 0x1366d
incq %rsi
addq %rdi, %rcx
addq %rdi, %rdx
jmp 0x135be
leaq 0x662c78(%rax), %rcx
leaq 0x67cb98(%rax), %rdx
movabsq $0x1, %rsi
movl $0x360, %edi            # imm = 0x360
cmpq $0x7c, %rsi
je 0x137e4
leaq 0x1dca(%rsi), %r8
imulq $0x360, %rsi, %r10      # imm = 0x360
movsd 0x6489f0(%r10,%rax), %xmm0
movsd 0x648a20(%r10,%rax), %xmm1
movsd 0x648a50(%r10,%rax), %xmm2
movsd 0x648a80(%r10,%rax), %xmm3
leaq 0x1e45(%rsi), %r9
movsd %xmm0, 0x662910(%r10,%rax)
movsd %xmm1, 0x662940(%r10,%rax)
movsd %xmm2, 0x662970(%r10,%rax)
movsd %xmm3, 0x6629a0(%r10,%rax)
movq %rcx, %r10
xorl %r11d, %r11d
cmpq $0x4, %r11
je 0x1376d
xorl %ebx, %ebx
cmpq $0x5, %rbx
je 0x13764
andq $0x0, (%r10,%rbx,8)
incq %rbx
jmp 0x13754
incq %r11
addq $0x30, %r10
jmp 0x1374c
leaq 0x1ec0(%rsi), %r10
imulq $0x360, %r9, %r9        # imm = 0x360
addq %rax, %r9
imulq $0x360, %r8, %r8        # imm = 0x360
addq %rax, %r8
imulq $0x360, %r10, %r10      # imm = 0x360
addq %rax, %r10
movq %rdx, %r11
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x137d6
imulq $0x30, %rbx, %r14
movsd 0x30(%r14,%r9), %xmm0
addsd %xmm0, %xmm0
subsd 0x30(%r14,%r8), %xmm0
movsd %xmm0, 0x30(%r14,%r10)
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x137cd
andq $0x0, (%r11,%r14,8)
incq %r14
jmp 0x137bd
incq %rbx
addq $0x30, %r11
jmp 0x13797
incq %rsi
addq %rdi, %rcx
addq %rdi, %rdx
jmp 0x136d7
leaq 0x19bf8(%rax), %rcx
leaq 0x19f58(%rax), %rdx
movabsq $0x1, %rsi
movl $0x19f20, %edi          # imm = 0x19F20
cmpq $0x42, %rsi
je 0x138ff
imulq $0x7b, %rsi, %r9
leaq -0x2(%r9), %r8
imulq $0x360, %r8, %r8        # imm = 0x360
movsd 0x30(%rax,%r8), %xmm0
movsd 0x60(%rax,%r8), %xmm1
movsd 0x90(%rax,%r8), %xmm2
movsd 0xc0(%rax,%r8), %xmm3
leaq -0x1(%r9), %r10
imulq $0x19f20, %rsi, %r11    # imm = 0x19F20
movsd %xmm0, -0x330(%r11,%rax)
movsd %xmm1, -0x300(%r11,%rax)
movsd %xmm2, -0x2d0(%r11,%rax)
movsd %xmm3, -0x2a0(%r11,%rax)
movq %rcx, %r11
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x13896
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x1388d
andq $0x0, (%r11,%r14,8)
incq %r14
jmp 0x1387d
incq %rbx
addq $0x30, %r11
jmp 0x13874
imulq $0x360, %r10, %r10      # imm = 0x360
addq %rax, %r10
addq %rax, %r8
imulq $0x360, %r9, %r9        # imm = 0x360
addq %rax, %r9
movq %rdx, %r11
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x138f1
imulq $0x30, %rbx, %r14
movsd 0x30(%r14,%r10), %xmm0
addsd %xmm0, %xmm0
subsd 0x30(%r14,%r8), %xmm0
movsd %xmm0, 0x30(%r14,%r9)
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x138e8
andq $0x0, (%r11,%r14,8)
incq %r14
jmp 0x138d8
incq %rbx
addq $0x30, %r11
jmp 0x138b2
incq %rsi
addq %rdi, %rcx
addq %rdi, %rdx
jmp 0x13801
leaq 0x6f8(%rax), %rcx
leaq 0x398(%rax), %rdx
movabsq $0x1, %rsi
movl $0x19f20, %edi          # imm = 0x19F20
cmpq $0x42, %rsi
je 0x13a1e
imulq $0x7b, %rsi, %r9
leaq -0x78(%r9), %r8
imulq $0x360, %r8, %r8        # imm = 0x360
movsd 0x30(%rax,%r8), %xmm0
movsd 0x60(%rax,%r8), %xmm1
movsd 0x90(%rax,%r8), %xmm2
movsd 0xc0(%rax,%r8), %xmm3
leaq -0x79(%r9), %r10
imulq $0x19f20, %rsi, %r11    # imm = 0x19F20
movsd %xmm0, -0x19830(%r11,%rax)
movsd %xmm1, -0x19800(%r11,%rax)
movsd %xmm2, -0x197d0(%r11,%rax)
movsd %xmm3, -0x197a0(%r11,%rax)
movq %rcx, %r11
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x139b1
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x139a8
andq $0x0, (%r11,%r14,8)
incq %r14
jmp 0x13998
incq %rbx
addq $0x30, %r11
jmp 0x1398f
addq $-0x7a, %r9
imulq $0x360, %r10, %r10      # imm = 0x360
addq %rax, %r10
addq %rax, %r8
imulq $0x360, %r9, %r9        # imm = 0x360
addq %rax, %r9
movq %rdx, %r11
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x13a10
imulq $0x30, %rbx, %r14
movsd 0x30(%r14,%r10), %xmm0
addsd %xmm0, %xmm0
subsd 0x30(%r14,%r8), %xmm0
movsd %xmm0, 0x30(%r14,%r9)
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x13a07
andq $0x0, (%r11,%r14,8)
incq %r14
jmp 0x139f7
incq %rbx
addq $0x30, %r11
jmp 0x139d1
incq %rsi
addq %rdi, %rcx
addq %rdi, %rdx
jmp 0x1391c
popq %rbx
popq %r14
retq