// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gcmisc.c
// Function: mg_gchain_drop_flt
void mg_gchain_drop_flt(void *km, mg_gchains_t *gcs)
{
	int32_t i, n_gc, n_lc, n_a, n_lc0, n_a0, *o2n;
	if (gcs->n_gc == 0) return;
	KMALLOC(km, o2n, gcs->n_gc);
	for (i = 0, n_gc = 0; i < gcs->n_gc; ++i) {
		mg_gchain_t *r = &gcs->gc[i];
		o2n[i] = -1;
		if (r->flt || r->cnt == 0) {
			kfree(gcs->km, r->p);
			continue;
		}
		o2n[i] = n_gc++;
	}
	n_gc = n_lc = n_a = 0;
	n_lc0 = n_a0 = 0;
	for (i = 0; i < gcs->n_gc; ++i) {
		mg_gchain_t *r = &gcs->gc[i];
		if (o2n[i] >= 0) {
			memmove(&gcs->a[n_a], &gcs->a[n_a0], r->n_anchor * sizeof(mg128_t));
			memmove(&gcs->lc[n_lc], &gcs->lc[n_lc0], r->cnt * sizeof(mg_llchain_t));
			gcs->gc[n_gc] = *r;
			gcs->gc[n_gc].id = n_gc;
			gcs->gc[n_gc].parent = o2n[gcs->gc[n_gc].parent];
			++n_gc, n_lc += r->cnt, n_a += r->n_anchor;
		}
		n_lc0 += r->cnt, n_a0 += r->n_anchor;
	}
	assert(n_lc0 == gcs->n_lc && n_a0 == gcs->n_a);
	kfree(km, o2n);
	gcs->n_gc = n_gc, gcs->n_lc = n_lc, gcs->n_a = n_a;
	if (n_a != n_a0) {
		KREALLOC(gcs->km, gcs->a, gcs->n_a);
		KREALLOC(gcs->km, gcs->lc, gcs->n_lc);
		KREALLOC(gcs->km, gcs->gc, gcs->n_gc);
	}
	mg_gchain_restore_offset(gcs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x2bd9f
jmp 0x2c0d1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rsi
shlq $0x2, %rsi
callq 0x2890
movq %rax, -0x30(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x2be4e
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rax
movl 0x44(%rax), %eax
shrl $0x8, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2be14
movq -0x38(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x2be2a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x2670
jmp 0x2be40
movl -0x18(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x30(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2bdc6
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x2bfd7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0x2bfaf
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x20(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movslq -0x28(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rax
movslq 0x10(%rax), %rdx
shlq $0x4, %rdx
callq 0x22d0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x14, %rax, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movslq -0x24(%rbp), %rax
imulq $0x14, %rax, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rax
movslq 0xc(%rax), %rax
imulq $0x14, %rax, %rdx
callq 0x22d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movslq -0x18(%rbp), %rax
imulq $0x68, %rax, %rax
addq %rax, %rdi
movq -0x40(%rbp), %rsi
movl $0x68, %edx
callq 0x2230
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x18(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x18(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rcx
movslq 0x4(%rcx), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x18(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x40(%rbp), %rax
movl 0xc(%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x40(%rbp), %rax
movl 0xc(%rax), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2be78
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jne 0x2bff1
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x2bff1
jmp 0x2c010
leaq 0x11ac1(%rip), %rdi     # 0x3dab9
leaq 0x11a29(%rip), %rsi     # 0x3da28
movl $0xb3, %edx
leaq 0x11ad5(%rip), %rcx     # 0x3dae0
callq 0x2170
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x2670
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x20(%rbp), %eax
cmpl -0x28(%rbp), %eax
je 0x2c0c8
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x10(%rbp), %rax
movslq 0x10(%rax), %rdx
shlq $0x4, %rdx
callq 0x2ae0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rax
movslq 0xc(%rax), %rax
imulq $0x14, %rax, %rdx
callq 0x2ae0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rax
imulq $0x68, %rax, %rdx
callq 0x2ae0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x2b380
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)