// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/rcut.cpp
// Function: load_mc_gg_dump(kv_u_trans_t**, unsigned int*, kv_gg_status**, unsigned short*, char const*)
uint32_t load_mc_gg_dump(kv_u_trans_t **rta, uint32_t *un, kv_gg_status **rs, uint16_t *hapN, const char* fn)
{
	fprintf(stderr, "\n[M::%s]\n", __func__);
	kv_u_trans_t *ta = NULL;
	kv_gg_status *s = NULL;
	uint64_t flag = 0;
    char *buf = (char*)calloc(strlen(fn) + 25, 1);
    sprintf(buf, "%s.hic.dbg.dump.bin", fn);

    FILE* fp = NULL; 
    fp = fopen(buf, "r"); 
    if(!fp)
	{
		free(buf);
		return 0;
	} 
	CALLOC(ta, 1);
	flag += fread(&ta->n, sizeof(ta->n), 1, fp);
	ta->m = ta->n; MALLOC(ta->a, ta->n);
	flag += fread(ta->a, sizeof(u_trans_t), ta->n, fp);

	flag += fread(&ta->idx.n, sizeof(ta->idx.n), 1, fp);
	ta->idx.m = ta->idx.n; MALLOC(ta->idx.a, ta->idx.n);
    flag += fread(ta->idx.a, sizeof(uint64_t), ta->idx.n, fp);

	flag += fread(un, sizeof(*un), 1, fp);

	CALLOC(s, 1);
	flag += fread(&(s->n), sizeof(s->n), 1, fp);
	s->m = s->n; MALLOC(s->a, s->n);
    flag += fread(s->a, sizeof(mc_gg_status), s->n, fp);

	flag += fread(hapN, sizeof(*hapN), 1, fp);
	*rta = ta; *rs = s;
	fclose(fp);
    free(buf);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movq %rcx, 0x20(%rsp)
movq %rdx, %r15
movq %rsi, 0x18(%rsp)
movq %rdi, %rbp
movq 0x26a7ad(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x210a82(%rip), %rsi    # 0x2302bf
leaq 0x211a1e(%rip), %rdx    # 0x231262
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22b0
movq %r14, %rdi
callq 0x2090
leaq 0x19(%rax), %rdi
pushq $0x1
popq %rsi
callq 0x2120
movq %rax, %r12
leaq 0x2119e3(%rip), %rsi    # 0x23124e
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x213d28(%rip), %rsi    # 0x2335a7
movq %r12, %rdi
callq 0x2210
testq %rax, %rax
je 0x1f9ad
movq %rax, %r13
pushq $0x1
popq %rbx
movq %rbp, 0x10(%rsp)
pushq $0x30
popq %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %r14
pushq $0x8
popq %rbp
movq %rax, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x22f0
movq %r15, 0x8(%rsp)
movq (%r14), %r15
movq %r15, 0x8(%r14)
imulq $0x30, %r15, %rdi
callq 0x2280
movq %rax, 0x10(%r14)
movq %rax, %rdi
pushq $0x30
popq %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x22f0
leaq 0x18(%r14), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x22f0
movq 0x18(%r14), %r15
movq %r15, 0x20(%r14)
leaq (,%r15,8), %rdi
callq 0x2280
movq %rax, 0x28(%r14)
movq %rax, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x22f0
pushq $0x4
popq %rsi
movq 0x18(%rsp), %rdi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x22f0
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rbp
leaq 0x8(%rax), %rdi
pushq $0x8
popq %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x22f0
movq 0x8(%rbp), %r15
movq %r15, 0x10(%rbp)
movq %r15, %rdi
shlq $0x5, %rdi
callq 0x2280
movq %rax, (%rbp)
pushq $0x20
popq %rsi
movq %rax, %rdi
movq %r15, %rdx
movq %r13, %rcx
callq 0x22f0
pushq $0x2
popq %rsi
movq 0x20(%rsp), %rdi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x22f0
movq 0x10(%rsp), %rax
movq %r14, (%rax)
movq 0x8(%rsp), %rax
movq %rbp, (%rax)
movq %r13, %rdi
callq 0x2190
pushq $0x1
popq %rbx
movq %r12, %rdi
callq 0x2220
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq