// File: /workspace/github_c_makefile_star2_O0/lh3[P]bgt/vcf.c
// Function: vcf_format1
int vcf_format1(const bcf_hdr_t *h, const bcf1_t *v, kstring_t *s)
{
	uint8_t *ptr = (uint8_t*)v->shared.s;
	int i;
	s->l = 0;
	bcf_unpack((bcf1_t*)v, BCF_UN_ALL);
	kputs(h->id[BCF_DT_CTG][v->rid].key, s); // CHROM
	kputc('\t', s); kputw(v->pos + 1, s); // POS
	kputc('\t', s); kputs(v->d.id, s); // ID
	kputc('\t', s); // REF
	if (v->n_allele > 0) kputs(v->d.allele[0], s);
	else kputc('.', s);
	kputc('\t', s); // ALT
	if (v->n_allele > 1) {
		for (i = 1; i < v->n_allele; ++i) {
			if (i > 1) kputc(',', s);
			kputs(v->d.allele[i], s);
		}
	} else kputc('.', s);
	kputc('\t', s); // QUAL
	if (memcmp(&v->qual, &bcf_float_missing, 4) == 0) kputc('.', s); // QUAL
	else ksprintf(s, "%g", v->qual);
	kputc('\t', s); // FILTER
	if (v->d.n_flt) {
		for (i = 0; i < v->d.n_flt; ++i) {
			if (i) kputc(';', s);
			kputs(h->id[BCF_DT_ID][v->d.flt[i]].key, s);
		}
	} else kputc('.', s);
	kputc('\t', s); // INFO
	if (v->n_info) {
		for (i = 0; i < v->n_info; ++i) {
			bcf_info_t *z = &v->d.info[i];
			if (i) kputc(';', s);
			kputs(h->id[BCF_DT_ID][z->key].key, s);
			if (z->len <= 0) continue;
			kputc('=', s);
			if (z->len == 1) {
				if (z->type == BCF_BT_FLOAT) ksprintf(s, "%g", z->v1.f);
				else if (z->type != BCF_BT_CHAR) kputw(z->v1.i, s);
				else kputc(z->v1.i, s);
			} else bcf_fmt_array(s, z->len, z->type, z->vptr);
		}
	} else kputc('.', s);
	// FORMAT and individual information
	ptr = (uint8_t*)v->indiv.s;
	if (v->n_sample && v->n_fmt) { // FORMAT
		int i, j, l, gt_i = -1;
		bcf_fmt_t *fmt;
		fmt = (bcf_fmt_t*)alloca(v->n_fmt * sizeof(bcf_fmt_t));
		ptr = bcf_unpack_fmt_core(ptr, v->n_sample, v->n_fmt, fmt);
		for (i = 0; i < (int)v->n_fmt; ++i) {
			kputc(i? ':' : '\t', s);
			kputs(h->id[BCF_DT_ID][fmt[i].id].key, s);
			if (strcmp(h->id[BCF_DT_ID][fmt[i].id].key, "GT") == 0) gt_i = i;
		}
		for (j = 0; j < v->n_sample; ++j) {
			kputc('\t', s);
			for (i = 0; i < (int)v->n_fmt; ++i) {
				bcf_fmt_t *f = &fmt[i];
				if (i) kputc(':', s);
				if (gt_i == i) {
					int8_t *x = (int8_t*)(f->p + j * f->size); // FIXME: does not work with n_alt >= 64
					for (l = 0; l < f->n && x[l] != bcf_int8_end; ++l) {
						if (l) kputc("/|"[x[l]&1], s);
						if (x[l]>>1) kputw((x[l]>>1) - 1, s);
						else kputc('.', s);
					}
					if (l == 0) kputc('.', s);
				} else bcf_fmt_array(s, f->n, f->type, f->p + j * f->size);
			}
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rdi
movl $0xf, %esi
callq 0x13d00
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x10880
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edi
addl $0x1, %edi
movq -0x18(%rbp), %rsi
callq 0x108c0
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x10880
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x0, %eax
jle 0x14506
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x10880
jmp 0x14514
movq -0x18(%rbp), %rsi
movl $0x2e, %edi
callq 0x10ce0
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x1, %eax
jle 0x14594
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
shrq $0x10, %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jge 0x14592
cmpl $0x1, -0x24(%rbp)
jle 0x1456e
movq -0x18(%rbp), %rsi
movl $0x2c, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rsi
callq 0x10880
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x14540
jmp 0x145a2
movq -0x18(%rbp), %rsi
movl $0x2e, %edi
callq 0x10ce0
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
addq $0xc, %rax
movl (%rax), %eax
movl 0x19de0(%rip), %ecx     # 0x2e3a0
subl %ecx, %eax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x145dd
movq -0x18(%rbp), %rsi
movl $0x2e, %edi
callq 0x10ce0
jmp 0x145fc
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movss 0xc(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x13a3f(%rip), %rsi     # 0x28034
movb $0x1, %al
callq 0x11710
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
je 0x14673
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x5c(%rcx), %eax
jge 0x14671
cmpl $0x0, -0x24(%rbp)
je 0x1463b
movq -0x18(%rbp), %rsi
movl $0x3b, %edi
callq 0x10ce0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x70(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x10880
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1461b
jmp 0x14681
movq -0x18(%rbp), %rsi
movl $0x2e, %edi
callq 0x10ce0
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x0, %eax
je 0x147c7
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jge 0x147c5
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x146f2
movq -0x18(%rbp), %rsi
movl $0x3b, %edi
callq 0x10ce0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x10880
movq -0x30(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jg 0x14723
jmp 0x147b7
movq -0x18(%rbp), %rsi
movl $0x3d, %edi
callq 0x10ce0
movq -0x30(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x14796
movq -0x30(%rbp), %rax
cmpl $0x5, 0x4(%rax)
jne 0x14766
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movss 0xc(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x138d7(%rip), %rsi     # 0x28034
movb $0x1, %al
callq 0x11710
jmp 0x14794
movq -0x30(%rbp), %rax
cmpl $0x7, 0x4(%rax)
je 0x14782
movq -0x30(%rbp), %rax
movl 0xc(%rax), %edi
movq -0x18(%rbp), %rsi
callq 0x108c0
jmp 0x14792
movq -0x30(%rbp), %rax
movl 0xc(%rax), %edi
movq -0x18(%rbp), %rsi
callq 0x10ce0
jmp 0x14794
jmp 0x147b5
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0x113a0
jmp 0x147b7
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x146ad
jmp 0x147d5
movq -0x18(%rbp), %rsi
movl $0x2e, %edi
callq 0x10ce0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x28, %rax
cmpl $0x0, %eax
je 0x14ae4
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
cmpl $0x0, %eax
je 0x14ae4
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movzbl 0x14(%rax), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %ecx
movl %ecx, %eax
leal 0xf(,%rax,8), %eax
andl $-0x10, %eax
movl %eax, %ecx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x28, %rax
movl %eax, %esi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movl %eax, %edx
movq -0x48(%rbp), %rcx
callq 0x13a90
movq %rax, -0x20(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x1492c
movl -0x34(%rbp), %ecx
movl $0x9, %edi
movl $0x3a, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
movq -0x18(%rbp), %rsi
callq 0x10ce0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x10880
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x129b4(%rip), %rsi     # 0x272c0
callq 0x2240
cmpl $0x0, %eax
jne 0x1491c
movl -0x34(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x1491e
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1487a
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
shrq $0x28, %rcx
cmpl %ecx, %eax
jge 0x14ae2
movq -0x18(%rbp), %rsi
movl $0x9, %edi
callq 0x10ce0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x14ad2
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x149a4
movq -0x18(%rbp), %rsi
movl $0x3a, %edi
callq 0x10ce0
movl -0x40(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x14a92
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x38(%rbp), %ecx
movq -0x50(%rbp), %rdx
imull 0xc(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x50(%rbp), %rdx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, -0x59(%rbp)
jge 0x149fa
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $-0x7f, %eax
setne %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x14a03
jmp 0x14a7c
cmpl $0x0, -0x3c(%rbp)
je 0x14a2f
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
andl $0x1, %eax
movslq %eax, %rcx
leaq 0x138dd(%rip), %rax     # 0x282ff
movsbl (%rax,%rcx), %edi
movq -0x18(%rbp), %rsi
callq 0x10ce0
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
sarl %eax
cmpl $0x0, %eax
je 0x14a5e
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %edi
sarl %edi
subl $0x1, %edi
movq -0x18(%rbp), %rsi
callq 0x108c0
jmp 0x14a6c
movq -0x18(%rbp), %rsi
movl $0x2e, %edi
callq 0x10ce0
jmp 0x14a6e
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x149d4
cmpl $0x0, -0x3c(%rbp)
jne 0x14a90
movq -0x18(%rbp), %rsi
movl $0x2e, %edi
callq 0x10ce0
jmp 0x14ac2
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x50(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rcx
movl -0x38(%rbp), %eax
movq -0x50(%rbp), %r8
imull 0xc(%r8), %eax
cltq
addq %rax, %rcx
callq 0x113a0
jmp 0x14ac4
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1495f
jmp 0x14ad4
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x14933
jmp 0x14ae4
xorl %eax, %eax
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)