// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/immersed_boundary.c
// Function: GetInterState
static int GetInterState(const int sid, const int k, const int j, const int i, const int did,
        const int end, const int path[restrict][DIMS], const Node *const node, const Partition *const part)
{
    /* search around the specified node to check interfacial state */
    int idx = 0; /* linear array index math variable */
    int ih = 0, jh = 0, kh = 0; /* neighbouring node */
    int flag = 0; /* control flag */
    for (int n = 0; n < end; ++n) {
        kh = k + path[n][Z];
        jh = j + path[n][Y];
        ih = i + path[n][X];
        if (!InPartBox(kh, jh, ih, part->ns[PIN])) {
            continue;
        }
        idx = IndexNode(kh, jh, ih, part->n[Y], part->n[X]);
        switch (sid) {
            case INTERL:
                if (did != node[idx].did) { /* a heterogeneous node on the path */
                    flag = 1;
                }
                break;
            case INTERG:
                if (did == node[idx].did) { /* a computational node on the path */
                    flag = 1;
                }
                break;
            default:
                break;
        }
        if (1 == flag) { /* return the layer number */
            for (int r = 1; r <= part->gl; ++r) {
                if (part->pathSep[r] > n) {
                    return r;
                }
            }
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1aa15
movl -0xc(%rbp), %eax
movq 0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
addl 0x8(%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0x10(%rbp), %eax
movq 0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
addl 0x4(%rcx), %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movq 0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
addl (%rcx), %eax
movl %eax, -0x24(%rbp)
movl -0x2c(%rbp), %edi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
movq 0x20(%rbp), %rcx
addq $0x68, %rcx
callq 0x9530
cmpl $0x0, %eax
jne 0x1a945
jmp 0x1aa07
movl -0x2c(%rbp), %edi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
movq 0x20(%rbp), %rax
movl 0xc(%rax), %r8d
movl 0x10(%rax), %ecx
callq 0x9500
movl %eax, -0x20(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x3c(%rbp)
testl %eax, %eax
je 0x1a977
jmp 0x1a96d
movl -0x3c(%rbp), %eax
subl $0x1, %eax
je 0x1a999
jmp 0x1a9bb
movl -0x18(%rbp), %eax
movq 0x18(%rbp), %rcx
movslq -0x20(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
je 0x1a997
movl $0x1, -0x30(%rbp)
jmp 0x1a9bd
movl -0x18(%rbp), %eax
movq 0x18(%rbp), %rcx
movslq -0x20(%rbp), %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x1a9b9
movl $0x1, -0x30(%rbp)
jmp 0x1a9bd
jmp 0x1a9bd
movl $0x1, %eax
cmpl -0x30(%rbp), %eax
jne 0x1aa05
movl $0x1, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq 0x20(%rbp), %rcx
cmpl 0x24(%rcx), %eax
jg 0x1aa03
movq 0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl 0x380(%rax,%rcx,4), %eax
cmpl -0x34(%rbp), %eax
jle 0x1a9f6
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1aa1c
jmp 0x1a9f8
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1a9ce
jmp 0x1aa05
jmp 0x1aa07
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1a8d2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)