// File: /workspace/github_c_makefile_star2_O1/lh3[P]bgt/view.c
// Function: main_getalt
int main_getalt(int argc, char *argv[])
{
	int c;
	char *fn;
	BGZF *fp;
	bcf1_t *b;
	bcf_hdr_t *h;
	kstring_t s = {0,0,0};

	while ((c = getopt(argc, argv, "")) >= 0) {
	}
	if (argc - optind == 0) {
		fprintf(stderr, "Usage: bgt getalt <bgt-base>\n");
		return 1;
	}

	fn = (char*)calloc(strlen(argv[optind]) + 5, 1);
	sprintf(fn, "%s.bcf", argv[optind]);
	fp = bgzf_open(fn, "r");
	free(fn);
	assert(fp);

	h = bcf_hdr_read(fp);
	b = bcf_init1();
	while (bcf_read1(fp, b) >= 0) {
		char *ref, *alt;
		int l_ref, l_alt, i, min_l;
		bcf_get_ref_alt1(b, &l_ref, &ref, &l_alt, &alt);
		min_l = l_ref < l_alt? l_ref : l_alt;
		for (i = 0; i < min_l && ref[i] == alt[i]; ++i);
		s.l = 0;
		kputs(h->id[BCF_DT_CTG][b->rid].key, &s);
		kputc(':', &s); kputw(b->pos + 1 + i, &s);
		kputc(':', &s); kputw(b->rlen - i, &s);
		kputc(':', &s); kputsn(alt + i, l_alt - i, &s);
		puts(s.s);
	}
	bcf_destroy1(b);
	bcf_hdr_destroy(h);

	bgzf_close(fp);
	free(s.s);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x1b9af(%rip), %r14     # 0x1f7c4
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x23d0
testl %eax, %eax
jns 0x3e15
movq 0x2216b(%rip), %rax     # 0x25f98
movslq (%rax), %rax
cmpl %ebp, %eax
je 0x41cc
movq (%rbx,%rax,8), %rbx
movq %rbx, %rdi
callq 0x2170
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x2220
movq %rax, %r14
leaq 0x1a4fc(%rip), %rsi     # 0x1e358
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x23f0
leaq 0x1b3cb(%rip), %rsi     # 0x1f23b
movq %r14, %rdi
callq 0x434c
movq %rax, %rbx
movq %r14, %rdi
callq 0x2050
testq %rbx, %rbx
je 0x41d8
movq %rbx, %rdi
callq 0xb8f8
movq %rax, 0x28(%rsp)
xorl %eax, %eax
callq 0xb9db
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0xba56
testl %eax, %eax
js 0x4197
movq %rbx, 0x38(%rsp)
movq %r15, %rdi
leaq 0x24(%rsp), %rsi
leaq 0x40(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x30(%rsp), %r8
callq 0x110dd
movl 0x24(%rsp), %ecx
movl 0x20(%rsp), %eax
cmpl %eax, %ecx
cmovll %ecx, %eax
movl $0x0, %r13d
testl %eax, %eax
jle 0x3f12
movq 0x40(%rsp), %rcx
movq 0x30(%rsp), %rdx
movl %eax, %esi
xorl %r13d, %r13d
movb (%rcx,%r13), %dil
cmpb (%rdx,%r13), %dil
jne 0x3f12
incq %r13
cmpq %r13, %rsi
jne 0x3efd
movl %eax, %r13d
movq $0x0, (%rsp)
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
movslq (%r15), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %r12
movq %r12, %rdi
callq 0x2170
movslq %eax, %rbp
leaq 0x1(%rbp), %rbx
cmpq 0x8(%rsp), %rbx
jb 0x3f8c
movq %rbx, %rax
shrq %rax
orq %rbx, %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(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x2280
movq %rbp, (%rsp)
movb $0x0, (%r14,%rbp)
cmpq 0x8(%rsp), %rbx
jb 0x3ff5
movq %rbx, %rax
shrq %rax
orq %rbx, %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(%rsp)
movq %r14, %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rbx, (%rsp)
movw $0x3a, (%rax,%rbp)
movl 0x4(%r15), %eax
leal (%rax,%r13), %edi
incl %edi
movq %rsp, %rsi
callq 0x41f7
movq (%rsp), %rbx
leaq 0x1(%rbx), %r14
cmpq 0x8(%rsp), %r14
jb 0x406d
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, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %r14, (%rsp)
movw $0x3a, (%rax,%rbx)
movl 0x8(%r15), %edi
subl %r13d, %edi
movq %rsp, %rsi
callq 0x41f7
movq (%rsp), %r14
leaq 0x1(%r14), %rbx
cmpq 0x8(%rsp), %rbx
jb 0x40e2
movq %rbx, %rax
shrq %rax
orq %rbx, %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(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq %rbx, (%rsp)
movw $0x3a, (%rdi,%r14)
movl %r13d, %r12d
addq 0x30(%rsp), %r12
movslq 0x20(%rsp), %rbp
movslq %r13d, %rax
subq %rax, %rbp
leaq (%r14,%rbp), %rax
addq $0x2, %rax
cmpq 0x8(%rsp), %rax
jb 0x4157
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(%rsp)
callq 0x2330
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %r14
leaq (%r14,%rbx), %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x2280
addq %rbp, %rbx
movq %rbx, (%rsp)
movb $0x0, (%r14,%rbx)
movq %r14, %rdi
callq 0x20e0
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xba56
testl %eax, %eax
jns 0x3ebb
movq %r15, %rdi
callq 0xb9ea
movq 0x28(%rsp), %rdi
callq 0xb84a
movq %rbx, %rdi
callq 0x5040
movq 0x10(%rsp), %rdi
callq 0x2050
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2a79
movl $0x1, %eax
jmp 0x41bd
leaq 0x1ac2a(%rip), %rdi     # 0x1ee09
leaq 0x1ac26(%rip), %rsi     # 0x1ee0c
leaq 0x1ac26(%rip), %rcx     # 0x1ee13
movl $0xcd, %edx
callq 0x21b0