// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x21e0
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x243c5(%rip), %rdx     # 0x28465
callq 0x23e0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0x40af
jmp 0x4092
movl -0x8(%rbp), %eax
movq 0x29edf(%rip), %rcx     # 0x2df98
subl (%rcx), %eax
cmpl $0x0, %eax
jne 0x40e4
movq 0x29f31(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x23c98(%rip), %rsi     # 0x27d69
movb $0x0, %al
callq 0x2260
movl $0x1, -0x4(%rbp)
jmp 0x42f6
movq -0x10(%rbp), %rax
movq 0x29ea9(%rip), %rcx     # 0x2df98
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2170
movq %rax, %rdi
addq $0x5, %rdi
movl $0x1, %esi
callq 0x2230
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x29e79(%rip), %rcx     # 0x2df98
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x2322b(%rip), %rsi     # 0x27358
movb $0x0, %al
callq 0x2410
movq -0x20(%rbp), %rdi
leaq 0x23f9f(%rip), %rsi     # 0x280de
callq 0x47c0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2040
cmpq $0x0, -0x28(%rbp)
je 0x415a
jmp 0x4179
leaq 0x23c26(%rip), %rdi     # 0x27d87
leaq 0x23c22(%rip), %rsi     # 0x27d8a
movl $0xcd, %edx
leaq 0x23c1d(%rip), %rcx     # 0x27d91
callq 0x21b0
movq -0x28(%rbp), %rdi
callq 0xff80
movq %rax, -0x38(%rbp)
movb $0x0, %al
callq 0x100d0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x10250
cmpl $0x0, %eax
jl 0x42cb
movq -0x30(%rbp), %rdi
leaq -0x64(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0x68(%rbp), %rcx
leaq -0x60(%rbp), %r8
callq 0x154d0
movl -0x64(%rbp), %eax
cmpl -0x68(%rbp), %eax
jge 0x41d0
movl -0x64(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x41d6
movl -0x68(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0x70(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x70(%rbp), %ecx
movb %al, -0x75(%rbp)
jge 0x4210
movq -0x58(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x60(%rbp), %rcx
movslq -0x6c(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x75(%rbp)
movb -0x75(%rbp), %al
testb $0x1, %al
jne 0x4219
jmp 0x4226
jmp 0x421b
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x41e3
movq $0x0, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4310
movl $0x3a, %edi
leaq -0x50(%rbp), %rsi
callq 0x4350
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edi
addl $0x1, %edi
addl -0x6c(%rbp), %edi
leaq -0x50(%rbp), %rsi
callq 0x4480
movl $0x3a, %edi
leaq -0x50(%rbp), %rsi
callq 0x4350
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edi
subl -0x6c(%rbp), %edi
leaq -0x50(%rbp), %rsi
callq 0x4480
movl $0x3a, %edi
leaq -0x50(%rbp), %rsi
callq 0x4350
movq -0x60(%rbp), %rdi
movslq -0x6c(%rbp), %rax
addq %rax, %rdi
movl -0x68(%rbp), %esi
subl -0x6c(%rbp), %esi
leaq -0x50(%rbp), %rdx
callq 0x4670
movq -0x40(%rbp), %rdi
callq 0x20e0
jmp 0x4191
movq -0x30(%rbp), %rdi
callq 0x10100
movq -0x38(%rbp), %rdi
callq 0xfe40
movq -0x28(%rbp), %rdi
callq 0x5c50
movq -0x40(%rbp), %rdi
callq 0x2040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)