// File: chhylp123[P]hifiasm/inter.cpp
// Function: debug_sl_compress_base_disk_0(uldat_t*, char*)
void debug_sl_compress_base_disk_0(uldat_t *sl, char* gfa_name)
{
	int32_t ret, rid = 0, sr_0, sr_1; gzFile fp;
	init_ucr_file_t(sl, gfa_name, 1);
	fp = gzopen(gfa_name, "r"); assert(fp);
    sl->ks = kseq_init(fp);
	while ((ret = kseq_read(sl->ks)) >= 0) {
		write_compress_base_disk(sl->ucr_s->fp, rid, sl->ks->seq.s, sl->ks->seq.l, &(sl->ucr_s->u));
		rid++;   
	}
	kseq_destroy(sl->ks);
    gzclose(fp);

	destory_ucr_file_t(sl);


	uint64_t ulid; uint32_t ulen; kvec_t(char) des; kv_init(des);
	init_ucr_file_t(sl, gfa_name, 2); rid = 0;

	fp = gzopen(gfa_name, "r"); assert(fp);
    sl->ks = kseq_init(fp);
	while (1) {
		sr_0 = kseq_read(sl->ks); des.n = 0; 
		if(sr_0 >= 0) sr_0 = 1;
		else sr_0 = 0;
		if(sr_0 == 0) sl->ks->seq.l = 1;
		kv_resize(char, des, sl->ks->seq.l);
		sr_1 = load_compress_base_disk(sl->ucr_s->fp, &ulid, des.a, &ulen, &(sl->ucr_s->u));
		if(sr_0 != sr_1) fprintf(stderr, "[M::%s::] rid->%d, sr_0->%d, sr_1->%d\n", __func__, rid, sr_0, sr_1);
		assert(sr_0 == sr_1);
		if(sr_0 == 0 || sr_1 == 0) break;
		// if(rid != (int64_t)ulid) fprintf(stderr, "[M::%s::] rid->%d, ulid->%lu, sr_0->%d, sr_1->%d\n", __func__, rid, ulid, sr_0, sr_1);
		assert(rid == (int64_t)ulid);
		assert(sl->ks->seq.l == ulen);
		assert(memcmp(sl->ks->seq.s, des.a, ulen) == 0);
		rid++;   
	}
	kseq_destroy(sl->ks); kv_destroy(des);
    gzclose(fp);

	destory_ucr_file_t(sl);
	fprintf(stderr, "[M::%s::] ==> Have checked %d UL reads\n", __func__, rid);
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x1, %edx
callq 0x2cf000
movq -0x10(%rbp), %rdi
leaq 0xc1212(%rip), %rsi     # 0x3903d6
callq 0x22c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x2cf1d6
jmp 0x2cf1f5
leaq 0xc3b5a(%rip), %rdi     # 0x392d37
leaq 0xc164b(%rip), %rsi     # 0x39082f
movl $0x33a2, %edx           # imm = 0x33A2
leaq 0xc3b4a(%rip), %rcx     # 0x392d3a
callq 0x2130
movq -0x28(%rbp), %rdi
callq 0x2ce660
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x2cf590
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0x2cf263
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rdi
movslq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x40(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq 0x40(%rax), %r8
addq $0x8, %r8
callq 0x13590
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2cf209
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x2cee50
movq -0x28(%rbp), %rdi
callq 0x2380
movq -0x8(%rbp), %rdi
callq 0x2cf110
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x2, %edx
callq 0x2cf000
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xc1118(%rip), %rsi     # 0x3903d6
callq 0x22c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x2cf2d0
jmp 0x2cf2ef
leaq 0xc3a60(%rip), %rdi     # 0x392d37
leaq 0xc1551(%rip), %rsi     # 0x39082f
movl $0x33b1, %edx           # imm = 0x33B1
leaq 0xc3a50(%rip), %rcx     # 0x392d3a
callq 0x2130
movq -0x28(%rbp), %rdi
callq 0x2ce660
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x2cf590
movl %eax, -0x1c(%rbp)
movq $0x0, -0x50(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x2cf32a
movl $0x1, -0x1c(%rbp)
jmp 0x2cf331
movl $0x0, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x2cf347
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq $0x1, 0x30(%rax)
jmp 0x2cf349
movq -0x48(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
cmpq 0x30(%rcx), %rax
jae 0x2cf3eb
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shrq %rax
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shrq $0x2, %rax
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shrq $0x4, %rax
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shrq $0x8, %rax
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shrq $0x10, %rax
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
shlq $0x0, %rsi
callq 0x2360
movq %rax, -0x40(%rbp)
jmp 0x2cf3ed
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x40(%rax), %r8
addq $0x8, %r8
leaq -0x30(%rbp), %rsi
leaq -0x34(%rbp), %rcx
callq 0x13790
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x2cf44a
movq 0xf4bb9(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %r8d
movl -0x20(%rbp), %r9d
leaq 0xc3934(%rip), %rsi     # 0x392d70
leaq 0xc3954(%rip), %rdx     # 0x392d97
movb $0x0, %al
callq 0x22a0
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x2cf454
jmp 0x2cf473
leaq 0xc395a(%rip), %rdi     # 0x392db5
leaq 0xc13cd(%rip), %rsi     # 0x39082f
movl $0x33bb, %edx           # imm = 0x33BB
leaq 0xc38cc(%rip), %rcx     # 0x392d3a
callq 0x2130
cmpl $0x0, -0x1c(%rbp)
je 0x2cf47f
cmpl $0x0, -0x20(%rbp)
jne 0x2cf484
jmp 0x2cf532
movslq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x2cf490
jmp 0x2cf4af
leaq 0xc392b(%rip), %rdi     # 0x392dc2
leaq 0xc1391(%rip), %rsi     # 0x39082f
movl $0x33be, %edx           # imm = 0x33BE
leaq 0xc3890(%rip), %rcx     # 0x392d3a
callq 0x2130
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rax), %rax
movl -0x34(%rbp), %ecx
cmpq %rcx, %rax
jne 0x2cf4c5
jmp 0x2cf4e4
leaq 0xc390b(%rip), %rdi     # 0x392dd7
leaq 0xc135c(%rip), %rsi     # 0x39082f
movl $0x33bf, %edx           # imm = 0x33BF
leaq 0xc385b(%rip), %rcx     # 0x392d3a
callq 0x2130
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x40(%rax), %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %eax
movl %eax, %edx
callq 0x20b0
cmpl $0x0, %eax
jne 0x2cf505
jmp 0x2cf524
leaq 0xc38e1(%rip), %rdi     # 0x392ded
leaq 0xc131c(%rip), %rsi     # 0x39082f
movl $0x33c0, %edx           # imm = 0x33C0
leaq 0xc381b(%rip), %rcx     # 0x392d3a
callq 0x2130
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2cf303
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x2cee50
movq -0x40(%rbp), %rdi
callq 0x2210
movq -0x28(%rbp), %rdi
callq 0x2380
movq -0x8(%rbp), %rdi
callq 0x2cf110
movq 0xf4a7f(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x18(%rbp), %ecx
leaq 0xc38a7(%rip), %rsi     # 0x392e15
leaq 0xc3822(%rip), %rdx     # 0x392d97
movb $0x0, %al
callq 0x22a0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)