// File: /workspace/github_cpp_makefile_star2_O2/jamesliu516[P]amrdg2d/wall4amrdg2013.cpp
// Function: bilinearIntplt(std::vector<bodygridclass*, std::allocator<bodygridclass*>>&, pointxy const*, privariables&)
void bilinearIntplt(vector< OctCell * > &grid, const PXYZ *px, JBBL &ingrid1)
{
    double amatrix[20];
    double ujie[4];
    SHBL shu;
    PXYZ pxdc; //px����Ӧ�ĶԳƵ�����
    int i;

    for( i=0; i<4; i++)
    {
        amatrix[i * 5 + 0] =1.0;
        amatrix[i * 5 + 1] = grid[i]->xc1;
        amatrix[i * 5 + 2] = grid[i]->yc1;
        amatrix[i * 5 + 3] = grid[i]->xc1 * grid[i]->yc1;
    }

    for(i=0; i<4; i++)
    {
        amatrix[i * 5 + 4] = grid[i]->dof[0][0];
    }

    gem(amatrix, 4, ujie);

    shu.q = ujie[0] + ujie[1] * px->x + ujie[2] * px->y + ujie[3] * px->x * px->y;

    for( i=0; i<4; i++)
    {
        amatrix[i * 5 + 0] =1.0;
        amatrix[i * 5 + 1] = grid[i]->xc1;
        amatrix[i * 5 + 2] = grid[i]->yc1;
        amatrix[i * 5 + 3] = grid[i]->xc1 * grid[i]->yc1;
    }

    for(i=0; i<4; i++)
    {
        amatrix[i * 5 + 4] = grid[i]->dof[1][0];
    }

    gem(amatrix, 4, ujie);

    shu.qu = ujie[0] + ujie[1] * px->x + ujie[2] * px->y + ujie[3] * px->x * px->y;

    for( i=0; i<4; i++)
    {
        amatrix[i * 5 + 0] =1.0;
        amatrix[i * 5 + 1] = grid[i]->xc1;
        amatrix[i * 5 + 2] = grid[i]->yc1;
        amatrix[i * 5 + 3] = grid[i]->xc1 * grid[i]->yc1;
    }

    for(i=0; i<4; i++)
    {
        amatrix[i * 5 + 4] = grid[i]->dof[2][0];
    }

    gem(amatrix, 4, ujie);

    shu.qv = ujie[0] + ujie[1] * px->x + ujie[2] * px->y + ujie[3] * px->x * px->y;

    for( i=0; i<4; i++)
    {
        amatrix[i * 5 + 0] =1.0;
        amatrix[i * 5 + 1] = grid[i]->xc1;
        amatrix[i * 5 + 2] = grid[i]->yc1;
        amatrix[i * 5 + 3] = grid[i]->xc1 * grid[i]->yc1;
    }

    for(i=0; i<4; i++)
    {
        amatrix[i * 5 + 4] = grid[i]->dof[3][0];
    }

    gem(amatrix, 4, ujie);

    shu.te = ujie[0] + ujie[1] * px->x + ujie[2] * px->y + ujie[3] * px->x * px->y;

    shblToJbbl(&shu, &ingrid1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rax
pushq $0x3
popq %rcx
movabsq $0x3ff0000000000000, %r13 # imm = 0x3FF0000000000000
movq %rax, %rdx
cmpq $0x17, %rcx
je 0x11c85
movq %r13, 0x8(%rsp,%rcx,8)
movq (%rdx), %rsi
movupd 0x278(%rsi), %xmm0
movupd %xmm0, 0x10(%rsp,%rcx,8)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rdx
jmp 0x11c4d
pushq $0x4
popq %rcx
cmpq $0x18, %rcx
je 0x11ca6
movq (%rax), %rdx
movsd 0x30(%rdx), %xmm0
movsd %xmm0, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rax
jmp 0x11c88
leaq 0x20(%rsp), %rdi
pushq $0x4
popq %rsi
movq %rsp, %r12
movq %r12, %rdx
callq 0x11979
movsd (%r14), %xmm0
movsd 0x8(%r12), %xmm1
mulsd %xmm0, %xmm1
addsd (%r12), %xmm1
movsd 0x8(%r14), %xmm2
movsd 0x10(%r12), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm1, %xmm3
mulsd 0x18(%r12), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
movsd %xmm0, 0xc0(%rsp)
movq (%r15), %rax
pushq $0x3
popq %rcx
movq %rax, %rdx
cmpq $0x17, %rcx
je 0x11d3d
movq %r13, 0x8(%rsp,%rcx,8)
movq (%rdx), %rsi
movupd 0x278(%rsi), %xmm0
movupd %xmm0, 0x10(%rsp,%rcx,8)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rdx
jmp 0x11d05
pushq $0x4
popq %rcx
cmpq $0x18, %rcx
je 0x11d5e
movq (%rax), %rdx
movsd 0x60(%rdx), %xmm0
movsd %xmm0, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rax
jmp 0x11d40
leaq 0x20(%rsp), %rdi
pushq $0x4
popq %rsi
movq %rsp, %r12
movq %r12, %rdx
callq 0x11979
movsd (%r14), %xmm0
movsd 0x8(%r12), %xmm1
mulsd %xmm0, %xmm1
addsd (%r12), %xmm1
movsd 0x8(%r14), %xmm2
movsd 0x10(%r12), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm1, %xmm3
mulsd 0x18(%r12), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
movsd %xmm0, 0xc8(%rsp)
movq (%r15), %rax
pushq $0x3
popq %rcx
movq %rax, %rdx
cmpq $0x17, %rcx
je 0x11df5
movq %r13, 0x8(%rsp,%rcx,8)
movq (%rdx), %rsi
movupd 0x278(%rsi), %xmm0
movupd %xmm0, 0x10(%rsp,%rcx,8)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rdx
jmp 0x11dbd
pushq $0x4
popq %rcx
cmpq $0x18, %rcx
je 0x11e19
movq (%rax), %rdx
movsd 0x90(%rdx), %xmm0
movsd %xmm0, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rax
jmp 0x11df8
leaq 0x20(%rsp), %rdi
pushq $0x4
popq %rsi
movq %rsp, %r12
movq %r12, %rdx
callq 0x11979
movsd (%r14), %xmm0
movsd 0x8(%r12), %xmm1
mulsd %xmm0, %xmm1
addsd (%r12), %xmm1
movsd 0x8(%r14), %xmm2
movsd 0x10(%r12), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm1, %xmm3
mulsd 0x18(%r12), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
movsd %xmm0, 0xd0(%rsp)
movq (%r15), %rax
pushq $0x3
popq %rcx
movq %rax, %rdx
cmpq $0x17, %rcx
je 0x11eb0
movq %r13, 0x8(%rsp,%rcx,8)
movq (%rdx), %rsi
movupd 0x278(%rsi), %xmm0
movupd %xmm0, 0x10(%rsp,%rcx,8)
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rdx
jmp 0x11e78
pushq $0x4
popq %rcx
cmpq $0x18, %rcx
je 0x11ed4
movq (%rax), %rdx
movsd 0xc0(%rdx), %xmm0
movsd %xmm0, 0x20(%rsp,%rcx,8)
addq $0x5, %rcx
addq $0x8, %rax
jmp 0x11eb3
leaq 0x20(%rsp), %rdi
pushq $0x4
popq %rsi
movq %rsp, %r15
movq %r15, %rdx
callq 0x11979
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
movsd 0x8(%r15), %xmm2
mulsd %xmm0, %xmm2
addsd (%r15), %xmm2
movsd 0x10(%r15), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
mulsd 0x18(%r15), %xmm0
mulsd %xmm1, %xmm0
addsd %xmm3, %xmm0
leaq 0xc0(%rsp), %rdi
movsd %xmm0, 0x18(%rdi)
movq %rbx, %rsi
callq 0xdcdc
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq