// File: /workspace/github_c_makefile_star2_O1/lh3[P]fermi-lite/rld0.c
// Function: rld_enc1
static int rld_enc1(rld_t *e, rlditr_t *itr, int64_t l, uint8_t c)
{
	int w;
	uint64_t x = rld_delta_enc1(l, &w) << e->abits | c;
	w += e->abits;
	if (w >= itr->r && itr->p == itr->stail) enc_next_block(e, itr);
	if (w > itr->r) {
		w -= itr->r;
		*itr->p++ |= x >> w;
		*itr->p = x << (itr->r = 64 - w);
	} else itr->r -= w, *itr->p |= x << itr->r;
	e->cnt[0] += l;
	e->cnt[c + 1] += l;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %eax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rdx, %rcx
shrq $0x20, %rcx
jne 0x8763
cmpq $0x10000, %rbx          # imm = 0x10000
jae 0x8785
cmpq $0x100, %rbx            # imm = 0x100
jae 0x87be
leaq 0xf016(%rip), %rcx      # 0x17770
movsbl (%rbx,%rcx), %ecx
jmp 0x880a
movq %rbx, %rdx
shrq $0x30, %rdx
jne 0x87a5
movq %rbx, %rdx
shrq $0x28, %rdx
jne 0x87d5
leaq 0xeff4(%rip), %rdx      # 0x17770
movsbl (%rcx,%rdx), %ecx
jmp 0x8807
movq %rbx, %rcx
cmpq $0x1000000, %rbx        # imm = 0x1000000
jae 0x87e5
shrq $0x10, %rcx
leaq 0xefd4(%rip), %rdx      # 0x17770
movsbl (%rcx,%rdx), %ecx
addl $0x10, %ecx
jmp 0x880a
movq %rbx, %rcx
shrq $0x38, %rcx
jne 0x87f9
leaq 0xefbb(%rip), %rcx      # 0x17770
movsbl (%rdx,%rcx), %ecx
addl $0x10, %ecx
jmp 0x8807
movq %rbx, %rcx
shrq $0x8, %rcx
leaq 0xefa4(%rip), %rdx      # 0x17770
movsbl (%rcx,%rdx), %ecx
addl $0x8, %ecx
jmp 0x880a
leaq 0xef94(%rip), %rcx      # 0x17770
movsbl (%rdx,%rcx), %ecx
addl $0x8, %ecx
jmp 0x8807
shrq $0x18, %rcx
leaq 0xef80(%rip), %rdx      # 0x17770
movsbl (%rcx,%rdx), %ecx
addl $0x18, %ecx
jmp 0x880a
leaq 0xef70(%rip), %rdx      # 0x17770
movsbl (%rcx,%rdx), %ecx
addl $0x18, %ecx
addl $0x20, %ecx
leal 0x1(%rcx), %edx
cmpl $0x10000, %edx          # imm = 0x10000
jae 0x882c
cmpl $0x100, %edx            # imm = 0x100
jae 0x8849
movl %edx, %esi
leaq 0xef4a(%rip), %rdi      # 0x17770
movsbl (%rsi,%rdi), %esi
jmp 0x886f
movl %edx, %esi
cmpl $0x1000000, %edx        # imm = 0x1000000
jae 0x885e
shrl $0x10, %esi
leaq 0xef30(%rip), %rdi      # 0x17770
movsbl (%rsi,%rdi), %esi
addl $0x10, %esi
jmp 0x886f
movl %edx, %esi
shrl $0x8, %esi
leaq 0xef1b(%rip), %rdi      # 0x17770
movsbl (%rsi,%rdi), %esi
addl $0x8, %esi
jmp 0x886f
shrl $0x18, %esi
leaq 0xef08(%rip), %rdi      # 0x17770
movsbl (%rsi,%rdi), %esi
addl $0x18, %esi
leal (%rdx,%rsi,2), %ebp
movslq %edx, %r12
shlq %cl, %r12
movq %rbx, %rdx
btcq %rcx, %rdx
orq %rdx, %r12
movsbl 0x2(%r14), %ecx
shlq %cl, %r12
movzbl %al, %r13d
addl %ecx, %ebp
cmpl (%r15), %ebp
jl 0x88aa
movq 0x10(%r15), %rax
cmpq 0x20(%r15), %rax
jne 0x88aa
movq %r14, %rdi
movq %r15, %rsi
callq 0x8d5c
orq %r13, %r12
movl (%r15), %eax
movl %ebp, %ecx
subl %eax, %ecx
jle 0x88e0
movq %r12, %rax
shrq %cl, %rax
movq 0x10(%r15), %rdx
leaq 0x8(%rdx), %rsi
movq %rsi, 0x10(%r15)
orq %rax, (%rdx)
movl $0x40, %eax
subl %ecx, %eax
movl %eax, (%r15)
negl %ecx
shlq %cl, %r12
movq %r12, 0x8(%rdx)
jmp 0x88f1
subl %ebp, %eax
movl %eax, (%r15)
movl %eax, %ecx
shlq %cl, %r12
movq 0x10(%r15), %rax
orq %r12, (%rax)
movq 0x20(%r14), %rax
addq %rbx, (%rax)
addq %rbx, 0x8(%rax,%r13,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq