// File: /workspace/github_cpp_makefile_star2_O3/6851-2021[P]Cache-Oblivious-Data-Structures/static_search_trees/test_ca_sst.cpp
// Function: test_get_update_5()
void test_get_update_5() {
    // -- This is a bit of stress test
    // Test update all elements.
    // make value = key^2. Do multiple passes with random tree sizes.
    for (int i = 0; i < 1; i++) {
        // limit size to the range [0...10000]
        // no point in doing more.
        int t_size = 5000000;
        CA_static_search_tree tree(t_size);
        for (int j = 0; j < t_size; j++) {
            tree.update(j, j);
        }
        // now update them again but in BACKWARDS order.
        for (int j = t_size - 1; j >= 0; j--) {
            tree.update(j, 2*j);
        }
        // for (int j = 0; j < t_size; j++) {
        //     if (tree.get(2*j) != j) {
        //         cout << "test_get_update_5 failed: expected value " << j*j << " at index " << j << ", tree size: " << t_size << endl;
        //         return;
        //     }
        // }
        for (int j = 0; j < t_size; j++) {
            if (tree.get(2*j) != j) {
                cout << "test_get_update_5 failed: expected value " << 2*j << " at index " << j << ", tree size: " << t_size << endl;
                return;
            }
            if (tree.get(2*(t_size-j-1)) != (t_size-j-1)) {
                cout << "test_get_update_5 failed: expected value " << 2*j << " at index " << j << ", tree size: " << t_size << endl;
                return;
            }
        }
    }
    cout << "test_get_update_5: OK" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x4c4b40, %esi         # imm = 0x4C4B40
callq 0x1f72
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
movl %ebp, %edx
callq 0x219e
incl %ebp
cmpl $0x4c4b40, %ebp         # imm = 0x4C4B40
jne 0x2f4e
movl $0x4c4b3f, %ebx         # imm = 0x4C4B3F
movl $0x98967e, %ebp         # imm = 0x98967E
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x219e
decl %ebx
addl $-0x2, %ebp
cmpl $-0x2, %ebp
jne 0x2f73
xorl %ebp, %ebp
movl $0x98967e, %r14d        # imm = 0x98967E
movl $0x4c4b3f, %r12d        # imm = 0x4C4B3F
leaq 0x8(%rsp), %r15
xorl %ebx, %ebx
movq %r15, %rdi
movl %ebp, %esi
callq 0x21ce
cmpl %eax, %ebx
jne 0x3025
movq %r15, %rdi
movl %r14d, %esi
callq 0x21ce
cmpl %eax, %r12d
jne 0x30ac
incl %ebx
addl $0x2, %ebp
addl $-0x2, %r14d
decl %r12d
cmpl $0x4c4b40, %ebx         # imm = 0x4C4B40
jne 0x2f9e
leaq 0x8(%rsp), %rdi
callq 0x1fd8
movq 0x3ff3(%rip), %rbx      # 0x6fd8
leaq 0x13c8(%rip), %rsi      # 0x43b4
movl $0x15, %edx
movq %rbx, %rdi
callq 0x1130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
jmp 0x314b
movq 0x3fac(%rip), %rdi      # 0x6fd8
leaq 0x1357(%rip), %rsi      # 0x438a
movl $0x29, %edx
callq 0x1130
movq 0x3f94(%rip), %rdi      # 0x6fd8
movl %ebp, %esi
callq 0x11b0
movq %rax, %r14
leaq 0x12c6(%rip), %rsi      # 0x431b
movl $0xa, %edx
movq %rax, %rdi
callq 0x1130
movq %r14, %rdi
movl %ebx, %esi
callq 0x11b0
movq %rax, %rbx
leaq 0x12b0(%rip), %rsi      # 0x4326
movl $0xd, %edx
movq %rax, %rdi
callq 0x1130
movq %rbx, %rdi
movl $0x4c4b40, %esi         # imm = 0x4C4B40
callq 0x11b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
jmp 0x312e
movq 0x3f25(%rip), %rdi      # 0x6fd8
leaq 0x12d0(%rip), %rsi      # 0x438a
movl $0x29, %edx
callq 0x1130
movq 0x3f0d(%rip), %rdi      # 0x6fd8
movl %ebp, %esi
callq 0x11b0
movq %rax, %r14
leaq 0x123f(%rip), %rsi      # 0x431b
movl $0xa, %edx
movq %rax, %rdi
callq 0x1130
movq %r14, %rdi
movl %ebx, %esi
callq 0x11b0
movq %rax, %rbx
leaq 0x1229(%rip), %rsi      # 0x4326
movl $0xd, %edx
movq %rax, %rdi
callq 0x1130
movq %rbx, %rdi
movl $0x4c4b40, %esi         # imm = 0x4C4B40
callq 0x11b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
leaq 0x8(%rsp), %rdi
callq 0x1fd8
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x315e
jmp 0x315e
jmp 0x315e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1fd8
movq %rbx, %rdi
callq 0x11c0