// File: /workspace/github_c_makefile_star2_O2/mohuangrui[P]ArtraCFD/fluid_dynamics.c
// Function: LLLU
static void LLLU(const Real dt, const Real coeA, const Real coeB, const int to,
        const int tn, const int tm, const int p, Space *space, const Model *model)
{
    const Partition *const part = &(space->part);
    Node *const node = space->node;
    int idx = 0; /* linear array index math variable */
    int i = 0, j = 0, k = 0; /* index with normal order */
    const int h[DIMS][DIMS] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; /* direction indicator */
    Real RHS[5][DIMU] = {{0.0}}; /* spatial operator */
    Real *restrict FhatR = RHS[0]; /* reconstructed numerical convective flux vector */
    Real *restrict FhatL = RHS[1]; /* reconstructed numerical convective flux vector */
    Real *restrict FvhatR = RHS[2]; /* reconstructed numerical diffusive flux vector */
    Real *restrict FvhatL = RHS[3]; /* reconstructed numerical diffusive flux vector */
    Real *restrict Phi = RHS[4]; /* right hand side vector */
    Real *temp = NULL;
    const IntVec partn = {part->n[X], part->n[Y], part->n[Z]};
    const RealVec dd = {part->dd[X], part->dd[Y], part->dd[Z]};
    const RealVec r = {dt * dd[X], dt * dd[Y], dt * dd[Z]};
    int s = 0, sN = 0; /* space sweep control for the operator p */
    switch (p) {
        case PHI: /* source term */
            s = 0; sN = s + 1;
            break;
        case DIMS: /* all spatial operators */
            s = 0; sN = DIMS;
            break;
        default: /* individual spatial operator */
            s = p; sN = s + 1;
            break;
    }
    /* space sweep with dimension priority */
    for (; s < sN; ++s) {
        for (int ks = part->np[s][Z][MIN]; ks < part->np[s][Z][MAX]; ++ks) {
            for (int js = part->np[s][Y][MIN]; js < part->np[s][Y][MAX]; ++js) {
                for (int is = part->np[s][X][MIN], state = 0; is < part->np[s][X][MAX]; ++is) {
                    switch (s) {
                        case X:
                            i = is; j = js; k = ks;
                            break;
                        case Y:
                            i = js; j = is; k = ks;
                            break;
                        case Z:
                            i = js; j = ks; k = is;
                            break;
                        default:
                            break;
                    }
                    idx = IndexNode(k, j, i, partn[Y], partn[X]);
                    if (0 != node[idx].did) {
                        state = 0; /* mark domain change and boundary occurrence */
                        continue;
                    }
                    switch (p) {
                        case PHI:
                            ComputePhi(tn, k, j, i, partn, node, model, Phi);
                            SolveOperator(OPTSPLIT, s, coeA, coeB, node[idx].U[to], node[idx].U[tn], node[idx].U[tm], dt, Phi);
                            continue;
                        default:
                            break;
                    }
                    switch (state) {
                        case 1: /* inherit numerical flux from the previous node */
                            temp = FhatL;
                            FhatL = FhatR;
                            FhatR = temp;
                            temp = FvhatL;
                            FvhatL = FvhatR;
                            FvhatR = temp;
                            break;
                        default: /* compute numerical flux at left interface */
                            ComputeFhat(tn, s, k - h[s][Z], j - h[s][Y], i - h[s][X], partn, node, model, FhatL);
                            ComputeFvhat(tn, s, k - h[s][Z], j - h[s][Y], i - h[s][X], partn, dd, node, model, FvhatL);
                            state = 1;
                            break;
                    }
                    ComputeFhat(tn, s, k, j, i, partn, node, model, FhatR);
                    ComputeFvhat(tn, s, k, j, i, partn, dd, node, model, FvhatR);
                    LU(FhatR, FhatL, FvhatR, FvhatL, Phi);
                    SolveOperator(model->multidim, s, coeA, coeB, node[idx].U[to], node[idx].U[tn], node[idx].U[tm], r[s], Phi);
                }
            }
        }
    }
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %r8, 0x10(%rsp)
movq %rcx, %r14
movl %edx, %r12d
movl %esi, %ebp
movl %edi, 0x8(%rsp)
movsd %xmm2, 0x90(%rsp)
movsd %xmm1, 0x88(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq (%rcx), %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xf0(%rsp)
pushq $0x1
popq %rax
movl %eax, 0xe0(%rsp)
movl %eax, 0xf0(%rsp)
movl %eax, 0x100(%rsp)
leaq 0x130(%rsp), %rdi
movl $0xc8, %edx
movq %rdi, 0x58(%rsp)
xorl %esi, %esi
callq 0x20d0
movq 0x34(%r14), %rax
movq %rax, 0x28(%rsp)
movl 0x3c(%r14), %eax
movl %eax, 0x30(%rsp)
movupd 0x70(%r14), %xmm0
movapd %xmm0, 0xc0(%rsp)
movq %r14, 0x70(%rsp)
movsd 0x80(%r14), %xmm1
movsd %xmm1, 0xd0(%rsp)
movapd 0xb0(%rsp), %xmm3
movapd %xmm3, %xmm2
unpcklpd %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0]
mulpd %xmm0, %xmm2
movapd %xmm2, 0x110(%rsp)
mulsd %xmm3, %xmm1
movsd %xmm1, 0x120(%rsp)
cmpl $0x4, %r12d
je 0x1007f
cmpl $0x3, %r12d
jne 0x1008c
pushq $0x3
jmp 0x10081
pushq $0x1
popq %rax
movq %rax, 0x48(%rsp)
xorl %r13d, %r13d
jmp 0x1009b
leal 0x1(%r12), %eax
movslq %r12d, %r13
cltq
movq %rax, 0x48(%rsp)
movl 0x8(%rsp), %eax
xorl %r9d, %r9d
leaq 0x158(%rsp), %rcx
movq %rcx, 0x38(%rsp)
leaq 0x180(%rsp), %rcx
movq %rcx, 0x50(%rsp)
leaq 0x1a8(%rsp), %rdi
addq $0x1f8, 0x70(%rsp)      # imm = 0x1F8
movl %eax, %eax
movq %rax, 0x80(%rsp)
movl %ebp, %eax
movq %rax, 0x78(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
movq %r12, 0xa8(%rsp)
cmpq 0x48(%rsp), %r13
jge 0x10479
imulq $0x18, %r13, %rdx
movq 0x70(%rsp), %rsi
leaq (%rsi,%rdx), %rbx
movl 0x10(%rsi,%rdx), %esi
imulq $0xc, %r13, %rdx
addq %rsp, %rdx
addq $0xe0, %rdx
movq %rdx, 0xa0(%rsp)
movq %rbx, 0x98(%rsp)
movq %r13, 0x18(%rsp)
cmpl 0x14(%rbx), %esi
jge 0x10471
movl 0x8(%rbx), %edx
movl %esi, 0x64(%rsp)
cmpl 0xc(%rbx), %edx
jge 0x1046a
movl (%rbx), %r8d
movl $0x0, 0xc(%rsp)
movl %edx, 0x68(%rsp)
cmpl 0x4(%rbx), %r8d
jge 0x10463
cmpl $0x2, %r13d
movq %rdi, 0x20(%rsp)
je 0x1018b
movl %edx, %r14d
movl %r8d, %r15d
movl %esi, %ebp
cmpl $0x1, %r13d
je 0x10194
movl %r9d, %r14d
movl %eax, %r15d
movl %ecx, %ebp
testl %r13d, %r13d
jne 0x10194
movl %r8d, %r14d
movl %edx, %r15d
movl %esi, %ebp
jmp 0x10194
movl %edx, %r14d
movl %esi, %r15d
movl %r8d, %ebp
movl %r8d, 0x6c(%rsp)
movl 0x28(%rsp), %r8d
movl 0x2c(%rsp), %ecx
movl %ebp, %edi
movl %r15d, %esi
movl %r14d, %edx
callq 0x75ec
cltq
imulq $0x88, %rax, %r13
movq 0x40(%rsp), %rax
cmpl $0x0, (%rax,%r13)
je 0x101d6
movl $0x0, 0xc(%rsp)
movq 0x18(%rsp), %r13
jmp 0x10441
addq %rax, %r13
cmpl $0x4, %r12d
jne 0x10268
movl 0x8(%rsp), %edi
movl %ebp, %esi
movl %r15d, %edx
movl %r14d, %ecx
leaq 0x28(%rsp), %r8
movq %rax, %r9
leaq 0x1d0(%rsp), %rbx
pushq %rbx
pushq 0x18(%rsp)
callq 0x17054
popq %rax
popq %rcx
leaq 0x10(%r13), %rdx
imulq $0x28, 0x80(%rsp), %rax
leaq (%rax,%r13), %rcx
addq $0x10, %rcx
imulq $0x28, 0x78(%rsp), %rax
leaq (%rax,%r13), %r8
addq $0x10, %r8
xorl %edi, %edi
movq 0x18(%rsp), %r13
movl %r13d, %esi
movsd 0x88(%rsp), %xmm0
movsd 0x90(%rsp), %xmm1
movapd 0xb0(%rsp), %xmm2
movq %rbx, %r9
movq 0x98(%rsp), %rbx
callq 0x1048b
jmp 0x10441
cmpl $0x1, 0xc(%rsp)
jne 0x1029b
movq 0x10(%rsp), %r10
movq 0x38(%rsp), %rbx
movq 0x58(%rsp), %rcx
movq %rcx, 0x38(%rsp)
movq 0x20(%rsp), %r12
movq 0x50(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movl 0x8(%rsp), %edi
jmp 0x10339
movl %ebp, %edx
movq 0xa0(%rsp), %r12
subl 0x8(%r12), %edx
movl %r15d, %ecx
subl 0x4(%r12), %ecx
movl %r14d, %r8d
subl (%r12), %r8d
subq $0x8, %rsp
movl 0x10(%rsp), %edi
movq 0x20(%rsp), %rbx
movl %ebx, %esi
leaq 0x30(%rsp), %r9
pushq 0x40(%rsp)
pushq 0x20(%rsp)
pushq %rax
callq 0xae94
addq $0x20, %rsp
movl %ebp, %edx
subl 0x8(%r12), %edx
movl %r15d, %ecx
subl 0x4(%r12), %ecx
movl %r14d, %r8d
subl (%r12), %r8d
movl 0x8(%rsp), %r12d
movl %r12d, %edi
movl %ebx, %esi
leaq 0x28(%rsp), %r9
pushq 0x20(%rsp)
movq 0x18(%rsp), %rbx
pushq %rbx
pushq 0x50(%rsp)
leaq 0xd8(%rsp), %rax
pushq %rax
callq 0xc59c
movq 0x60(%rsp), %rax
movl %r12d, %edi
addq $0x20, %rsp
movq %rbx, %r10
movq 0x58(%rsp), %rbx
movq 0x50(%rsp), %r12
subq $0x8, %rsp
movq 0x20(%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
movl %r14d, %r8d
leaq 0x30(%rsp), %r9
pushq %rbx
pushq %r10
pushq %rax
callq 0xae94
addq $0x20, %rsp
movl 0x8(%rsp), %edi
movq 0x18(%rsp), %rsi
movl %ebp, %edx
movl %r15d, %ecx
movl %r14d, %r8d
leaq 0x28(%rsp), %r9
pushq %r12
pushq 0x18(%rsp)
pushq 0x50(%rsp)
leaq 0xd8(%rsp), %rax
pushq %rax
callq 0xc59c
addq $0x20, %rsp
xorl %eax, %eax
movq 0x38(%rsp), %rcx
movq 0x20(%rsp), %rdx
cmpq $0x28, %rax
je 0x103c4
movsd (%rcx,%rax), %xmm0
subsd (%rbx,%rax), %xmm0
addsd (%r12,%rax), %xmm0
subsd (%rdx,%rax), %xmm0
movsd %xmm0, 0x1d0(%rsp,%rax)
addq $0x8, %rax
jmp 0x1039a
movq 0x10(%rsp), %rax
movl 0x10(%rax), %edi
leaq 0x10(%r13), %rdx
imulq $0x28, 0x80(%rsp), %rax
leaq (%rax,%r13), %rcx
addq $0x10, %rcx
imulq $0x28, 0x78(%rsp), %rax
leaq (%rax,%r13), %r8
addq $0x10, %r8
movq 0x18(%rsp), %r13
movsd 0x110(%rsp,%r13,8), %xmm2
movl %r13d, %esi
movsd 0x88(%rsp), %xmm0
movsd 0x90(%rsp), %xmm1
leaq 0x1d0(%rsp), %r9
callq 0x1048b
movq %rbx, 0x58(%rsp)
movq %r12, 0x50(%rsp)
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
movq 0xa8(%rsp), %r12
movq 0x98(%rsp), %rbx
movl 0x6c(%rsp), %r8d
incl %r8d
movl %r14d, %r9d
movl %r15d, %eax
movl %ebp, %ecx
movq 0x20(%rsp), %rdi
movl 0x64(%rsp), %esi
movl 0x68(%rsp), %edx
jmp 0x10151
incl %edx
jmp 0x10139
incl %esi
jmp 0x10129
incq %r13
jmp 0x100ea
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq