// File: /workspace/github_c_makefile_star2_O1/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, 0x40(%rsp)
movq %rcx, %r14
movl %edx, %r15d
movl %esi, %ebp
movl %edi, %r12d
movsd %xmm2, 0x90(%rsp)
movsd %xmm1, 0x88(%rsp)
movsd %xmm0, 0x70(%rsp)
movq (%rcx), %rax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0x110(%rsp)
movl $0x1, %r13d
movl %r13d, 0x100(%rsp)
movl %r13d, 0x110(%rsp)
movl %r13d, 0x120(%rsp)
leaq 0x130(%rsp), %rdi
xorl %ebx, %ebx
movl $0xc8, %edx
xorl %esi, %esi
callq 0x20d0
movsd 0x70(%rsp), %xmm3
movl 0x34(%r14), %eax
movl %eax, 0x2c(%rsp)
movl 0x38(%r14), %eax
movl %eax, 0x30(%rsp)
movl 0x3c(%r14), %eax
movl %eax, 0x34(%rsp)
movsd 0x70(%r14), %xmm0
movsd %xmm0, 0xc0(%rsp)
movsd 0x78(%r14), %xmm1
movsd %xmm1, 0xc8(%rsp)
movsd 0x80(%r14), %xmm2
movsd %xmm2, 0xd0(%rsp)
mulsd %xmm3, %xmm0
movsd %xmm0, 0xe0(%rsp)
mulsd %xmm3, %xmm1
movsd %xmm1, 0xe8(%rsp)
mulsd %xmm3, %xmm2
movsd %xmm2, 0xf0(%rsp)
cmpl $0x4, %r15d
movq %r15, 0xb0(%rsp)
movl %r12d, 0x14(%rsp)
je 0x110a6
cmpl $0x3, %r15d
jne 0x1109f
movl $0x3, %r13d
jmp 0x110a6
leal 0x1(%r15), %r13d
movl %r15d, %ebx
leaq 0x130(%rsp), %rsi
movl %r13d, 0x6c(%rsp)
cmpl %r13d, %ebx
jge 0x1156e
leaq 0x158(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x180(%rsp), %rdi
leaq 0x1a8(%rsp), %r13
addq $0x1f8, %r14            # imm = 0x1F8
movl 0x14(%rsp), %eax
movq %rax, 0x78(%rsp)
movl %ebp, %eax
movq %rax, 0x80(%rsp)
movslq %ebx, %r9
movq $0x0, 0x98(%rsp)
xorl %r8d, %r8d
xorl %edx, %edx
movq %r14, 0xa0(%rsp)
leaq (%r9,%r9,2), %rax
movl 0x10(%r14,%rax,8), %ecx
movl %ecx, 0x18(%rsp)
cmpl 0x14(%r14,%rax,8), %ecx
jge 0x11558
leaq (%r14,%rax,8), %rcx
leaq (%rsp,%rax,4), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, 0xa8(%rsp)
movq %r9, 0x20(%rsp)
movq %rcx, 0xb8(%rsp)
movl 0x8(%rcx), %eax
movl %eax, 0x1c(%rsp)
cmpl 0xc(%rcx), %eax
jge 0x11545
movl (%rcx), %ebp
cmpl 0x4(%rcx), %ebp
jge 0x1152e
xorl %ebx, %ebx
movq %rdi, 0x48(%rsp)
movq %rsi, 0x50(%rsp)
movq 0x98(%rsp), %rax
cmpl $0x2, %r9d
je 0x111b8
movl %edx, %edi
movl %r8d, %ecx
movl 0x1c(%rsp), %edx
movl %ebp, %esi
movl 0x18(%rsp), %r8d
movl %r8d, %r12d
cmpl $0x1, %r9d
movq 0x60(%rsp), %r14
je 0x111c8
movl %edi, %edx
movl %ecx, %esi
movl %eax, %r12d
testl %r9d, %r9d
jne 0x111c8
movl %ebp, %edx
movl 0x1c(%rsp), %esi
movl 0x18(%rsp), %eax
movl %eax, %r12d
jmp 0x111c8
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %esi
movl %ebp, %r12d
movq 0x60(%rsp), %r14
movl 0x2c(%rsp), %r8d
movl 0x30(%rsp), %ecx
movl %r12d, %edi
movl %esi, 0xc(%rsp)
movl %edx, 0x10(%rsp)
callq 0x7ea3
cltq
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %r15
xorl %eax, %eax
cmpl $0x0, (%r14,%r15)
movq %r12, 0x98(%rsp)
je 0x1120e
movq 0x50(%rsp), %r12
movq 0x48(%rsp), %r14
jmp 0x112ca
addq %r14, %r15
cmpl $0x4, 0xb0(%rsp)
jne 0x112f8
movl 0x14(%rsp), %edi
movl %r12d, %esi
movl 0xc(%rsp), %edx
movl 0x10(%rsp), %ecx
leaq 0x2c(%rsp), %r8
movq %r14, %r9
leaq 0x1d0(%rsp), %rax
pushq %rax
pushq 0x48(%rsp)
callq 0x18858
addq $0x10, %rsp
leaq 0x10(%r15), %rax
movq 0x78(%rsp), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq 0x10(%r15,%rcx,8), %rcx
movq 0x80(%rsp), %rdx
leaq (%rdx,%rdx,4), %rdx
leaq (%r15,%rdx,8), %rdx
addq $0x10, %rdx
xorl %esi, %esi
movsd 0x90(%rsp), %xmm2
movsd 0x88(%rsp), %xmm3
movsd 0x70(%rsp), %xmm4
movsd 0x1d0(%rsp,%rsi), %xmm0
mulsd %xmm4, %xmm0
addsd (%rcx,%rsi), %xmm0
mulsd %xmm2, %xmm0
movsd (%rax,%rsi), %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%rsi)
addq $0x8, %rsi
cmpq $0x28, %rsi
jne 0x1128c
movq 0x50(%rsp), %r12
movq 0x48(%rsp), %r14
movl %ebx, %eax
movq 0x20(%rsp), %r9
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %r8d
incl %ebp
movl %eax, %ebx
movq %r14, %rdi
movq %r12, %rsi
movq 0xb8(%rsp), %rcx
cmpl 0x4(%rcx), %ebp
jl 0x11167
jmp 0x11534
cmpl $0x1, %ebx
jne 0x11328
movq %r12, %rcx
movq 0x38(%rsp), %r12
movq 0x50(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %r14, %r10
movq %r13, %r14
movq 0x48(%rsp), %rax
movq %rax, 0x58(%rsp)
movl 0x14(%rsp), %ebx
jmp 0x113c1
movl %r12d, %edx
movq 0xa8(%rsp), %rbx
subl 0x8(%rbx), %edx
movl 0xc(%rsp), %ecx
subl 0x4(%rbx), %ecx
movl 0x10(%rsp), %r8d
subl (%rbx), %r8d
subq $0x8, %rsp
movl 0x1c(%rsp), %edi
movq 0x28(%rsp), %rsi
leaq 0x34(%rsp), %r9
pushq 0x40(%rsp)
movq %r13, 0x68(%rsp)
movq 0x50(%rsp), %r13
pushq %r13
pushq %r14
callq 0xbb5c
addq $0x20, %rsp
movl %r12d, %edx
subl 0x8(%rbx), %edx
movl 0xc(%rsp), %ecx
subl 0x4(%rbx), %ecx
movl 0x10(%rsp), %r8d
subl (%rbx), %r8d
movl 0x14(%rsp), %ebx
movl %ebx, %edi
movq 0x20(%rsp), %rsi
leaq 0x2c(%rsp), %r9
pushq 0x58(%rsp)
pushq %r13
pushq %r14
leaq 0xd8(%rsp), %rax
pushq %rax
callq 0xd318
addq $0x20, %rsp
movq %r12, %rcx
movq 0x50(%rsp), %r12
movq %r14, %r10
movq 0x48(%rsp), %r14
subq $0x8, %rsp
movl %ebx, %edi
movq 0x28(%rsp), %rsi
movq %rcx, %r13
movl %r13d, %edx
movl 0x14(%rsp), %ecx
movl 0x18(%rsp), %r8d
leaq 0x34(%rsp), %r9
pushq %r12
pushq 0x50(%rsp)
pushq %r10
callq 0xbb5c
addq $0x20, %rsp
movl %ebx, %edi
movq 0x20(%rsp), %rsi
movl %r13d, %edx
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %r8d
leaq 0x2c(%rsp), %r9
pushq %r14
movq 0x48(%rsp), %rbx
pushq %rbx
pushq 0x70(%rsp)
leaq 0xd8(%rsp), %rax
pushq %rax
callq 0xd318
addq $0x20, %rsp
xorl %eax, %eax
movq 0x38(%rsp), %rcx
movq %rbx, %rdx
movq 0x58(%rsp), %r13
movsd (%rcx,%rax), %xmm0
subsd (%r12,%rax), %xmm0
addsd (%r14,%rax), %xmm0
subsd (%r13,%rax), %xmm0
movsd %xmm0, 0x1d0(%rsp,%rax)
addq $0x8, %rax
cmpq $0x28, %rax
jne 0x11436
movq 0x80(%rsp), %rax
leaq (%rax,%rax,4), %rax
leaq (%r15,%rax,8), %rax
addq $0x10, %rax
movq 0x20(%rsp), %r9
movsd 0xe0(%rsp,%r9,8), %xmm0
testq %r9, %r9
movsd 0x90(%rsp), %xmm3
movsd 0x88(%rsp), %xmm4
je 0x114da
cmpl $0x1, 0x10(%rdx)
jne 0x114da
mulsd %xmm3, %xmm0
xorl %ecx, %ecx
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %r8d
movsd 0x1d0(%rsp,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%rax,%rcx,8), %xmm1
movsd %xmm1, (%rax,%rcx,8)
incq %rcx
cmpq $0x5, %rcx
jne 0x114b0
movl $0x1, %eax
jmp 0x112d8
movq 0x78(%rsp), %rcx
leaq (%rcx,%rcx,4), %rcx
leaq (%r15,%rcx,8), %rcx
addq $0x10, %rcx
addq $0x10, %r15
xorl %edx, %edx
movsd 0x1d0(%rsp,%rdx), %xmm1
mulsd %xmm0, %xmm1
addsd (%rcx,%rdx), %xmm1
mulsd %xmm3, %xmm1
movsd (%r15,%rdx), %xmm2
mulsd %xmm4, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rax,%rdx)
addq $0x8, %rdx
cmpq $0x28, %rdx
jne 0x114f1
movl $0x1, %eax
jmp 0x112cf
movq %rsi, %r12
movq %rdi, %r14
movl 0x1c(%rsp), %eax
incl %eax
movq %r12, %rsi
movq %r14, %rdi
jmp 0x1114d
movl 0x18(%rsp), %eax
incl %eax
movl %eax, 0x18(%rsp)
cmpl 0x14(%rcx), %eax
jl 0x1114a
incq %r9
cmpl %r9d, 0x6c(%rsp)
movq 0xa0(%rsp), %r14
jne 0x1110f
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq