// File: BenLangmead[P]bowtie/./filebuf.h
// Function: BitpairOutFileBuf::write(int)
void write(int bp) {
		assert_lt(bp, 4);
		assert_geq(bp, 0);
		buf_[cur_] |= (bp << bpPtr_);
		if(bpPtr_ == 6) {
			bpPtr_ = 0;
			cur_++;
			if(cur_ == BUF_SZ) {
				// Flush the buffer
				if(!fwrite((const void *)buf_, BUF_SZ, 1, out_)) {
					std::cerr << "Error writing to the reference index file (.4.ebwt)" << std::endl;
					throw 1;
				}
				// Reset to beginning of the buffer
				cur_ = 0;
			}
			// Initialize next octet to 0
			buf_[cur_] = 0;
		} else {
			bpPtr_ += 2;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpl $0x4, -0xc(%rbp)
jl 0x3c9e6
movq 0xd688(%rip), %rdi      # 0x49fc0
leaq 0x2908(%rip), %rsi      # 0x3f247
callq 0x5360
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x5750
movq %rax, %rdi
leaq 0x2904(%rip), %rsi      # 0x3f25d
callq 0x5360
movq %rax, %rdi
movl $0x4, %esi
callq 0x5750
movq %rax, %rdi
leaq 0x4c43(%rip), %rsi      # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0xd5fc(%rip), %rsi      # 0x49f80
callq 0x53c0
movq 0xd630(%rip), %rdi      # 0x49fc0
leaq 0x4a05(%rip), %rsi      # 0x4139c
callq 0x5360
movq %rax, %rdi
leaq 0x3de4(%rip), %rsi      # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0x228, %esi            # imm = 0x228
callq 0x5750
movq %rax, %rdi
movq 0xd5be(%rip), %rsi      # 0x49f80
callq 0x53c0
leaq 0x3c9c(%rip), %rdi      # 0x4066a
leaq 0x49c7(%rip), %rsi      # 0x4139c
movl $0x228, %edx            # imm = 0x228
leaq 0x6d2d(%rip), %rcx      # 0x4370e
callq 0x51e0
cmpl $0x0, -0xc(%rbp)
jge 0x3caa2
movq 0xd5c9(%rip), %rdi      # 0x49fc0
leaq 0x2807(%rip), %rsi      # 0x3f205
callq 0x5360
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x5750
movq %rax, %rdi
leaq 0x2804(%rip), %rsi      # 0x3f21c
callq 0x5360
movq %rax, %rdi
xorl %esi, %esi
callq 0x5750
movq %rax, %rdi
leaq 0x4b87(%rip), %rsi      # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0xd540(%rip), %rsi      # 0x49f80
callq 0x53c0
movq 0xd574(%rip), %rdi      # 0x49fc0
leaq 0x4949(%rip), %rsi      # 0x4139c
callq 0x5360
movq %rax, %rdi
leaq 0x3d28(%rip), %rsi      # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0x229, %esi            # imm = 0x229
callq 0x5750
movq %rax, %rdi
movq 0xd502(%rip), %rsi      # 0x49f80
callq 0x53c0
leaq 0x3be0(%rip), %rdi      # 0x4066a
leaq 0x490b(%rip), %rsi      # 0x4139c
movl $0x229, %edx            # imm = 0x229
leaq 0x6c71(%rip), %rcx      # 0x4370e
callq 0x51e0
movq -0x18(%rbp), %rax
movl -0xc(%rbp), %esi
movl 0x8(%rax), %ecx
shll %cl, %esi
movq 0x10(%rax), %rcx
movsbl 0x18(%rax,%rcx), %edx
orl %esi, %edx
movb %dl, 0x18(%rax,%rcx)
cmpl $0x6, 0x8(%rax)
jne 0x3cb6b
movq -0x18(%rbp), %rax
movl $0x0, 0x8(%rax)
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
cmpq $0x20000, 0x10(%rax)    # imm = 0x20000
jne 0x3cb5c
movq -0x18(%rbp), %rax
movq %rax, %rdi
addq $0x18, %rdi
movq (%rax), %rcx
movl $0x20000, %esi          # imm = 0x20000
movl $0x1, %edx
callq 0x5820
cmpq $0x0, %rax
jne 0x3cb50
movq 0xd4de(%rip), %rdi      # 0x49ff0
leaq 0x6c18(%rip), %rsi      # 0x43731
callq 0x5360
movq %rax, %rdi
movq 0xd458(%rip), %rsi      # 0x49f80
callq 0x53c0
movl $0x4, %edi
callq 0x5180
movq %rax, %rdi
movl $0x1, (%rdi)
movq 0xd429(%rip), %rsi      # 0x49f70
xorl %eax, %eax
movl %eax, %edx
callq 0x5720
movq -0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movb $0x0, 0x18(%rax,%rcx)
jmp 0x3cb78
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x8(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop