// File: /workspace/github_c_makefile_star2_O2/lh3[P]fermi-lite/unitig.c
// Function: worker
static void worker(void *data, long _i, int tid)
{
	worker_t *w = (worker_t*)data;
	thrdat_t *d = &w->d[tid];
	uint64_t i = (w->prime * _i) % w->e->mcnt[1];
	if (unitig1(&d->a, i, &d->str, &d->cov, d->z.k, d->z.nei, &d->z.nsr) >= 0) { // then we keep the unitig
		uint64_t *p[2], x[2];
		magv_t *q;
		p[0] = w->visited + (d->z.k[0]>>6); x[0] = 1LLU<<(d->z.k[0]&0x3f);
		p[1] = w->visited + (d->z.k[1]>>6); x[1] = 1LLU<<(d->z.k[1]&0x3f);
		if ((__sync_fetch_and_or(p[0], x[0])&x[0]) || (__sync_fetch_and_or(p[1], x[1])&x[1])) return;
		d->z.len = d->str.l;
		if (d->max_l < d->str.m) {
			d->max_l = d->str.m;
			d->z.seq = realloc(d->z.seq, d->max_l);
			d->z.cov = realloc(d->z.cov, d->max_l);
		}
		memcpy(d->z.seq, d->str.s, d->z.len);
		memcpy(d->z.cov, d->cov.s, d->z.len + 1);
		kv_pushp(magv_t, d->v, &q);
		mag_v_copy_to_empty(q, &d->z);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rax
movq 0x20(%rdi), %rcx
movq 0x28(%rdi), %r13
movslq %edx, %rsi
imulq (%rdi), %rax
movq 0x28(%rcx), %rcx
xorl %edx, %edx
divq 0x8(%rcx)
imulq $0x170, %rsi, %r15      # imm = 0x170
andq $0x0, 0x128(%r13,%r15)
andq $0x0, 0x110(%r13,%r15)
andl $0x0, 0xf4(%r13,%r15)
movq 0x78(%r13,%r15), %rax
movq %rdx, %rcx
sarq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %rdx, %rax
jb 0xa956
movq %rdi, %r14
leaq (%r15,%r13), %rbp
leaq (%r15,%r13), %rax
addq $0xc0, %rax
movq 0x8(%rbp), %rdi
leaq 0x48(%rsp), %r12
leaq 0x18(%rsp), %r8
movq %rdx, %rsi
movq %rax, 0x10(%rsp)
movq %rax, %rdx
movq %r12, %rcx
callq 0x88cb
movq %rax, %rbx
movl 0xc0(%rbp), %edi
movq 0xd0(%rbp), %rsi
callq 0x3796
movq 0xc0(%rbp), %rax
movq %rax, 0x40(%rsp)
cmpq $0x2, 0x10(%r12)
jb 0xa601
cmpq 0x48(%rsp), %rbx
jne 0xa956
movq 0x78(%rbp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xa1ad
cmpl $0x0, 0x18(%rsp)
jne 0xa956
movslq 0x10(%rbp), %rsi
cmpq %rsi, 0xc0(%rbp)
jbe 0xa956
leaq (%r15,%r13), %rbx
addq $0xd8, %rbx
movq 0x8(%rbp), %rdi
leaq 0x18(%rbp), %r8
leaq 0x48(%rsp), %rcx
movq 0x10(%rsp), %rdx
callq 0x96bd
movl $0x1, 0xf4(%rbp)
movq 0xc8(%rbp), %rsi
cmpq %rsi, 0xe0(%rbp)
jae 0xa66f
movq %rbx, %rdi
callq 0xa992
leaq (%r15,%r13), %rax
addq $0x8, %rax
movq %rax, 0x28(%rsp)
leaq 0xf0(%r13,%r15), %rax
movq %rax, 0x38(%rsp)
leaq 0x100(%r13,%r15), %rax
movq %rax, 0x30(%rsp)
leaq 0x110(%r13,%r15), %r12
leaq 0x128(%r13,%r15), %rax
movq %rax, 0x20(%rsp)
movq 0xc0(%rbp), %rax
movq 0xe8(%rbp), %rcx
movq %rax, 0xd8(%rbp)
movb $0x0, (%rcx,%rax)
xorl %eax, %eax
cmpq (%rbx), %rax
jae 0xa6db
movq 0xe8(%rbp), %rcx
movb $0x22, (%rcx,%rax)
incq %rax
jmp 0xa6c6
movq 0x50(%rsp), %rax
movq %rax, 0x100(%rbp)
movq 0x48(%rsp), %r8
leaq 0x108(%rbp), %r13
movq %r8, 0x108(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0xa79a
leaq 0x1c(%rsp), %r15
movq %r15, (%rsp)
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
movq 0x30(%rsp), %r9
callq 0xa9e6
addl %eax, 0xf4(%rbp)
leaq 0x48(%rbp), %rsi
movq %r12, %rdi
callq 0xaef5
cmpl $0x0, (%r15)
je 0xa79a
movq 0x58(%rbp), %rax
movq 0x100(%rbp), %rbx
movq 0x18(%rax), %r15
movq 0x128(%rbp), %rcx
cmpq 0x130(%rbp), %rcx
jne 0xa813
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rax
cmoveq %rax, %rsi
movq %rsi, 0x130(%rbp)
movq 0x138(%rbp), %rdi
shlq $0x4, %rsi
callq 0x21c0
movq %rax, 0x138(%rbp)
movq 0x128(%rbp), %rcx
jmp 0xa81a
andq $0x0, 0x48(%rbp)
andq $0x0, 0x30(%rbp)
andq $0x0, 0x18(%rbp)
leaq 0x48(%rbp), %r12
movl 0xc0(%rbp), %edi
movq 0xd0(%rbp), %rsi
callq 0x37be
movl 0xd8(%rbp), %edi
movq 0xe8(%rbp), %rsi
callq 0x3796
movl 0xc0(%rbp), %ecx
subl 0x40(%rsp), %ecx
movq 0x50(%rsp), %r8
leaq 0x1c(%rsp), %rax
movq %rax, (%rsp)
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
movq %r13, %r9
callq 0xa9e6
addl %eax, 0xf4(%rbp)
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0xaef5
jmp 0xa833
movq 0x138(%rbp), %rax
leaq 0x1(%rcx), %rdx
movq 0x20(%rsp), %rsi
movq %rdx, (%rsi)
shlq $0x4, %rcx
movq %rbx, (%rax,%rcx)
movq %r15, 0x8(%rax,%rcx)
movq 0x18(%r14), %rax
movq 0x30(%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, %rsi
shrq $0x6, %rsi
andl $0x3f, %edx
movq (%r13), %rcx
lock
btsq %rdx, (%rax,%rsi,8)
jb 0xa956
movl %ecx, %edx
andl $0x3f, %edx
shrq $0x6, %rcx
lock
btsq %rdx, (%rax,%rcx,8)
jb 0xa956
movl 0xc0(%rbp), %eax
movl %eax, 0xf0(%rbp)
movq 0xc8(%rbp), %rsi
cmpq %rsi, (%rbp)
jae 0xa8bb
movq %rsi, (%rbp)
movq 0x140(%rbp), %rdi
callq 0x21c0
movq %rax, 0x140(%rbp)
movq (%rbp), %rsi
movq 0x148(%rbp), %rdi
callq 0x21c0
movq %rax, 0x148(%rbp)
movl 0xf0(%rbp), %eax
movq 0xd0(%rbp), %rsi
movq 0x140(%rbp), %rdi
movslq %eax, %rdx
callq 0x2170
movq 0xe8(%rbp), %rsi
movq 0x148(%rbp), %rdi
movslq 0xf0(%rbp), %rdx
incq %rdx
callq 0x2170
movq 0x158(%rbp), %rcx
cmpq 0x160(%rbp), %rcx
jne 0xa933
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rax
movq %rax, 0x160(%rbp)
movq 0x168(%rbp), %rdi
imulq $0x68, %rax, %rsi
callq 0x21c0
movq %rax, 0x168(%rbp)
movq 0x158(%rbp), %rcx
jmp 0xa93a
movq 0x168(%rbp), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x158(%rbp)
imulq $0x68, %rcx, %rdi
addq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0xd916
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq