// File: /workspace/github_c_makefile_star2_O3/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
leaq 0x1b9cf(%rip), %r14     # 0x1f7e4
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 0x43c9
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 0x1b3d8(%rip), %rsi     # 0x1f248
movq %r14, %rdi
callq 0x43f4
movq %rax, %r12
movq %r14, %rdi
callq 0x2050
testq %r12, %r12
je 0x43d5
movq %r12, %rdi
callq 0xba37
movq %rax, 0x28(%rsp)
xorl %eax, %eax
callq 0xbb1a
movq %rax, %r13
movq %r12, %rdi
movq %rax, %rsi
callq 0xbb95
xorl %ebp, %ebp
testl %eax, %eax
js 0x4396
xorl %r14d, %r14d
movq %r13, 0x38(%rsp)
movq %r12, 0x20(%rsp)
movq %r13, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x40(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x30(%rsp), %r8
callq 0x1127d
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %eax
cmpl %eax, %ecx
cmovll %ecx, %eax
movl $0x0, %r12d
testl %eax, %eax
jle 0x3f1c
movq 0x40(%rsp), %rcx
movq 0x30(%rsp), %rdx
movl %eax, %esi
xorl %r12d, %r12d
movb (%rcx,%r12), %dil
cmpb (%rdx,%r12), %dil
jne 0x3f1c
incq %r12
cmpq %r12, %rsi
jne 0x3f07
movl %eax, %r12d
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
movslq (%r13), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rbx
movq %rbx, %rdi
callq 0x2170
movslq %eax, %rdx
leaq 0x1(%rdx), %r15
cmpq %r14, %r15
jb 0x3f8d
movq %r15, %rax
shrq %rax
orq %r15, %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, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
movq %rdx, %rbp
callq 0x2330
movq %rbp, %rdx
movq %rax, %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq %rdx, %rbx
callq 0x2280
movb $0x0, (%rbp,%rbx)
cmpq %r14, %r15
jae 0x3faa
movq %rbx, %r9
jmp 0x3fef
movq %r15, %rax
shrq %rax
orq %r15, %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, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2330
movq %rbx, %r9
movq %rax, %rbp
movl $0xcccccccd, %r8d       # imm = 0xCCCCCCCD
movw $0x3a, (%rbp,%r9)
movl 0x4(%r13), %eax
addl %r12d, %eax
incl %eax
je 0x40bf
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
xorl %ebx, %ebx
movl %ecx, %edx
imulq %r8, %rdx
shrq $0x23, %rdx
leal (%rdx,%rdx), %esi
leal (%rsi,%rsi,4), %esi
movl %ecx, %edi
subl %esi, %edi
orb $0x30, %dil
movb %dil, 0x10(%rsp,%rbx)
incq %rbx
cmpl $0x9, %ecx
movl %edx, %ecx
ja 0x4015
testl %eax, %eax
jns 0x4049
movl %ebx, %eax
incl %ebx
movb $0x2d, 0x10(%rsp,%rax)
movslq %ebx, %rax
addq %r9, %rax
addq $0x2, %rax
cmpq %r14, %rax
jb 0x409a
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, %r14
shrq $0x10, %r14
orq %rax, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2330
movq %rax, %rbp
movl %ebx, %eax
incl %ebx
leaq 0xf(%rsp), %rcx
addq %rcx, %rax
movb (%rax), %cl
movb %cl, (%rbp,%r15)
incq %r15
decl %ebx
decq %rax
cmpl $0x1, %ebx
jg 0x40a6
movq %r15, %r9
jmp 0x4116
addq $0x2, %r9
cmpq %r14, %r9
jb 0x4110
movq %r9, %rax
shrq %rax
orq %r9, %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, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
movq %r9, %rbx
callq 0x2330
movq %rbx, %r9
movq %rax, %rbp
movb $0x30, (%rbp,%r15)
movb $0x0, (%rbp,%r9)
leaq 0x1(%r9), %rbx
cmpq %r14, %rbx
jb 0x416d
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, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
movq %r9, %r15
callq 0x2330
movq %r15, %r9
movq %rax, %rbp
movl $0xcccccccd, %r8d       # imm = 0xCCCCCCCD
movw $0x3a, (%rbp,%r9)
movl 0x8(%r13), %eax
subl %r12d, %eax
jne 0x41df
addq $0x2, %r9
cmpq %r14, %r9
jb 0x41d5
movq %r9, %rax
shrq %rax
orq %r9, %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, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
movq %r9, %r15
callq 0x2330
movq %r15, %r9
movq %rax, %rbp
movb $0x30, (%rbp,%rbx)
jmp 0x4296
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
xorl %r15d, %r15d
movl %ecx, %edx
imulq %r8, %rdx
shrq $0x23, %rdx
leal (%rdx,%rdx), %esi
leal (%rsi,%rsi,4), %esi
movl %ecx, %edi
subl %esi, %edi
orb $0x30, %dil
movb %dil, 0x10(%rsp,%r15)
incq %r15
cmpl $0x9, %ecx
movl %edx, %ecx
ja 0x41e9
testl %eax, %eax
jns 0x421f
movl %r15d, %eax
incl %r15d
movb $0x2d, 0x10(%rsp,%rax)
movslq %r15d, %rax
addq %r9, %rax
addq $0x2, %rax
cmpq %r14, %rax
jb 0x4270
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, %r14
shrq $0x10, %r14
orq %rax, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2330
movq %rax, %rbp
movl %r15d, %eax
incl %r15d
leaq 0xf(%rsp), %rcx
addq %rcx, %rax
movb (%rax), %cl
movb %cl, (%rbp,%rbx)
incq %rbx
decl %r15d
decq %rax
cmpl $0x1, %r15d
jg 0x427e
movq %rbx, %r9
movb $0x0, (%rbp,%r9)
leaq 0x1(%r9), %r13
cmpq %r14, %r13
jb 0x42ed
movq %r13, %rax
shrq %rax
orq %r13, %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, %r14
shrq $0x10, %r14
orq %rcx, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
movq %r9, %rbx
callq 0x2330
movq %rbx, %r9
movq %rax, %rbp
movw $0x3a, (%rbp,%r9)
movl %r12d, %ebx
addq 0x30(%rsp), %rbx
movslq 0x8(%rsp), %r15
movslq %r12d, %rax
subq %rax, %r15
leaq (%r9,%r15), %rax
addq $0x2, %rax
cmpq %r14, %rax
jb 0x4357
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, %r14
shrq $0x10, %r14
orq %rax, %r14
incq %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2330
movq %rax, %rbp
movq 0x20(%rsp), %r12
movq %rbp, %rdi
addq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2280
addq %r15, %r13
movb $0x0, (%rbp,%r13)
movq %rbp, %rdi
callq 0x20e0
movq %r12, %rdi
movq 0x38(%rsp), %r13
movq %r13, %rsi
callq 0xbb95
testl %eax, %eax
jns 0x3ec5
movq %r13, %rdi
callq 0xbb29
movq 0x28(%rsp), %rdi
callq 0xb980
movq %r12, %rdi
callq 0x542d
movq %rbp, %rdi
callq 0x2050
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2a9c
movl $0x1, %eax
jmp 0x43ba
leaq 0x1aa2d(%rip), %rdi     # 0x1ee09
leaq 0x1aa29(%rip), %rsi     # 0x1ee0c
leaq 0x1aa29(%rip), %rcx     # 0x1ee13
movl $0xcd, %edx
callq 0x21b0