// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
subq $0xc8, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movq %rsp, %rdi
xorl %r15d, %r15d
movl $0xc0, %edx
xorl %esi, %esi
callq 0x3120
addq $0x30, %r14
movupd (%r14,%r15), %xmm0
movupd 0x10(%r14,%r15), %xmm1
movupd 0x20(%r14,%r15), %xmm2
movupd %xmm2, 0x20(%rsp,%r15)
movupd %xmm1, 0x10(%rsp,%r15)
movupd %xmm0, (%rsp,%r15)
addq $0x30, %r15
cmpq $0xc0, %r15
jne 0x198d7
cmpl $0x3, %ebp
ja 0x19ae7
movl %ebp, %eax
leaq 0x4222(%rip), %rcx      # 0x1db40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x48(%rsp), %rax
xorl %ecx, %ecx
movapd 0x41da(%rip), %xmm0     # 0x1db10
movapd 0x41f2(%rip), %xmm1     # 0x1db30
movsd -0x48(%rax), %xmm2
movsd -0x40(%rax), %xmm3
movsd -0x38(%rax), %xmm4
movsd -0x30(%rax), %xmm5
movhpd -0x18(%rax), %xmm2      # xmm2 = xmm2[0],mem[0]
movhpd -0x10(%rax), %xmm3      # xmm3 = xmm3[0],mem[0]
mulpd %xmm0, %xmm3
addpd %xmm2, %xmm3
movhpd -0x8(%rax), %xmm4       # xmm4 = xmm4[0],mem[0]
mulpd %xmm0, %xmm4
addpd %xmm3, %xmm4
movhpd (%rax), %xmm5           # xmm5 = xmm5[0],mem[0]
mulpd %xmm1, %xmm5
addpd %xmm4, %xmm5
movupd %xmm5, (%rbx,%rcx,8)
addq $0x2, %rcx
addq $0x60, %rax
cmpq $0x4, %rcx
jne 0x1993e
jmp 0x19ae7
leaq 0x48(%rsp), %rax
xorl %ecx, %ecx
movapd 0x3c4c(%rip), %xmm0     # 0x1d5f0
movapd 0x4184(%rip), %xmm1     # 0x1db30
movsd -0x48(%rax), %xmm2
movsd -0x40(%rax), %xmm3
movsd -0x38(%rax), %xmm4
movsd -0x30(%rax), %xmm5
movhpd -0x18(%rax), %xmm2      # xmm2 = xmm2[0],mem[0]
movhpd -0x10(%rax), %xmm3      # xmm3 = xmm3[0],mem[0]
mulpd %xmm0, %xmm3
addpd %xmm2, %xmm3
movhpd -0x8(%rax), %xmm4       # xmm4 = xmm4[0],mem[0]
mulpd %xmm0, %xmm4
addpd %xmm3, %xmm4
movhpd (%rax), %xmm5           # xmm5 = xmm5[0],mem[0]
mulpd %xmm1, %xmm5
addpd %xmm4, %xmm5
movupd %xmm5, (%rbx,%rcx,8)
addq $0x2, %rcx
addq $0x60, %rax
cmpq $0x4, %rcx
jne 0x199ac
jmp 0x19ae7
leaq 0x48(%rsp), %rax
xorl %ecx, %ecx
movapd 0x40fe(%rip), %xmm0     # 0x1db10
movapd 0x3bd6(%rip), %xmm1     # 0x1d5f0
movapd 0x40fe(%rip), %xmm2     # 0x1db20
movsd -0x48(%rax), %xmm3
movsd -0x40(%rax), %xmm4
movsd -0x38(%rax), %xmm5
movsd -0x30(%rax), %xmm6
movhpd -0x18(%rax), %xmm3      # xmm3 = xmm3[0],mem[0]
movhpd -0x10(%rax), %xmm4      # xmm4 = xmm4[0],mem[0]
mulpd %xmm0, %xmm4
addpd %xmm3, %xmm4
movhpd -0x8(%rax), %xmm5       # xmm5 = xmm5[0],mem[0]
mulpd %xmm1, %xmm5
addpd %xmm4, %xmm5
movhpd (%rax), %xmm6           # xmm6 = xmm6[0],mem[0]
mulpd %xmm2, %xmm6
addpd %xmm5, %xmm6
movupd %xmm6, (%rbx,%rcx,8)
addq $0x2, %rcx
addq $0x60, %rax
cmpq $0x4, %rcx
jne 0x19a22
jmp 0x19ae7
leaq 0x48(%rsp), %rax
xorl %ecx, %ecx
movapd 0x3b6b(%rip), %xmm0     # 0x1d5f0
movapd 0x4083(%rip), %xmm1     # 0x1db10
movapd 0x408b(%rip), %xmm2     # 0x1db20
movsd -0x48(%rax), %xmm3
movsd -0x40(%rax), %xmm4
movsd -0x38(%rax), %xmm5
movsd -0x30(%rax), %xmm6
movhpd -0x18(%rax), %xmm3      # xmm3 = xmm3[0],mem[0]
movhpd -0x10(%rax), %xmm4      # xmm4 = xmm4[0],mem[0]
mulpd %xmm0, %xmm4
addpd %xmm3, %xmm4
movhpd -0x8(%rax), %xmm5       # xmm5 = xmm5[0],mem[0]
mulpd %xmm1, %xmm5
addpd %xmm4, %xmm5
movhpd (%rax), %xmm6           # xmm6 = xmm6[0],mem[0]
mulpd %xmm2, %xmm6
addpd %xmm5, %xmm6
movupd %xmm6, (%rbx,%rcx,8)
addq $0x2, %rcx
addq $0x60, %rax
cmpq $0x4, %rcx
jne 0x19a95
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)