LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: write_mc_gg_dump(kv_u_trans_t*, unsigned int, kv_gg_status*, unsigned short, char const*)
void write_mc_gg_dump(kv_u_trans_t *ta, uint32_t un, kv_gg_status *s, uint16_t hapN, const char* fn)
{
	fprintf(stderr, "\n[M::%s]\n", __func__);
	char *buf = (char*)calloc(strlen(fn) + 50, 1);
    sprintf(buf, "%s.hic.dbg.dump.bin", fn);
    FILE* fp = fopen(buf, "w");

	fwrite(&ta->n, sizeof(ta->n), 1, fp);
    fwrite(ta->a, sizeof(u_trans_t), ta->n, fp);

    fwrite(&ta->idx.n, sizeof(ta->idx.n), 1, fp);
    fwrite(ta->idx.a, sizeof(uint64_t), ta->idx.n, fp);

	fwrite(&un, sizeof(un), 1, fp);

	fwrite(&(s->n), sizeof(s->n), 1, fp);
    fwrite(s->a, sizeof(mc_gg_status), s->n, fp);

	fwrite(&hapN, sizeof(hapN), 1, fp);

	fclose(fp);
    free(buf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rdx, %r14
movq %rdi, %rbp
leaq 0x4(%rsp), %rax
movl %esi, (%rax)
leaq 0x2(%rsp), %rax
movw %cx, (%rax)
movq 0x125d4e(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xc111f(%rip), %rsi     # 0x1ee3bb
leaq 0xc20aa(%rip), %rdx     # 0x1ef34d
xorl %eax, %eax
callq 0x22b0
movq %rbx, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
pushq $0x1
popq %r12
movq %r12, %rsi
callq 0x2120
movq %rax, %r15
leaq 0xc2092(%rip), %rsi     # 0x1ef35e
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0xcd3c1(%rip), %rsi     # 0x1fa6a1
movq %r15, %rdi
callq 0x2210
movq %rax, %rbx
pushq $0x8
popq %r13
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x2410
movq (%rbp), %rdx
movq 0x10(%rbp), %rdi
pushq $0x30
popq %rsi
movq %rbx, %rcx
callq 0x2410
leaq 0x18(%rbp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x18(%rbp), %rdx
movq 0x28(%rbp), %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq 0x2410
pushq $0x4
popq %rsi
leaq 0x4(%rsp), %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
leaq 0x8(%r14), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq (%r14), %rdi
movq 0x8(%r14), %rdx
pushq $0x20
popq %rsi
movq %rbx, %rcx
callq 0x2410
pushq $0x2
popq %rsi
leaq 0x2(%rsp), %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq %rbx, %rdi
callq 0x2190
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: debug_mc_gg_t(char const*, unsigned int, unsigned int)
void debug_mc_gg_t(const char* fn, uint32_t update_ta, uint32_t convert_mc_g_t)
{
	kv_u_trans_t *ta = NULL;
	kv_gg_status *s = NULL;
	uint32_t un;
	uint16_t hapN;
	if(load_mc_gg_dump(&ta, &un, &s, &hapN, fn))
	{
		if(convert_mc_g_t)
		{
			mc_opt_t opt;
			mc_opt_init(&opt, asm_opt.n_perturb, asm_opt.f_perturb, asm_opt.seed);
			mc_g_t *mg = NULL;
			mg = to_mc_g_t(ta, s, un);
			char *o_file = get_outfile_name(asm_opt.output_file_name);
			trans_chain* t_ch = load_hc_trans(o_file);
			mb_solve_core(&opt, mg, &(t_ch->k_trans), 1);
			mc_solve_core(&opt, mg, NULL);
		}
		else
		{
			mc_solve_general(ta, un, s, hapN, update_ta, 0);
		}
	}
	exit(1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movl %edx, %ebx
movq %rdi, %r8
leaq 0x18(%rsp), %rdi
andq $0x0, (%rdi)
leaq 0x10(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x8(%rsp), %rsi
leaq 0xe(%rsp), %rcx
callq 0x12d3a0
testl %eax, %eax
je 0x12d7f8
testl %ebx, %ebx
jne 0x12d764
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x12d800
leaq 0x125fed(%rip), %r15    # 0x253758
movl 0x1d0(%r15), %eax
movsd 0x1d8(%r15), %xmm0
movq 0x1c8(%r15), %rcx
leaq 0x20(%rsp), %rbx
movl %eax, 0x4(%rbx)
movsd %xmm0, 0x10(%rbx)
movl $0x3e8, (%rbx)          # imm = 0x3E8
movq %rcx, 0x18(%rbx)
movl %eax, 0xc(%rbx)
cvtsi2sd %eax, %xmm0
mulsd 0xb5da0(%rip), %xmm0    # 0x1e3548
cvttsd2si %xmm0, %eax
movl %eax, 0x8(%rbx)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0x8(%rsp), %edx
callq 0x12d55b
movq %rax, %r14
movq 0x10(%r15), %rdi
callq 0xc0fe9
movq %rax, %rdi
callq 0x84211
leaq 0x138(%rax), %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12a457
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x12a599
pushq $0x1
popq %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: dump_kv_u_trans_t(kv_u_trans_t*, _IO_FILE*)
void dump_kv_u_trans_t(kv_u_trans_t *z, FILE *fp)
{
	fwrite(&(z->n), sizeof(z->n), 1, fp);
    fwrite(z->a, sizeof((*(z->a))), z->n, fp);
    fwrite(&z->idx.n, sizeof(z->idx.n), 1, fp);
    fwrite(z->idx.a, sizeof((*(z->idx.a))), z->idx.n, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x8
popq %r15
pushq $0x1
popq %r12
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq (%r14), %rdx
movq 0x10(%r14), %rdi
pushq $0x30
popq %rsi
movq %rbx, %rcx
callq 0x2410
leaq 0x18(%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x18(%r14), %rdx
movq 0x28(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2410
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: dump_asg_t(asg_t*, _IO_FILE*)
void dump_asg_t(asg_t *g, FILE *fp)
{
	uint32_t tmp, Len;
	tmp = g->n_arc;
    fwrite(&tmp, sizeof(tmp), 1, fp);

    tmp = g->is_srt;
    fwrite(&tmp, sizeof(tmp), 1, fp);

    tmp = g->n_seq;
    fwrite(&tmp, sizeof(tmp), 1, fp);
    
    tmp = g->is_symm;
    fwrite(&tmp, sizeof(tmp), 1, fp);

    tmp = g->r_seq;
    fwrite(&tmp, sizeof(tmp), 1, fp);


    // Len = g->n_seq*2;
    // fwrite(g->seq_vis, sizeof((*(g->seq_vis))), Len, fp);

    Len = g->n_seq*2;
    fwrite(g->idx, sizeof((*(g->idx))), Len, fp);
    fwrite(g->arc, sizeof((*(g->arc))), g->n_arc, fp);
    fwrite(g->seq, sizeof((*(g->seq))), g->n_seq, fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl 0x4(%rdi), %eax
andl %ebp, %eax
leaq 0x4(%rsp), %r15
movl %eax, (%r15)
pushq $0x4
popq %r12
pushq $0x1
popq %r13
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2410
movl 0x4(%r14), %eax
shrl $0x1f, %eax
movl %eax, (%r15)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2410
andl 0x14(%r14), %ebp
movl %ebp, (%r15)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2410
movl 0x14(%r14), %eax
shrl $0x1f, %eax
movl %eax, (%r15)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2410
movl 0x18(%r14), %eax
movl %eax, (%r15)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2410
movl 0x14(%r14), %edx
addl %edx, %edx
movq 0x28(%r14), %rdi
pushq $0x8
popq %r15
movq %r15, %rsi
movq %rbx, %rcx
callq 0x2410
movq 0x8(%r14), %rdi
movl 0x4(%r14), %edx
movl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
andq %r12, %rdx
pushq $0x18
popq %rsi
movq %rbx, %rcx
callq 0x2410
movq 0x20(%r14), %rdi
movl 0x14(%r14), %edx
andq %r12, %rdx
movq %r15, %rsi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2410
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: dump_ma_ug_t(ma_ug_t*, _IO_FILE*)
void dump_ma_ug_t(ma_ug_t *ug, FILE *fp)
{
	ma_utg_t *u = NULL; uint32_t t, i;
    fwrite(&(ug->u.n), sizeof(ug->u.n), 1, fp);
    for (i = 0; i < ug->u.n; i++) {
        u = &(ug->u.a[i]);
        t = u->len;
        fwrite(&t, sizeof(t), 1, fp);
        t = u->circ;
        fwrite(&t, sizeof(t), 1, fp);
        fwrite(&(u->start), sizeof(u->start), 1, fp);
        fwrite(&(u->end), sizeof(u->end), 1, fp);
        fwrite(&(u->n), sizeof(u->n), 1, fp);
        fwrite(u->a, sizeof(uint64_t), u->n, fp);
    }
	dump_asg_t(ug->g, fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2410
xorl %eax, %eax
movq %r14, 0x10(%rsp)
pushq $0x4
popq %rbp
movl %eax, %r13d
cmpq %r13, (%r14)
jbe 0x12dab3
movq 0x10(%rsp), %rax
movq 0x10(%rax), %r14
imulq $0x28, %r13, %r12
leaq (%r14,%r12), %r15
addq $0x4, %r15
movl -0x4(%r15), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2410
movl -0x4(%r15), %eax
shrl $0x1f, %eax
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rdi
movq %rbp, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2410
movq %r15, %rdi
movq %rbp, %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2410
leaq (%r14,%r12), %rdi
addq $0x8, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2410
leaq (%r14,%r12), %r15
addq $0x10, %r15
movq 0x10(%rsp), %r14
movq %r15, %rdi
movq %rbp, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x8(%r15), %rdi
movl (%r15), %edx
pushq $0x8
popq %rsi
movq %rbx, %rcx
callq 0x2410
leal 0x1(%r13), %eax
jmp 0x12d9ee
movq 0x18(%r14), %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12d8c7
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: dump_bubble_type(bubble_type*, _IO_FILE*)
void dump_bubble_type(bubble_type* bub, FILE *fp)
{
	fwrite(&(bub->chain_weight.n), sizeof(bub->chain_weight.n), 1, fp);
	fwrite(bub->chain_weight.a, sizeof((*(bub->chain_weight.a))), bub->chain_weight.n, fp);

	fwrite(&(bub->list.n), sizeof(bub->list.n), 1, fp);
	fwrite(bub->list.a, sizeof((*(bub->list.a))), bub->list.n, fp);

	fwrite(&(bub->num.n), sizeof(bub->num.n), 1, fp);
	fwrite(bub->num.a, sizeof((*(bub->num.a))), bub->num.n, fp);

	fwrite(&(bub->pathLen.n), sizeof(bub->pathLen.n), 1, fp);
	fwrite(bub->pathLen.a, sizeof((*(bub->pathLen.a))), bub->pathLen.n, fp);

	dump_ma_ug_t(bub->b_ug, fp);
	dump_asg_t(bub->b_g, fp);
	dump_ma_ug_t(bub->ug, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc8(%rdi), %rdi
pushq $0x8
popq %r15
pushq $0x1
popq %r12
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0xc8(%r14), %rdx
movq 0xd8(%r14), %rdi
pushq $0x20
popq %rsi
movq %rbx, %rcx
callq 0x2410
leaq 0x18(%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x18(%r14), %rdx
movq 0x28(%r14), %rdi
pushq $0x4
popq %r13
movq %r13, %rsi
movq %rbx, %rcx
callq 0x2410
leaq 0x30(%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x30(%r14), %rdx
movq 0x40(%r14), %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq 0x2410
leaq 0x48(%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x48(%r14), %rdx
movq 0x58(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0x2410
movq 0xc0(%r14), %rdi
movq %rbx, %rsi
callq 0x12d9c2
movq 0xb8(%r14), %rdi
movq %rbx, %rsi
callq 0x12d8c7
movq 0x10(%r14), %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x12d9c2
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: dump_rid(All_reads*, _IO_FILE*)
void dump_rid(All_reads *rdb, FILE *fp)
{
	fwrite(&(rdb->total_reads), sizeof(rdb->total_reads), 1, fp);
	fwrite(&(rdb->name_index_size), sizeof(rdb->name_index_size), 1, fp);
	fwrite(rdb->name_index, sizeof((*(rdb->name_index))), rdb->name_index_size, fp);

	fwrite(&(rdb->total_name_length), sizeof(rdb->total_name_length), 1, fp);
	fwrite(rdb->name, sizeof((*(rdb->name))), rdb->total_name_length, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x50(%rdi), %rdi
pushq $0x8
popq %r12
pushq $0x1
popq %r15
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2410
leaq 0x48(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x40(%r14), %rdi
movq 0x48(%r14), %rdx
movq %r12, %rsi
movq %rbx, %rcx
callq 0x2410
leaq 0x60(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2410
movq 0x8(%r14), %rdi
movq 0x60(%r14), %rdx
movq %r15, %rsi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2410
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: load_rid(All_reads*, _IO_FILE*)
void load_rid(All_reads *rdb, FILE *fp)
{
	fread(&(rdb->total_reads), sizeof(rdb->total_reads), 1, fp);
	fread(&(rdb->name_index_size), sizeof(rdb->name_index_size), 1, fp);
	MALLOC(rdb->name_index, rdb->name_index_size);
	fread(rdb->name_index, sizeof((*(rdb->name_index))), rdb->name_index_size, fp);

	fread(&(rdb->total_name_length), sizeof(rdb->total_name_length), 1, fp);
	MALLOC(rdb->name, rdb->total_name_length);
	fread(rdb->name, sizeof((*(rdb->name))), rdb->total_name_length, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x50(%rdi), %rdi
pushq $0x8
popq %r12
pushq $0x1
popq %r15
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x48(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
movq 0x48(%r14), %r13
leaq (,%r13,8), %rdi
callq 0x2280
movq %rax, 0x40(%r14)
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x60(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
movq 0x60(%r14), %r12
movq %r12, %rdi
callq 0x2280
movq %rax, 0x8(%r14)
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: load_kv_u_trans_t(kv_u_trans_t*, _IO_FILE*)
void load_kv_u_trans_t(kv_u_trans_t *z, FILE *fp)
{
	fread(&(z->n), sizeof(z->n), 1, fp); 
	z->m = z->n; MALLOC(z->a, z->n);
    fread(z->a, sizeof((*(z->a))), z->n, fp);

    fread(&z->idx.n, sizeof(z->idx.n), 1, fp);
	z->idx.m = z->idx.n; MALLOC(z->idx.a, z->idx.n);
    fread(z->idx.a, sizeof((*(z->idx.a))), z->idx.n, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x8
popq %r15
pushq $0x1
popq %r12
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x22f0
movq (%r14), %r13
movq %r13, 0x8(%r14)
imulq $0x30, %r13, %rdi
callq 0x2280
movq %rax, 0x10(%r14)
pushq $0x30
popq %rsi
movq %rax, %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x18(%r14), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x22f0
movq 0x18(%r14), %r12
movq %r12, 0x20(%r14)
leaq (,%r12,8), %rdi
callq 0x2280
movq %rax, 0x28(%r14)
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: load_asg_t(asg_t*, _IO_FILE*)
void load_asg_t(asg_t *g, FILE *fp)
{
	uint32_t tmp, Len;
    fread(&tmp, sizeof(tmp), 1, fp);
	g->n_arc = g->m_arc = tmp;

    fread(&tmp, sizeof(tmp), 1, fp);
	g->is_srt = tmp;

    fread(&tmp, sizeof(tmp), 1, fp);
	g->n_seq = g->m_seq = tmp;
    
    fread(&tmp, sizeof(tmp), 1, fp);
	g->is_symm = tmp;

    fread(&tmp, sizeof(tmp), 1, fp);
	g->r_seq = tmp;

    // Len = g->n_seq*2;
    // fwrite(g->seq_vis, sizeof((*(g->seq_vis))), Len, fp);

    Len = g->n_seq*2;
	CALLOC(g->idx, Len); fread(g->idx, sizeof((*(g->idx))), Len, fp);
	CALLOC(g->arc, g->n_arc); fread(g->arc, sizeof((*(g->arc))), g->n_arc, fp);
	CALLOC(g->seq, g->n_seq); fread(g->seq, sizeof((*(g->seq))), g->n_seq, fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rsp), %r15
pushq $0x4
popq %r13
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq 0x22f0
movl (%r15), %eax
movl %eax, (%r14)
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
andl %ebp, %eax
movl $0x80000000, %r12d      # imm = 0x80000000
movl 0x4(%r14), %ecx
andl %r12d, %ecx
orl %eax, %ecx
movl %ecx, 0x4(%r14)
movq %r15, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x22f0
movl (%r15), %eax
shll $0x1f, %eax
movl 0x4(%r14), %ecx
andl %ebp, %ecx
orl %eax, %ecx
movl %ecx, 0x4(%r14)
movq %r15, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x22f0
movl (%r15), %eax
movl %eax, 0x10(%r14)
andl %ebp, %eax
andl 0x14(%r14), %r12d
orl %eax, %r12d
movl %r12d, 0x14(%r14)
movq %r15, %rdi
movq %r13, %r12
movq %r13, %rsi
pushq $0x1
popq %r13
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
movl (%r15), %eax
shll $0x1f, %eax
andl 0x14(%r14), %ebp
orl %eax, %ebp
movl %ebp, 0x14(%r14)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
movl (%r15), %eax
movl %eax, 0x18(%r14)
movl 0x14(%r14), %r12d
addl %r12d, %r12d
pushq $0x8
popq %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x2120
movq %rax, 0x28(%r14)
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x22f0
movl 0x4(%r14), %r12d
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
andq %rbp, %r12
pushq $0x18
popq %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2120
movq %rax, 0x8(%r14)
movq %rax, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x22f0
movl 0x14(%r14), %r12d
andq %rbp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2120
movq %rax, 0x20(%r14)
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: load_ma_ug_t(ma_ug_t*, _IO_FILE*)
void load_ma_ug_t(ma_ug_t *ug, FILE *fp)
{
	ma_utg_t *u = NULL; uint32_t t, i;
    fread(&(ug->u.n), sizeof(ug->u.n), 1, fp);
	ug->u.m = ug->u.n; CALLOC(ug->u.a, ug->u.n);
    for (i = 0; i < ug->u.n; i++) {
        u = &(ug->u.a[i]);
		fread(&t, sizeof(t), 1, fp); u->len = t;
        fread(&t, sizeof(t), 1, fp); u->circ = t;
        fread(&(u->start), sizeof(u->start), 1, fp);
        fread(&(u->end), sizeof(u->end), 1, fp);
        fread(&(u->n), sizeof(u->n), 1, fp);
		u->m = u->n; MALLOC(u->a, u->n);
        fread(u->a, sizeof((*(u->a))), u->n, fp);
    }
	CALLOC(ug->g, 1);
	load_asg_t(ug->g, fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rcx
movq %rdi, %r14
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rcx, 0x10(%rsp)
callq 0x22f0
movq (%r14), %r15
movq %r15, 0x8(%r14)
pushq $0x28
popq %rsi
movq %r15, %rdi
callq 0x2120
movq %r14, 0x8(%rsp)
movq %rax, 0x10(%r14)
xorl %eax, %eax
pushq $0x1
popq %rbp
movq 0x10(%rsp), %rbx
movl %eax, %r14d
cmpq %r14, %r15
jbe 0x12e006
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r13
imulq $0x28, %r14, %r12
leaq 0x4(%rsp), %rdi
pushq $0x4
popq %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x22f0
movl 0x4(%rsp), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
leaq (%r12,%r13), %r15
addq $0x4, %r15
movl -0x4(%r15), %ecx
movl $0x80000000, %edx       # imm = 0x80000000
andl %edx, %ecx
orl %eax, %ecx
movl %ecx, -0x4(%r15)
leaq 0x4(%rsp), %rdi
pushq $0x4
popq %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x22f0
movl 0x4(%rsp), %eax
shll $0x1f, %eax
movl -0x4(%r15), %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
orl %eax, %ecx
movl %ecx, -0x4(%r15)
movq %r15, %rdi
pushq $0x4
popq %r15
movq %r15, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq (%r12,%r13), %rdi
addq $0x8, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq (%r12,%r13), %r15
addq $0x10, %r15
movq %r15, %rdi
pushq $0x4
popq %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x22f0
movl (%r15), %r13d
movl %r13d, -0x4(%r15)
leaq (,%r13,8), %rdi
callq 0x2280
movq %rax, 0x8(%r15)
movq %rax, %rdi
pushq $0x8
popq %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
leal 0x1(%r14), %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %r15
jmp 0x12df0d
pushq $0x1
popq %rdi
pushq $0x48
popq %rsi
callq 0x2120
movq 0x8(%rsp), %rcx
movq %rax, 0x18(%rcx)
movq %rax, %rdi
movq 0x10(%rsp), %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12dd61
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: load_bubble_type(bubble_type*, _IO_FILE*)
void load_bubble_type(bubble_type* bub, FILE *fp)
{
	fread(&(bub->chain_weight.n), sizeof(bub->chain_weight.n), 1, fp);
	bub->chain_weight.m = bub->chain_weight.n; CALLOC(bub->chain_weight.a, bub->chain_weight.n);
	fread(bub->chain_weight.a, sizeof((*(bub->chain_weight.a))), bub->chain_weight.n, fp);

	fread(&(bub->list.n), sizeof(bub->list.n), 1, fp);
	bub->list.m = bub->list.n; CALLOC(bub->list.a, bub->list.n);
	fread(bub->list.a, sizeof((*(bub->list.a))), bub->list.n, fp);

	fread(&(bub->num.n), sizeof(bub->num.n), 1, fp);
	bub->num.m = bub->num.n; CALLOC(bub->num.a, bub->num.n);
	fread(bub->num.a, sizeof((*(bub->num.a))), bub->num.n, fp);

	fread(&(bub->pathLen.n), sizeof(bub->pathLen.n), 1, fp);
	bub->pathLen.m = bub->pathLen.n; CALLOC(bub->pathLen.a, bub->pathLen.n);
	fread(bub->pathLen.a, sizeof((*(bub->pathLen.a))), bub->pathLen.n, fp);

	CALLOC(bub->b_ug, 1); load_ma_ug_t(bub->b_ug, fp);
	CALLOC(bub->b_g, 1); load_asg_t(bub->b_g, fp);
	CALLOC(bub->ug, 1); load_ma_ug_t(bub->ug, fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc8(%rdi), %rdi
pushq $0x8
popq %r12
pushq $0x1
popq %r15
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
movq 0xc8(%r14), %r13
movq %r13, 0xd0(%r14)
pushq $0x20
popq %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2120
movq %rax, 0xd8(%r14)
movq %rax, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x18(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
movq 0x18(%r14), %rbp
movq %rbp, 0x20(%r14)
pushq $0x4
popq %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2120
movq %rax, 0x28(%r14)
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x30(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
movq 0x30(%r14), %rbp
movq %rbp, 0x38(%r14)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2120
movq %rax, 0x40(%r14)
movq %rax, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x48(%r14), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
movq 0x48(%r14), %r13
movq %r13, 0x50(%r14)
movq %r13, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, 0x58(%r14)
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
pushq $0x38
popq %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, 0xc0(%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x12dec4
pushq $0x48
popq %rsi
movq %r15, %rdi
callq 0x2120
movq %rax, 0xb8(%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x12dd61
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, 0x10(%r14)
movq %rax, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12dec4
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: prt_rcut_res(char const*, signed char*, ma_ug_t*, asg_t*)
void prt_rcut_res(const char* fn, int8_t *s, ma_ug_t *ug, asg_t *sg)
{
	uint32_t i, k, flag = AMBIGU; 
	char *buf = (char*)calloc(strlen(fn) + 50, 1);
    sprintf(buf, "%s.rcut.res.log", fn);
    FILE *fp = fopen(buf, "w");
	uint8_t *rs = NULL; MALLOC(rs, sg->n_seq);
	memset(rs, AMBIGU, sg->n_seq*sizeof((*rs)));

    for (i = 0; i < ug->g->n_seq; i++) {
        if(ug->g->seq[i].del) continue;
        flag = AMBIGU;
		if(s[i] == 0) continue;
		flag = (s[i] > 0? FATHER:MOTHER);
        for (k = 0; k < ug->u.a[i].n; k++) rs[ug->u.a[i].a[k]>>33] = flag;
    }

	for (i = 0; i < sg->n_seq; i++) {
		if(rs[i] == AMBIGU) continue;
		fprintf(fp, "%.*s\t%u\n", (int)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i), rs[i]);
	}

	fclose(fp); free(rs);
    free(buf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r15
callq 0x2090
leaq 0x32(%rax), %rdi
pushq $0x1
popq %rsi
callq 0x2120
movq %rax, %r14
leaq 0xc0fe8(%rip), %rsi     # 0x1ef3b2
xorl %r13d, %r13d
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0xcc2c0(%rip), %rsi     # 0x1fa6a1
movq %r14, 0x8(%rsp)
movq %r14, %rdi
callq 0x2210
movq %rax, %r15
movq %rbx, 0x10(%rsp)
movl 0x14(%rbx), %r14d
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movq %r14, %rsi
andq %rbx, %rsi
pushq $0x1
popq %rdi
callq 0x2120
movq %r12, %r10
movq %rax, %r12
movq 0x18(%r10), %rax
movl 0x14(%rax), %ecx
andq %rbx, %rcx
cmpq %rcx, %r13
je 0x12e474
movq 0x20(%rax), %rdx
cmpl $0x0, (%rdx,%r13,8)
js 0x12e46f
movb (%rbp,%r13), %dil
testb %dil, %dil
je 0x12e46f
movq 0x10(%r10), %rsi
imulq $0x28, %r13, %r8
leaq (%rsi,%r8), %rdx
movl 0x10(%rsi,%r8), %esi
testb %dil, %dil
setle %dil
incb %dil
xorl %r8d, %r8d
cmpq %r8, %rsi
je 0x12e46f
movq 0x18(%rdx), %r9
movq (%r9,%r8,8), %r9
shrq $0x21, %r9
movb %dil, (%r12,%r9)
incq %r8
jmp 0x12e455
incq %r13
jmp 0x12e41d
leaq 0x125db5(%rip), %rbp    # 0x254230
leaq 0xb489b(%rip), %r13     # 0x1e2d1d
xorl %ebx, %ebx
movl %r14d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %rbx
jae 0x12e4c8
movzbl (%r12,%rbx), %r8d
testl %r8d, %r8d
je 0x12e4c3
movq 0x40(%rbp), %rax
movl 0x8(%rax,%rbx,8), %edx
movq (%rax,%rbx,8), %rcx
subl %ecx, %edx
addq 0x8(%rbp), %rcx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x22b0
movq 0x10(%rsp), %rax
movl 0x14(%rax), %r14d
incq %rbx
jmp 0x12e484
movq %r15, %rdi
callq 0x2190
movq %r12, %rdi
callq 0x2220
movq 0x8(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: quick_debug_phasing(char const*)
void quick_debug_phasing(const char* fn)
{
	kv_u_trans_t *ta; ma_ug_t *ug; asg_t *read_g; double f_rate;
	uint32_t renew_s; int8_t *s; uint32_t is_sys; bubble_type *bub; kv_u_trans_t *ref;
	load_debug_phasing(fn, &ta, &ug, &read_g, &f_rate, &renew_s, &s, &is_sys, &bub, &ref);



	mc_solve(NULL, NULL, ta, ug, read_g, f_rate, NULL, renew_s, s, is_sys, bub, ref, 0, 0);
	// mc_solve_core_adv(const mc_opt_t *opt, mc_g_t *mg, bubble_type* bub, kv_u_trans_t *ref)

	// for (k = 0; k < ug->g->n_seq; k++) {
	// 	fprintf(stderr, "utg%.6dl(len::%u), s[k]::%d\n", (int32_t)(k)+1, ug->g->seq[k].len, s[k]);
	// }
	prt_rcut_res(fn, s, ug, read_g);
	
	exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rax
leaq 0x10(%rsp), %r10
leaq 0x4(%rsp), %r11
leaq 0x18(%rsp), %r14
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %r15
leaq 0x38(%rsp), %r12
leaq 0x30(%rsp), %r13
leaq 0x2c(%rsp), %rbp
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
movq %rbp, %r9
pushq %rax
pushq %r10
pushq %r11
pushq %r14
callq 0x12e1af
addq $0x20, %rsp
leaq 0x20(%rsp), %rax
movq (%rax), %rdx
movq (%r15), %r14
movq (%r12), %r15
movsd (%r13), %xmm0
movl (%rbp), %eax
leaq 0x18(%rsp), %rcx
movq (%rcx), %r12
leaq 0x4(%rsp), %rcx
movl (%rcx), %ecx
leaq 0x10(%rsp), %rsi
movq (%rsi), %rsi
leaq 0x8(%rsp), %rdi
movq (%rdi), %rdi
subq $0x40, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %ecx, 0x10(%rsp)
andl $0x0, 0x30(%rsp)
movq %r12, 0x8(%rsp)
andl $0x0, 0x28(%rsp)
movl %eax, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rcx
movq %r15, %r8
xorl %r9d, %r9d
callq 0x12b808
addq $0x40, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x12e395
pushq $0x1
popq %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: ks_shuffle_uint32_t(unsigned long, unsigned int*, unsigned long*)
static void ks_shuffle_uint32_t(size_t n, uint32_t a[], uint64_t *x)
{
	size_t i, j;
	for (i = n; i > 1; --i) {
		uint32_t tmp;
		j = (size_t)(kr_drand_r(x) * i);
		tmp = a[j]; a[j] = a[i-1]; a[i-1] = tmp;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpq $0x2, %r15
jb 0x12e62f
movq %rbx, %rdi
callq 0x12e635
cvtsi2sd %r15, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0xb4c8f(%rip), %xmm1    # 0x1e3298
cvttsd2si %xmm1, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
movl (%r14,%rdx,4), %eax
movl -0x4(%r14,%r15,4), %ecx
movl %ecx, (%r14,%rdx,4)
movl %eax, -0x4(%r14,%r15,4)
decq %r15
jmp 0x12e5e2
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: mcgg_set_spin(mc_match_t const*, mcgg_svaux_t*, unsigned int, unsigned int, char const*)
static void mcgg_set_spin(const mc_match_t *ma, mcgg_svaux_t *b, uint32_t k, mcg_node_t s, const char* cmd)
{
	uint32_t o, j, n;
	mcg_node_t s0 = b->s[k].s;
	/*******************************for debug************************************/
	// mcg_node_t t = s;
	// o = 0;
	// while (t) {
	// 	o += (t&1); t>>=1;
	// }
	// if(o != b->s[k].h[0] && o != b->s[k].h[1]) fprintf(stderr, "cmd-%s, ERROR-mcgg-1\n", cmd);
	// if(s0 == s) fprintf(stderr, "cmd-%s, ERROR-mcgg-2\n", cmd);
	/*******************************for debug************************************/
	if (s0 == s) return;
	o = ma->idx.a[k] >> 32;
	n = (uint32_t)ma->idx.a[k];
	for (j = 0; j < n; ++j) {
		const mc_edge_t *e = &ma->ma.a[o + j];
		uint32_t t = ma_y(*e);///1->z[0]; (-1)->z[1];
		mcp_de(*(b->z), t, s0) -= e->w; 
		mcp_de(*(b->z), t, s) += e->w; 
	}
	b->s[k].s = s;
}

// Assembly:
movl %ecx, %eax
movq 0x50(%rsi), %r8
movl %edx, %ecx
movq %rcx, %r9
shlq $0x5, %r9
movl (%r8,%r9), %edx
cmpl %eax, %edx
je 0x12e892
pushq %r15
pushq %r14
pushq %rbx
addq %r9, %r8
movq 0x10(%rdi), %r9
movq (%r9,%rcx,8), %r10
movl %r10d, %r9d
shrq $0x20, %r10
subq $0x1, %r9
jb 0x12e88a
movq 0x28(%rdi), %r11
movl %r10d, %ebx
shlq $0x4, %rbx
movl (%r11,%rbx), %r14d
movq 0x40(%rsi), %rcx
movq (%rcx), %r15
movb 0x8(%rcx), %cl
shll %cl, %r14d
leal (%r14,%rdx), %ecx
movsd (%r15,%rcx,8), %xmm0
subsd 0x8(%r11,%rbx), %xmm0
movsd %xmm0, (%r15,%rcx,8)
movsd 0x8(%r11,%rbx), %xmm0
addl %eax, %r14d
addsd (%r15,%r14,8), %xmm0
movsd %xmm0, (%r15,%r14,8)
incq %r10
jmp 0x12e836
movl %eax, (%r8)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: kr_drand_node_new(unsigned long, mcgg_svaux_t*)
static inline mcg_node_t kr_drand_node_new(uint64_t id, mcgg_svaux_t *b)
{
	uint32_t hn = b->s[id].h[0]-1, k;
	if((b->s[id].h[1] != (uint16_t)-1) && (kr_drand_r(&b->x) > b->s[id].hw[0]))
	{
		hn = b->s[id].h[1]-1;
	}
	b->x = kr_splitmix64(b->x);
	k = b->x%(b->m[hn].n);
	if(b->m[hn].a[k] == b->s[id].s && b->m[hn].n > 1)
	{
		k = b->x%(b->m[hn].n-1);
		if(b->m[hn].a[k] == b->s[id].s) k = b->m[hn].n-1;
	} 
	return b->m[hn].a[k];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x50(%rsi), %r15
shlq $0x5, %rbx
movzwl 0x4(%r15,%rbx), %ebp
cmpw $-0x1, 0x6(%r15,%rbx)
je 0x12e8d5
movq %r14, %rdi
callq 0x12e635
movq 0x50(%r14), %r15
ucomisd 0x10(%r15,%rbx), %xmm0
jbe 0x12e8d5
leaq (%r15,%rbx), %rax
movzwl 0x6(%rax), %ebp
movzwl %bp, %r12d
decl %r12d
movq (%r14), %rdi
callq 0x125d08
movq %rax, %rsi
movq %rax, (%r14)
movq 0x60(%r14), %rax
imulq $0x18, %r12, %rcx
movq (%rax,%rcx), %rdi
movq 0x8(%rax,%rcx), %r8
movq %rsi, %rax
xorl %edx, %edx
divq %r8
movl %edx, %eax
movl (%rdi,%rax,4), %ecx
cmpq $0x2, %r8
jb 0x12e92e
cmpl (%r15,%rbx), %ecx
jne 0x12e92e
decq %r8
movq %rsi, %rax
xorl %edx, %edx
divq %r8
movl %edx, %eax
cmpl %ecx, (%rdi,%rax,4)
cmovneq %rdx, %r8
movl %r8d, %eax
movl (%rdi,%rax,4), %ecx
movl %ecx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: decode_mb_node(mb_g_t*, unsigned int, unsigned int**, unsigned int*, signed char*, unsigned int**, unsigned int*, signed char*)
inline void decode_mb_node(mb_g_t *mbg, uint32_t id, uint32_t **a0, uint32_t *n0, mc_node_t *s0, 
uint32_t **a1, uint32_t *n1, mc_node_t *s1)
{
	if(a0) (*a0) = mbg->u->bid.a + mbg->u->u.a[id].a[0];
	if(n0) (*n0) = mbg->u->u.a[id].occ[0];
	if(s0) (*s0) = mbg->u->u.a[id].s[0];

	if(a1) (*a1) = mbg->u->bid.a + mbg->u->u.a[id].a[1];
	if(n1) (*n1) = mbg->u->u.a[id].occ[1];
	if(s1) (*s1) = mbg->u->u.a[id].s[1];
}

// Assembly:
movl %esi, %eax
testq %rdx, %rdx
je 0x12e95a
movq (%rdi), %rsi
movq 0x40(%rsi), %r10
imulq $0x38, %rax, %r11
movl (%r10,%r11), %r10d
shlq $0x2, %r10
addq 0x10(%rsi), %r10
movq %r10, (%rdx)
testq %rcx, %rcx
je 0x12e970
movq (%rdi), %rdx
movq 0x40(%rdx), %rdx
imulq $0x38, %rax, %rsi
movl 0x8(%rdx,%rsi), %edx
movl %edx, (%rcx)
testq %r8, %r8
je 0x12e987
movq (%rdi), %rcx
movq 0x40(%rcx), %rcx
imulq $0x38, %rax, %rdx
movb 0x10(%rcx,%rdx), %cl
movb %cl, (%r8)
movq 0x8(%rsp), %rcx
testq %r9, %r9
je 0x12e9ac
movq (%rdi), %rdx
movq 0x40(%rdx), %rsi
imulq $0x38, %rax, %r8
movl 0x4(%rsi,%r8), %esi
shlq $0x2, %rsi
addq 0x10(%rdx), %rsi
movq %rsi, (%r9)
movq 0x10(%rsp), %rdx
testq %rcx, %rcx
je 0x12e9c8
movq (%rdi), %rsi
movq 0x40(%rsi), %rsi
imulq $0x38, %rax, %r8
movl 0xc(%rsi,%r8), %esi
movl %esi, (%rcx)
testq %rdx, %rdx
je 0x12e9de
movq (%rdi), %rcx
movq 0x40(%rcx), %rcx
imulq $0x38, %rax, %rax
movb 0x11(%rcx,%rax), %al
movb %al, (%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: next_uid(mc_bp_iter*, bubble_type*, unsigned int*, unsigned int*)
inline uint32_t next_uid(mc_bp_iter *iter, bubble_type* bub, uint32_t *c_bid, uint32_t *c_uid)
{
	ma_utg_t *u = &(bub->b_ug->u.a[iter->chain_id]);
	uint32_t *a, n, uid;
	while (1)
	{
		if(iter->bid >= u->n) break;
		get_bubbles(bub, u->a[iter->bid]>>33, NULL, NULL, &a, &n, NULL);
		while (1)
		{
			if(iter->uid >= n) break;
			uid = a[iter->uid]>>1;
			if(c_bid) (*c_bid) = iter->bid;
			if(c_uid) (*c_uid) = iter->uid;
			iter->uid++;
			return uid;
		}
		iter->bid++, iter->uid = 0;
	}
	return (uint32_t)-1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, %rbx
movq 0xc0(%rsi), %rax
imulq $0x28, (%rdi), %r15
addq 0x10(%rax), %r15
movq 0x8(%rdi), %rax
pushq $-0x1
popq %rbp
leaq 0x20(%rsp), %r13
leaq 0xc(%rsp), %r14
movl 0x10(%r15), %ecx
cmpq %rcx, %rax
jae 0x12ea94
movq 0x18(%r15), %rcx
movq (%rcx,%rax,8), %rsi
shrq $0x21, %rsi
andq $0x0, (%rsp)
movq %r12, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r13, %r8
movq %r14, %r9
callq 0xf6ab5
movq 0x10(%rbx), %rax
movl 0xc(%rsp), %ecx
cmpq %rcx, %rax
jb 0x12ea68
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
jmp 0x12ea1d
movq 0x20(%rsp), %rcx
movl (%rcx,%rax,4), %ebp
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0x12ea7f
movl 0x8(%rbx), %ecx
movl %ecx, (%rdx)
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x12ea8b
movl %eax, (%rcx)
shrl %ebp
incq %rax
movq %rax, 0x10(%rbx)
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: back_status(mcgg_svaux_t*, unsigned int, unsigned int)
void inline back_status(mcgg_svaux_t *b, uint32_t id, uint32_t to_opt)
{
	if(to_opt)
	{
		b->s_opt[id] = b->s[id];
		memcpy(b->z_opt->z+(id<<b->z->hapN), b->z->z+(id<<b->z->hapN), (1<<b->z->hapN)*sizeof(t_w_t));
	}
	else
	{
		b->s[id] = b->s_opt[id];
		memcpy(b->z->z+(id<<b->z->hapN), b->z_opt->z+(id<<b->z->hapN), (1<<b->z->hapN)*sizeof(t_w_t));
	}
	
}

// Assembly:
movl %esi, %eax
testl %edx, %edx
je 0x12ead8
shlq $0x5, %rax
movq 0x50(%rdi), %rcx
movq 0x58(%rdi), %rdx
movups (%rcx,%rax), %xmm0
movups 0x10(%rcx,%rax), %xmm1
movups %xmm1, 0x10(%rdx,%rax)
movups %xmm0, (%rdx,%rax)
movq 0x40(%rdi), %rax
movl 0x8(%rax), %ecx
shll %cl, %esi
movq 0x48(%rdi), %rdx
jmp 0x12eb03
movq 0x50(%rdi), %rcx
movq 0x58(%rdi), %rdx
shlq $0x5, %rax
movups (%rdx,%rax), %xmm0
movups 0x10(%rdx,%rax), %xmm1
movups %xmm1, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
movq 0x40(%rdi), %rdx
movl 0x8(%rdx), %ecx
shll %cl, %esi
movq 0x48(%rdi), %rax
leaq (,%rsi,8), %rdi
addq (%rdx), %rdi
shlq $0x3, %rsi
addq (%rax), %rsi
pushq $0x1
popq %rax
shll %cl, %eax
movslq %eax, %rdx
shlq $0x3, %rdx
jmp 0x2160
nop
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/horder.cpp
// Function: init_debug_phasing(ma_ug_t*, kvec_pe_hit*, kv_u_trans_t*, h_covs*)
debug_phasing_t *init_debug_phasing(ma_ug_t *ug, kvec_pe_hit *hits, kv_u_trans_t *k_trans, h_covs *b_points)
{
    debug_phasing_t *p = NULL; CALLOC(p, 1);
    p->ug = copy_untig_graph(ug);
    p->b_points = b_points;

    p->hits.pos_mode = hits->pos_mode; p->hits.uID_bits = hits->pos_mode;
    p->hits.a.n = p->hits.a.m = hits->a.n = hits->a.m;
    MALLOC(p->hits.a.a, p->hits.a.n); 
    memcpy(p->hits.a.a, hits->a.a, p->hits.a.n*sizeof(pe_hit));
    
    p->k_trans.n = p->k_trans.m = k_trans->n;
    MALLOC(p->k_trans.a, p->k_trans.n); 
    memcpy(p->k_trans.a, k_trans->a, p->k_trans.n*sizeof(u_trans_t));

    p->k_trans.idx.n = p->k_trans.idx.m = k_trans->idx.n;
    MALLOC(p->k_trans.idx.a, p->k_trans.idx.n); 
    memcpy(p->k_trans.idx.a, k_trans->idx.a, p->k_trans.idx.n*sizeof(uint64_t));

    return p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r13
pushq $0x1
popq %rdi
movl $0x98, %esi
callq 0x2120
movq %rax, %r14
movq %r13, %rdi
callq 0x8c99a
movq %rax, (%r14)
movq %r12, 0x90(%r14)
movq 0x50(%r15), %rax
movq %rax, 0x58(%r14)
movq %rax, 0x50(%r14)
movq 0x8(%r15), %r12
movq %r12, (%r15)
movq %r12, 0x10(%r14)
movq %r12, 0x8(%r14)
shlq $0x5, %r12
movq %r12, %rdi
callq 0x2280
movq %rax, 0x18(%r14)
movq 0x10(%r15), %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x2160
movq (%rbx), %rax
movq %rax, 0x68(%r14)
movq %rax, 0x60(%r14)
imulq $0x30, %rax, %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x70(%r14)
movq 0x10(%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2160
movq 0x18(%rbx), %r15
movq %r15, 0x80(%r14)
movq %r15, 0x78(%r14)
shlq $0x3, %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x88(%r14)
movq 0x28(%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2160
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/horder.cpp
// Function: destory_debug_phasing_t(debug_phasing_t**)
void destory_debug_phasing_t(debug_phasing_t **x)
{
    ma_ug_destroy((*x)->ug);
    free((*x)->hits.a.a); free((*x)->hits.idx.a); free((*x)->hits.occ.a);
    free((*x)->k_trans.a); free((*x)->k_trans.idx.a);
    free(*x);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rax), %rdi
callq 0x6921d
movq (%rbx), %rax
movq 0x18(%rax), %rdi
callq 0x2220
movq (%rbx), %rax
movq 0x30(%rax), %rdi
callq 0x2220
movq (%rbx), %rax
movq 0x48(%rax), %rdi
callq 0x2220
movq (%rbx), %rax
movq 0x70(%rax), %rdi
callq 0x2220
movq (%rbx), %rax
movq 0x88(%rax), %rdi
callq 0x2220
movq (%rbx), %rdi
popq %rbx
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/horder.cpp
// Function: iter_rid(buf_t*, unsigned long*, unsigned long*, ma_ug_t*)
uint32_t iter_rid(buf_t *b, uint64_t *ui, uint64_t *ri, ma_ug_t *ug)
{
    ma_utg_t *u = NULL;
    while ((*ui) < b->b.n)
    {
        u =  &(ug->u.a[b->b.a[(*ui)]>>1]);
        while ((*ri) < u->n) return u->a[(*ri)++]>>32;
        (*ui)++; (*ri) = 0;
    }

    return (uint32_t)-1;
}

// Assembly:
pushq %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq (%rsi), %r8
cmpq 0x38(%rdi), %r8
jae 0x130b28
movq 0x10(%rcx), %r9
movq 0x48(%rdi), %r10
movl (%r10,%r8,4), %r10d
shrl %r10d
imulq $0x28, %r10, %r11
movq (%rdx), %r10
movl 0x10(%r9,%r11), %ebx
cmpq %rbx, %r10
jb 0x130b15
incq %r8
movq %r8, (%rsi)
andq $0x0, (%rdx)
jmp 0x130ae0
addq %r11, %r9
movq 0x18(%r9), %rax
leaq 0x1(%r10), %rcx
movq %rcx, (%rdx)
movl 0x4(%rax,%r10,8), %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/horder.cpp
// Function: print_N50(ma_ug_t*)
void print_N50(ma_ug_t* ug)
{
    kvec_t(uint64_t) b; kv_init(b);
    uint64_t i, s, len;
    for (i = s = 0; i < ug->u.n; ++i) 
    {
        kv_push(uint64_t, b, ug->u.a[i].len);
        s += ug->u.a[i].len;
    }
    len = s;
    
    radix_sort_ho64(b.a, b.a+b.n);
    fprintf(stderr, "[M::%s::] Genome Size: %lu, # Contigs: %u, Largest Contig: %lu\n", 
    __func__, len, (uint32_t)ug->u.n, b.a[b.n-1]);
    i = b.n; s = 0;
    while (i > 0)
    {
        i--;
        s += b.a[i];
        if(s >= (len>>1))
        {
            fprintf(stderr, "[M::%s::] N50: %lu\n", __func__, b.a[i]);
            break;
        }
    }
    
    kv_destroy(b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
xorl %r13d, %r13d
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %ebp, %ebp
xorl %eax, %eax
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %edi, %edi
cmpq (%r15), %r12
jae 0x131888
cmpq %rax, %r12
jne 0x131862
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
callq 0x2370
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %rax, %rdi
movq %rbx, %rax
movq 0x10(%r15), %rcx
movl (%rcx,%r13), %edx
andq %rsi, %rdx
movq %rdx, (%rdi,%r12,8)
incq %r12
movl (%rcx,%r13), %ecx
andq %rsi, %rcx
addq %rcx, %r14
addq $-0x8, %rbp
addq $0x28, %r13
jmp 0x131832
movq %rdi, %rsi
subq %rbp, %rsi
movq %rdi, %rbx
callq 0x12f210
movq 0x121743(%rip), %r13    # 0x252fe0
movq (%r13), %rdi
movl (%r15), %r8d
movq -0x8(%rbx,%r12,8), %r9
decq %r12
leaq 0xbdd4e(%rip), %rsi     # 0x1ef601
leaq 0xbdd87(%rip), %rdx     # 0x1ef641
xorl %r15d, %r15d
movq %r14, %rcx
xorl %eax, %eax
callq 0x22b0
movq %rbx, %rdi
shrq %r14
cmpq $-0x1, %r12
je 0x1318fe
movq (%rdi,%r12,8), %rcx
addq %rcx, %r15
decq %r12
cmpq %r14, %r15
jb 0x1318cd
movq (%r13), %rdi
leaq 0xbdd5e(%rip), %rsi     # 0x1ef64b
leaq 0xbdd4d(%rip), %rdx     # 0x1ef641
xorl %eax, %eax
callq 0x22b0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/horder.cpp
// Function: print_N50_layout(ma_ug_t*, sc_lay_t*)
void print_N50_layout(ma_ug_t* ug, sc_lay_t* sl)
{
    kvec_t(uint64_t) b; kv_init(b);
    lay_t *p = NULL;
    uint64_t i, k, s, ulen, len, occ = 0;
    for (i = s = 0; i < sl->n; ++i) 
    {
        p = &(sl->a[i]);
        for (k = ulen = 0; k < p->n; k+=2)
        {
            ulen += ug->u.a[p->a[k]>>1].len;
        }
        occ += p->n;
        
        kv_push(uint64_t, b, ulen);
        s += ulen;
    }
    len = s;
    
    radix_sort_ho64(b.a, b.a+b.n);
    fprintf(stderr, "[M::%s::] Scaffold Size: %lu, # Scaffolds: %u (occ-%lu), Largest Scaffold: %lu\n", 
    __func__, len, (uint32_t)sl->n, occ, b.a[b.n-1]);
    i = b.n; s = 0;
    while (i > 0)
    {
        i--;
        s += b.a[i];
        if(s >= (len>>1))
        {
            fprintf(stderr, "[M::%s::] N50: %lu\n", __func__, b.a[i]);
            break;
        }
    }
    
    kv_destroy(b);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r11
movq %rdi, %r13
pushq $-0x1
popq %r9
xorl %eax, %eax
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %edi, %edi
xorl %r10d, %r10d
movq %rsi, 0x10(%rsp)
cmpq 0x8(%r11), %rbx
jae 0x1319dd
movq (%r11), %rdx
imulq $0x18, %rbx, %rsi
leaq (%rdx,%rsi), %rcx
movq 0x8(%rdx,%rsi), %rbp
xorl %edx, %edx
xorl %r14d, %r14d
cmpq %rbp, %rdx
jae 0x131983
movq 0x10(%r13), %rsi
movq (%rcx), %r8
movl (%r8,%rdx,4), %r8d
shrl %r8d
imulq $0x28, %r8, %r8
movl (%rsi,%r8), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
addq %rsi, %r14
addq $0x2, %rdx
jmp 0x131959
cmpq %rax, %rbx
jne 0x1319c8
leaq (%rax,%rax), %r15
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %r12, 0x20(%rsp)
movq %r9, 0x18(%rsp)
movq %r10, %r12
callq 0x2370
movq 0x10(%rsp), %r11
movq %r12, %r10
movq 0x18(%rsp), %r9
movq 0x20(%rsp), %r12
movq %rax, %rdi
movq %r15, %rax
addq %rbp, %r10
movq %r14, (%rdi,%rbx,8)
incq %rbx
addq %r14, %r12
incq %r9
jmp 0x13193a
leaq (%rdi,%rbx,8), %r13
movq %r13, %rsi
movq %rdi, %r15
movq %r9, %rbp
movq %r10, %rbx
movq %r11, %r14
callq 0x12f210
movq 0x1215e4(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movl 0x8(%r14), %r8d
movq -0x8(%r13), %rax
movq %rax, (%rsp)
leaq 0xbdc4d(%rip), %rsi     # 0x1ef65f
leaq 0xbdc96(%rip), %rdx     # 0x1ef6af
xorl %r14d, %r14d
movq %r12, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x22b0
movq %rbp, %rax
movq %r15, %rdi
shrq %r12
cmpq $-0x1, %rax
je 0x131a69
movq (%rdi,%rax,8), %rcx
addq %rcx, %r14
decq %rax
cmpq %r12, %r14
jb 0x131a32
movq 0x121592(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xbdbf3(%rip), %rsi     # 0x1ef64b
leaq 0xbdc50(%rip), %rdx     # 0x1ef6af
xorl %eax, %eax
callq 0x22b0
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/horder.cpp
// Function: init_trans_col(ma_ug_t*, unsigned long, kv_u_trans_t*)
trans_col_t *init_trans_col(ma_ug_t *ug, uint64_t r_num, kv_u_trans_t *ref)
{
    trans_col_t *p = NULL; 
    CALLOC(p, 1);
    p->ref = ref;
    p->idx = init_trans_chain(ug, r_num);
    return p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x2120
movq %rax, %r12
movq %rbx, (%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x83943
movq %rax, 0x8(%r12)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/horder.cpp
// Function: idx_hits(kvec_pe_hit*, unsigned long)
void idx_hits(kvec_pe_hit* hits, uint64_t n)
{
    uint64_t k, l;
    kv_resize(uint64_t, hits->idx, n);
    hits->idx.n = n;
    memset(hits->idx.a, 0, hits->idx.n*sizeof(uint64_t));

    radix_sort_pe_hit_idx_hn1(hits->a.a, hits->a.a + hits->a.n);
    for (k = 1, l = 0; k <= hits->a.n; ++k) {   
        if (k == hits->a.n || (get_hit_suid(*hits, k) != get_hit_suid(*hits, l))) {
            if (k - l > 1) radix_sort_pe_hit_idx_hn2(hits->a.a + l, hits->a.a + k);
            hits->idx.a[get_hit_suid(*hits, l)] = (uint64_t)l << 32 | (k - l);            
            l = k;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
cmpq %rsi, 0x20(%rdi)
jae 0x131ba6
leaq -0x1(%r14), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, 0x28(%rbx)
jmp 0x131baa
movq 0x28(%rbx), %rdi
movq %r14, 0x18(%rbx)
shlq $0x3, %r14
xorl %r15d, %r15d
xorl %esi, %esi
movq %r14, %rdx
callq 0x20e0
movq (%rbx), %rsi
movq 0x10(%rbx), %rdi
shlq $0x5, %rsi
addq %rdi, %rsi
callq 0x12eda6
pushq $0x1
popq %r14
pushq $0x20
popq %r12
cmpq (%rbx), %r14
ja 0x131c6a
movq 0x10(%rbx), %rsi
je 0x131c10
movq (%rsi,%r12), %rax
addq %rax, %rax
movb 0x48(%rbx), %dl
xorl %ecx, %ecx
subb %dl, %cl
shrq %cl, %rax
movq %r15, %rdx
shlq $0x5, %rdx
movq (%rsi,%rdx), %rdx
addq %rdx, %rdx
shrq %cl, %rdx
cmpq %rdx, %rax
je 0x131c5e
movq %r14, %r13
subq %r15, %r13
cmpq $0x2, %r13
jb 0x131c32
movq %r15, %rdi
shlq $0x5, %rdi
addq %rsi, %rdi
addq %r12, %rsi
callq 0x12f027
movq 0x10(%rbx), %rsi
movq %r15, %rax
shlq $0x20, %rax
shlq $0x5, %r15
movq (%rsi,%r15), %rdx
addq %rdx, %rdx
movb 0x48(%rbx), %sil
xorl %ecx, %ecx
subb %sil, %cl
shrq %cl, %rdx
orq %r13, %rax
movq 0x28(%rbx), %rcx
movq %rax, (%rcx,%rdx,8)
movq %r14, %r15
incq %r14
addq $0x20, %r12
jmp 0x131bda
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq