// File: BenLangmead[P]bowtie/./ebwt.h
// Function: SideLocus::initFromRow(unsigned long, EbwtParams const&, unsigned char const*)
void initFromRow(TIndexOffU row, const EbwtParams& ep, const uint8_t* ebwt) {
		const uint32_t sideSz     = ep._sideSz;
		// Side length is hard-coded for now; this allows the compiler
		// to do clever things to accelerate / and %.
		if (ep._isBt2Index) {
			_sideNum = row / (48*OFF_SIZE);
			_charOff = row % (48*OFF_SIZE);
		} else {
			_sideNum = row / (56*OFF_SIZE);
			_charOff = row % (56*OFF_SIZE);
		}
		_sideByteOff = _sideNum * sideSz;
		assert_leq(row, ep._len);
		assert_leq(_sideByteOff + sideSz, ep._ebwtTotSz);
#ifndef NO_PREFETCH
		__builtin_prefetch((const void *)(ebwt + _sideByteOff),
		                   0 /* prepare for read */,
		                   PREFETCH_LOCALITY);
#endif
		// prefetch this side too
		_fw = ep._isBt2Index ? true : ((_sideNum & 1) != 0); // odd-numbered sides are forward
		_by = _charOff >> 2; // byte within side
		assert_lt(_by, (int)ep._sideBwtSz);
		_bp = _charOff & 3;  // bit-pair within byte
		if(!_fw) {
			_by = ep._sideBwtSz - _by - 1;
			_bp ^= 3;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl 0x84(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0xb9(%rax)
je 0x190fe
movq -0x10(%rbp), %rax
movl $0x180, %ecx            # imm = 0x180
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0x180, %ecx            # imm = 0x180
xorl %edx, %edx
divq %rcx
movq -0x30(%rbp), %rax
movw %dx, %cx
movw %cx, 0x10(%rax)
jmp 0x19130
movq -0x10(%rbp), %rax
movl $0x1c0, %ecx            # imm = 0x1C0
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0x1c0, %ecx            # imm = 0x1C0
xorl %edx, %edx
divq %rcx
movq -0x30(%rbp), %rax
movw %dx, %cx
movw %cx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
movl -0x24(%rbp), %edx
imulq %rdx, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jbe 0x1920b
movq 0x30e66(%rip), %rdi     # 0x49fc0
leaq 0x26042(%rip), %rsi     # 0x3f1a3
callq 0x5360
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x50c0
movq %rax, %rdi
leaq 0x2603e(%rip), %rsi     # 0x3f1ba
callq 0x5360
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x50c0
movq %rax, %rdi
leaq 0x2841e(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x30dd7(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x30e0b(%rip), %rdi     # 0x49fc0
leaq 0x25f01(%rip), %rsi     # 0x3f0bd
callq 0x5360
movq %rax, %rdi
leaq 0x275bf(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0x5c9, %esi            # imm = 0x5C9
callq 0x5750
movq %rax, %rdi
movq 0x30d99(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x27477(%rip), %rdi     # 0x4066a
leaq 0x25ec3(%rip), %rsi     # 0x3f0bd
movl $0x5c9, %edx            # imm = 0x5C9
leaq 0x27168(%rip), %rcx     # 0x4036e
callq 0x51e0
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x24(%rbp), %ecx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
cmpq 0xb0(%rcx), %rax
jbe 0x192ee
movq 0x30d90(%rip), %rdi     # 0x49fc0
leaq 0x25f6c(%rip), %rsi     # 0x3f1a3
callq 0x5360
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movl -0x24(%rbp), %eax
addq %rax, %rsi
callq 0x50c0
movq %rax, %rdi
leaq 0x25f5f(%rip), %rsi     # 0x3f1ba
callq 0x5360
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq 0xb0(%rax), %rsi
callq 0x50c0
movq %rax, %rdi
leaq 0x2833b(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x30cf4(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x30d28(%rip), %rdi     # 0x49fc0
leaq 0x25e1e(%rip), %rsi     # 0x3f0bd
callq 0x5360
movq %rax, %rdi
leaq 0x274dc(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0x5ca, %esi            # imm = 0x5CA
callq 0x5750
movq %rax, %rdi
movq 0x30cb6(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x27394(%rip), %rdi     # 0x4066a
leaq 0x25de0(%rip), %rsi     # 0x3f0bd
movl $0x5ca, %edx            # imm = 0x5CA
leaq 0x27085(%rip), %rcx     # 0x4036e
callq 0x51e0
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
addq (%rcx), %rax
prefetcht1 (%rax)
movq -0x18(%rbp), %rax
testb $0x1, 0xb9(%rax)
je 0x19310
movb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x19326
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
setne %al
movb %al, -0x31(%rbp)
movq -0x30(%rbp), %rax
movb -0x31(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x12(%rax)
movzwl 0x10(%rax), %ecx
sarl $0x2, %ecx
movw %cx, 0x14(%rax)
movswl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x88(%rcx), %eax
jl 0x19411
movq 0x30c67(%rip), %rdi     # 0x49fc0
leaq 0x25ee7(%rip), %rsi     # 0x3f247
callq 0x5360
movq %rax, %rdi
movq -0x30(%rbp), %rax
movswl 0x14(%rax), %esi
callq 0x5300
movq %rax, %rdi
leaq 0x25ede(%rip), %rsi     # 0x3f25d
callq 0x5360
movq %rax, %rdi
movq -0x18(%rbp), %rax
movl 0x88(%rax), %esi
callq 0x5750
movq %rax, %rdi
leaq 0x28218(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x30bd1(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x30c05(%rip), %rdi     # 0x49fc0
leaq 0x25cfb(%rip), %rsi     # 0x3f0bd
callq 0x5360
movq %rax, %rdi
leaq 0x273b9(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0x5d3, %esi            # imm = 0x5D3
callq 0x5750
movq %rax, %rdi
movq 0x30b93(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x27271(%rip), %rdi     # 0x4066a
leaq 0x25cbd(%rip), %rsi     # 0x3f0bd
movl $0x5d3, %edx            # imm = 0x5D3
leaq 0x26f62(%rip), %rcx     # 0x4036e
callq 0x51e0
movq -0x30(%rbp), %rax
movzwl 0x10(%rax), %ecx
andl $0x3, %ecx
movb %cl, 0x16(%rax)
testb $0x1, 0x12(%rax)
jne 0x1944a
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x88(%rcx), %ecx
movswl 0x14(%rax), %edx
subl %edx, %ecx
subl $0x1, %ecx
movw %cx, 0x14(%rax)
movsbl 0x16(%rax), %ecx
xorl $0x3, %ecx
movb %cl, 0x16(%rax)
addq $0x40, %rsp
popq %rbp
retq