// File: nilnilnil[P]autocomplete/./include/sparsetable.hpp
// Function: SparseTable::initialize(std::vector<unsigned int, std::allocator<unsigned int>> const&)
void initialize(vui_t const& elems) {

        this->len = elems.size();
        this->repr.clear();

        cerr<<"len: "<<this->len<<endl;

        const size_t ntables = log2(this->len) + 1;
        this->repr.resize(ntables);

        cerr<<"ntables: "<<ntables<<endl;

        this->repr[0].resize(this->len);
        for (size_t i = 0; i < this->len; ++i) {
            this->repr[0][i] = std::make_pair(elems[i], i);
        }

        for (size_t i = 1; i < ntables; ++i) {
            // bs is the 'block size'. i.e. Number of element in the
            // array this->repr[i]
            // cerr<<"starting i: "<<i<<endl;
            const uint_t pbs = 1<<(i-1);
            const uint_t bs = 1<<i;
            const size_t vsz = this->len - bs + 1;

            this->repr[i] = vpui_t();
            this->repr[i].resize(vsz);

            // cerr<<"i: "<<i<<", vsz: "<<vsz<<endl;

            vpui_t& curr = this->repr[i];
            vpui_t& prev = this->repr[i - 1];

            for (size_t j = 0; j < vsz; ++j) {
                // 'j' is the starting index of a block of size 'bs'
                if (prev[j].first > prev[j+pbs].first) {
                    curr[j] = prev[j];
                }
                else {
                    curr[j] = prev[j+pbs];
                }
                // cerr<<"curr["<<j<<"] = "<<curr[j].first<<endl;
            }
            // cerr<<"done with i: "<<i<<endl;
        }
        // cerr<<"initialize() completed"<<endl;
    }

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x88(%rsp), %rdi
callq 0xd4e0
movq 0x18(%rsp), %rdi
movl %eax, 0x18(%rdi)
callq 0x10070
movq 0x1d9eb(%rip), %rdi     # 0x2aff0
leaq 0x14f57(%rip), %rsi     # 0x22563
callq 0x5550
movq %rax, %rdi
movq 0x18(%rsp), %rax
movl 0x18(%rax), %esi
callq 0x57a0
movq %rax, %rdi
movq 0x1d97d(%rip), %rsi     # 0x2afa8
callq 0x55a0
movq 0x18(%rsp), %rax
movl 0x18(%rax), %edi
callq 0x5d90
movq 0x18(%rsp), %rdi
addl $0x1, %eax
movl %eax, %eax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rsi
callq 0x10090
movq 0x1d98d(%rip), %rdi     # 0x2aff0
leaq 0x14eff(%rip), %rsi     # 0x22569
callq 0x5550
movq %rax, %rdi
movq 0x80(%rsp), %rsi
callq 0x5110
movq %rax, %rdi
movq 0x1d91f(%rip), %rsi     # 0x2afa8
callq 0x55a0
movq 0x18(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10130
movq %rax, %rdi
movq 0x18(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, %esi
callq 0xf070
movq $0x0, 0x78(%rsp)
movq 0x18(%rsp), %rcx
movq 0x78(%rsp), %rax
movl 0x18(%rcx), %ecx
cmpq %rcx, %rax
jae 0xd729
movq 0x88(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0xd380
movq %rax, %rdi
leaq 0x78(%rsp), %rsi
callq 0x10150
movq 0x18(%rsp), %rdi
movl %eax, 0x68(%rsp)
movq %rdx, 0x70(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0x10130
movq %rax, %rdi
movq 0x78(%rsp), %rsi
callq 0xfde0
movq %rax, %rdi
leaq 0x68(%rsp), %rsi
callq 0x10180
movq 0x78(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x78(%rsp)
jmp 0xd6b7
movq $0x1, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpq 0x80(%rsp), %rax
jae 0xd8ec
movq 0x18(%rsp), %rax
movq 0x60(%rsp), %rcx
subq $0x1, %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x5c(%rsp)
movq 0x60(%rsp), %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x58(%rsp)
movl 0x18(%rax), %eax
subl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, 0x50(%rsp)
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x52a0
leaq 0x38(%rsp), %rdi
callq 0xef30
movq 0x18(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x10130
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x101b0
leaq 0x38(%rsp), %rdi
callq 0xef90
movq 0x18(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x10130
movq %rax, %rdi
movq 0x50(%rsp), %rsi
callq 0xf070
movq 0x18(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x10130
movq 0x18(%rsp), %rdi
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rsi
subq $0x1, %rsi
callq 0x10130
movq %rax, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x50(%rsp), %rax
jae 0xd8d7
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xfde0
movl (%rax), %eax
movl %eax, 0x14(%rsp)
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x5c(%rsp), %eax
addq %rax, %rsi
callq 0xfde0
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl (%rcx), %eax
jbe 0xd88d
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xfde0
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xfde0
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0xfe00
jmp 0xd8c2
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x5c(%rsp), %eax
addq %rax, %rsi
callq 0xfde0
movq %rax, (%rsp)
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xfde0
movq (%rsp), %rsi
movq %rax, %rdi
callq 0xfe00
jmp 0xd8c4
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0xd815
jmp 0xd8d9
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0xd732
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)
nop