// File: /workspace/github_c_makefile_star2_O3/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 $0x78, %rsp
movq %rsi, %rax
movq 0x20(%rdi), %rcx
movq 0x28(%rdi), %rbp
movslq %edx, %rdx
imulq (%rdi), %rax
imulq $0x170, %rdx, %r14      # imm = 0x170
movq 0x28(%rcx), %rcx
xorl %esi, %esi
xorl %edx, %edx
divq 0x8(%rcx)
movq %rsi, 0x128(%rbp,%r14)
movq %rsi, 0x110(%rbp,%r14)
movl $0x0, 0xf4(%rbp,%r14)
movq 0x78(%rbp,%r14), %rax
movq %rdx, %rcx
sarq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %rdx, %rax
jb 0xc5b4
movq %rdi, %rbx
leaq (%r14,%rbp), %r13
leaq (%r14,%rbp), %rax
addq $0xc0, %rax
movq 0x8(%r13), %rdi
leaq 0x48(%rsp), %r12
leaq 0x2c(%rsp), %r8
movq %rdx, %rsi
movq %rax, 0x10(%rsp)
movq %rax, %rdx
movq %r12, %rcx
callq 0xa2f7
movq %rax, %r15
movl 0xc0(%r13), %edi
movq 0xd0(%r13), %rsi
callq 0x4662
movq 0xc0(%r13), %r8
movq 0x10(%r12), %rax
cmpq $0x2, %rax
jb 0xc1d6
cmpq 0x48(%rsp), %r15
jne 0xc5b4
testq %rax, %rax
je 0xc223
movq 0x78(%r13), %rax
xorl %edx, %edx
movq 0x48(%rsp), %rcx
addq %rdx, %rcx
movq %rcx, %rsi
movl $0x1, %edi
shlq %cl, %rdi
shrq $0x6, %rsi
lock
orq %rdi, (%rax,%rsi,8)
movq 0x50(%rsp), %rcx
addq %rdx, %rcx
movq %rcx, %rsi
movl $0x1, %edi
shlq %cl, %rdi
shrq $0x6, %rsi
lock
orq %rdi, (%rax,%rsi,8)
incq %rdx
cmpq 0x58(%rsp), %rdx
jb 0xc1e1
cmpl $0x0, 0x2c(%rsp)
jne 0xc5b4
movslq 0x10(%r13), %rsi
cmpq %rsi, 0xc0(%r13)
jbe 0xc5b4
movq %r8, 0x70(%rsp)
leaq (%r14,%rbp), %rax
addq $0xd8, %rax
movq %rax, 0x20(%rsp)
movq 0x8(%r13), %rdi
leaq 0x18(%r13), %r8
leaq 0x48(%rsp), %rcx
movq 0x10(%rsp), %rdx
callq 0xb1a9
movl $0x1, 0xf4(%r13)
movq 0xc8(%r13), %rsi
cmpq %rsi, 0xe0(%r13)
jae 0xc28f
movq 0x20(%rsp), %rdi
callq 0xc5f0
movq 0xc0(%r13), %rax
movq 0xe8(%r13), %rcx
movq %rax, 0xd8(%r13)
movb $0x0, (%rcx,%rax)
cmpq $0x0, 0xd8(%r13)
je 0xc2cb
xorl %eax, %eax
movq 0xe8(%r13), %rcx
movb $0x22, (%rcx,%rax)
incq %rax
cmpq 0xd8(%r13), %rax
jb 0xc2b4
leaq (%r14,%rbp), %rax
addq $0x8, %rax
movq %rax, 0x40(%rsp)
leaq 0x100(%rbp,%r14), %r9
leaq 0x128(%rbp,%r14), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x100(%r13)
movq 0x48(%rsp), %r8
leaq 0x108(%r13), %rax
movq %rax, 0x38(%rsp)
movq %r8, 0x108(%r13)
cmpq $0x0, 0x18(%r13)
je 0xc3d3
leaq (%r14,%rbp), %r15
addq $0x110, %r15            # imm = 0x110
leaq 0x1c(%rsp), %rax
movq %rax, (%rsp)
movq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x20(%rsp), %rdx
xorl %ecx, %ecx
movq %r9, %r12
callq 0xc644
addl %eax, 0xf4(%r13)
leaq 0x48(%r13), %rsi
movq %r15, %rdi
callq 0xcd04
movq %r12, %r9
leaq 0x1c(%rsp), %rax
cmpl $0x0, (%rax)
je 0xc3d3
movq 0x58(%r13), %rax
movq 0x100(%r13), %r15
movq 0x18(%rax), %rdi
movq 0x128(%r13), %rcx
cmpq 0x130(%r13), %rcx
jne 0xc463
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %esi
cmovneq %rax, %rsi
movq %rsi, 0x130(%r13)
movq %rdi, 0x10(%rsp)
movq 0x138(%r13), %rdi
shlq $0x4, %rsi
callq 0x21c0
movq 0x10(%rsp), %rdi
movq %r12, %r9
movq %rax, 0x138(%r13)
movq 0x128(%r13), %rcx
jmp 0xc46a
leaq 0x48(%r13), %rax
movq %rax, 0x68(%rsp)
xorl %eax, %eax
movq %rax, 0x48(%r13)
movq %rax, 0x30(%r13)
movq %rax, 0x18(%r13)
movl 0xc0(%r13), %edi
movq 0xd0(%r13), %rsi
movq %r9, %r15
callq 0x468c
movl 0xd8(%r13), %edi
movq 0xe8(%r13), %rsi
callq 0x4662
movl 0xc0(%r13), %ecx
subl 0x70(%rsp), %ecx
movq 0x50(%rsp), %r8
leaq 0x1c(%rsp), %rax
movq %rax, (%rsp)
movq 0x40(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x38(%rsp), %r12
movq %r12, %r9
callq 0xc644
addl %eax, 0xf4(%r13)
movq 0x30(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0xcd04
movq %r15, %r9
jmp 0xc488
movq 0x138(%r13), %rax
leaq 0x1(%rcx), %rdx
movq 0x30(%rsp), %rsi
movq %rdx, (%rsi)
shlq $0x4, %rcx
movq %r15, (%rax,%rcx)
movq %rdi, 0x8(%rax,%rcx)
movq 0x38(%rsp), %r12
movq 0x18(%rbx), %rax
movq (%r9), %rdx
movq %rdx, %rsi
shrq $0x6, %rsi
andl $0x3f, %edx
movq (%r12), %rcx
lock
btsq %rdx, (%rax,%rsi,8)
jb 0xc5b4
movl %ecx, %edx
andl $0x3f, %edx
shrq $0x6, %rcx
lock
btsq %rdx, (%rax,%rcx,8)
jb 0xc5b4
movl 0xc0(%r13), %eax
movl %eax, 0xf0(%r13)
movq 0xc8(%r13), %rsi
cmpq %rsi, (%r13)
jae 0xc50e
movq %rsi, (%r13)
movq 0x140(%r13), %rdi
callq 0x21c0
movq %rax, 0x140(%r13)
movq (%r13), %rsi
movq 0x148(%r13), %rdi
callq 0x21c0
movq %rax, 0x148(%r13)
movl 0xf0(%r13), %eax
leaq (%r14,%rbp), %rbx
addq $0xf0, %rbx
movq 0xd0(%r13), %rsi
movq 0x140(%r13), %rdi
movslq %eax, %rdx
callq 0x2170
movq 0xe8(%r13), %rsi
movq 0x148(%r13), %rdi
movslq 0xf0(%r13), %rdx
incq %rdx
callq 0x2170
movq 0x158(%r13), %rcx
cmpq 0x160(%r13), %rcx
jne 0xc593
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rax, %rcx
movq %rcx, 0x160(%r13)
movq 0x168(%r13), %rdi
imulq $0x68, %rcx, %rsi
callq 0x21c0
movq %rax, 0x168(%r13)
movq 0x158(%r13), %rcx
jmp 0xc59a
movq 0x168(%r13), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x158(%r13)
imulq $0x68, %rcx, %rdi
addq %rax, %rdi
movq %rbx, %rsi
callq 0xfd9d
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq