// File: /workspace/github_c_makefile_star2_O2/lh3[P]fermi2/correct.c
// Function: kmer_lookup
static inline int kmer_lookup(int k, int suf_len, uint64_t kmer[2], fmc_hash_t **h, kmercache_t *cache)
{
	int absent, i = (kmer[0]>>(k>>1<<1)&3) < 2? 0 : 1;
	khint_t kh, kc;
	longcell_t x, *p;

	x.suf = kmer[i] & ((1<<(suf_len<<1)) - 1);
	x.x = kmer[i] >> (suf_len<<1) << 28;
	x.missing = 0; // This line suppresses a gcc warning. It has no effect.
	kc = kh_put(kache, cache, x, &absent);
	p = &kh_key(cache, kc);
	if (absent) {
		fmc_hash_t *g = h[x.suf];
		kh = kh_get(fmc, g, x.x);
		if (kh == kh_end(g)) p->missing = 1;
		else p->missing = 0, p->x = kh_key(g, kh);
	}
	if (fmc_verbose >= 6) {
		int i, which = (kmer[0]>>(k>>1<<1)&3) < 2? 0 : 1;
		int val = p->missing? -1 : fmc_cell_get_val(p->x, !which);
		fprintf(stderr, "?? ");
		for (i = k-1; i >= 0; --i) fputc("ACGT"[kmer[0]>>2*i&3], stderr); fprintf(stderr, " - ");
		for (i = k-1; i >= 0; --i) fputc("ACGT"[kmer[1]>>2*i&3], stderr);
		fprintf(stderr, " - [%c] %lx", "+-"[which], (long)kmer[which]);
		if (p->missing) fprintf(stderr, " - NOHIT\n");
		else fprintf(stderr, " - %c%d\n", "ACGTN"[fmc_cell_get_b1(val)], fmc_cell_get_q1(val));
	}
	return p->missing? -1 : fmc_cell_get_val(p->x, !i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, 0x20(%rsp)
movl %edi, %ecx
andb $-0x2, %cl
pushq $0x2
popq %rdx
shlq %cl, %rdx
movq (%r14), %rcx
xorl %eax, %eax
movq %rdx, 0x18(%rsp)
movq %rcx, 0x30(%rsp)
testq %rdx, %rcx
setne %al
leal (%rsi,%rsi), %ecx
pushq $-0x1
popq %r13
shll %cl, %r13d
movq %r8, %rbp
movq (%r14,%rax,8), %rax
notl %r13d
andl %eax, %r13d
shrq %cl, %rax
movq %rax, 0x8(%rsp)
movl (%r8), %r15d
movl %r15d, %eax
shrl $0x2, %eax
movl %r15d, %ecx
shrl %ecx
addl %eax, %ecx
cmpl %ecx, 0x8(%r8)
jb 0x9668
movl 0x4(%rbp), %eax
addl %eax, %eax
cmpl %eax, %r15d
jbe 0x964b
decl %r15d
jmp 0x964e
incl %r15d
movq %rbp, %rdi
movl %r15d, %esi
callq 0x9f19
movl (%rbp), %r15d
movl %r15d, %edx
testl %eax, %eax
js 0x97d7
movq %rbx, (%rsp)
movq 0x8(%rsp), %rax
shlq $0x1c, %rax
leal -0x1(%r15), %r12d
movq %r13, 0x10(%rsp)
movq %rax, 0x28(%rsp)
shldq $0x24, %rax, %r13
movq %r13, %rdi
callq 0x953d
andl %r12d, %eax
movq 0x10(%rbp), %rsi
movl %eax, %ecx
shrl $0x4, %ecx
movl (%rsi,%rcx,4), %edx
leal (%rax,%rax), %ecx
shrl %cl, %edx
testb $0x2, %dl
je 0x96b0
movl %eax, %edx
jmp 0x9737
pushq $0x1
popq %r8
movl %eax, %edi
movl %r15d, %edx
movl %edi, %ecx
shrl $0x4, %ecx
movl (%rsi,%rcx,4), %r9d
leal (%rdi,%rdi), %ecx
andl $0x1e, %ecx
movl %r9d, %r10d
shrl %cl, %r10d
testb $0x2, %r10b
jne 0x9718
testb $0x1, %r10b
jne 0x96f8
movq 0x18(%rbp), %r10
movl %edi, %r11d
shlq $0x4, %r11
movq (%r10,%r11), %rbx
movq 0x8(%r10,%r11), %r10
shrdq $0x1c, %rbx, %r10
cmpq %r13, %r10
je 0x9718
btl %ecx, %r9d
cmovbl %edi, %edx
addl %r8d, %edi
andl %r12d, %edi
incl %r8d
cmpl %eax, %edi
jne 0x96b9
movb $0x1, %cl
movl %r15d, %r8d
cmpl %r15d, %edx
je 0x9727
jmp 0x9737
shrl %cl, %r9d
testb $0x2, %r9b
sete %cl
movl %edx, %r8d
movl %edi, %eax
cmpl %r15d, %r8d
cmovel %eax, %r8d
testb %cl, %cl
cmovnel %eax, %r8d
movl %r8d, %edx
movl %edx, %r8d
shrl $0x4, %r8d
movl (%rsi,%r8,4), %esi
leal (%rdx,%rdx), %ecx
andl $0x1e, %ecx
shrl %cl, %esi
testb $0x2, %sil
pushq $-0x1
popq %r13
jne 0x9795
movq %r13, %rax
movl %edx, %r10d
shlq $0x4, %r10
addq 0x18(%rbp), %r10
testb $0x1, %sil
movq (%rsp), %rbx
movq 0x10(%rsp), %r13
je 0x98a2
movq %r13, (%r10)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%r10)
pushq $0x3
popq %rsi
shll %cl, %esi
notl %esi
movq 0x10(%rbp), %rcx
andl %esi, (%rcx,%r8,4)
incl 0x4(%rbp)
jmp 0x97d7
movq 0x18(%rbp), %rsi
movl %edx, %edi
shlq $0x4, %rdi
movq 0x10(%rsp), %r13
movq %r13, (%rsi,%rdi)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsi,%rdi)
pushq $0x3
popq %rsi
shll %cl, %esi
notl %esi
movq 0x10(%rbp), %rcx
andl %esi, (%rcx,%r8,4)
movq 0x4(%rbp), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%rbp)
movq (%rsp), %rbx
movl %edx, %r10d
shlq $0x4, %r10
addq 0x18(%rbp), %r10
movq (%rbx,%r13,8), %rbx
movl (%rbx), %eax
testl %eax, %eax
je 0x9874
pushq $0x1
popq %rbp
movq %rax, (%rsp)
leal -0x1(%rax), %r12d
movabsq $0xfffffffff, %rax      # imm = 0xFFFFFFFFF
movq 0x8(%rsp), %rdi
andq %rax, %rdi
movq %rdi, %r15
movq %r10, %r13
callq 0x953d
movq %r13, %r10
andl %r12d, %eax
movq 0x10(%rbx), %rsi
movl %eax, %edx
movl %edx, %ecx
shrl $0x4, %ecx
movl (%rsi,%rcx,4), %edi
leal (%rdx,%rdx), %ecx
andl $0x1e, %ecx
movl %edi, %r8d
shrl %cl, %r8d
testb $0x2, %r8b
jne 0x9865
testb $0x1, %r8b
jne 0x9858
movq 0x18(%rbx), %r8
movl %edx, %r9d
movq (%r8,%r9,8), %r8
shrq $0x1c, %r8
cmpq %r15, %r8
je 0x9865
addl %ebp, %edx
andl %r12d, %edx
incl %ebp
cmpl %eax, %edx
jne 0x9824
jmp 0x987a
shrl %cl, %edi
testb $0x3, %dil
movq (%rsp), %rax
cmovnel %eax, %edx
jmp 0x9876
xorl %edx, %edx
cmpl %eax, %edx
jne 0x988c
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
incq %rax
orq %rax, (%r10)
jmp 0x989f
andb $0x7f, 0x7(%r10)
movq 0x18(%rbx), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%r10)
pushq $-0x1
popq %rax
cmpl $0x6, 0x18927(%rip)     # 0x221d0
pushq $0xe
popq %rsi
jge 0x98e0
cmpq $0x0, (%r10)
js 0x98d1
xorl %edx, %edx
movq 0x30(%rsp), %rcx
testq %rcx, 0x18(%rsp)
movq 0x8(%r10), %rax
cmovnel %edx, %esi
movl %esi, %ecx
shrq %cl, %rax
andl $0x3fff, %eax           # imm = 0x3FFF
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rax
cmpq $0x0, (%r10)
movq %r10, 0x8(%rsp)
movq %rax, (%rsp)
js 0x9905
xorl %ecx, %ecx
testq %rax, 0x18(%rsp)
movq 0x8(%r10), %rax
cmovel %esi, %ecx
shrq %cl, %rax
jmp 0x9908
pushq $-0x1
popq %rax
movq %rax, 0x10(%rsp)
movq 0x186e4(%rip), %rbx     # 0x21ff8
movq (%rbx), %rcx
leaq 0x1031d(%rip), %rdi     # 0x19c3b
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x2310
movq 0x20(%rsp), %rax
leal -0x1(%rax), %r13d
leal -0x2(,%rax,2), %r12d
leaq 0x102fe(%rip), %rbp     # 0x19c3f
movl %r13d, %r15d
jmp 0x9965
movq (%r14), %rax
movl %r12d, %ecx
shrq %cl, %rax
andl $0x3, %eax
movsbl (%rax,%rbp), %edi
movq (%rbx), %rsi
callq 0x2170
decl %r15d
addl $-0x2, %r12d
testl %r15d, %r15d
jns 0x9946
movq (%rbx), %rcx
leaq 0x102d0(%rip), %rdi     # 0x19c44
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x2310
movq 0x20(%rsp), %rax
leal -0x2(,%rax,2), %r12d
jmp 0x99ae
movq 0x8(%r14), %rax
movl %r12d, %ecx
shrq %cl, %rax
andl $0x3, %eax
movsbl (%rax,%rbp), %edi
movq (%rbx), %rsi
callq 0x2170
decl %r13d
addl $-0x2, %r12d
testl %r13d, %r13d
jns 0x998e
xorl %eax, %eax
movq (%rsp), %rcx
testq %rcx, 0x18(%rsp)
setne %al
movq (%rbx), %rdi
leaq 0x10289(%rip), %rcx     # 0x19c54
movsbl (%rax,%rcx), %edx
movq (%r14,%rax,8), %rcx
leaq 0x1026e(%rip), %rsi     # 0x19c48
xorl %eax, %eax
callq 0x21c0
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
movq (%rbx), %rcx
js 0x9a26
movq 0x10(%rsp), %r8
movl %r8d, %eax
shrl $0xc, %eax
andl $0x3, %eax
leaq 0xf9d1(%rip), %rdx      # 0x193d5
movsbl (%rax,%rdx), %edx
shrl $0x4, %r8d
andl $0x3e, %r8d
leaq 0x1024a(%rip), %rsi     # 0x19c61
movq %rcx, %rdi
movl %r8d, %ecx
xorl %eax, %eax
callq 0x21c0
jmp 0x9a38
leaq 0x1022a(%rip), %rdi     # 0x19c57
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x2310
pushq $-0x1
popq %r13
movq %r13, %rax
movq 0x8(%rsp), %r10
pushq $0xe
popq %rsi
jmp 0x98ae