// File: wx-csy[P]librmq/./librmq/ind.h
// Function: librmq::rmq_ind<int>::query(unsigned long, unsigned long)
size_t query(size_t l, size_t r) {
        size_t lb = l / SEGLEN, rb = r / SEGLEN;
        if (lb != rb) { // speculative policy
            size_t ret = st.query(lb, std::min(nr_blocks, rb + 1));
            if (ret >= l and ret < r) return ret;
        } else {
            size_t base = lb * SEGLEN;
            return lookup_table[segid[lb]][l - base][r - base - 1] + base;
        } 
        
        size_t lbase = lb * SEGLEN, rbase = rb * SEGLEN;
        size_t v = lookup_suf[segid[lb]][l - lbase] + lbase;
        if (r != rbase) {
            size_t v2 = lookup_pref[segid[rb]][r - rbase - 1] + rbase;
            if (data[v2] < data[v]) v = v2;
        }
        if (lb + 1 == rb) return v;
        size_t vv = st.query(lb + 1, rb);
        return data[vv] < data[v] ? vv : v;
    }

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq %rdx, 0x78(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x80(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rax
shrq $0x3, %rax
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rax
cmpq 0x68(%rsp), %rax
je 0x3af1
movq 0x20(%rsp), %rdi
movq %rdi, %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
addq $0x8, %rdi
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
leaq 0x58(%rsp), %rsi
callq 0x3f30
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq (%rax), %rdx
callq 0x2c50
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpq 0x80(%rsp), %rax
jb 0x3aef
movq 0x60(%rsp), %rax
cmpq 0x78(%rsp), %rax
jae 0x3aef
movq 0x60(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x3ca1
jmp 0x3b58
movq 0x20(%rsp), %rax
movq 0x70(%rsp), %rcx
shlq $0x3, %rcx
movq %rcx, 0x50(%rsp)
movq 0x18(%rax), %rax
movq 0x70(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0xd4c28(%rip), %rax     # 0xd8740
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x80(%rsp), %rcx
subq 0x50(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq 0x78(%rsp), %rcx
subq 0x50(%rsp), %rcx
subq $0x1, %rcx
movsbq (%rax,%rcx), %rax
addq 0x50(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x3ca1
movq 0x20(%rsp), %rax
movq 0x70(%rsp), %rcx
shlq $0x3, %rcx
movq %rcx, 0x48(%rsp)
movq 0x68(%rsp), %rcx
shlq $0x3, %rcx
movq %rcx, 0x40(%rsp)
movq 0x18(%rax), %rax
movq 0x70(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0xedde3(%rip), %rax     # 0xf1970
shlq $0x3, %rcx
addq %rcx, %rax
movq 0x80(%rsp), %rcx
subq 0x48(%rsp), %rcx
movsbq (%rax,%rcx), %rax
addq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x78(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x3c1f
movq 0x20(%rsp), %rcx
movq 0x18(%rcx), %rax
movq 0x68(%rsp), %rdx
movslq (%rax,%rdx,4), %rdx
leaq 0xeb0eb(%rip), %rax     # 0xeecc0
shlq $0x3, %rdx
addq %rdx, %rax
movq 0x78(%rsp), %rdx
subq 0x40(%rsp), %rdx
subq $0x1, %rdx
movsbq (%rax,%rdx), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x10(%rcx), %rax
movq 0x30(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x10(%rcx), %rcx
movq 0x38(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x3c1d
movq 0x30(%rsp), %rax
movq %rax, 0x38(%rsp)
jmp 0x3c1f
movq 0x70(%rsp), %rax
addq $0x1, %rax
cmpq 0x68(%rsp), %rax
jne 0x3c3e
movq 0x38(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x3ca1
movq 0x20(%rsp), %rdi
addq $0x20, %rdi
movq 0x70(%rsp), %rsi
addq $0x1, %rsi
movq 0x68(%rsp), %rdx
callq 0x2c50
movq 0x20(%rsp), %rcx
movq %rax, 0x28(%rsp)
movq 0x10(%rcx), %rax
movq 0x28(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x10(%rcx), %rcx
movq 0x38(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x3c8a
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x3c94
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)