// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi-lite/rld0.c
// Function: rld_dump
int rld_dump(const rld_t *e, const char *fn)
{
	uint64_t k = 0;
	int i;
	uint32_t a;
	FILE *fp;
	fp = strcmp(fn, "-")? fopen(fn, "wb") : fdopen(fileno(stdout), "wb");
	if (fp == 0) return -1;
	a = e->asize<<16 | e->sbits;
	fwrite("RLD\3", 1, 4, fp); // write magic
	fwrite(&a, 4, 1, fp); // write sbits and asize
	fwrite(&k, 8, 1, fp); // preserve 8 bytes for future uses
	fwrite(&e->n_bytes, 8, 1, fp); // n_bytes can always be divided by 8
	fwrite(&e->n_frames, 8, 1, fp); // number of frames
	fwrite(e->mcnt + 1, 8, e->asize, fp); // write the marginal counts
	for (i = 0, k = e->n_bytes / 8; i < e->n - 1; ++i, k -= RLD_LSIZE)
		fwrite(e->z[i], 8, RLD_LSIZE, fp);
	fwrite(e->z[i], 8, k, fp);
	fwrite(e->frame, 8 * e->asize1, e->n_frames, fp);
	fclose(fp);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x190a9(%rip), %rsi     # 0x253dc
callq 0x2150
cmpl $0x0, %eax
je 0xc353
movq -0x18(%rbp), %rdi
leaq 0x19380(%rip), %rsi     # 0x256c8
callq 0x2250
movq %rax, -0x38(%rbp)
jmp 0xc374
movq 0x1dc66(%rip), %rax     # 0x29fc0
movq (%rax), %rdi
callq 0x21a0
movl %eax, %edi
leaq 0x1935d(%rip), %rsi     # 0x256c8
callq 0x21f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xc38f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc504
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
shll $0x10, %eax
movq -0x10(%rbp), %rcx
movsbl 0x3(%rcx), %ecx
orl %ecx, %eax
movl %eax, -0x28(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x1931a(%rip), %rdi     # 0x256cb
movl $0x1, %esi
movl $0x4, %edx
callq 0x2280
movq -0x30(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x2280
movq -0x30(%rbp), %rcx
leaq -0x20(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x2280
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x2280
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x2280
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %edx
movq -0x30(%rbp), %rcx
movl $0x8, %esi
callq 0x2280
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
shrq $0x3, %rax
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xc4ab
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x800000, %edx         # imm = 0x800000
callq 0x2280
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
subq $0x800000, %rax         # imm = 0x800000
movq %rax, -0x20(%rbp)
jmp 0xc45e
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x8, %esi
callq 0x2280
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x3, %eax
movslq %eax, %rsi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x30(%rbp), %rcx
callq 0x2280
movq -0x30(%rbp), %rdi
callq 0x20a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)