// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/htab.cpp
// Function: write_ct_index(void*, char*)
int write_ct_index(void *i_ct_idx, char* file_name)
{
	char* gfa_name = (char*)malloc(strlen(file_name)+25);
    sprintf(gfa_name, "%s.ct_flt", file_name);
    FILE* fp = fopen(gfa_name, "w");
	if (!fp) {
		free(gfa_name);
        return 0;
    }
	ha_ct_t* ct_idx = (ha_ct_t*)i_ct_idx;
	int i;
	ha_ct1_t *g;
	fwrite(&ct_idx->k, sizeof(ct_idx->k), 1, fp);
	fwrite(&ct_idx->pre, sizeof(ct_idx->pre), 1, fp);
	fwrite(&ct_idx->n_hash, sizeof(ct_idx->n_hash), 1, fp);
	fwrite(&ct_idx->n_shift, sizeof(ct_idx->n_shift), 1, fp);
	fwrite(&ct_idx->tot, sizeof(ct_idx->tot), 1, fp);
	for (i = 0; i < 1<<ct_idx->pre; i++)
	{
		g = &(ct_idx->h[i]);
		yak_ct_save(g->h, fp);
	}


	fprintf(stderr, "[M::%s] Index has been written.\n", __func__);
    free(gfa_name);
	fclose(fp);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2090
leaq 0x19(%rax), %rdi
callq 0x2280
movq %rax, %rbx
leaq 0x11f9cc(%rip), %rsi    # 0x23a278
xorl %ebp, %ebp
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x12de20(%rip), %rsi    # 0x2486e2
movq %rbx, %rdi
callq 0x2210
testq %rax, %rax
jne 0x11a8e8
movq %rbx, %rdi
callq 0x2220
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %rbx, 0x8(%rsp)
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rax, %rcx
callq 0x2410
leaq 0x4(%r14), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rdi, 0x10(%rsp)
movq %r15, %rcx
callq 0x2410
leaq 0x8(%r14), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0xc(%r14), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0x10(%r14), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movl 0x4(%r14), %ecx
cmpl $0x1f, %ecx
je 0x11aa6e
xorl %ebx, %ebx
xorl %r13d, %r13d
movq 0x20(%r14), %rax
movq (%rax,%rbx), %rbp
testq %rbp, %rbp
je 0x11aa55
cmpq $0x0, 0x10(%rbp)
je 0x11a998
movb (%rbp), %cl
movl $0x1, %eax
shll %cl, %eax
jmp 0x11a99a
xorl %eax, %eax
movl %eax, 0x4(%rsp)
movl $0x4, %esi
movl $0x1, %edx
leaq 0x4(%rsp), %rdi
movq %r15, %rcx
callq 0x2410
movl $0x4, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq %r15, %rcx
callq 0x2410
leaq 0x4(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movq 0x8(%rbp), %r12
xorl %edi, %edi
testq %r12, %r12
setne %dil
movq %r15, %rsi
callq 0x2270
testq %r12, %r12
je 0x11aa1f
movq 0x8(%rbp), %rdi
movl 0x4(%rsp), %eax
movl %eax, %edx
shrl $0x5, %edx
cmpl $0x20, %eax
movl $0x1, %eax
cmovbl %eax, %edx
movl $0x4, %esi
movq %r15, %rcx
callq 0x2410
movq 0x10(%rbp), %r12
xorl %edi, %edi
testq %r12, %r12
setne %dil
movq %r15, %rsi
callq 0x2270
testq %r12, %r12
je 0x11aa4e
movq 0x10(%rbp), %rdi
movl 0x4(%rsp), %edx
movl $0x8, %esi
movq %r15, %rcx
callq 0x2410
movq 0x10(%rsp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
incq %r13
cltq
addq $0x10, %rbx
cmpq %rax, %r13
jl 0x11a974
movq 0x17a56b(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x11f803(%rip), %rsi    # 0x23a282
leaq 0x11f81d(%rip), %rdx    # 0x23a2a3
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %rdi
callq 0x2220
movq %r15, %rdi
callq 0x2190
movl $0x1, %ebp
jmp 0x11a8d7