// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bcftools/vcf.c
// Function: vcf_read
int vcf_read(bcf_t *bp, bcf_hdr_t *h, bcf1_t *b)
{
	int dret, k, i, sync = 0;
	vcf_t *v = (vcf_t*)bp->v;
	char *p, *q;
	kstring_t str, rn;
	ks_tokaux_t aux, a2;
	if (!bp->is_vcf) return bcf_read(bp, h, b);
	v->line.l = 0;
	str.l = 0; str.m = b->m_str; str.s = b->str;
	rn.l = rn.m = h->l_nm; rn.s = h->name;
	if (ks_getuntil(v->ks, '\n', &v->line, &dret) < 0) return -1;
	b->n_smpl = h->n_smpl;
	for (p = kstrtok(v->line.s, "\t", &aux), k = 0; p; p = kstrtok(0, 0, &aux), ++k) {
		*(char*)aux.p = 0;
		if (k == 0) { // ref
			int tid = bcf_str2id(v->refhash, p);
			if (tid < 0) {
				tid = bcf_str2id_add(v->refhash, strdup(p));
				kputs(p, &rn); kputc('\0', &rn);
				sync = 1;
			}
			b->tid = tid;
		} else if (k == 1) { // pos
			b->pos = atoi(p) - 1;
		} else if (k == 5) { // qual
			b->qual = (p[0] >= '0' && p[0] <= '9')? atof(p) : 0;
		} else if (k <= 8) { // variable length strings
			kputs(p, &str); kputc('\0', &str);
			b->l_str = str.l; b->m_str = str.m; b->str = str.s;
			if (k == 8) bcf_sync(b);
		} else { // k > 9
			if (strncmp(p, "./.", 3) == 0) {
				for (i = 0; i < b->n_gi; ++i) {
					if (b->gi[i].fmt == bcf_str2int("GT", 2)) {
						((uint8_t*)b->gi[i].data)[k-9] = 1<<7;
					} else if (b->gi[i].fmt == bcf_str2int("GQ", 2)) {
						((uint8_t*)b->gi[i].data)[k-9] = 0;
					} else if (b->gi[i].fmt == bcf_str2int("SP", 2)) {
						((int32_t*)b->gi[i].data)[k-9] = 0;
					} else if (b->gi[i].fmt == bcf_str2int("DP", 2) || b->gi[i].fmt == bcf_str2int("DV", 2)) {
						((uint16_t*)b->gi[i].data)[k-9] = 0;
					} else if (b->gi[i].fmt == bcf_str2int("PL", 2)) {
						int y = b->n_alleles * (b->n_alleles + 1) / 2;
						memset((uint8_t*)b->gi[i].data + (k - 9) * y, 0, y);
					} else if (b->gi[i].fmt == bcf_str2int("GL", 2)) {
						int y = b->n_alleles * (b->n_alleles + 1) / 2;
						memset((float*)b->gi[i].data + (k - 9) * y, 0, y * 4);
					}
				}
				goto endblock;
			}
			for (q = kstrtok(p, ":", &a2), i = 0; q && i < b->n_gi; q = kstrtok(0, 0, &a2), ++i) {
				if (b->gi[i].fmt == bcf_str2int("GT", 2)) {
					((uint8_t*)b->gi[i].data)[k-9] = (q[0] - '0')<<3 | (q[2] - '0') | (q[1] == '/'? 0 : 1) << 6;
				} else if (b->gi[i].fmt == bcf_str2int("GQ", 2)) {
					double _x = strtod(q, &q);
					int x = (int)(_x + .499);
					if (x > 255) x = 255;
					((uint8_t*)b->gi[i].data)[k-9] = x;
				} else if (b->gi[i].fmt == bcf_str2int("SP", 2)) {
					int x = strtol(q, &q, 10);
					if (x > 0xffff) x = 0xffff;
					((uint32_t*)b->gi[i].data)[k-9] = x;
				} else if (b->gi[i].fmt == bcf_str2int("DP", 2) || b->gi[i].fmt == bcf_str2int("DV", 2)) {
					int x = strtol(q, &q, 10);
					if (x > 0xffff) x = 0xffff;
					((uint16_t*)b->gi[i].data)[k-9] = x;
				} else if (b->gi[i].fmt == bcf_str2int("PL", 2)) {
					int x, y, j;
					uint8_t *data = (uint8_t*)b->gi[i].data;
					y = b->n_alleles * (b->n_alleles + 1) / 2;
					for (j = 0; j < y; ++j) {
						x = strtol(q, &q, 10);
						if (x > 255) x = 255;
						data[(k-9) * y + j] = x;
						++q;
					}
				} else if (b->gi[i].fmt == bcf_str2int("GL", 2)) {
					int j, y;
					float x, *data = (float*)b->gi[i].data;
					y = b->n_alleles * (b->n_alleles + 1) / 2;
					for (j = 0; j < y; ++j) {
						x = strtod(q, &q);
						data[(k-9) * y + j] = x > 0? -x/10. : x;
						++q;
					}
				}
			}
		endblock: i = i;
		}
	}
	h->l_nm = rn.l; h->name = rn.s;
	if (sync) bcf_hdr_sync(h);
	return v->line.l + 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %r14
cmpl $0x0, (%rdi)
je 0xe268
movq 0x8(%rdi), %r13
leaq 0x20(%r13), %r15
movq $0x0, 0x20(%r13)
movslq 0xc(%rdx), %rax
movq %rax, 0x50(%rsp)
movq 0x18(%rdx), %rax
movq %rax, 0x48(%rsp)
movq %rdx, %r12
movl 0x8(%r14), %ebx
movq 0x18(%r14), %rax
movq %rax, 0x20(%rsp)
movq 0x10(%r13), %rdi
leaq 0x84(%rsp), %rcx
movl $0xa, %esi
movq %r15, %rdx
callq 0xd2e8
testl %eax, %eax
js 0xe281
movl 0x4(%r14), %eax
movq %r12, 0x40(%rsp)
movl %eax, 0x5c(%r12)
movq 0x30(%r13), %rdi
leaq 0xd6d6(%rip), %rsi      # 0x1b21d
leaq 0x88(%rsp), %rdx
callq 0x7466
testq %rax, %rax
je 0xe288
movq %rax, %r12
movq %r13, 0x78(%rsp)
movq %r15, 0x60(%rsp)
movq %r14, 0x68(%rsp)
movslq %ebx, %rcx
xorl %ebp, %ebp
movq $-0x24, %r13
movq $-0x9, %r14
movl $0x0, 0xc(%rsp)
movq %rcx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x40(%rsp), %rbx
movq 0xb0(%rsp), %rax
movb $0x0, (%rax)
cmpl $0x5, %ebp
je 0xdc47
cmpl $0x1, %ebp
je 0xdc35
testl %ebp, %ebp
movq %r14, 0x10(%rsp)
jne 0xdc6a
movq 0x78(%rsp), %r14
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe599
testl %eax, %eax
jns 0xe211
movq %r13, 0x28(%rsp)
movq 0x18(%r14), %r14
movq %r12, %rdi
callq 0x2510
movq %r14, %rdi
movq %rax, %rsi
callq 0xe6c1
movl %eax, 0xc(%rsp)
movq %r12, %rdi
callq 0x2180
cltq
movq 0x38(%rsp), %r14
movq %rax, 0x70(%rsp)
addq %r14, %rax
incq %rax
cmpq 0x30(%rsp), %rax
jae 0xe016
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %r13
jmp 0xe05c
movq %r12, %rdi
callq 0x2470
decl %eax
movl %eax, 0x4(%rbx)
jmp 0xe218
movb (%r12), %al
addb $-0x30, %al
xorps %xmm0, %xmm0
cmpb $0x9, %al
ja 0xdc60
movq %r12, %rdi
callq 0x2110
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rbx)
jmp 0xe218
cmpq $0x8, %rbp
ja 0xdca5
movq %r13, 0x28(%rsp)
movq %r12, %rdi
callq 0x2180
movslq %eax, %r14
movq 0x58(%rsp), %rax
addq %r14, %rax
incq %rax
cmpq 0x50(%rsp), %rax
jae 0xdf26
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %r13
jmp 0xdf67
movl $0x3, %edx
movq %r12, %rdi
leaq 0xd4fe(%rip), %rsi      # 0x1b1b2
callq 0x2090
testl %eax, %eax
je 0xe09d
movq %r12, %rdi
leaq 0xb509(%rip), %rsi      # 0x191d4
leaq 0xb8(%rsp), %rdx
callq 0x7466
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0xe1ac
xorl %r14d, %r14d
movslq 0x48(%rbx), %rcx
cmpq %rcx, %r14
jge 0xe1ac
movq 0x50(%rbx), %rcx
movq %r14, %r12
shlq $0x4, %r12
movl (%rcx,%r12), %edx
cmpl $0x4750, %edx           # imm = 0x4750
jle 0xdd5f
cmpl $0x504b, %edx           # imm = 0x504B
jg 0xddf6
cmpl $0x4751, %edx           # imm = 0x4751
je 0xde70
cmpl $0x4754, %edx           # imm = 0x4754
jne 0xdefa
movb (%rax), %dl
shlb $0x3, %dl
addb $-0x80, %dl
movb 0x2(%rax), %sil
addb $-0x30, %sil
orb %dl, %sil
cmpb $0x2f, 0x1(%rax)
setne %al
shlb $0x6, %al
orb %sil, %al
movq 0x8(%rcx,%r12), %rcx
movb %al, -0x9(%rcx,%rbp)
jmp 0xdefa
cmpl $0x4450, %edx           # imm = 0x4450
je 0xde41
cmpl $0x4456, %edx           # imm = 0x4456
je 0xde41
cmpl $0x474c, %edx           # imm = 0x474C
jne 0xdefa
movq 0x40(%rsp), %rax
movl 0x58(%rax), %eax
leal 0x1(%rax), %r15d
imull %eax, %r15d
cmpl $0x2, %r15d
jl 0xdefa
shrl %r15d
movq %r13, %rbx
imulq %r15, %rbx
addq 0x8(%rcx,%r12), %rbx
xorl %r12d, %r12d
movq 0x18(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x20e0
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, %xmm1
divss 0xd3f3(%rip), %xmm1     # 0x1b1c0
xorps %xmm2, %xmm2
cmpltss %xmm0, %xmm2
andps %xmm2, %xmm1
andnps %xmm0, %xmm2
orps %xmm1, %xmm2
movss %xmm2, (%rbx,%r12,4)
incq 0x18(%rsp)
incq %r12
cmpq %r12, %r15
jne 0xddaf
jmp 0xdefa
cmpl $0x504c, %edx           # imm = 0x504C
je 0xdea2
cmpl $0x5350, %edx           # imm = 0x5350
jne 0xdefa
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x22d0
movl $0xffff, %ecx           # imm = 0xFFFF
cmpl %ecx, %eax
cmovgel %ecx, %eax
movq 0x40(%rsp), %rcx
movq 0x50(%rcx), %rcx
movq 0x8(%rcx,%r12), %rcx
movl %eax, -0x24(%rcx,%rbp,4)
jmp 0xdefa
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x22d0
movl $0xffff, %ecx           # imm = 0xFFFF
cmpl %ecx, %eax
cmovgel %ecx, %eax
movq 0x50(%rbx), %rcx
movq 0x8(%rcx,%r12), %rcx
movw %ax, -0x12(%rcx,%rbp,2)
jmp 0xdefa
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x20e0
addsd 0xb183(%rip), %xmm0     # 0x19008
cvttsd2si %xmm0, %eax
movl $0xff, %ecx
cmpl %ecx, %eax
cmovgel %ecx, %eax
movq 0x50(%rbx), %rcx
movq 0x8(%rcx,%r12), %rcx
movb %al, -0x9(%rcx,%rbp)
jmp 0xdefa
movl 0x58(%rbx), %eax
leal 0x1(%rax), %r15d
imull %eax, %r15d
cmpl $0x2, %r15d
jl 0xdefa
shrl %r15d
movq 0x10(%rsp), %rbx
imulq %r15, %rbx
addq 0x8(%rcx,%r12), %rbx
xorl %r12d, %r12d
movq 0x18(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x22d0
movl $0xff, %ecx
cmpl %ecx, %eax
jl 0xdee9
movl $0xff, %eax
movb %al, (%rbx,%r12)
incq 0x18(%rsp)
incq %r12
cmpq %r12, %r15
jne 0xdec7
xorl %edi, %edi
xorl %esi, %esi
leaq 0xb8(%rsp), %rdx
callq 0x7466
movq %rax, 0x18(%rsp)
incq %r14
testq %rax, %rax
movq 0x40(%rsp), %rbx
jne 0xdce9
jmp 0xe1ac
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, %r13
shrq $0x10, %r13
orq %rax, %r13
incq %r13
movq 0x48(%rsp), %rdi
movq %r13, %rsi
callq 0x23d0
movq %rax, %r15
movq 0x58(%rsp), %rax
leaq (%r15,%rax), %rdi
movq %r12, %rsi
movq %rax, %r12
movq %r14, %rdx
callq 0x22e0
movq %r15, %rdi
leaq (%r14,%r12), %r15
movb $0x0, (%rdi,%r15)
addq %r14, %r12
incq %r12
cmpq %r13, %r12
jb 0xdfd7
movq %r12, %rax
shrq %rax
orq %r12, %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, %r13
shrq $0x10, %r13
orq %rcx, %r13
incq %r13
movq %r13, %rsi
callq 0x23d0
movq %rax, %rdi
movq 0x10(%rsp), %r14
movw $0x0, (%rdi,%r15)
movq %r12, 0x58(%rsp)
movl %r12d, 0x8(%rbx)
movq %r13, 0x50(%rsp)
movl %r13d, 0xc(%rbx)
movq %rdi, 0x18(%rbx)
cmpq $0x8, %rbp
movq %rdi, 0x48(%rsp)
jne 0xe00c
movq %rbx, %rdi
callq 0xb77e
movq 0x28(%rsp), %r13
jmp 0xe218
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, %r13
shrq $0x10, %r13
orq %rax, %r13
incq %r13
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x23d0
movq 0x38(%rsp), %r14
movq %rax, %r15
leaq (%rax,%r14), %rdi
movq %r12, %rsi
movq 0x70(%rsp), %r12
movq %r12, %rdx
callq 0x22e0
movq %r15, %rdi
leaq (%r12,%r14), %r15
movb $0x0, (%rdi,%r15)
addq %r12, %r14
incq %r14
cmpq %r13, %r14
movq %r14, 0x38(%rsp)
jae 0xe1b3
movq %r13, 0x30(%rsp)
jmp 0xe1f4
cmpl $0x0, 0x48(%rbx)
jle 0xe1ac
leaq -0x9(%rbp), %r15
movl $0x8, %r12d
xorl %r14d, %r14d
movq 0x50(%rbx), %rax
movl -0x8(%rax,%r12), %ecx
cmpl $0x4750, %ecx           # imm = 0x4750
jle 0xe0f3
cmpl $0x504b, %ecx           # imm = 0x504B
jg 0xe13b
cmpl $0x4751, %ecx           # imm = 0x4751
je 0xe166
cmpl $0x4754, %ecx           # imm = 0x4754
jne 0xe198
movq (%rax,%r12), %rax
movb $-0x80, -0x9(%rax,%rbp)
jmp 0xe198
cmpl $0x4450, %ecx           # imm = 0x4450
je 0xe159
cmpl $0x4456, %ecx           # imm = 0x4456
je 0xe159
cmpl $0x474c, %ecx           # imm = 0x474C
jne 0xe198
movl 0x58(%rbx), %ecx
leal 0x1(%rcx), %edx
imull %ecx, %edx
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
sarl %ecx
movslq %ecx, %rcx
movq %r15, %rdi
imulq %rcx, %rdi
shlq $0x2, %rdi
addq (%rax,%r12), %rdi
shll $0x2, %ecx
movslq %ecx, %rdx
jmp 0xe191
cmpl $0x504c, %ecx           # imm = 0x504C
je 0xe171
cmpl $0x5350, %ecx           # imm = 0x5350
jne 0xe198
movq (%rax,%r12), %rax
movl $0x0, -0x24(%rax,%rbp,4)
jmp 0xe198
movq (%rax,%r12), %rax
movw $0x0, -0x12(%rax,%rbp,2)
jmp 0xe198
movq (%rax,%r12), %rax
movb $0x0, -0x9(%rax,%rbp)
jmp 0xe198
movl 0x58(%rbx), %ecx
leal 0x1(%rcx), %edx
imull %ecx, %edx
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
sarl %ecx
movslq %ecx, %rdx
movq %r15, %rdi
imulq %rdx, %rdi
addq (%rax,%r12), %rdi
xorl %esi, %esi
callq 0x21f0
incq %r14
movslq 0x48(%rbx), %rax
addq $0x10, %r12
cmpq %rax, %r14
jl 0xe0b4
movq 0x10(%rsp), %r14
jmp 0xe218
movq %r14, %rax
shrq %rax
orq %r14, %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, 0x30(%rsp)
callq 0x23d0
movq %rax, %rdi
movq 0x28(%rsp), %r13
movl 0xc(%rsp), %eax
movq %rdi, 0x20(%rsp)
movw $0x0, (%rdi,%r15)
movl $0x1, 0xc(%rsp)
movq 0x10(%rsp), %r14
movl %eax, (%rbx)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x88(%rsp), %rdx
callq 0x7466
movq %rax, %r12
incq %rbp
addq $0x4, %r13
incq %r14
testq %rax, %rax
jne 0xdba2
movq 0x68(%rsp), %rdi
movq 0x38(%rsp), %rax
movl %eax, 0x8(%rdi)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rdi)
cmpl $0x0, 0xc(%rsp)
movq 0x60(%rsp), %r15
je 0xe295
callq 0xb602
jmp 0xe295
movq %r14, %rsi
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbb50
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xe29a
movl %ebx, 0x8(%r14)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%r14)
movl (%r15), %eax
incl %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq