// File: wx-csy[P]librmq/./librmq/ind.h
// Function: librmq::rmq_ind<int>::rmq_ind(unsigned long, int const*)
rmq_ind(size_t n, const T *data) :
            n(n), data(data) {
        nr_blocks = (n + SEGLEN - 1) / SEGLEN;
        size_t *segdata = new size_t[nr_blocks]; // ownership transferred to ST
        segid = new int[nr_blocks];
        size_t ptr = 0;
        for (size_t i = 0; ptr + SEGLEN <= n; ptr += SEGLEN, i++) {
            segdata[i] = std::min_element(data + ptr, data + ptr + SEGLEN) - data;
            segid[i] = select_segment(data + ptr);
        }
        if (ptr != n) {
            T rdata[SEGLEN] = {0};
            for (size_t i = 0; ptr + i < n; i++) rdata[i] = data[ptr + i];
            segdata[nr_blocks - 1] = std::min_element(data + ptr, data + n) - data;
            segid[nr_blocks - 1] = select_segment(rdata);
        }
        st.init(nr_blocks, data, segdata);
    }

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq 0xb0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, (%rdi)
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rdi)
addq $0x20, %rdi
movq %rdi, 0x30(%rsp)
callq 0x3d00
movq 0x38(%rsp), %rax
movq 0xa8(%rsp), %rcx
addq $0x7, %rcx
shrq $0x3, %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x1030
movq %rax, 0x40(%rsp)
jmp 0x37b0
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %rcx, 0x98(%rsp)
movq 0x8(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x1030
movq %rax, 0x28(%rsp)
jmp 0x37e8
movq 0x38(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq $0x0, 0x80(%rsp)
movq $0x0, 0x78(%rsp)
movq 0x80(%rsp), %rax
addq $0x8, %rax
cmpq 0xa8(%rsp), %rax
ja 0x38ed
movq 0xa0(%rsp), %rax
movq 0x80(%rsp), %rcx
leaq (%rax,%rcx,4), %rdi
leaq 0x20(%rax,%rcx,4), %rsi
callq 0x3d60
movq %rax, 0x20(%rsp)
jmp 0x384a
movq 0x20(%rsp), %rdx
movq 0xa0(%rsp), %rax
subq %rax, %rdx
sarq $0x2, %rdx
movq 0x98(%rsp), %rax
movq 0x78(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0xa0(%rsp), %rax
movq 0x80(%rsp), %rcx
leaq (%rax,%rcx,4), %rdi
callq 0x3da0
movl %eax, 0x1c(%rsp)
jmp 0x388e
movl 0x1c(%rsp), %edx
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x78(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x80(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x80(%rsp)
movq 0x78(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x78(%rsp)
jmp 0x380b
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
callq 0x2e70
jmp 0x3a12
movq 0x80(%rsp), %rax
cmpq 0xa8(%rsp), %rax
je 0x39e3
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x10a0
movq $0x0, 0x48(%rsp)
movq 0x80(%rsp), %rax
addq 0x48(%rsp), %rax
cmpq 0xa8(%rsp), %rax
jae 0x3965
movq 0xa0(%rsp), %rax
movq 0x80(%rsp), %rcx
addq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x50(%rsp,%rax,4)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x391d
movq 0xa0(%rsp), %rax
movq 0x80(%rsp), %rcx
leaq (%rax,%rcx,4), %rdi
movq 0xa8(%rsp), %rcx
leaq (%rax,%rcx,4), %rsi
callq 0x3d60
movq %rax, 0x10(%rsp)
jmp 0x3991
movq 0x38(%rsp), %rcx
movq 0x10(%rsp), %rdx
movq 0xa0(%rsp), %rax
subq %rax, %rdx
sarq $0x2, %rdx
movq 0x98(%rsp), %rax
movq 0x8(%rcx), %rcx
movq %rdx, -0x8(%rax,%rcx,8)
leaq 0x50(%rsp), %rdi
callq 0x3da0
movl %eax, 0xc(%rsp)
jmp 0x39cb
movl 0xc(%rsp), %edx
movq 0x38(%rsp), %rcx
movq 0x18(%rcx), %rax
movq 0x8(%rcx), %rcx
subq $0x1, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x38(%rsp), %rax
movq %rax, %rdi
addq $0x20, %rdi
movq 0x8(%rax), %rsi
movq 0xa0(%rsp), %rdx
movq 0x98(%rsp), %rcx
callq 0x2ef0
jmp 0x3a0a
addq $0xb8, %rsp
retq
movq 0x90(%rsp), %rdi
callq 0x1120
nop