// File: nilnilnil[P]autocomplete/./include/segtree.hpp
// Function: segtree::test()
int
    test() {
        vui_t v;
        v.push_back(45);
        v.push_back(4);
        v.push_back(5);
        v.push_back(2);
        v.push_back(99);
        v.push_back(41);
        v.push_back(45);
        v.push_back(45);
        v.push_back(51);
        v.push_back(89);
        v.push_back(1);
        v.push_back(3);
        v.push_back(5);
        v.push_back(98);

        for (int i = 0; i < 10; ++i) {
            // printf("%d: %d\n", i, log2(i));
        }

        SegmentTree st;
        st.initialize(v);

        for (size_t i = 0; i < v.size(); ++i) {
            for (size_t j = i; j < v.size(); ++j) {
                pui_t one = st.query_max(i, j);
                pui_t two = naive_query_max(v, i, j);
                printf("query_max(%u, %u) == (%u, %u)\n", (uint_t)i, (uint_t)j, one.first, two.first);
                assert(one.first == two.first);
            }
        }

        return 0;
    }

// Assembly:
subq $0xd8, %rsp
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xd3d0
movq 0x28(%rsp), %rdi
movl $0x2d, 0xbc(%rsp)
leaq 0xbc(%rsp), %rsi
callq 0xd3e0
jmp 0x5f08
movl $0x4, 0xa8(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0xd3e0
jmp 0x5f2a
movl $0x5, 0xa4(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa4(%rsp), %rsi
callq 0xd3e0
jmp 0x5f4c
movl $0x2, 0xa0(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xd3e0
jmp 0x5f6e
movl $0x63, 0x9c(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x9c(%rsp), %rsi
callq 0xd3e0
jmp 0x5f90
movl $0x29, 0x98(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd3e0
jmp 0x5fb2
movl $0x2d, 0x94(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x94(%rsp), %rsi
callq 0xd3e0
jmp 0x5fd4
movl $0x2d, 0x90(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xd3e0
jmp 0x5ff6
movl $0x33, 0x8c(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x8c(%rsp), %rsi
callq 0xd3e0
jmp 0x6018
movl $0x59, 0x88(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xd3e0
jmp 0x603a
movl $0x1, 0x84(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x84(%rsp), %rsi
callq 0xd3e0
jmp 0x605c
movl $0x3, 0x80(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xd3e0
jmp 0x607e
movl $0x5, 0x7c(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x7c(%rsp), %rsi
callq 0xd3e0
jmp 0x609a
movl $0x62, 0x78(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0xd3e0
jmp 0x60b6
movl $0x0, 0x74(%rsp)
cmpl $0xa, 0x74(%rsp)
jge 0x60ed
jmp 0x60c7
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x60be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x6247
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0xd410
jmp 0x60fb
leaq 0x50(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0xd460
jmp 0x610f
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xd4e0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x6226
movq 0x48(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xd4e0
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x6211
movl 0x48(%rsp), %esi
movl 0x40(%rsp), %edx
leaq 0x50(%rsp), %rdi
callq 0xd500
movq %rax, 0x10(%rsp)
jmp 0x618b
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rsp)
movl 0x48(%rsp), %esi
movl 0x40(%rsp), %edx
leaq 0xc0(%rsp), %rdi
callq 0x5e30
movq %rax, 0x8(%rsp)
jmp 0x61b1
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
movl 0x48(%rsp), %esi
movl 0x40(%rsp), %edx
movl 0x38(%rsp), %ecx
movl 0x30(%rsp), %r8d
leaq 0x1be4f(%rip), %rdi     # 0x22022
xorl %eax, %eax
callq 0x5070
jmp 0x61dc
jmp 0x61de
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x614a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x50(%rsp), %rdi
callq 0xd540
jmp 0x6247
jmp 0x6213
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x6118
leaq 0x50(%rsp), %rdi
callq 0xd540
leaq 0xc0(%rsp), %rdi
callq 0xd550
xorl %eax, %eax
addq $0xd8, %rsp
retq
leaq 0xc0(%rsp), %rdi
callq 0xd550
movq 0xb0(%rsp), %rdi
callq 0x5a40
nopw %cs:(%rax,%rax)