// File: /workspace/github_c_makefile_star2_O1/lh3[P]bgt/vcf.c
// Function: bcf_hdr_parse_line2
int bcf_hdr_parse_line2(const char *str, uint32_t *info, int *id_beg, int *id_end)
{
	const char *p, *q;
	int ctype;
	int type = -1; // Type
	int num = -1; // Number
	int var = -1; // A, G, ., or fixed
	int ctg_len = -1;

	if (*str != '#' && str[1] != '#') return -1;
	*id_beg = *id_end = *info = -1;
	p = str + 2;
	for (q = p; *q && *q != '='; ++q); // FIXME: do we need to check spaces?
	if (*q == 0) return -2;
	if (q - p == 4 && strncmp(p, "INFO", 4) == 0) ctype = BCF_HL_INFO;
	else if (q - p == 6 && strncmp(p, "FILTER", 6) == 0) ctype = BCF_HL_FLT;
	else if (q - p == 6 && strncmp(p, "FORMAT", 6) == 0) ctype = BCF_HL_FMT;
	else if (q - p == 6 && strncmp(p, "contig", 6) == 0) ctype = BCF_HL_CTG;
	else return -3;
	for (; *q && *q != '<'; ++q);
	if (*q == 0) return -3;
	p = q + 1; // now p points to the first character following '<'
	while (*p && *p != '>') {
		int which = 0;
		char *tmp;
		const char *val;
		for (q = p; *q && *q != '='; ++q);
		if (*q == 0) break;
		if (q - p == 2 && strncmp(p, "ID", 2) == 0) which = 1; // ID
		else if (q - p == 4 && strncmp(p, "Type", 4) == 0) which = 2; // Number
		else if (q - p == 6 && strncmp(p, "Number", 6) == 0) which = 3; // Type
		else if (q - p == 6 && strncmp(p, "length", 6) == 0) which = 4; // length
		val = q + 1;
		if (*val == '"') { // quoted string
			for (q = val + 1; *q && *q != '"'; ++q)
				if (*q == '\\' && *(q+1) != 0) ++q;
			if (*q != '"') return -4; // open double quotation mark
			p = q + 1;
			if (*p == ',') ++p;
			continue;
		}
		for (q = val; *q && *q != ',' && *q != '>'; ++q); // parse val
		if (which == 1) {
			*id_beg = val - str; *id_end = q - str;
		} else if (which == 2) {
			if (q - val == 7 && strncmp(val, "Integer", 7) == 0) type = BCF_HT_INT;
			else if (q - val == 5 && strncmp(val, "Float", 5) == 0) type = BCF_HT_REAL;
			else if (q - val == 6 && strncmp(val, "String", 6) == 0) type = BCF_HT_STR;
			else if (q - val == 4 && strncmp(val, "Flag", 4) == 0) type = BCF_HT_FLAG;
		} else if (which == 3) {
			if (*val == 'A') var = BCF_VL_A;
			else if (*val == 'G') var = BCF_VL_G;
			else if (*val == 'R') var = BCF_VL_R;
			else if (isdigit(*val)) var = BCF_VL_FIXED, num = strtol(val, &tmp, 10);
			else var = BCF_VL_VAR;
			if (var != BCF_VL_FIXED) num = 0xfffff;
		} else if (which == 4) {
			if (isdigit(*val)) ctg_len = strtol(val, &tmp, 10);
		}
		p = q + 1;
	}
	if (ctype == BCF_HL_CTG) {
		if (ctg_len > 0) return ctg_len;
		else return -5;
	} else {
		if (ctype == BCF_HL_FLT) num = 0;
		if (type == BCF_HT_FLAG) {
			if (num != 0 && hts_verbose >= 2)
				fprintf(stderr, "[W::%s] ignore Number for a Flag\n", __func__);
			num = 0, var = BCF_VL_FIXED; // if Flag VCF type, force to change num to 0
		}
		if (num == 0) type = BCF_HT_FLAG, var = BCF_VL_FIXED; // conversely, if num==0, force the type to Flag
		if (*id_beg < 0 || type < 0 || num < 0 || var < 0) return -5; // missing information
		*info = (uint32_t)num<<12 | var<<8 | type<<4 | ctype;
		//printf("%d, %s, %d, %d, [%d,%d]\n", ctype, bcf_type_name[type], var, num, *id_beg, *id_end);
		return 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r15
movq %rdi, %r13
cmpb $0x23, (%rdi)
je 0xaa81
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpb $0x23, 0x1(%r13)
jne 0xab42
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rsi, 0x30(%rsp)
movl %eax, (%rsi)
movl %eax, (%r15)
movq %rdx, 0x38(%rsp)
movl %eax, (%rdx)
leaq 0x2(%r13), %rbx
leaq 0x3(%r13), %r12
xorl %r14d, %r14d
movzbl -0x1(%r12), %eax
testl %eax, %eax
je 0xab3d
cmpl $0x3d, %eax
je 0xaabd
incq %r12
incq %r14
jmp 0xaaa2
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
cmpq $0x6, %r14
je 0xaaec
cmpq $0x4, %r14
jne 0xab42
leaq 0x15184(%rip), %rsi     # 0x1fc59
movl $0x4, %edx
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0xab5c
cmpq $0x6, %r14
jne 0xab42
leaq 0x1472d(%rip), %rsi     # 0x1f220
movl $0x6, %edx
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0xab53
leaq 0x14ceb(%rip), %rsi     # 0x1f7f6
movl $0x6, %edx
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0xab63
leaq 0x14704(%rip), %rsi     # 0x1f227
movl $0x6, %edx
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
jne 0xab42
movl $0x3, %ecx
movb $0x1, %dl
jmp 0xab6a
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edx, %edx
movb $0x1, %sil
xorl %ecx, %ecx
jmp 0xab6c
movl $0x1, %ecx
jmp 0xab68
movl $0x2, %ecx
xorl %edx, %edx
xorl %esi, %esi
movzbl -0x1(%r12), %eax
testl %eax, %eax
je 0xab42
cmpl $0x3c, %eax
je 0xab80
incq %r12
jmp 0xab6c
movl %esi, 0x1c(%rsp)
movl %edx, 0x24(%rsp)
movl %ecx, 0x20(%rsp)
movl $0x1, %eax
subl %r13d, %eax
movq %rax, 0x40(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movl $0x9, %eax
movl %eax, %r14d
leaq 0x145c5(%rip), %rbx     # 0x1f174
movl $0x8, %eax
movl %eax, %eax
movq %rax, 0x48(%rsp)
movabsq $0x4000100000000001, %r9 # imm = 0x4000100000000001
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x8(%rsp)
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x28(%rsp)
movzbl (%r12), %eax
testl %eax, %eax
je 0xb080
cmpl $0x3e, %eax
je 0xb080
xorl %ebp, %ebp
movzbl (%r12,%rbp), %eax
testl %eax, %eax
je 0xacba
cmpl $0x3d, %eax
je 0xac10
incq %rbp
jmp 0xabf9
cmpq $0x6, %rbp
je 0xac80
cmpq $0x4, %rbp
je 0xac58
cmpq $0x2, %rbp
jne 0xacc3
movl $0x2, %edx
movq %r12, %rdi
leaq 0x145f9(%rip), %rsi     # 0x1f22e
callq 0x2090
testl %eax, %eax
je 0xacdb
cmpq $0x6, %rbp
movabsq $0x4000100000000001, %r9 # imm = 0x4000100000000001
je 0xac80
cmpq $0x4, %rbp
jne 0xacc3
movl $0x4, %edx
movq %r12, %rdi
leaq 0x145ca(%rip), %rsi     # 0x1f231
callq 0x2090
testl %eax, %eax
je 0xacd5
cmpq $0x6, %rbp
movabsq $0x4000100000000001, %r9 # imm = 0x4000100000000001
jne 0xacc3
movl $0x6, %edx
movq %r12, %rdi
leaq 0x145a7(%rip), %rsi     # 0x1f236
callq 0x2090
testl %eax, %eax
je 0xaccd
movl $0x6, %edx
movq %r12, %rdi
leaq 0x14596(%rip), %rsi     # 0x1f23d
callq 0x2090
testl %eax, %eax
sete %sil
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0xace3
movslq (%rbx,%r14,4), %rax
addq %rbx, %rax
jmpq *%rax
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
jmp 0xaced
movb $0x1, %dl
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0xace1
movb $0x1, %cl
xorl %eax, %eax
jmp 0xacdf
movb $0x1, %al
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movabsq $0x4000100000000001, %r9 # imm = 0x4000100000000001
movsbq 0x1(%r12,%rbp), %r13
cmpq $0x22, %r13
jne 0xad26
leaq (%r12,%rbp), %rax
addq $0x2, %rax
movzbl (%rax), %ecx
cmpl $0x5c, %ecx
je 0xad18
testl %ecx, %ecx
je 0xae0d
cmpl $0x22, %ecx
jne 0xad21
jmp 0xad85
cmpb $0x0, 0x1(%rax)
je 0xad21
incq %rax
incq %rax
jmp 0xad01
leaq (%r12,%rbp), %rdi
incq %rdi
leaq 0x1(%r12), %r10
xorl %ebx, %ebx
movzbl (%r10,%rbp), %r8d
cmpq $0x3e, %r8
ja 0xad45
btq %r8, %r9
jb 0xad4d
decq %rbx
incq %r10
jmp 0xad34
testb %al, %al
je 0xada3
movq 0x40(%rsp), %rax
addl %r12d, %eax
addl %ebp, %eax
movq 0x38(%rsp), %rcx
movl %eax, (%rcx)
subl %ebx, %eax
movl %eax, (%r15)
addq %rbp, %r12
subq %rbx, %r12
addq $0x2, %r12
xorl %eax, %eax
movl %eax, %eax
leaq 0x143f8(%rip), %rbx     # 0x1f174
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
leaq 0x1(%rax), %r12
leaq 0x2(%rax), %rcx
cmpb $0x2c, 0x1(%rax)
cmoveq %rcx, %r12
movq 0x48(%rsp), %rax
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
testb %cl, %cl
je 0xae1d
movq $-0x4, %rax
subq %rbx, %rax
cmpq $0x3, %rax
ja 0xaff5
movq %rbx, %r13
negq %r13
leaq 0x1439c(%rip), %rcx     # 0x1f164
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x5, %edx
movq %rdi, 0x10(%rsp)
leaq 0x1446a(%rip), %rsi     # 0x1f24c
callq 0x2090
testl %eax, %eax
je 0xafdb
cmpq $0x4, %r13
movq 0x10(%rsp), %rdi
je 0xaf26
cmpq $0x6, %r13
je 0xaefd
jmp 0xafeb
movl $0x1, %eax
movl %eax, %eax
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
testb %dl, %dl
je 0xae7f
cmpb $0x41, %r13b
je 0xafa8
movzbl %r13b, %eax
cmpl $0x52, %eax
je 0xaf6a
cmpl $0x47, %eax
jne 0xafb4
xorl %ecx, %ecx
testb %cl, %cl
movq 0x8(%rsp), %rax
movl $0xfffff, %edx          # imm = 0xFFFFF
cmovel %edx, %eax
movq %rax, 0x8(%rsp)
movl $0x3, %eax
cmovnel %ecx, %eax
movl %eax, 0x4(%rsp)
addq %rbp, %r12
subq %rbx, %r12
addq $0x2, %r12
movl %ecx, %eax
leaq 0x142fe(%rip), %rbx     # 0x1f174
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
testb %sil, %sil
je 0xaff5
movq %rdi, 0x10(%rsp)
callq 0x2460
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r13,2)
je 0xafeb
movq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0xa, %edx
callq 0x2270
movq %rax, 0x28(%rsp)
jmp 0xafeb
movl $0x7, %edx
movq %rdi, 0x10(%rsp)
leaq 0x14374(%rip), %rsi     # 0x1f244
callq 0x2090
testl %eax, %eax
je 0xafe4
cmpq $0x4, %r13
movq 0x10(%rsp), %rdi
je 0xaf26
cmpq $0x6, %r13
je 0xaefd
cmpq $0x5, %r13
je 0xadd1
jmp 0xafeb
movl $0x6, %edx
movq %rdi, %r13
leaq 0x14346(%rip), %rsi     # 0x1f252
callq 0x2090
testl %eax, %eax
je 0xafd2
cmpq $-0x4, %rbx
movq %r13, %rdi
jne 0xafeb
movl $0x4, %edx
leaq 0x14327(%rip), %rsi     # 0x1f259
callq 0x2090
testl %eax, %eax
movl (%rsp), %ecx
cmovel %eax, %ecx
movl %ecx, (%rsp)
addq %rbp, %r12
subq %rbx, %r12
addq $0x2, %r12
xorl %eax, %eax
movl %eax, %eax
leaq 0x1421d(%rip), %rbx     # 0x1f174
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
movabsq $0x4000100000000001, %r9 # imm = 0x4000100000000001
jmpq *%rax
xorl %ecx, %ecx
testb %cl, %cl
movq 0x8(%rsp), %rax
movl $0xfffff, %edx          # imm = 0xFFFFF
cmovel %edx, %eax
movq %rax, 0x8(%rsp)
movl $0x4, %eax
cmovnel %ecx, %eax
movl %eax, 0x4(%rsp)
addq %rbp, %r12
subq %rbx, %r12
addq $0x2, %r12
movl %ecx, %eax
leaq 0x141d5(%rip), %rbx     # 0x1f174
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movl $0x2, %ecx
xorl %eax, %eax
jmp 0xb03a
movq %rdi, 0x10(%rsp)
callq 0x2460
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r13,2)
jne 0xb013
movl $0x1, %ecx
xorl %eax, %eax
jmp 0xb030
movl $0x3, (%rsp)
jmp 0xafeb
movl $0x2, (%rsp)
jmp 0xafeb
movl $0x1, (%rsp)
movabsq $0x4000100000000001, %r9 # imm = 0x4000100000000001
addq %rbp, %r12
subq %rbx, %r12
addq $0x2, %r12
xorl %eax, %eax
movl %eax, %eax
leaq 0x1416a(%rip), %rbx     # 0x1f174
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0xa, %edx
callq 0x2270
movq %rax, 0x8(%rsp)
movb $0x1, %al
xorl %ecx, %ecx
movabsq $0x4000100000000001, %r9 # imm = 0x4000100000000001
testb %al, %al
movq 0x8(%rsp), %rax
movl $0xfffff, %edx          # imm = 0xFFFFF
cmovel %edx, %eax
movq %rax, 0x8(%rsp)
movl $0x0, %eax
cmovnel %eax, %ecx
movl %ecx, 0x4(%rsp)
addq %rbp, %r12
subq %rbx, %r12
addq $0x2, %r12
movl %eax, %eax
leaq 0x14107(%rip), %rbx     # 0x1f174
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
jmp 0xab42
cmpb $0x0, 0x24(%rsp)
je 0xb09b
movq 0x28(%rsp), %rax
testl %eax, %eax
movl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
cmovgl %eax, %ebp
jmp 0xab42
movl 0x20(%rsp), %r15d
xorl %ebx, %ebx
cmpb $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %rax
cmovnel %ebx, %eax
movl (%rsp), %r12d
testl %r12d, %r12d
je 0xb0c5
movl %eax, %ebx
movq 0x30(%rsp), %r14
movl 0x4(%rsp), %eax
jmp 0xb0dc
testl %eax, %eax
movq 0x30(%rsp), %r14
je 0xb0da
leaq 0x1b17b(%rip), %rax     # 0x26250
cmpl $0x2, (%rax)
jge 0xb12b
xorl %eax, %eax
testl %ebx, %ebx
cmovel %ebx, %r12d
cmovel %ebx, %eax
movl %eax, %ecx
movq 0x38(%rsp), %rax
cmpl $0x0, (%rax)
movl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
js 0xab42
movl %r12d, %eax
orl %ebx, %eax
js 0xab42
testl %ecx, %ecx
js 0xab42
movl %ecx, %eax
shll $0xc, %ebx
orl %r15d, %ebx
shll $0x8, %eax
orl %ebx, %eax
shll $0x4, %r12d
orl %eax, %r12d
movl %r12d, (%r14)
xorl %ebp, %ebp
jmp 0xab42
callq 0x2b3c
jmp 0xb0da