// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %rsi, 0x18(%rsp)
movq %rdi, %r12
movslq 0x2f8e(%rip), %r14      # 0x5070
movq %r14, %rdi
callq 0x1090
testq %r14, %r14
jle 0x229b
xorl %ecx, %ecx
movslq (%r15,%rcx,4), %rdx
cmpl $0x0, (%r12,%rdx,4)
setne %dl
addb %dl, %dl
movb %dl, (%rax,%rcx)
incq %rcx
cmpq %rcx, %r14
jne 0x20f5
testl %r14d, %r14d
jle 0x229b
movq 0x2f72(%rip), %rcx      # 0x5090
xorl %edx, %edx
cmpb $0x0, (%rax,%rdx)
jne 0x2130
cmpl $0x0, (%rcx,%rdx,4)
jne 0x2130
movb $0x1, (%rax,%rdx)
incq %rdx
cmpq %rdx, %r14
jne 0x2120
testl %r14d, %r14d
jle 0x229b
movq 0x2f48(%rip), %rcx      # 0x5090
movq %rcx, 0x10(%rsp)
movq 0x2f34(%rip), %rcx      # 0x5088
movq %rcx, 0x8(%rsp)
movq 0x2f20(%rip), %rsi      # 0x5080
xorl %ecx, %ecx
movq 0x2f0f(%rip), %r8       # 0x5078
movq %r14, 0x30(%rsp)
movq %r15, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r10d, %r10d
xorl %r11d, %r11d
movslq (%r15,%r10,4), %r12
cmpb $0x0, (%rax,%r12)
jne 0x2201
movq 0x10(%rsp), %rcx
movslq (%rcx,%r12,4), %r13
testq %r13, %r13
jle 0x21dc
movq 0x8(%rsp), %rcx
movq (%rcx,%r12,8), %rbx
xorl %edi, %edi
xorl %ebp, %ebp
movslq (%rbx,%rdi,4), %rcx
movslq (%rsi,%rcx,4), %rdx
testq %rdx, %rdx
jle 0x21d2
movq (%r8,%rcx,8), %rcx
xorl %r14d, %r14d
movslq (%rcx,%r14,4), %r15
cmpb $0x1, (%rax,%r15)
adcl $0x0, %ebp
incq %r14
cmpq %r14, %rdx
jne 0x21be
incq %rdi
cmpq %r13, %rdi
jne 0x21aa
jmp 0x21de
xorl %ebp, %ebp
testl %r9d, %r9d
sets %cl
cmpl %r11d, %ebp
setl %dl
orb %cl, %dl
cmovel %r9d, %r12d
cmovnel %ebp, %r11d
movl %r12d, %r9d
movq 0x30(%rsp), %r14
movq 0x28(%rsp), %r15
incq %r10
cmpq %r14, %r10
jne 0x2184
testl %r9d, %r9d
js 0x2265
movl %r9d, %ecx
movb $0x1, (%rax,%rcx)
movq 0x10(%rsp), %rdx
movslq (%rdx,%rcx,4), %rdi
testq %rdi, %rdi
jle 0x2265
movq 0x8(%rsp), %rdx
movq (%rdx,%rcx,8), %r9
xorl %r10d, %r10d
movslq (%r9,%r10,4), %rcx
movslq (%rsi,%rcx,4), %rdx
testq %rdx, %rdx
jle 0x225d
movq (%r8,%rcx,8), %rcx
xorl %r11d, %r11d
movslq (%rcx,%r11,4), %rbx
cmpb $0x0, (%rax,%rbx)
jne 0x2255
movb $0x2, (%rax,%rbx)
incq %r11
cmpq %r11, %rdx
jne 0x2247
incq %r10
cmpq %rdi, %r10
jne 0x2233
movq 0x20(%rsp), %rcx
incl %ecx
cmpl %r14d, %ecx
jne 0x2173
testl %r14d, %r14d
jle 0x229b
xorl %ecx, %ecx
xorl %ebp, %ebp
movq 0x18(%rsp), %rsi
cmpb $0x1, (%rax,%rcx)
jne 0x2291
movslq %ebp, %rdx
incl %ebp
movl %ecx, (%rsi,%rdx,4)
incq %rcx
cmpq %rcx, %r14
jne 0x2283
jmp 0x229d
xorl %ebp, %ebp
movq %rax, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq