// File: /workspace/github_c_makefile_star2_O0/lh3[P]fermi-lite/unitig.c
// Function: fm6_retrieve
uint64_t fm6_retrieve(const rld_t *e, uint64_t x, kstring_t *s, rldintv_t *k2, int *contained)
{
	uint64_t k = x, ok[6];
	rldintv_t ok2[6];
	s->l = 0; *contained = 0;
	while (1) {
		int c = rld_rank1a(e, k + 1, ok);
		k = e->cnt[c] + ok[c] - 1;
		if (c == 0) break;
		if (s->l > 0) {
			if (k2->x[2] == 1) k2->x[0] = k;
			else {
				rld_extend(e, k2, ok2, 1);
				*k2 = ok2[c];
			}
		} else fm6_set_intv(e, c, *k2);
		kputc(c, s);
	}
	if (k2->x[2] != 1) {
		rld_extend(e, k2, ok2, 1);
		if (ok2[0].x[2] != k2->x[2]) *contained |= 1; // left contained
		*k2 = ok2[0];
	} else k2->x[0] = k;
	rld_extend(e, k2, ok2, 0);
	if (ok2[0].x[2] != k2->x[2]) *contained |= 2; // right contained
	*k2 = ok2[0];
	return k;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x1, %rsi
leaq -0x60(%rbp), %rdx
callq 0xccb0
movl %eax, -0x124(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x124(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x124(%rbp), %rcx
addq -0x60(%rbp,%rcx,8), %rax
subq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x124(%rbp)
jne 0xdb2c
jmp 0xdc6c
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0xdba3
movq -0x20(%rbp), %rax
cmpq $0x1, 0x10(%rax)
jne 0xdb4e
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0xdb9e
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x120(%rbp), %rdx
movl $0x1, %ecx
callq 0xd6f0
movq -0x20(%rbp), %rax
movslq -0x124(%rbp), %rdx
leaq -0x120(%rbp), %rcx
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
jmp 0xdc58
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x124(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x124(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x124(%rbp), %rdx
subq (%rax,%rdx,8), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x130(%rbp)
cmpl $0x1, -0x124(%rbp)
jl 0xdc24
cmpl $0x4, -0x124(%rbp)
jg 0xdc24
movl $0x5, %eax
subl -0x124(%rbp), %eax
movl %eax, -0x134(%rbp)
jmp 0xdc30
movl -0x124(%rbp), %eax
movl %eax, -0x134(%rbp)
movq -0x130(%rbp), %rax
movl -0x134(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movl -0x124(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0xdd60
jmp 0xdadc
movq -0x20(%rbp), %rax
cmpq $0x1, 0x10(%rax)
je 0xdcdd
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x120(%rbp), %rdx
movl $0x1, %ecx
callq 0xd6f0
movq -0x110(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0xdcac
movq -0x28(%rbp), %rax
movl (%rax), %ecx
orl $0x1, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq -0x120(%rbp), %rcx
movq %rcx, (%rax)
movq -0x118(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x110(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x108(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0xdce8
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x120(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd6f0
movq -0x110(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0xdd1a
movq -0x28(%rbp), %rax
movl (%rax), %ecx
orl $0x2, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq -0x120(%rbp), %rcx
movq %rcx, (%rax)
movq -0x118(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x110(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x108(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)