// File: /workspace/github_c_makefile_star2_O2/lh3[P]fermi2/diff.c
// Function: main_diff
int main_diff(int argc, char *argv[])
{
	int c, min_k = 25, max_k = 51, min_occ = 2, n_threads = 1;
	uint64_t n_seqs, *bits;
	rld_t *eqry = 0, *eref = 0;
	while ((c = getopt(argc, argv, "k:K:o:t:")) >= 0) {
		if (c == 'k') min_k = atoi(optarg);
		else if (c == 'K') max_k = atoi(optarg);
		else if (c == 'o') min_occ = atoi(optarg);
		else if (c == 't') n_threads = atoi(optarg);
	}
	if (optind == argc) {
		if (strcmp(argv[0], "diff") == 0)
			fprintf(stderr, "Usage: fermi2 diff [-k minK=%d] [-K maxK=%d] [-o minOcc=%d] [-t nThreads=1] <query.rld> <ref.rld>\n", min_k, max_k, min_occ);
		else fprintf(stderr, "Usage: fermi2 %s [-k minK=%d] [-K maxK=%d] [-o minOcc=%d] [-t nThreads=1] <query.rld>\n", argv[0], min_k, max_k, min_occ);
		return 1;
	}
	eqry = rld_restore(argv[optind]);
	if (optind + 1 < argc)
		eref = rld_restore(argv[optind+1]);
	n_seqs = eqry->mcnt[1];
	bits = fm_diff(eqry, eref, min_k, max_k, min_occ, n_threads);
	rld_destroy(eref);
	rld_destroy(eqry);
	fwrite(&n_seqs, 8, 1, stdout);
	fwrite(bits, 8, (n_seqs + 63) / 64, stdout);
	free(bits);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movl %edi, %r13d
pushq $0x1
popq %r15
pushq $0x2
popq %rax
movl %eax, 0xc(%rsp)
pushq $0x33
popq %rax
movl %eax, 0x8(%rsp)
pushq $0x19
popq %r14
leaq 0x14f5f(%rip), %rbx     # 0x191fc
movq 0x1dd34(%rip), %rbp     # 0x21fd8
movl %r13d, %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x22f0
testl %eax, %eax
js 0x4304
cmpl $0x4b, %eax
je 0x42d8
cmpl $0x74, %eax
je 0x42e7
cmpl $0x6f, %eax
je 0x42f5
cmpl $0x6b, %eax
jne 0x42a4
movq (%rbp), %rdi
callq 0x2300
movl %eax, %r14d
jmp 0x42a4
movq (%rbp), %rdi
callq 0x2300
movl %eax, 0x8(%rsp)
jmp 0x42a4
movq (%rbp), %rdi
callq 0x2300
movl %eax, %r15d
jmp 0x42a4
movq (%rbp), %rdi
callq 0x2300
movl %eax, 0xc(%rsp)
jmp 0x42a4
movq 0x1dcc5(%rip), %rbx     # 0x21fd0
movslq (%rbx), %rax
cmpl %r13d, %eax
je 0x43d1
movq (%r12,%rax,8), %rdi
callq 0x2f1e
movq %rax, %rbp
movslq (%rbx), %rax
leal 0x1(%rax), %ecx
xorl %ebx, %ebx
cmpl %r13d, %ecx
jge 0x433f
movq 0x8(%r12,%rax,8), %rdi
callq 0x2f1e
movq %rax, %r13
jmp 0x4342
xorl %r13d, %r13d
movq 0x28(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
movq %rbp, %rdi
movq %r13, %rsi
movl %r14d, %edx
movl 0x8(%rsp), %ecx
movl 0xc(%rsp), %r8d
movl %r15d, %r9d
callq 0x3ba8
movq %rax, %r14
movq %r13, %rdi
callq 0x26e6
movq %rbp, %rdi
callq 0x26e6
movq 0x1dc39(%rip), %r13     # 0x21fc0
movq (%r13), %rcx
pushq $0x8
popq %r15
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2310
movq (%r12), %rdx
addq $0x3f, %rdx
shrq $0x6, %rdx
movq (%r13), %rcx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2310
movq %r14, %rdi
callq 0x2040
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rbx
leaq 0x14e29(%rip), %rsi     # 0x19205
movq %rbx, %rdi
callq 0x21a0
movq 0x1dc0d(%rip), %rcx     # 0x21ff8
movq (%rcx), %rdi
testl %eax, %eax
jne 0x440e
leaq 0x14e11(%rip), %rsi     # 0x1920a
movl %r14d, %edx
movl 0x8(%rsp), %ecx
movl 0xc(%rsp), %r8d
xorl %eax, %eax
callq 0x21c0
jmp 0x442c
leaq 0x14e58(%rip), %rsi     # 0x1926d
movq %rbx, %rdx
movl %r14d, %ecx
movl 0x8(%rsp), %r8d
movl 0xc(%rsp), %r9d
xorl %eax, %eax
callq 0x21c0
pushq $0x1
popq %rbx
jmp 0x43c0