// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x28(%rbp), %rdx
leaq -0x40(%rbp), %rcx
leaq -0x30(%rbp), %r8
callq 0x154d0
movl -0x3c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x20f01
movl -0x3c(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x20f07
movl -0x40(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %ecx
xorl %eax, %eax
cmpl -0x44(%rbp), %ecx
movb %al, -0x51(%rbp)
jge 0x20f41
movq -0x28(%rbp), %rax
movslq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x30(%rbp), %rcx
movslq -0x48(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x20f4a
jmp 0x20f57
jmp 0x20f4c
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x20f14
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
addl -0x48(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0x48(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2170
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x4c(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x1d010
movq -0x18(%rbp), %rsi
xorl %edi, %edi
callq 0x1d1a0
movq -0x30(%rbp), %rdi
movslq -0x48(%rbp), %rax
addq %rax, %rdi
movl -0x40(%rbp), %esi
subl -0x48(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x1d010
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x4c(%rbp), %rax
addq %rax, %rcx
addq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x2109f
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
addl -0x48(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0x48(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rdi
movl -0x4c(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x1d010
movq -0x20(%rbp), %rsi
xorl %edi, %edi
callq 0x1d1a0
movq -0x28(%rbp), %rdi
movslq -0x48(%rbp), %rax
addq %rax, %rdi
movl -0x3c(%rbp), %esi
subl -0x48(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x1d010
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x4c(%rbp), %rax
addq %rax, %rcx
addq $0x1, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)