// File: /workspace/github_c_makefile_star2_O3/lh3[P]bgt/bgt.c
// Function: bgtm_hapcnt_print_destroy
char *bgtm_hapcnt_print_destroy(const bgtm_t *bm, int n_hap, bgt_hapcnt_t *hc)
{
	int i, j;
	kstring_t s = {0,0,0};
	ksprintf(&s, "NA\t%d\n", bm->n_aal);
	for (i = 0; i < bm->n_aal; ++i) {
		bgt_allele_t *a = &bm->aal[i];
		ksprintf(&s, "AA\t%s:%d:%d:%s\n", a->chr.s, a->pos+1, a->rlen, a->al);
	}
	ksprintf(&s, "NH\t%d\t%d\n", n_hap, bm->n_groups);
	for (i = 0; i < n_hap; ++i) {
		kputs("HC\t", &s);
		for (j = 0; j < bm->n_aal; ++j)
			kputc('0' + (hc[i].hap>>j&1), &s);
		for (j = 0; j < bm->n_groups; ++j)
			ksprintf(&s, "\t%d", hc[i].cnt[j]);
		kputc('\n', &s);
		free(hc[i].cnt);
	}
	free(hc);
	return s.s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, 0x20(%rsp)
movl %esi, %ebp
movq %rdi, %r14
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl 0x90(%r14), %edx
leaq 0x460a(%rip), %rsi      # 0x1fcd7
xorl %eax, %eax
callq 0x19831
cmpl $0x0, 0x90(%r14)
jle 0x1b72b
movl $0x28, %ebx
leaq 0x45f4(%rip), %r15      # 0x1fcde
movq %rsp, %r12
xorl %r13d, %r13d
movq 0x98(%r14), %rax
movl -0x4(%rax,%rbx), %ecx
incl %ecx
movl (%rax,%rbx), %r8d
movq -0x18(%rax,%rbx), %rdx
movq -0x10(%rax,%rbx), %r9
movq %r12, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x19831
incq %r13
movslq 0x90(%r14), %rax
addq $0x30, %rbx
cmpq %rax, %r13
jl 0x1b6f0
movl 0x8(%r14), %ecx
leaq 0x45b8(%rip), %rsi      # 0x1fcee
movq %rsp, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x19831
testl %ebp, %ebp
jle 0x1b95e
movl %ebp, %eax
movq %rax, 0x30(%rsp)
movq %rsp, %rax
movq (%rax), %rcx
movq 0x8(%rax), %r13
xorl %ebx, %ebx
movq 0x20(%rsp), %r12
leaq 0x4(%rcx), %rbp
cmpq %r13, %rbp
jae 0x1b772
movq 0x10(%rsp), %rax
jmp 0x1b7b9
movq %rbp, %rax
shrq %rax
orq %rbp, %rax
movq %rcx, %r15
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, %r13
shrq $0x10, %r13
orq %rcx, %r13
incq %r13
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x2330
movq %r15, %rcx
movl $0x94348, (%rax,%rcx)   # imm = 0x94348
addq $0x3, %rcx
cmpl $0x0, 0x90(%r14)
movq %rbx, 0x40(%rsp)
leaq (%rbx,%rbx,2), %rdx
movq %rdx, 0x28(%rsp)
jle 0x1b86c
movq %rcx, 0x38(%rsp)
leaq (%r12,%rdx,8), %r12
xorl %r15d, %r15d
movq (%r12), %rcx
btq %r15, %rcx
setb %bl
leaq (%r15,%rbp), %rcx
cmpq %r13, %rcx
jb 0x1b83f
movq %rcx, %rdx
shrq %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x2, %rcx
orq %rdx, %rcx
movq %rcx, %rdx
shrq $0x4, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x8, %rcx
orq %rdx, %rcx
movq %rcx, %r13
shrq $0x10, %r13
orq %rcx, %r13
incq %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x2330
orb $0x30, %bl
leaq (%rax,%rbp), %rcx
movb %bl, -0x1(%r15,%rcx)
movb $0x0, (%r15,%rcx)
incq %r15
movslq 0x90(%r14), %rcx
cmpq %rcx, %r15
jl 0x1b7ec
movq 0x38(%rsp), %rcx
addq %r15, %rcx
movq 0x20(%rsp), %r12
movq %rcx, (%rsp)
movq %r13, 0x8(%rsp)
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x8(%r14)
movq %rcx, %r15
leaq 0x4473(%rip), %rbp      # 0x1fcfc
jle 0x1b8c7
movq 0x28(%rsp), %rax
leaq (%r12,%rax,8), %rbx
addq $0x10, %rbx
xorl %r15d, %r15d
movq %rsp, %r13
movq (%rbx), %rax
movl (%rax,%r15,4), %edx
movq %r13, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x19831
incq %r15
movslq 0x8(%r14), %rax
cmpq %rax, %r15
jl 0x1b89e
movq (%rsp), %r15
movq 0x8(%rsp), %r13
leaq 0x1(%r15), %rcx
cmpq %r13, %rcx
movq %rcx, %rbx
jae 0x1b8da
movq 0x10(%rsp), %rbp
jmp 0x1b92b
movq %rcx, %rax
shrq %rax
orq %rcx, %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, %r13
shrq $0x10, %r13
orq %rcx, %r13
incq %r13
movq %r13, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x2330
movq %rbx, %rcx
movq %rax, %rbp
movq %rax, 0x10(%rsp)
movq %rcx, (%rsp)
movw $0xa, (%rbp,%r15)
movq 0x28(%rsp), %rax
movq 0x10(%r12,%rax,8), %rdi
callq 0x2050
movq %rbx, %rcx
movq 0x40(%rsp), %rbx
incq %rbx
cmpq 0x30(%rsp), %rbx
jne 0x1b762
jmp 0x1b968
movq 0x10(%rsp), %rbp
movq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x2050
movq %rbp, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq