// File: /workspace/github_cpp_makefile_star2_O2/jamesliu516[P]amrdg2d/sonCellAvg.cpp
// Function: sonCellAvg(int, bodygridclass*, double*)
void sonCellAvg(int nson, OctCell *pcell, double dof0[4])
{
    double dof[4][6]={0.0};
    for(int i=0;i<4;++i){
        for(int j=0;j<nDOF;++j){
            dof[i][j]=pcell->dof[i][j];
        }
    }

    switch(nson) {
    case 0:
        for(int i=0;i<4;++i) {
            dof0[i]= dof[i][0]-0.5*dof[i][1]-0.5*dof[i][2]+0.25*dof[i][3];
        }
        break;
    case 1:
        for(int i=0;i<4;++i){
            dof0[i]= dof[i][0]+0.5*dof[i][1]-0.5*dof[i][2]-0.25*dof[i][3];
        }
        break;
    case 2:
        for(int i=0;i<4;++i){
            dof0[i]= dof[i][0]+0.5*dof[i][1]+0.5*dof[i][2]+0.25*dof[i][3];
        }
        break;
    case 3:
        for(int i=0;i<4;++i){
            dof0[i]= dof[i][0]-0.5*dof[i][1]+0.5*dof[i][2]-0.25*dof[i][3];
        }
        break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movq %rsp, %r15
xorl %r12d, %r12d
movl $0xc0, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x3100
addq $0x30, %r14
cmpq $0x4, %r12
je 0x17aec
xorl %eax, %eax
cmpq $0x6, %rax
je 0x17adf
movsd (%r14,%rax,8), %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
jmp 0x17ac8
incq %r12
addq $0x30, %r14
addq $0x30, %r15
jmp 0x17ac0
cmpl $0x3, %ebp
ja 0x17c6b
movl %ebp, %eax
leaq 0x3fd2(%rip), %rcx      # 0x1bad0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x18(%rsp), %rax
xorl %ecx, %ecx
movsd 0x365a(%rip), %xmm0     # 0x1b170
movsd 0x3d12(%rip), %xmm1     # 0x1b830
cmpq $0x4, %rcx
je 0x17c6b
movsd -0x10(%rax), %xmm2
mulsd %xmm0, %xmm2
addsd -0x18(%rax), %xmm2
movsd -0x8(%rax), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd (%rax), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movsd %xmm2, (%rbx,%rcx,8)
incq %rcx
addq $0x30, %rax
jmp 0x17b1e
leaq 0x18(%rsp), %rax
xorl %ecx, %ecx
movsd 0x360c(%rip), %xmm0     # 0x1b178
movsd 0x3cbc(%rip), %xmm1     # 0x1b830
cmpq $0x4, %rcx
je 0x17c6b
movsd -0x10(%rax), %xmm2
mulsd %xmm0, %xmm2
addsd -0x18(%rax), %xmm2
movsd -0x8(%rax), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd (%rax), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movsd %xmm2, (%rbx,%rcx,8)
incq %rcx
addq $0x30, %rax
jmp 0x17b74
leaq 0x18(%rsp), %rax
xorl %ecx, %ecx
movsd 0x35ae(%rip), %xmm0     # 0x1b170
movsd 0x35ae(%rip), %xmm1     # 0x1b178
movsd 0x3ef6(%rip), %xmm2     # 0x1bac8
cmpq $0x4, %rcx
je 0x17c6b
movsd -0x10(%rax), %xmm3
mulsd %xmm0, %xmm3
addsd -0x18(%rax), %xmm3
movsd -0x8(%rax), %xmm4
mulsd %xmm1, %xmm4
addsd %xmm3, %xmm4
movsd (%rax), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rbx,%rcx,8)
incq %rcx
addq $0x30, %rax
jmp 0x17bd2
leaq 0x18(%rsp), %rax
xorl %ecx, %ecx
movsd 0x3558(%rip), %xmm0     # 0x1b178
movsd 0x3548(%rip), %xmm1     # 0x1b170
movsd 0x3e98(%rip), %xmm2     # 0x1bac8
cmpq $0x4, %rcx
je 0x17c6b
movsd -0x10(%rax), %xmm3
mulsd %xmm0, %xmm3
addsd -0x18(%rax), %xmm3
movsd -0x8(%rax), %xmm4
mulsd %xmm1, %xmm4
addsd %xmm3, %xmm4
movsd (%rax), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rbx,%rcx,8)
incq %rcx
addq $0x30, %rax
jmp 0x17c30
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop