// File: /workspace/github_c_makefile_star2_O3/lh3[P]bgt/vcf.c
// Function: bcf_unpack
int bcf_unpack(bcf1_t *b, int which)
{
	uint8_t *ptr = (uint8_t*)b->shared.s;
	int *offset, i;
	bcf_dec_t *d = &b->d;
	if (which & BCF_UN_FLT) which |= BCF_UN_STR;
	if (which & BCF_UN_INFO) which |= BCF_UN_SHR;
	if ((which&BCF_UN_STR) && !(b->unpacked&BCF_UN_STR)) { // ID
		kstring_t tmp;
		tmp.l = 0; tmp.m = d->m_str; tmp.s = d->id;
		ptr = bcf_fmt_sized_array(&tmp, ptr); kputc('\0', &tmp);
		// REF and ALT
		offset = (int*)alloca(b->n_allele * sizeof(int));
		for (i = 0; i < b->n_allele; ++i) {
			offset[i] = tmp.l;
			ptr = bcf_fmt_sized_array(&tmp, ptr);
			kputc('\0', &tmp);
		}
		hts_expand(char*, b->n_allele, d->m_allele, d->allele); // NM: hts_expand() is a macro
		for (i = 0; i < b->n_allele; ++i)
			d->allele[i] = tmp.s + offset[i];
		d->m_str = tmp.m; d->id = tmp.s; // write tmp back
		b->unpack_ptr = ptr;
		b->unpacked |= BCF_UN_STR;
	}
	if ((which&BCF_UN_FLT) && !(b->unpacked&BCF_UN_FLT)) { // FILTER
		ptr = b->unpack_ptr;
		if (*ptr>>4) {
			int type;
			d->n_flt = bcf_dec_size(ptr, &ptr, &type);
			hts_expand(int, d->n_flt, d->m_flt, d->flt);
			for (i = 0; i < d->n_flt; ++i)
				d->flt[i] = bcf_dec_int1(ptr, type, &ptr);
		} else ++ptr, d->n_flt = 0;
		b->unpack_ptr = ptr;
		b->unpacked |= BCF_UN_FLT;
	}
	if ((which&BCF_UN_INFO) && !(b->unpacked&BCF_UN_INFO)) { // INFO
		ptr = b->unpack_ptr;
		hts_expand(bcf_info_t, b->n_info, d->m_info, d->info);
		bcf_unpack_info_core(ptr, b->n_info, d->info);
		b->unpacked |= BCF_UN_INFO;
	}
	if ((which&BCF_UN_FMT) && b->n_sample && !(b->unpacked&BCF_UN_FMT)) { // FORMAT
		hts_expand(bcf_fmt_t, b->n_fmt, d->m_fmt, d->fmt);
		bcf_unpack_fmt_core((uint8_t*)b->indiv.s, b->n_sample, b->n_fmt, d->fmt);
		b->unpacked |= BCF_UN_FMT;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %r12d
movq %rdi, %rbx
movl %esi, %eax
shrl %eax
andl $0x1, %eax
testb $0x4, %r12b
movl $0x7, %r13d
cmovel %eax, %r13d
orl %esi, %r13d
testb $0x1, %r13b
je 0xf369
testb $0x1, 0x88(%rbx)
jne 0xf369
movl %r12d, -0x48(%rbp)
movq 0x28(%rbx), %rsi
leaq -0x40(%rbp), %r12
movq $0x0, (%r12)
movslq 0x50(%rbx), %rax
movq %rax, 0x8(%r12)
movq 0x60(%rbx), %rax
movq %rax, 0x10(%r12)
movq %r12, %rdi
callq 0xd7de
movq %rax, %r15
movq (%r12), %rcx
leaq 0x1(%rcx), %rdx
cmpq 0x8(%r12), %rdx
jae 0xf1a2
movq -0x30(%rbp), %rax
jmp 0xf1ef
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2330
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rcx
leaq 0x1(%rcx), %rdx
movl %r13d, -0x44(%rbp)
movq %rdx, -0x40(%rbp)
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movb %dl, (%rcx,%rax)
movq 0x10(%rbx), %rax
movl %eax, %ecx
shrl $0x10, %ecx
leal 0xf(,%rcx,4), %edx
andl $-0x10, %edx
movq %rsp, %r14
subq %rdx, %r14
movq %r14, %rsp
cmpl $0x10000, %eax          # imm = 0x10000
jb 0xf2d4
xorl %r13d, %r13d
xorl %r12d, %r12d
movl -0x40(%rbp), %eax
movl %eax, (%r14,%r12,4)
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0xd7de
movq %rax, %r15
movq -0x40(%rbp), %rdx
leaq 0x1(%rdx), %rcx
cmpq -0x38(%rbp), %rcx
jae 0xf25e
movq -0x30(%rbp), %rax
jmp 0xf2ab
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2330
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, -0x40(%rbp)
movb %r13b, (%rax,%rdx)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movb %r13b, (%rcx,%rax)
incq %r12
movq 0x10(%rbx), %rax
movl %eax, %ecx
shrl $0x10, %ecx
cmpq %rcx, %r12
jb 0xf234
cmpl 0x54(%rbx), %ecx
jle 0xf31e
decl %ecx
movl %ecx, %eax
sarl %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x10, %eax
orl %ecx, %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x54(%rbx)
movq 0x68(%rbx), %rdi
cltq
leaq 0x8(,%rax,8), %rsi
callq 0x2330
movq %rax, 0x68(%rbx)
movq 0x10(%rbx), %rax
shrq $0x10, %rax
testw %ax, %ax
movl -0x48(%rbp), %r12d
movl -0x44(%rbp), %r13d
je 0xf34d
xorl %eax, %eax
movslq (%r14,%rax,4), %rcx
addq -0x30(%rbp), %rcx
movq 0x68(%rbx), %rdx
movq %rcx, (%rdx,%rax,8)
incq %rax
movzwl 0x12(%rbx), %ecx
cmpq %rcx, %rax
jb 0xf331
movl -0x38(%rbp), %eax
movl %eax, 0x50(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x60(%rbx)
movq %r15, 0x90(%rbx)
orb $0x1, 0x88(%rbx)
testb $0x2, %r13b
je 0xf482
testb $0x2, 0x88(%rbx)
jne 0xf482
movq 0x90(%rbx), %r14
movzbl (%r14), %r15d
cmpl $0x10, %r15d
jae 0xf3a0
incq %r14
movl $0x0, 0x5c(%rbx)
jmp 0xf474
cmpb $-0x11, %r15b
jbe 0xf3c3
movzbl 0x1(%r14), %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0xf3ce
cmpl $0x1, %eax
jne 0xf3d9
movsbl 0x2(%r14), %eax
addq $0x3, %r14
jmp 0xf3e1
incq %r14
movl %r15d, %eax
shrl $0x4, %eax
jmp 0xf3e1
movswl 0x2(%r14), %eax
addq $0x4, %r14
jmp 0xf3e1
movl 0x2(%r14), %eax
addq $0x6, %r14
movl %eax, 0x5c(%rbx)
cmpl 0x58(%rbx), %eax
jle 0xf42e
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
leal 0x1(%rcx), %eax
movl %eax, 0x58(%rbx)
movq 0x70(%rbx), %rdi
movslq %ecx, %rax
leaq 0x4(,%rax,4), %rsi
callq 0x2330
movq %rax, 0x70(%rbx)
movl 0x5c(%rbx), %eax
testl %eax, %eax
jle 0xf474
andb $0xf, %r15b
movq 0x70(%rbx), %rax
xorl %ecx, %ecx
movzbl %r15b, %edx
cmpb $0x2, %r15b
je 0xf454
cmpl $0x1, %edx
jne 0xf45e
movsbl (%r14), %esi
incq %r14
jmp 0xf465
movswl (%r14), %esi
addq $0x2, %r14
jmp 0xf465
movl (%r14), %esi
addq $0x4, %r14
movl %esi, (%rax,%rcx,4)
incq %rcx
movslq 0x5c(%rbx), %rsi
cmpq %rsi, %rcx
jl 0xf440
movq %r14, 0x90(%rbx)
orb $0x2, 0x88(%rbx)
testb $0x4, %r13b
je 0xf4fd
testb $0x4, 0x88(%rbx)
jne 0xf4fd
movq 0x90(%rbx), %r15
movzwl 0x10(%rbx), %esi
cmpl 0x4c(%rbx), %esi
jle 0xf4ea
decl %esi
movl %esi, %eax
sarl %eax
orl %esi, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x10, %eax
orl %ecx, %eax
incl %eax
movl %eax, 0x4c(%rbx)
movq 0x78(%rbx), %rdi
cltq
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2330
movq %rax, %rdx
movq %rax, 0x78(%rbx)
movzwl 0x10(%rbx), %esi
jmp 0xf4ee
movq 0x78(%rbx), %rdx
movq %r15, %rdi
callq 0xf004
orb $0x4, 0x88(%rbx)
testb $0x8, %r12b
je 0xf5a8
movq 0x10(%rbx), %rsi
movq %rsi, %rax
shrq $0x28, %rax
je 0xf5a8
testb $0x8, 0x88(%rbx)
jne 0xf5a8
movq %rsi, %rax
shrq $0x20, %rax
movzbl %al, %edx
cmpl 0x48(%rbx), %edx
jle 0xf58d
decl %edx
movl %edx, %eax
sarl %eax
orl %edx, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x10, %eax
orl %ecx, %eax
incl %eax
movl %eax, 0x48(%rbx)
movq 0x80(%rbx), %rdi
cltq
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2330
movq %rax, %rcx
movq %rax, 0x80(%rbx)
movq 0x10(%rbx), %rsi
movq %rsi, %rax
shrq $0x20, %rax
movzbl %al, %edx
jmp 0xf594
movq 0x80(%rbx), %rcx
movq 0x40(%rbx), %rdi
shrq $0x28, %rsi
callq 0xef2e
orb $0x8, 0x88(%rbx)
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq