// File: jamesliu516[P]amrdg2d/solveAMR.cpp
// Function: solveGradient()
void solveGradient()
{
    double fjbx[4],fjby[4];
    double vol0,vol1;

    for(vector<Face>::size_type isz=0; isz!=faces_comp.size(); ++isz){
        for(int i=0;i<4;++i){
            faces_comp[isz].parent->Ux[i]=0.0;
            faces_comp[isz].parent->Uy[i]=0.0;
            faces_comp[isz].neighbor->Ux[i]=0.0;
            faces_comp[isz].neighbor->Uy[i]=0.0;
        }
    }

    for(vector<Face>::size_type isz=0; isz!=faces_comp.size(); ++isz){
        solveEdge4Gradient(faces_comp[isz], fjbx,fjby);
        vol0=faces_comp[isz].parent->dx*faces_comp[isz].parent->dy;
        vol1=faces_comp[isz].neighbor->dx*faces_comp[isz].neighbor->dy;
        for(int i=0;i<4;++i){
            faces_comp[isz].parent->Ux[i]+=fjbx[i]/vol0;
            faces_comp[isz].parent->Uy[i]+=fjby[i]/vol0;;
            faces_comp[isz].neighbor->Ux[i]-=fjbx[i]/vol1;
            faces_comp[isz].neighbor->Uy[i]-=fjby[i]/vol1;
        }
    }
}

// Assembly:
subq $0xb8, %rsp
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x1611f(%rip), %rdi     # 0x50710
callq 0x13310
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
je 0x3a6d5
movl $0x0, 0x54(%rsp)
cmpl $0x4, 0x54(%rsp)
jge 0x3a6c0
movq 0x58(%rsp), %rsi
leaq 0x160ea(%rip), %rdi     # 0x50710
callq 0x13340
movq (%rax), %rax
movslq 0x54(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, 0x1b8(%rax,%rcx,8)
movq 0x58(%rsp), %rsi
leaq 0x160c5(%rip), %rdi     # 0x50710
callq 0x13340
movq (%rax), %rax
movslq 0x54(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, 0x1d8(%rax,%rcx,8)
movq 0x58(%rsp), %rsi
leaq 0x160a0(%rip), %rdi     # 0x50710
callq 0x13340
movq 0x8(%rax), %rax
movslq 0x54(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, 0x1b8(%rax,%rcx,8)
movq 0x58(%rsp), %rsi
leaq 0x1607a(%rip), %rdi     # 0x50710
callq 0x13340
movq 0x8(%rax), %rax
movslq 0x54(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, 0x1d8(%rax,%rcx,8)
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x3a60f
jmp 0x3a6c2
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x3a5e0
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x16021(%rip), %rdi     # 0x50710
callq 0x13310
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
je 0x3a927
movq 0x48(%rsp), %rsi
leaq 0x15fff(%rip), %rdi     # 0x50710
callq 0x13340
movq %rax, %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x3d2d0
movq 0x48(%rsp), %rsi
leaq 0x15fd9(%rip), %rdi     # 0x50710
callq 0x13340
movq (%rax), %rax
movsd 0x288(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x15fb7(%rip), %rdi     # 0x50710
callq 0x13340
movsd 0x20(%rsp), %xmm0
movq (%rax), %rax
mulsd 0x290(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x15f8f(%rip), %rdi     # 0x50710
callq 0x13340
movq 0x8(%rax), %rax
movsd 0x288(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x15f6c(%rip), %rdi     # 0x50710
callq 0x13340
movsd 0x28(%rsp), %xmm0
movq 0x8(%rax), %rax
mulsd 0x290(%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movl $0x0, 0x44(%rsp)
cmpl $0x4, 0x44(%rsp)
jge 0x3a912
movslq 0x44(%rsp), %rax
movsd 0x90(%rsp,%rax,8), %xmm0
divsd 0x68(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x48(%rsp), %rsi
leaq 0x15f17(%rip), %rdi     # 0x50710
callq 0x13340
movsd (%rsp), %xmm0
movq (%rax), %rax
movslq 0x44(%rsp), %rcx
addsd 0x1b8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1b8(%rax,%rcx,8)
movslq 0x44(%rsp), %rax
movsd 0x70(%rsp,%rax,8), %xmm0
divsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x15ed0(%rip), %rdi     # 0x50710
callq 0x13340
movsd 0x8(%rsp), %xmm0
movq (%rax), %rax
movslq 0x44(%rsp), %rcx
addsd 0x1d8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1d8(%rax,%rcx,8)
movslq 0x44(%rsp), %rax
movsd 0x90(%rsp,%rax,8), %xmm0
divsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x15e85(%rip), %rdi     # 0x50710
callq 0x13340
movsd 0x10(%rsp), %xmm1
movq 0x8(%rax), %rax
movslq 0x44(%rsp), %rcx
movsd 0x1b8(%rax,%rcx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x1b8(%rax,%rcx,8)
movslq 0x44(%rsp), %rax
movsd 0x70(%rsp,%rax,8), %xmm0
divsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x15e38(%rip), %rdi     # 0x50710
callq 0x13340
movsd 0x18(%rsp), %xmm1
movq 0x8(%rax), %rax
movslq 0x44(%rsp), %rcx
movsd 0x1d8(%rax,%rcx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x1d8(%rax,%rcx,8)
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x3a7c9
jmp 0x3a914
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x3a6de
addq $0xb8, %rsp
retq
nop