// File: /workspace/github_c_makefile_star2_O0/lh3[P]bgt/import.c
// Function: main_atomize
int main_atomize(int argc, char *argv[])
{
	int c, vcf_in = 0, bcf_out = 0, write_M = 0, id_GT = -1, use_missing = 1;
	char moder[8], modew[8], *fn_ref = 0;
	htsFile *in, *out;
	bcf_atombuf_t *ab;
	const bcf_atom_t *a;
	bcf1_t *b;

	while ((c = getopt(argc, argv, "0bSMt:")) >= 0) {
		if (c == 'S') vcf_in = 1;
		else if (c == 't') vcf_in = 1, fn_ref = optarg;
		else if (c == 'b') bcf_out = 1;
		else if (c == 'M') write_M = 1;
		else if (c == '0') use_missing = 0;
	}
	if (optind == argc) {
		fprintf(stderr, "Usage: bgt atomize [options] <in.bcf>|<in.vcf>\n");
		fprintf(stderr, "Options:\n");
		fprintf(stderr, "  -b       BCF output\n");
		fprintf(stderr, "  -S       VCF input\n");
		fprintf(stderr, "  -t FILE  list of contig names and lengths (force -S)\n");
		fprintf(stderr, "  -M       use <M> at a multi-allelic site (override -0)\n");
		fprintf(stderr, "  -0       use 0 at a multi-allelic genotype\n");
		return 1;
	}

	strcpy(moder, "r");
	if (vcf_in == 0) strcat(moder, "b");
	in = hts_open(argv[optind], moder, fn_ref);
	assert(in);
	ab = bcf_atombuf_init(in, 0);

	strcpy(modew, "w");
	if (bcf_out) strcat(modew, "b");
	out = hts_open("-", modew, 0);
	vcf_hdr_write(out, ab->h);

	id_GT = bcf_id2int(ab->h, BCF_DT_ID, "GT");
	if (id_GT < 0) {
		bcf_hdr_append(ab->h, "##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
		id_GT = bcf_id2int(ab->h, BCF_DT_ID, "GT");
	}

	b = bcf_init1();
	while ((a = bcf_atom_read(ab)) != 0) {
		bcf_atom2bcf2(a, b, write_M, id_GT, use_missing);
		vcf_write1(out, ab->h, b);
	}
	bcf_destroy1(b);

	hts_close(out);
	bcf_atombuf_destroy(ab);
	hts_close(in);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x24279(%rip), %rdx     # 0x27391
callq 0x23e0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0x3186
cmpl $0x53, -0x14(%rbp)
jne 0x3134
movl $0x1, -0x18(%rbp)
jmp 0x3184
cmpl $0x74, -0x14(%rbp)
jne 0x3151
movl $0x1, -0x18(%rbp)
movq 0x2ae68(%rip), %rax     # 0x2dfb0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x3182
cmpl $0x62, -0x14(%rbp)
jne 0x3160
movl $0x1, -0x1c(%rbp)
jmp 0x3180
cmpl $0x4d, -0x14(%rbp)
jne 0x316f
movl $0x1, -0x20(%rbp)
jmp 0x317e
cmpl $0x30, -0x14(%rbp)
jne 0x317c
movl $0x0, -0x28(%rbp)
jmp 0x317e
jmp 0x3180
jmp 0x3182
jmp 0x3184
jmp 0x310a
movq 0x2ae0b(%rip), %rax     # 0x2df98
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0x324c
movq 0x2ae59(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x241ef(%rip), %rsi     # 0x27398
movb $0x0, %al
callq 0x2260
movq 0x2ae41(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x23ffd(%rip), %rsi     # 0x271be
movb $0x0, %al
callq 0x2260
movq 0x2ae29(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x241ef(%rip), %rsi     # 0x273c8
movb $0x0, %al
callq 0x2260
movq 0x2ae11(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x241ee(%rip), %rsi     # 0x273df
movb $0x0, %al
callq 0x2260
movq 0x2adf9(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x241ec(%rip), %rsi     # 0x273f5
movb $0x0, %al
callq 0x2260
movq 0x2ade1(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x2420c(%rip), %rsi     # 0x2742d
movb $0x0, %al
callq 0x2260
movq 0x2adc9(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x2422e(%rip), %rsi     # 0x27467
movb $0x0, %al
callq 0x2260
movl $0x1, -0x4(%rbp)
jmp 0x33de
leaq -0x30(%rbp), %rdi
leaq 0x24e87(%rip), %rsi     # 0x280de
callq 0x2090
cmpl $0x0, -0x18(%rbp)
jne 0x3272
leaq -0x30(%rbp), %rdi
leaq 0x24d14(%rip), %rsi     # 0x27f81
callq 0x2400
movq -0x10(%rbp), %rax
movq 0x2ad1b(%rip), %rcx     # 0x2df98
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x84f0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x329e
jmp 0x32bd
leaq 0x23dba(%rip), %rdi     # 0x2705f
leaq 0x23fd1(%rip), %rsi     # 0x2727d
movl $0xa5, %edx
leaq 0x241dd(%rip), %rcx     # 0x27495
callq 0x21b0
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq 0x17af0
movq %rax, -0x58(%rbp)
leaq -0x38(%rbp), %rdi
leaq 0x2422d(%rip), %rsi     # 0x27504
callq 0x2090
cmpl $0x0, -0x1c(%rbp)
je 0x32f2
leaq -0x38(%rbp), %rdi
leaq 0x24c94(%rip), %rsi     # 0x27f81
callq 0x2400
leaq -0x38(%rbp), %rsi
leaq 0x241b7(%rip), %rdi     # 0x274b4
xorl %eax, %eax
movl %eax, %edx
callq 0x84f0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x10e10
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
leaq 0x23f94(%rip), %rdx     # 0x272c0
callq 0x14b90
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0x3367
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rdi
leaq 0x23f7a(%rip), %rsi     # 0x272c3
callq 0xfbd0
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
leaq 0x23f61(%rip), %rdx     # 0x272c0
callq 0x14b90
movl %eax, -0x24(%rbp)
movb $0x0, %al
callq 0x100d0
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rdi
callq 0x17d20
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
je 0x33b3
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl -0x20(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
callq 0x17ff0
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x68(%rbp), %rdx
callq 0x14af0
jmp 0x3372
movq -0x68(%rbp), %rdi
callq 0x10100
movq -0x50(%rbp), %rdi
callq 0x87b0
movq -0x58(%rbp), %rdi
callq 0x17c80
movq -0x48(%rbp), %rdi
callq 0x87b0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)