// File: /workspace/github_c_makefile_star2_O1/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 0x5077(%rip), %rsi      # 0x1fcb7
xorl %eax, %eax
callq 0x190a5
cmpl $0x0, 0x90(%r14)
jle 0x1ac9e
movl $0x28, %ebx
leaq 0x5061(%rip), %r15      # 0x1fcbe
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 0x190a5
incq %r13
movslq 0x90(%r14), %rax
addq $0x30, %rbx
cmpq %rax, %r13
jl 0x1ac63
movl 0x8(%r14), %ecx
leaq 0x5025(%rip), %rsi      # 0x1fcce
movq %rsp, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x190a5
testl %ebp, %ebp
movq 0x20(%rsp), %r12
jle 0x1aedf
movl %ebp, %eax
movq %rax, 0x38(%rsp)
leaq 0x500c(%rip), %rbp      # 0x1fcdc
xorl %ecx, %ecx
movq (%rsp), %r15
leaq 0x4(%r15), %rbx
cmpq 0x8(%rsp), %rbx
jb 0x1ad2f
movq %rbx, %rax
shrq %rax
orq %rbx, %rax
movq %rcx, %r13
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 %r13, %rcx
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movb $0x9, 0x2(%rax,%r15)
movw $0x4348, (%rax,%r15)    # imm = 0x4348
leaq 0x3(%r15), %rdx
movq %rdx, 0x28(%rsp)
movq %rdx, (%rsp)
movb $0x0, 0x3(%rax,%r15)
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rax
cmpl $0x0, 0x90(%r14)
movq %rcx, 0x40(%rsp)
leaq (%rcx,%rcx,2), %rcx
movq %rcx, 0x30(%rsp)
jle 0x1ae0a
leaq (%r12,%rcx,8), %r15
xorl %ebp, %ebp
movq (%r15), %rcx
btq %rbp, %rcx
setb %r12b
leaq (%rbx,%rbp), %rcx
cmpq %r13, %rcx
jb 0x1add3
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, %r12b
leaq (%rax,%rbx), %rcx
movb %r12b, -0x1(%rbp,%rcx)
movb $0x0, (%rbp,%rcx)
incq %rbp
movslq 0x90(%r14), %rcx
cmpq %rcx, %rbp
jl 0x1ad80
movq 0x28(%rsp), %rcx
addq %rbp, %rcx
movq 0x20(%rsp), %r12
leaq 0x4ed4(%rip), %rbp      # 0x1fcdc
jmp 0x1ae0f
movq 0x28(%rsp), %rcx
movq %rcx, (%rsp)
movq %r13, 0x8(%rsp)
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x8(%r14)
movq %rsp, %r13
jle 0x1ae57
movq 0x30(%rsp), %rax
leaq (%r12,%rax,8), %rbx
addq $0x10, %rbx
xorl %r15d, %r15d
movq (%rbx), %rax
movl (%rax,%r15,4), %edx
movq %r13, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x190a5
incq %r15
movslq 0x8(%r14), %rax
cmpq %rax, %r15
jl 0x1ae37
movq (%rsp), %rbx
leaq 0x1(%rbx), %r15
cmpq 0x8(%rsp), %r15
jb 0x1aeae
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, %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 %r15, (%rsp)
movw $0xa, (%rax,%rbx)
movq 0x30(%rsp), %rax
movq 0x10(%r12,%rax,8), %rdi
callq 0x2050
movq 0x40(%rsp), %rcx
incq %rcx
cmpq 0x38(%rsp), %rcx
jne 0x1acd2
movq %r12, %rdi
callq 0x2050
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq