// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/immersed_boundary.c
// Function: SetInterfacialField
static void SetInterfacialField(Space *space, const Model *model)
{
    const Partition *const part = &(space->part);
    Node *const node = space->node;
    int idx = 0; /* linear array index math variable */
    const int sd = 0; /* solution domain */
    IntVec n = {0}; /* current node */
    RealVec p = {0.0}; /* node point */
    Real Uo[DIMUo] = {0.0};
    Real weightSum = 0.0;
    for (int k = part->ns[PIN][Z][MIN]; k < part->ns[PIN][Z][MAX]; ++k) {
        for (int j = part->ns[PIN][Y][MIN]; j < part->ns[PIN][Y][MAX]; ++j) {
            for (int i = part->ns[PIN][X][MIN]; i < part->ns[PIN][X][MAX]; ++i) {
                idx = IndexNode(k, j, i, part->n[Y], part->n[X]);
                /* reconstruct newly joined node for the solution domain */
                if ((node[idx].gst != node[idx].did) && (sd == node[idx].did)) {
                    /* a newly joined solution domain node */
                    n[X] = i; n[Y] = j; n[Z] = k;
                    p[X] = MapPoint(i, part->domain[X][MIN], part->d[X], part->ng[X]);
                    p[Y] = MapPoint(j, part->domain[Y][MIN], part->d[Y], part->ng[Y]);
                    p[Z] = MapPoint(k, part->domain[Z][MIN], part->d[Z], part->ng[Z]);
                    weightSum = InverseDistanceWeighting(TO, n, p, R, TYPEF, node[idx].did, part, node, model, Uo);
                    Normalize(DIMUo, weightSum, Uo);
                    Uo[0] = Uo[4] / (Uo[5] * model->gasR); /* compute density */
                    MapConservative(model->gamma, Uo, node[idx].U[TO]);
                    node[idx].fid = NONE; /* set domain change mark to avoid reconstruction interference */
                }
                /* reset interfacial state */
                node[idx].lid = 0;
                node[idx].gst = 0;
                /* search neighbours to determine the current interfacial state */
                if (sd == node[idx].did) { /* skip interfacial nodes for main domain */
                    continue;
                }
                node[idx].lid = GetInterState(INTERL, k, j, i, node[idx].did, part->pathSep[0], part->path, node, part);
                if ((0 < node[idx].lid) && (sd != node[idx].did)) { /* ghost node is a subset of interfacial node */
                    node[idx].gst = GetInterState(INTERG, k, j, i, sd, part->pathSep[0], part->path, node, part);
                }
            }
        }
    }
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xc8, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
leaq -0x3c(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x20d0
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20d0
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20d0
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x20(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x7c(%rcx), %eax
jge 0x197b8
movq -0x20(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x74(%rcx), %eax
jge 0x197a2
movq -0x20(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x1978c
movl -0x9c(%rbp), %edi
movl -0xa0(%rbp), %esi
movl -0xa4(%rbp), %edx
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x20(%rbp), %rax
movl 0xc(%rax), %r8d
callq 0x9500
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
je 0x19623
movq -0x28(%rbp), %rcx
movslq -0x2c(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
jne 0x19623
movl -0xa4(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0xa4(%rbp), %edi
movq -0x20(%rbp), %rax
movsd 0x3c8(%rax), %xmm0
movq -0x20(%rbp), %rax
movsd 0x30(%rax), %xmm1
movq -0x20(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x9690
movsd %xmm0, -0x60(%rbp)
movl -0xa0(%rbp), %edi
movq -0x20(%rbp), %rax
movsd 0x3d8(%rax), %xmm0
movq -0x20(%rbp), %rax
movsd 0x38(%rax), %xmm1
movq -0x20(%rbp), %rax
movl 0x1c(%rax), %esi
callq 0x9690
movsd %xmm0, -0x58(%rbp)
movl -0x9c(%rbp), %edi
movq -0x20(%rbp), %rax
movsd 0x3e8(%rax), %xmm0
movq -0x20(%rbp), %rax
movsd 0x40(%rax), %xmm1
movq -0x20(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x9690
movsd %xmm0, -0x50(%rbp)
leaq -0x3c(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %r9d
movq -0x20(%rbp), %rbx
movq -0x28(%rbp), %r11
movq -0x18(%rbp), %r10
leaq -0x90(%rbp), %rax
xorl %edi, %edi
movl $0x2, %ecx
movl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x1a470
movsd %xmm0, -0x98(%rbp)
movsd -0x98(%rbp), %xmm0
leaq -0x90(%rbp), %rsi
movl $0x6, %edi
callq 0x9c60
movsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
movq -0x18(%rbp), %rax
mulsd 0x48(%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x18(%rbp), %rax
movsd 0x40(%rax), %xmm0
leaq -0x90(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x2c(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rsi
addq $0x10, %rsi
callq 0x9400
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
movq -0x28(%rbp), %rcx
movslq -0x2c(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
jne 0x19672
jmp 0x19778
movl -0x9c(%rbp), %esi
movl -0xa0(%rbp), %edx
movl -0xa4(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rdi
imulq $0x88, %rdi, %rdi
addq %rdi, %rax
movl (%rax), %r8d
movq -0x20(%rbp), %rax
movl 0x380(%rax), %r9d
movq -0x20(%rbp), %r11
addq $0x218, %r11            # imm = 0x218
movq -0x28(%rbp), %r10
movq -0x20(%rbp), %rax
xorl %edi, %edi
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1a880
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movslq -0x2c(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpl 0x8(%rcx), %eax
jge 0x19776
movq -0x28(%rbp), %rcx
movslq -0x2c(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
je 0x19776
movl -0x9c(%rbp), %esi
movl -0xa0(%rbp), %edx
movl -0xa4(%rbp), %ecx
movq -0x20(%rbp), %rax
movl 0x380(%rax), %r9d
movq -0x20(%rbp), %r11
addq $0x218, %r11            # imm = 0x218
movq -0x28(%rbp), %r10
movq -0x20(%rbp), %rax
movl $0x1, %edi
xorl %r8d, %r8d
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1a880
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
jmp 0x19778
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x19424
jmp 0x1978e
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x19404
jmp 0x197a4
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x193e4
addq $0xc8, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)