// File: /workspace/github_c_makefile_star2_O1/lh3[P]bgt/bgt.c
// Function: bgt_al_from_bcf
void bgt_al_from_bcf(const bcf_hdr_t *h, const bcf1_t *b, bgt_allele_t *a, bgt_allele_t *r)
{
	char *ref, *alt;
	const char *chr;
	int l_ref, l_alt, min_l, shift, l_chr;
	bcf_get_ref_alt1(b, &l_ref, &ref, &l_alt, &alt);
	min_l = l_ref < l_alt? l_ref : l_alt;
	for (shift = 0; shift < min_l && ref[shift] == alt[shift]; ++shift);
	a->rid = b->rid, a->pos = b->pos + shift, a->rlen = b->rlen - shift;
	a->chr.l = 0;
	chr = h->id[BCF_DT_CTG][b->rid].key;
	l_chr = strlen(chr);
	kputsn(chr, l_chr, &a->chr);
	kputc(0, &a->chr);
	kputsn(alt + shift, l_alt - shift, &a->chr);
	a->al = a->chr.s + l_chr + 1;
	if (r) {
		r->rid = b->rid, r->pos = b->pos + shift, r->rlen = b->rlen - shift;
		r->chr.l = 0;
		kputsn(chr, l_chr, &r->chr);
		kputc(0, &r->chr);
		kputsn(ref + shift, l_ref - shift, &r->chr);
		r->al = r->chr.s + l_chr + 1;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r12
leaq 0x4(%rsp), %r13
leaq 0x18(%rsp), %rdx
movq %rsp, %rbp
leaq 0x10(%rsp), %r8
movq %rsi, 0x8(%rsp)
movq %rsi, %rdi
movq %r13, %rsi
movq %rbp, %rcx
callq 0x110dd
movl (%r13), %eax
movl (%rbp), %r14d
cmpl %r14d, %eax
cmovll %eax, %r14d
testl %r14d, %r14d
jle 0x19fec
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
movl %r14d, %esi
xorl %edx, %edx
movb (%rax,%rdx), %dil
cmpb (%rcx,%rdx), %dil
jne 0x19ff1
incq %rdx
cmpq %rdx, %rsi
jne 0x19fd8
jmp 0x19ff4
xorl %r14d, %r14d
jmp 0x19ff4
movl %edx, %r14d
movq 0x8(%rsp), %rdx
movslq (%rdx), %rax
movl %eax, 0x20(%r15)
movl 0x4(%rdx), %ecx
addl %r14d, %ecx
movl %ecx, 0x24(%r15)
movl 0x8(%rdx), %ecx
subl %r14d, %ecx
movl %ecx, 0x28(%r15)
movq $0x0, (%r15)
movq 0x20(%r12), %rcx
shlq $0x4, %rax
movq (%rcx,%rax), %r13
movq %r13, %rdi
callq 0x2170
movq %rax, 0x40(%rsp)
movslq %eax, %r12
leaq 0x1(%r12), %rbp
cmpq 0x8(%r15), %rbp
jb 0x1a088
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, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
callq 0x2330
movq %rax, 0x10(%r15)
movq %rbp, 0x28(%rsp)
movq 0x10(%r15), %rdi
addq (%r15), %rdi
movq %r13, 0x38(%rsp)
movq %r13, %rsi
movq %r12, %rdx
callq 0x2280
movq (%r15), %rax
addq %r12, %rax
movq %rax, (%r15)
movq 0x10(%r15), %rcx
movb $0x0, (%rcx,%rax)
movq (%r15), %rax
incq %rax
cmpq 0x8(%r15), %rax
jb 0x1a106
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, 0x8(%r15)
movq 0x10(%r15), %rdi
callq 0x2330
movq %rax, 0x10(%r15)
movq (%r15), %rax
movq 0x10(%r15), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r15)
xorl %edx, %edx
movb %dl, (%rcx,%rax)
movq (%r15), %rax
movq 0x10(%r15), %rcx
movb %dl, (%rcx,%rax)
movl %r14d, %eax
movq 0x10(%rsp), %r13
movq %rax, 0x30(%rsp)
addq %rax, %r13
movslq (%rsp), %rbp
movslq %r14d, %rax
movq %rax, 0x20(%rsp)
subq %rax, %rbp
movq (%r15), %rax
addq %rbp, %rax
incq %rax
cmpq 0x8(%r15), %rax
jb 0x1a196
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, 0x8(%r15)
movq 0x10(%r15), %rdi
callq 0x2330
movq %rax, 0x10(%r15)
movq 0x10(%r15), %rdi
addq (%r15), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2280
addq (%r15), %rbp
movq %rbp, (%r15)
movq 0x10(%r15), %rax
movb $0x0, (%rax,%rbp)
movq 0x10(%r15), %rax
movslq 0x40(%rsp), %r13
addq %r13, %rax
incq %rax
movq %rax, 0x18(%r15)
testq %rbx, %rbx
je 0x1a36d
movq 0x8(%rsp), %rcx
movl (%rcx), %eax
movl %eax, 0x20(%rbx)
movl 0x4(%rcx), %eax
addl %r14d, %eax
movl %eax, 0x24(%rbx)
movl 0x8(%rcx), %eax
subl %r14d, %eax
movl %eax, 0x28(%rbx)
movq $0x0, (%rbx)
movq 0x28(%rsp), %rcx
cmpq 0x8(%rbx), %rcx
jb 0x1a245
movq %rcx, %rax
shrq %rax
orq %rcx, %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, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x2330
movq %rax, 0x10(%rbx)
movq 0x10(%rbx), %rdi
addq (%rbx), %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
callq 0x2280
addq (%rbx), %r12
movq %r12, (%rbx)
movq 0x10(%rbx), %rax
movb $0x0, (%rax,%r12)
movq (%rbx), %rax
incq %rax
cmpq 0x8(%rbx), %rax
movq 0x30(%rsp), %r15
jb 0x1a2be
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, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x2330
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
xorl %edx, %edx
movb %dl, (%rcx,%rax)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movb %dl, (%rcx,%rax)
addq 0x18(%rsp), %r15
movslq 0x4(%rsp), %r14
subq 0x20(%rsp), %r14
movq (%rbx), %rax
addq %r14, %rax
incq %rax
cmpq 0x8(%rbx), %rax
jb 0x1a33e
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, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x2330
movq %rax, 0x10(%rbx)
movq 0x10(%rbx), %rdi
addq (%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2280
addq (%rbx), %r14
movq %r14, (%rbx)
movq 0x10(%rbx), %rax
movb $0x0, (%rax,%r14)
movq 0x10(%rbx), %rax
addq %r13, %rax
incq %rax
movq %rax, 0x18(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq