// File: /workspace/github_c_makefile_star2_O0/lh3[P]bgt/pbwt.c
// Function: pbf_seek
int pbf_seek(pbf_t *pb, uint64_t k)
{
	int x, i, g;
	uint8_t t;
	if (pb->is_writing) return -1;
	if (k == pb->k) return 0;
	if (k > pb->k && k - pb->k <= 1<<pb->shift) {
		while (pb->k < k) pbf_read(pb);
		return 0;
	}
	if (pb->idx == 0 || k >= pb->n) return -1;
	fseek(pb->fp, pb->idx[k>>pb->shift], SEEK_SET);
	fread(&t, 1, 1, pb->fp);
	assert(t == 'S'); // a bug or corrupted file if it is not an "S" line
	for (g = 0; g < pb->g; ++g) {
		fread(pb->pb[g]->S, 4, pb->m, pb->fp);
		if (pb->n_sub > 0 && pb->n_sub < pb->m) // update pb->sub if needed
			pbf_fill_sub(pb->m, pb->pb[g]->S, pb->n_sub, pb->sub[g], pb->invS, pb->sub_list);
	}
	pb->k = k >> pb->shift << pb->shift;
	x = k & ((1<<pb->shift) - 1);
	for (i = 0; i < x; ++i) pbf_read(pb);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x1bd86
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1bfad
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0x1bda0
movl $0x0, -0x4(%rbp)
jmp 0x1bfad
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jbe 0x1bdf9
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq 0x58(%rcx), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
ja 0x1bdf9
jmp 0x1bdd4
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpq -0x18(%rbp), %rax
jae 0x1bded
movq -0x10(%rbp), %rdi
callq 0x1bb90
jmp 0x1bdd4
movl $0x0, -0x4(%rbp)
jmp 0x1bfad
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x1be12
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jb 0x1be1e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1bfad
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shrq %cl, %rdx
movq %rdx, %rcx
movq (%rax,%rcx,8), %rsi
xorl %edx, %edx
callq 0x2320
movq -0x10(%rbp), %rax
movq (%rax), %rcx
leaq -0x25(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x20f0
movzbl -0x25(%rbp), %eax
cmpl $0x53, %eax
jne 0x1be6c
jmp 0x1be8b
leaq 0xc5f3(%rip), %rdi      # 0x28466
leaq 0xc5f5(%rip), %rsi      # 0x2846f
movl $0x16a, %edx            # imm = 0x16A
leaq 0xc5f0(%rip), %rcx      # 0x28476
callq 0x21b0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x1bf40
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl $0x4, %esi
callq 0x20f0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x40(%rax)
jle 0x1bf30
movq -0x10(%rbp), %rax
movl 0x40(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x1bf30
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movq 0x68(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x50(%rax), %r9
callq 0x1bfc0
jmp 0x1bf32
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1be92
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shrq %cl, %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
shlq %cl, %rax
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
andq %rcx, %rax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1bfa6
movq -0x10(%rbp), %rdi
callq 0x1bb90
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1bf8a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)