// File: /workspace/github_c_makefile_star2_O1/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 0xf2e9
testb $0x1, 0x88(%rbx)
jne 0xf2e9
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 0xd5c4
movq %rax, %r15
movq (%r12), %rax
incq %rax
cmpq 0x8(%r12), %rax
jb 0xf16e
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2330
movq %rax, -0x30(%rbp)
movl %r13d, -0x44(%rbp)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, -0x40(%rbp)
xorl %edx, %edx
movb %dl, (%rcx,%rax)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movb %dl, (%rcx,%rax)
movl 0x10(%rbx), %ecx
movl %ecx, %eax
shrl $0x10, %eax
leal 0xf(,%rax,4), %edx
andl $-0x10, %edx
movq %rsp, %r14
subq %rdx, %r14
movq %r14, %rsp
cmpl $0x10000, %ecx          # imm = 0x10000
jb 0xf259
xorl %r13d, %r13d
xorl %r12d, %r12d
movl -0x40(%rbp), %eax
movl %eax, (%r14,%r12,4)
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0xd5c4
movq %rax, %r15
movq -0x40(%rbp), %rax
incq %rax
cmpq -0x38(%rbp), %rax
jb 0xf227
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2330
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, -0x40(%rbp)
movb %r13b, (%rcx,%rax)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movb %r13b, (%rcx,%rax)
incq %r12
movl 0x10(%rbx), %eax
shrl $0x10, %eax
cmpq %rax, %r12
jb 0xf1bf
cmpl 0x54(%rbx), %eax
movl -0x44(%rbp), %r13d
jle 0xf2a4
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, 0x54(%rbx)
movq 0x68(%rbx), %rdi
movslq %ecx, %rax
leaq 0x8(,%rax,8), %rsi
callq 0x2330
movq %rax, 0x68(%rbx)
cmpw $0x0, 0x12(%rbx)
movl -0x48(%rbp), %r12d
je 0xf2cd
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 0xf2b1
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 0xf401
testb $0x2, 0x88(%rbx)
jne 0xf401
movq 0x90(%rbx), %r15
movzbl (%r15), %r14d
cmpl $0x10, %r14d
jae 0xf320
incq %r15
movl $0x0, 0x5c(%rbx)
jmp 0xf3f3
cmpb $-0x11, %r14b
jbe 0xf343
movzbl 0x1(%r15), %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0xf34e
cmpl $0x1, %eax
jne 0xf359
movsbl 0x2(%r15), %eax
addq $0x3, %r15
jmp 0xf361
incq %r15
movl %r14d, %eax
shrl $0x4, %eax
jmp 0xf361
movswl 0x2(%r15), %eax
addq $0x4, %r15
jmp 0xf361
movl 0x2(%r15), %eax
addq $0x6, %r15
movl %eax, 0x5c(%rbx)
cmpl 0x58(%rbx), %eax
jle 0xf3ab
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)
cmpl $0x0, 0x5c(%rbx)
jle 0xf3f3
andb $0xf, %r14b
movq 0x70(%rbx), %rax
xorl %ecx, %ecx
movzbl %r14b, %edx
cmpb $0x2, %r14b
je 0xf3d3
cmpl $0x1, %edx
jne 0xf3dd
movsbl (%r15), %esi
incq %r15
jmp 0xf3e4
movswl (%r15), %esi
addq $0x2, %r15
jmp 0xf3e4
movl (%r15), %esi
addq $0x4, %r15
movl %esi, (%rax,%rcx,4)
incq %rcx
movslq 0x5c(%rbx), %rsi
cmpq %rsi, %rcx
jl 0xf3bf
movq %r15, 0x90(%rbx)
orb $0x2, 0x88(%rbx)
testb $0x4, %r13b
je 0xf478
testb $0x4, 0x88(%rbx)
jne 0xf478
movq 0x90(%rbx), %r15
movzwl 0x10(%rbx), %eax
cmpl 0x4c(%rbx), %eax
jle 0xf461
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
incl %ecx
movl %ecx, 0x4c(%rbx)
movq 0x78(%rbx), %rdi
movslq %ecx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2330
movq %rax, 0x78(%rbx)
movzwl 0x10(%rbx), %esi
movq 0x78(%rbx), %rdx
movq %r15, %rdi
callq 0xef90
orb $0x4, 0x88(%rbx)
testb $0x8, %r12b
je 0xf518
movq 0x10(%rbx), %rax
movq %rax, %rcx
shrq $0x28, %rcx
je 0xf518
testb $0x8, 0x88(%rbx)
jne 0xf518
shrq $0x20, %rax
movzbl %al, %eax
cmpl 0x48(%rbx), %eax
jle 0xf4ef
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
incl %ecx
movl %ecx, 0x48(%rbx)
movq 0x80(%rbx), %rdi
movslq %ecx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2330
movq %rax, 0x80(%rbx)
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rdi
movq %rax, %rsi
shrq $0x28, %rsi
shrq $0x20, %rax
movzbl %al, %edx
movq 0x80(%rbx), %rcx
callq 0xeeba
orb $0x8, 0x88(%rbx)
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq