// File: BenLangmead[P]bowtie/./filebuf.h
// Function: FileBuf::peek()
int peek() {
		assert(_in != NULL || _zIn != NULL || _inf != NULL || _ins != NULL);
		assert_leq(_cur, _buf_sz);
		if(_cur == _buf_sz) {
			if(_done) {
				// We already exhausted the input stream
				return -1;
			}
			// Read a new buffer's worth of data
			else {
				// Get the next chunk
				if(_inf != NULL) {
					_inf->read((char*)_buf, BUF_SZ);
					_buf_sz = _inf->gcount();
				} else if(_zIn != NULL) {
					_buf_sz = gzread(_zIn, (void *)_buf, BUF_SZ);
				} else if(_ins != NULL) {
					_ins->read((char*)_buf, BUF_SZ);
					_buf_sz = _ins->gcount();
				} else {
					assert(_in != NULL);
					// TODO: consider an _unlocked function
					_buf_sz = fread(_buf, 1, BUF_SZ, _in);
				}
				_cur = 0;
				if(_buf_sz == 0) {
					// Exhausted, and we have nothing to return to the
					// caller
					_done = true;
					return -1;
				} else if(_buf_sz < BUF_SZ) {
					// Exhausted
					_done = true;
				}
			}
		}
		return (int)_buf[_cur];
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movb $0x1, %al
cmpq $0x0, (%rcx)
movb %al, -0x11(%rbp)
jne 0x2f02e
movq -0x20(%rbp), %rcx
movb $0x1, %al
cmpq $0x0, 0x8(%rcx)
movb %al, -0x11(%rbp)
jne 0x2f02e
movq -0x20(%rbp), %rcx
movb $0x1, %al
cmpq $0x0, 0x10(%rcx)
movb %al, -0x11(%rbp)
jne 0x2f02e
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
setne %al
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0x2f037
jmp 0x2f039
jmp 0x2f058
leaq 0x12320(%rip), %rdi     # 0x41360
leaq 0x12355(%rip), %rsi     # 0x4139c
movl $0xdc, %edx
leaq 0x12355(%rip), %rcx     # 0x413a8
callq 0x51e0
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rax
cmpq 0x28(%rcx), %rax
jbe 0x2f127
movq 0x1af4f(%rip), %rdi     # 0x49fc0
leaq 0x1012b(%rip), %rsi     # 0x3f1a3
callq 0x5360
movq %rax, %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x50c0
movq %rax, %rdi
leaq 0x10123(%rip), %rsi     # 0x3f1ba
callq 0x5360
movq %rax, %rdi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x50c0
movq %rax, %rdi
leaq 0x12502(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x1aebb(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x1aeef(%rip), %rdi     # 0x49fc0
leaq 0x122c4(%rip), %rsi     # 0x4139c
callq 0x5360
movq %rax, %rdi
leaq 0x116a3(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0xdd, %esi
callq 0x5750
movq %rax, %rdi
movq 0x1ae7d(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x1155b(%rip), %rdi     # 0x4066a
leaq 0x12286(%rip), %rsi     # 0x4139c
movl $0xdd, %edx
leaq 0x12286(%rip), %rcx     # 0x413a8
callq 0x51e0
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rax
cmpq 0x28(%rcx), %rax
jne 0x2f292
movq -0x20(%rbp), %rax
testb $0x1, 0x30(%rax)
je 0x2f14f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2f2a2
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2f18d
movq -0x20(%rbp), %rsi
movq 0x10(%rsi), %rdi
addq $0x31, %rsi
movl $0x40000, %edx          # imm = 0x40000
callq 0x54f0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5870
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x2f252
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2f1c0
movq -0x20(%rbp), %rsi
movq 0x8(%rsi), %rdi
addq $0x31, %rsi
movl $0x40000, %edx          # imm = 0x40000
callq 0x57d0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
movq %rcx, 0x28(%rax)
jmp 0x2f250
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x2f1fb
movq -0x20(%rbp), %rsi
movq 0x18(%rsi), %rdi
addq $0x31, %rsi
movl $0x40000, %edx          # imm = 0x40000
callq 0x54f0
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x5870
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x2f24e
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2f207
jmp 0x2f226
leaq 0x121ae(%rip), %rdi     # 0x413bc
leaq 0x12187(%rip), %rsi     # 0x4139c
movl $0xef, %edx
leaq 0x12187(%rip), %rcx     # 0x413a8
callq 0x51e0
movq -0x20(%rbp), %rax
movq %rax, %rdi
addq $0x31, %rdi
movq (%rax), %rcx
movl $0x1, %esi
movl $0x40000, %edx          # imm = 0x40000
callq 0x5600
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x2f250
jmp 0x2f252
movq -0x20(%rbp), %rax
movq $0x0, 0x20(%rax)
cmpq $0x0, 0x28(%rax)
jne 0x2f276
movq -0x20(%rbp), %rax
movb $0x1, 0x30(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2f2a2
movq -0x20(%rbp), %rax
cmpq $0x40000, 0x28(%rax)    # imm = 0x40000
jae 0x2f28c
movq -0x20(%rbp), %rax
movb $0x1, 0x30(%rax)
jmp 0x2f28e
jmp 0x2f290
jmp 0x2f292
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
movzbl 0x31(%rax,%rcx), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)