// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/bwt.c
// Function: bwt_2occ
void bwt_2occ(const bwt_t *bwt, bwtint_t k, bwtint_t l, ubyte_t c, bwtint_t *ok, bwtint_t *ol)
{
	bwtint_t _k, _l;
	_k = (k >= bwt->primary)? k-1 : k;
	_l = (l >= bwt->primary)? l-1 : l;
	if (_l/OCC_INTERVAL != _k/OCC_INTERVAL || k == (bwtint_t)(-1) || l == (bwtint_t)(-1)) {
		*ok = bwt_occ(bwt, k, c);
		*ol = bwt_occ(bwt, l, c);
	} else {
		bwtint_t m, n, i, j;
		uint32_t *p;
		if (k >= bwt->primary) --k;
		if (l >= bwt->primary) --l;
		//n = ((bwtint_t*)(p = bwt_occ_intv(bwt, k)))[c];
		n = ((bwtint_t*)(p = getOccInterval(bwt, k)))[c];
		p += sizeof(bwtint_t);
		// calculate *ok
		j = k >> 5 << 5;
		for (i = k/OCC_INTERVAL*OCC_INTERVAL; i < j; i += 32, p += 2)
			n += __occ_aux((uint64_t)p[0]<<32 | p[1], c);
		m = n;
		n += __occ_aux(((uint64_t)p[0]<<32 | p[1]) & ~((1ull<<((~k&31)<<1)) - 1), c);
		if (c == 0) n -= ~k&31; // corrected for the masked bits
		*ok = n;
		// calculate *ol
		j = l >> 5 << 5;
		for (; i < j; i += 32, p += 2)
			m += __occ_aux((uint64_t)p[0]<<32 | p[1], c);
		m += __occ_aux(((uint64_t)p[0]<<32 | p[1]) & ~((1ull<<((~l&31)<<1)) - 1), c);
		if (c == 0) m -= ~l&31; // corrected for the masked bits
		*ol = m;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jb 0x1437f
movq -0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x14387
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jb 0x143aa
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x143b2
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shrq $0x7, %rax
movq -0x38(%rbp), %rcx
shrq $0x7, %rcx
cmpq %rcx, %rax
jne 0x143dd
cmpq $-0x1, -0x10(%rbp)
je 0x143dd
cmpq $-0x1, -0x18(%rbp)
jne 0x14418
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq 0x14080
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq 0x14080
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
jmp 0x14629
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jb 0x14431
movq -0x10(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jb 0x1444a
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x13be0
movq %rax, -0x68(%rbp)
movzbl -0x19(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
movq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
shrq $0x5, %rax
shlq $0x5, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
shrq $0x7, %rax
shlq $0x7, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x144de
movq -0x68(%rbp), %rax
movl (%rax), %eax
movl %eax, %edi
shlq $0x20, %rdi
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
orq %rax, %rdi
movzbl -0x19(%rbp), %esi
callq 0x14640
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
jmp 0x14493
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x68(%rbp), %rax
movl (%rax), %eax
movl %eax, %edi
shlq $0x20, %rdi
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
orq %rax, %rdi
movq -0x10(%rbp), %rcx
xorq $-0x1, %rcx
andq $0x1f, %rcx
shlq %rcx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
xorq $-0x1, %rax
andq %rax, %rdi
movzbl -0x19(%rbp), %esi
callq 0x14640
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x1454f
movq -0x10(%rbp), %rcx
xorq $-0x1, %rcx
andq $0x1f, %rcx
movq -0x50(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
shrq $0x5, %rax
shlq $0x5, %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x145b5
movq -0x68(%rbp), %rax
movl (%rax), %eax
movl %eax, %edi
shlq $0x20, %rdi
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
orq %rax, %rdi
movzbl -0x19(%rbp), %esi
callq 0x14640
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x68(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x68(%rbp)
jmp 0x1456a
movq -0x68(%rbp), %rax
movl (%rax), %eax
movl %eax, %edi
shlq $0x20, %rdi
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
orq %rax, %rdi
movq -0x18(%rbp), %rcx
xorq $-0x1, %rcx
andq $0x1f, %rcx
shlq %rcx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
xorq $-0x1, %rax
andq %rax, %rdi
movzbl -0x19(%rbp), %esi
callq 0x14640
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x1461e
movq -0x18(%rbp), %rcx
xorq $-0x1, %rcx
andq $0x1f, %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)