// File: 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:
subq $0xf8, %rsp
movl %edi, 0xf4(%rsp)
movq %rsi, 0xe8(%rsp)
movq %rdx, 0xe0(%rsp)
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0xc0, %edx
callq 0x3150
movl $0x0, 0x1c(%rsp)
cmpl $0x4, 0x1c(%rsp)
jge 0x38526
movl $0x0, 0x18(%rsp)
cmpl $0x6, 0x18(%rsp)
jge 0x38517
movq 0xe8(%rsp), %rax
addq $0x30, %rax
movslq 0x1c(%rsp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq 0x1c(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movslq 0x18(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x384c6
jmp 0x38519
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x384b7
movl 0xf4(%rsp), %eax
movq %rax, (%rsp)
subq $0x3, %rax
ja 0x38850
movq (%rsp), %rax
leaq 0x748a(%rip), %rcx      # 0x3f9d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, 0x14(%rsp)
cmpl $0x4, 0x14(%rsp)
jge 0x3860b
movslq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movslq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd 0x6ba3(%rip), %xmm2     # 0x3f138
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movslq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm1
movsd 0x6b7d(%rip), %xmm2     # 0x3f138
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movslq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
movsd 0x71bf(%rip), %xmm2     # 0x3f7a0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xe0(%rsp), %rax
movslq 0x14(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x38557
jmp 0x38850
movl $0x0, 0x10(%rsp)
cmpl $0x4, 0x10(%rsp)
jge 0x386cc
movslq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movslq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd 0x6aea(%rip), %xmm2     # 0x3f140
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movslq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm1
movsd 0x6abc(%rip), %xmm2     # 0x3f138
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movslq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
movsd 0x7326(%rip), %xmm2     # 0x3f9c8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xe0(%rsp), %rax
movslq 0x10(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x38618
jmp 0x38850
movl $0x0, 0xc(%rsp)
cmpl $0x4, 0xc(%rsp)
jge 0x3878d
movslq 0xc(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movslq 0xc(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd 0x6a29(%rip), %xmm2     # 0x3f140
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movslq 0xc(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm1
movsd 0x6a03(%rip), %xmm2     # 0x3f140
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movslq 0xc(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
movsd 0x703d(%rip), %xmm2     # 0x3f7a0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xe0(%rsp), %rax
movslq 0xc(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x386d9
jmp 0x38850
movl $0x0, 0x8(%rsp)
cmpl $0x4, 0x8(%rsp)
jge 0x3884e
movslq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movslq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd 0x6960(%rip), %xmm2     # 0x3f138
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movslq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm1
movsd 0x6942(%rip), %xmm2     # 0x3f140
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movslq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %rax
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
movsd 0x71a4(%rip), %xmm2     # 0x3f9c8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xe0(%rsp), %rax
movslq 0x8(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x3879a
jmp 0x38850
addq $0xf8, %rsp
retq
nopl (%rax,%rax)