// File: jamesliu516[P]amrdg2d/setflag.cpp
// Function: set_exFlag4All(int, pointxy*)
void set_exFlag4All(int nmpnt, PXYZ wallpt[]) 
{
    Node *current;
    OctCell *lsbl;
    OctCell *lsbl1[4];
    double x1,y1;
    int value, flg=0;

    double xcn[4],ycn[4];
    int flgn[4], sflg;	

    current = HeadListAllGrid;
    while(current != NULL)
    {
        lsbl = current->cell;

        x1=lsbl->xc1;
        y1=lsbl->yc1;
        flg=0;

        value = newFlagpoint(x1,y1,nmpnt, wallpt);
        if(value==0 ) {
            flg=-1;
            lsbl->flag=-1; ///
        }
        lsbl->exflag=flg;
        current=current->next;
    }
    //cout<<"it is ok\n";

    current = HeadListAllGrid;
    while(current != NULL)
    {
        lsbl = current->cell;
        if(lsbl->exflag==-1){
            if(current->flg!=6)
            {
                //-----------------------
                lsbl1[0]=SouthNeighbor(lsbl);
                lsbl1[1]=EastNeighbor(lsbl);	
                lsbl1[2]=NorthNeighbor(lsbl);
                lsbl1[3]=WestNeighbor(lsbl);	        
                sflg=0;
                for(int i=0; i<4; ++i) {      
                    if(lsbl1[i]->exflag==0) {
                        flg=2;
                        ++sflg;
                        break;
                    }
                }  

                if(sflg==0) flg=-1;      
                lsbl->exflag=flg;
            }
        }
        current=current->next;
    }
}

// Assembly:
subq $0xc8, %rsp
movl %edi, 0xc4(%rsp)
movq %rsi, 0xb8(%rsp)
movl $0x0, 0x68(%rsp)
leaq 0x48a0b(%rip), %rax     # 0x506a0
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
cmpq $0x0, 0xb0(%rsp)
je 0x7d6a
movq 0xb0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x278(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x280(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movl $0x0, 0x68(%rsp)
movsd 0x78(%rsp), %xmm0
movsd 0x70(%rsp), %xmm1
movl 0xc4(%rsp), %edi
movq 0xb8(%rsp), %rsi
callq 0x15ff0
movl %eax, 0x6c(%rsp)
cmpl $0x0, 0x6c(%rsp)
jne 0x7d3b
movl $0xffffffff, 0x68(%rsp) # imm = 0xFFFFFFFF
movq 0xa8(%rsp), %rax
movw $0xffff, 0x1b0(%rax)    # imm = 0xFFFF
movl 0x68(%rsp), %eax
movw %ax, %cx
movq 0xa8(%rsp), %rax
movw %cx, 0x1b2(%rax)
movq 0xb0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x7ca0
leaq 0x4892f(%rip), %rax     # 0x506a0
movq (%rax), %rax
movq %rax, 0xb0(%rsp)
cmpq $0x0, 0xb0(%rsp)
je 0x7eb3
movq 0xb0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rax
movswl 0x1b2(%rax), %eax
cmpl $-0x1, %eax
jne 0x7e9a
movq 0xb0(%rsp), %rax
movswl (%rax), %eax
cmpl $0x6, %eax
je 0x7e98
movq 0xa8(%rsp), %rdi
callq 0x11a00
movq %rax, 0x80(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x118d0
movq %rax, 0x88(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x11670
movq %rax, 0x90(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x117a0
movq %rax, 0x98(%rsp)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
cmpl $0x4, 0x8(%rsp)
jge 0x7e73
movslq 0x8(%rsp), %rax
movq 0x80(%rsp,%rax,8), %rax
movswl 0x1b2(%rax), %eax
cmpl $0x0, %eax
jne 0x7e64
movl $0x2, 0x68(%rsp)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x7e73
jmp 0x7e66
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x7e2f
cmpl $0x0, 0xc(%rsp)
jne 0x7e82
movl $0xffffffff, 0x68(%rsp) # imm = 0xFFFFFFFF
movl 0x68(%rsp), %eax
movw %ax, %cx
movq 0xa8(%rsp), %rax
movw %cx, 0x1b2(%rax)
jmp 0x7e9a
movq 0xb0(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xb0(%rsp)
jmp 0x7d7c
addq $0xc8, %rsp
retq
nopl (%rax,%rax)