// File: /workspace/github_c_makefile_star2_O3/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 0xe42a
movq 0x8(%rdi), %r12
movq %rdx, %rbx
leaq 0x20(%r12), %r15
movq $0x0, 0x20(%r12)
movslq 0xc(%rdx), %rax
movq %rax, 0x50(%rsp)
movq 0x18(%rdx), %rax
movq %rax, 0x40(%rsp)
movl 0x8(%r14), %ebp
movq 0x18(%r14), %rax
movq %rax, 0x20(%rsp)
movq 0x10(%r12), %rdi
leaq 0x84(%rsp), %rcx
movl $0xa, %esi
movq %r15, %rdx
callq 0xd494
testl %eax, %eax
js 0xe443
movl 0x4(%r14), %eax
movq %rbx, 0x30(%rsp)
movl %eax, 0x5c(%rbx)
movq 0x30(%r12), %rdi
leaq 0xd591(%rip), %rsi      # 0x1b28d
leaq 0x88(%rsp), %rdx
callq 0x739e
testq %rax, %rax
je 0xe44a
movq %rax, %rbx
movq %r12, 0x78(%rsp)
movq %r15, 0x68(%rsp)
movq %r14, 0x70(%rsp)
movslq %ebp, %rcx
xorl %r15d, %r15d
movq $-0x24, 0x60(%rsp)
movq $-0x9, 0x58(%rsp)
leaq 0x8(%rsp), %rbp
movl $0x0, 0x14(%rsp)
movq %rcx, 0x28(%rsp)
movq %rcx, 0x38(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x30(%rsp), %r14
movq 0xb0(%rsp), %rax
movb $0x0, (%rax)
cmpl $0x5, %r15d
je 0xddbd
cmpl $0x1, %r15d
je 0xddaa
testl %r15d, %r15d
movq %r15, 0x18(%rsp)
jne 0xdddf
movq 0x78(%rsp), %r15
movq 0x18(%r15), %rdi
movq %rbx, %rsi
callq 0xe784
testl %eax, %eax
js 0xe1be
leaq 0x8(%rsp), %rbp
movq 0x18(%rsp), %r15
jmp 0xe3d3
movq %rbx, %rdi
callq 0x2470
decl %eax
movl %eax, 0x4(%r14)
jmp 0xe3d6
movb (%rbx), %al
addb $-0x30, %al
xorps %xmm0, %xmm0
cmpb $0x9, %al
ja 0xddd4
movq %rbx, %rdi
callq 0x2110
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%r14)
jmp 0xe3d6
cmpq $0x8, %r15
ja 0xde14
movq %rbx, %rdi
callq 0x2180
movslq %eax, %r12
movq 0x48(%rsp), %rbp
leaq (%r12,%rbp), %rax
incq %rax
movq 0x50(%rsp), %r13
cmpq %r13, %rax
jae 0xe208
movq 0x40(%rsp), %rax
jmp 0xe249
cmpb $0x2e, (%rbx)
jne 0xdf4b
cmpb $0x2f, 0x1(%rbx)
jne 0xdf4b
cmpb $0x2e, 0x2(%rbx)
jne 0xdf4b
cmpl $0x0, 0x48(%r14)
jle 0xe3d6
leaq -0x9(%r15), %r13
movl $0x8, %r12d
xorl %ebx, %ebx
movq 0x50(%r14), %rax
movl -0x8(%rax,%r12), %ecx
cmpl $0x4750, %ecx           # imm = 0x4750
jle 0xde88
cmpl $0x504b, %ecx           # imm = 0x504B
jg 0xded1
cmpl $0x4751, %ecx           # imm = 0x4751
je 0xdefe
cmpl $0x4754, %ecx           # imm = 0x4754
jne 0xdf32
movq (%rax,%r12), %rax
movb $-0x80, -0x9(%rax,%r15)
jmp 0xdf32
cmpl $0x4450, %ecx           # imm = 0x4450
je 0xdef0
cmpl $0x4456, %ecx           # imm = 0x4456
je 0xdef0
cmpl $0x474c, %ecx           # imm = 0x474C
jne 0xdf32
movl 0x58(%r14), %ecx
leal 0x1(%rcx), %edx
imull %ecx, %edx
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
sarl %ecx
movslq %ecx, %rcx
movq %r13, %rdi
imulq %rcx, %rdi
shlq $0x2, %rdi
addq (%rax,%r12), %rdi
shll $0x2, %ecx
movslq %ecx, %rdx
jmp 0xdf2b
cmpl $0x504c, %ecx           # imm = 0x504C
je 0xdf0a
cmpl $0x5350, %ecx           # imm = 0x5350
jne 0xdf32
movq (%rax,%r12), %rax
movl $0x0, -0x24(%rax,%r15,4)
jmp 0xdf32
movq (%rax,%r12), %rax
movw $0x0, -0x12(%rax,%r15,2)
jmp 0xdf32
movq (%rax,%r12), %rax
movb $0x0, -0x9(%rax,%r15)
jmp 0xdf32
movl 0x58(%r14), %ecx
leal 0x1(%rcx), %edx
imull %ecx, %edx
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
sarl %ecx
movslq %ecx, %rdx
movq %r13, %rdi
imulq %rdx, %rdi
addq (%rax,%r12), %rdi
xorl %esi, %esi
callq 0x21f0
incq %rbx
movslq 0x48(%r14), %rax
addq $0x10, %r12
cmpq %rax, %rbx
jl 0xde48
jmp 0xe3d6
movq %rbx, %rdi
leaq 0xb2d7(%rip), %rsi      # 0x1922c
leaq 0xb8(%rsp), %rdx
callq 0x739e
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xe3d6
movq %rax, %rdi
xorl %ebx, %ebx
movslq 0x48(%r14), %rax
cmpq %rax, %rbx
jge 0xe3d6
movq 0x50(%r14), %rax
movq %rbx, %r12
shlq $0x4, %r12
movl (%rax,%r12), %ecx
cmpl $0x4750, %ecx           # imm = 0x4750
jle 0xdfec
cmpl $0x504b, %ecx           # imm = 0x504B
jg 0xe086
cmpl $0x4751, %ecx           # imm = 0x4751
je 0xe101
cmpl $0x4754, %ecx           # imm = 0x4754
jne 0xe18a
movb (%rdi), %cl
shlb $0x3, %cl
addb $-0x80, %cl
movb 0x2(%rdi), %dl
addb $-0x30, %dl
orb %cl, %dl
cmpb $0x2f, 0x1(%rdi)
setne %cl
shlb $0x6, %cl
orb %dl, %cl
movq 0x8(%rax,%r12), %rax
movq 0x18(%rsp), %rdx
movb %cl, -0x9(%rax,%rdx)
jmp 0xe18a
cmpl $0x4450, %ecx           # imm = 0x4450
je 0xe0d6
cmpl $0x4456, %ecx           # imm = 0x4456
je 0xe0d6
cmpl $0x474c, %ecx           # imm = 0x474C
jne 0xe18a
movq 0x30(%rsp), %rcx
movl 0x58(%rcx), %ecx
leal 0x1(%rcx), %r15d
imull %ecx, %r15d
cmpl $0x2, %r15d
jl 0xe18a
shrl %r15d
movq 0x60(%rsp), %r14
imulq %r15, %r14
addq 0x8(%rax,%r12), %r14
xorl %r12d, %r12d
movq %rbp, %rsi
callq 0x20e0
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, %xmm1
divss 0xd1db(%rip), %xmm1     # 0x1b230
xorps %xmm2, %xmm2
cmpltss %xmm0, %xmm2
andps %xmm2, %xmm1
andnps %xmm0, %xmm2
orps %xmm1, %xmm2
movss %xmm2, (%r14,%r12,4)
movq 0x8(%rsp), %rdi
incq %rdi
movq %rdi, 0x8(%rsp)
incq %r12
cmpq %r12, %r15
jne 0xe03e
jmp 0xe18a
cmpl $0x504c, %ecx           # imm = 0x504C
je 0xe12f
cmpl $0x5350, %ecx           # imm = 0x5350
leaq 0x8(%rsp), %rbp
jne 0xe18a
movq %rbp, %rsi
movl $0xa, %edx
callq 0x22d0
movl $0xffff, %ecx           # imm = 0xFFFF
cmpl %ecx, %eax
cmovgel %ecx, %eax
movq 0x30(%rsp), %rcx
movq 0x50(%rcx), %rcx
movq 0x8(%rcx,%r12), %rcx
movq 0x18(%rsp), %rdx
movl %eax, -0x24(%rcx,%rdx,4)
jmp 0xe18a
movq %rbp, %rsi
movl $0xa, %edx
callq 0x22d0
movl $0xffff, %ecx           # imm = 0xFFFF
cmpl %ecx, %eax
cmovgel %ecx, %eax
movq 0x50(%r14), %rcx
movq 0x8(%rcx,%r12), %rcx
movw %ax, -0x12(%rcx,%r15,2)
jmp 0xe18a
movq %rbp, %rsi
callq 0x20e0
addsd 0xaf5f(%rip), %xmm0     # 0x19070
cvttsd2si %xmm0, %eax
movl $0xff, %ecx
cmpl %ecx, %eax
cmovgel %ecx, %eax
movq 0x50(%r14), %rcx
movq 0x8(%rcx,%r12), %rcx
movb %al, -0x9(%rcx,%r15)
jmp 0xe18a
movl 0x58(%r14), %ecx
leal 0x1(%rcx), %r15d
imull %ecx, %r15d
cmpl $0x2, %r15d
leaq 0x8(%rsp), %rbp
jl 0xe18a
shrl %r15d
movq 0x58(%rsp), %r14
imulq %r15, %r14
addq 0x8(%rax,%r12), %r14
xorl %r12d, %r12d
movq %rbp, %rsi
movl $0xa, %edx
callq 0x22d0
movl $0xff, %ecx
cmpl %ecx, %eax
cmovgel %ecx, %eax
movb %al, (%r14,%r12)
movq 0x8(%rsp), %rdi
incq %rdi
movq %rdi, 0x8(%rsp)
incq %r12
cmpq %r12, %r15
jne 0xe15a
xorl %edi, %edi
xorl %esi, %esi
leaq 0xb8(%rsp), %rdx
callq 0x739e
movq %rax, %rdi
movq %rax, 0x8(%rsp)
incq %rbx
testq %rax, %rax
movq 0x30(%rsp), %r14
movq 0x18(%rsp), %r15
jne 0xdf75
jmp 0xe3d6
movq 0x18(%r15), %r12
movq %rbx, %rdi
callq 0x2510
movq %r12, %rdi
movq %rax, %rsi
callq 0xe8b3
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
callq 0x2180
movslq %eax, %r13
movq 0x28(%rsp), %r12
leaq (%r12,%r13), %rax
incq %rax
movq 0x38(%rsp), %rbp
cmpq %rbp, %rax
jae 0xe2f6
movq 0x20(%rsp), %rax
jmp 0xe33c
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 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x23d0
movq %rax, %r15
leaq (%rax,%rbp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x22e0
movq %r15, %rdi
leaq (%r12,%rbp), %rbx
movb $0x0, (%r15,%rbx)
addq %r12, %rbp
incq %rbp
cmpq %r13, %rbp
jb 0xe2b1
movq %rbp, %rax
shrq %rax
orq %rbp, %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 %rbp, %rax
leaq 0x8(%rsp), %rbp
movq 0x18(%rsp), %r15
movw $0x0, (%rdi,%rbx)
movq %rax, 0x48(%rsp)
movl %eax, 0x8(%r14)
movl %r13d, 0xc(%r14)
movq %rdi, 0x18(%r14)
cmpq $0x8, %r15
movq %rdi, 0x40(%rsp)
movq %r13, 0x50(%rsp)
jne 0xe3d6
movq %r14, %rdi
callq 0xb8ba
jmp 0xe3d6
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, %rbp
shrq $0x10, %rbp
orq %rax, %rbp
incq %rbp
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0x23d0
movq 0x28(%rsp), %r12
movq %rax, %r15
leaq (%rax,%r12), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x22e0
movq %r15, %rdi
leaq (%r12,%r13), %rbx
movb $0x0, (%r15,%rbx)
addq %r13, %r12
incq %r12
cmpq %rbp, %r12
movq %r12, 0x28(%rsp)
jae 0xe371
movq %rbp, 0x38(%rsp)
jmp 0xe3b2
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, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x38(%rsp)
callq 0x23d0
movq %rax, %rdi
leaq 0x8(%rsp), %rbp
movq 0x18(%rsp), %r15
movl 0x14(%rsp), %eax
movq %rdi, 0x20(%rsp)
movw $0x0, (%rdi,%rbx)
movl $0x1, 0x14(%rsp)
movl %eax, (%r14)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x88(%rsp), %rdx
callq 0x739e
movq %rax, %rbx
incq %r15
addq $0x4, 0x60(%rsp)
incq 0x58(%rsp)
testq %rax, %rax
jne 0xdd61
movq 0x70(%rsp), %rdi
movq 0x28(%rsp), %rax
movl %eax, 0x8(%rdi)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rdi)
cmpl $0x0, 0x14(%rsp)
movq 0x68(%rsp), %r15
je 0xe457
callq 0xb73e
jmp 0xe457
movq %r14, %rsi
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbcac
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xe45c
movl %ebp, 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
nop