// File: /workspace/github_c_makefile_star2_O2/aligrudi[P]gpss/gpss.c
// Function: gpss_iset
static int gpss_iset(int *filt, int *S, int *P)
{
	/* mark[i]: 0 = not selected; 1 = selected; 2 = filtered or covered */
	char *mark = malloc(pt_n * sizeof(mark[0]));
	int S_n = 0;
	int i, j, k;
	for (i = 0; i < pt_n; i++)
		mark[i] = filt[P[i]] ? 2 : 0;
	for (i = 0; i < pt_n; i++)
		if (!mark[i] && pt_cnt[i] == 0)
			mark[i] = 1;
	for (i = 0; i < pt_n; i++) {
		int p = iset_next(P, mark);
		if (p >= 0) {
			mark[p] = 1;
			for (j = 0; j < pt_cnt[p]; j++) {
				int e = pt_ln[p][j];
				for (k = 0; k < ln_cnt[e]; k++)
					if (!mark[ln[e][k]])
						mark[ln[e][k]] = 2;
			}
		}
	}
	for (i = 0; i < pt_n; i++)
		if (mark[i] == 1)
			S[S_n++] = i;
	free(mark);
	return S_n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, 0x30(%rsp)
movq %rdi, %r12
movslq 0x310d(%rip), %r14      # 0x5070
movq %r14, %rdi
callq 0x1090
xorl %ecx, %ecx
testl %r14d, %r14d
movl $0x0, %esi
cmovgl %r14d, %esi
cmpq %rcx, %rsi
je 0x1f94
movslq (%rbx,%rcx,4), %rdx
cmpl $0x0, (%r12,%rdx,4)
setne %dl
addb %dl, %dl
movb %dl, (%rax,%rcx)
incq %rcx
jmp 0x1f79
movq 0x30f5(%rip), %rcx      # 0x5090
movq %rcx, 0x8(%rsp)
xorl %ecx, %ecx
movq 0x8(%rsp), %rdx
cmpq %rcx, %rsi
je 0x1fc1
cmpb $0x0, (%rax,%rcx)
jne 0x1fbc
cmpl $0x0, (%rdx,%rcx,4)
jne 0x1fbc
movb $0x1, (%rax,%rcx)
incq %rcx
jmp 0x1fa7
movq %rbx, 0x28(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x30b6(%rip), %rsi      # 0x5088
movq 0x30a7(%rip), %rdi      # 0x5080
xorl %r8d, %r8d
movq 0x3095(%rip), %r9       # 0x5078
xorl %ecx, %ecx
movq %r14, 0x20(%rsp)
cmpl 0x18(%rsp), %ecx
je 0x2104
movl %ecx, 0x10(%rsp)
xorl %r12d, %r12d
pushq $-0x1
popq %rbp
xorl %r11d, %r11d
movq 0x28(%rsp), %rcx
cmpq %r14, %r12
je 0x209b
movslq (%rcx,%r12,4), %rbx
cmpb $0x0, (%rax,%rbx)
jne 0x2093
movl %r11d, 0x14(%rsp)
movq 0x8(%rsp), %rcx
movl (%rcx,%rbx,4), %ecx
xorl %r11d, %r11d
testl %ecx, %ecx
cmovlel %r11d, %ecx
xorl %r10d, %r10d
cmpq %rcx, %r11
je 0x206e
movq (%rsi,%rbx,8), %rdx
movslq (%rdx,%r11,4), %rdx
movl (%rdi,%rdx,4), %r14d
testl %r14d, %r14d
cmovlel %r8d, %r14d
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x2069
movq (%r9,%rdx,8), %r13
movslq (%r13,%r15,4), %r13
cmpb $0x1, (%rax,%r13)
adcl $0x0, %r10d
incq %r15
jmp 0x204d
incq %r11
jmp 0x2032
testl %ebp, %ebp
sets %cl
movl 0x14(%rsp), %r11d
cmpl %r11d, %r10d
setl %dl
orb %cl, %dl
cmovel %ebp, %ebx
cmovnel %r10d, %r11d
movl %ebx, %ebp
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %r14
incq %r12
jmp 0x2006
testl %ebp, %ebp
js 0x20f4
movl %ebp, %ecx
movb $0x1, (%rax,%rcx)
movq 0x8(%rsp), %rdx
movl (%rdx,%rcx,4), %r10d
testl %r10d, %r10d
cmovlel %r8d, %r10d
xorl %r11d, %r11d
cmpq %r10, %r11
je 0x20f4
movq (%rsi,%rcx,8), %rdx
movslq (%rdx,%r11,4), %rdx
movl (%rdi,%rdx,4), %ebx
testl %ebx, %ebx
cmovlel %r8d, %ebx
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x20ef
movq (%r9,%rdx,8), %r15
movslq (%r15,%r14,4), %r15
cmpb $0x0, (%rax,%r15)
jne 0x20ea
movb $0x2, (%rax,%r15)
incq %r14
jmp 0x20d1
incq %r11
jmp 0x20b8
movl 0x10(%rsp), %ecx
incl %ecx
movq 0x20(%rsp), %r14
jmp 0x1fea
xorl %ecx, %ecx
xorl %ebp, %ebp
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %rdi
cmpq %rcx, %rdi
je 0x212a
cmpb $0x1, (%rax,%rcx)
jne 0x2125
movslq %ebp, %rdx
incl %ebp
movl %ecx, (%rsi,%rdx,4)
incq %rcx
jmp 0x2112
movq %rax, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq