// File: /workspace/github_cpp_makefile_star2_O1/6851-2021[P]Cache-Oblivious-Data-Structures/static_search_trees/test_simple_sst.cpp
// Function: test_get_update_4(bool)
void test_get_update_4(bool recursive) {
    // -- 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 < 100; i++) {
        // limit size to the range [0...10000]
        // no point in doing more.
        int t_size = 1 + rand() % 10000;
        simple_static_search_tree tree(t_size, recursive);
        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, j*j);
        }
        for (int j = 0; j < t_size; j++) {
            if (tree.get(j * j) != j) {
                cout << "test_get_update_4 failed: expected value " << j*j << " at index " << j << ", tree size: " << t_size << endl;
                return;
            }
        }
    }
    cout << "test_get_update_4: OK" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %ecx, %ecx
movzbl %dil, %eax
movl %eax, 0x8(%rsp)
leaq 0x18(%rsp), %r14
xorl %edx, %edx
movq %rdx, 0x10(%rsp)
movl %ecx, 0x4(%rsp)
callq 0x1060
cltq
imulq $0x68db8bad, %rax, %rcx # imm = 0x68DB8BAD
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x2c, %rcx
addl %edx, %ecx
imull $0x2710, %ecx, %ecx     # imm = 0x2710
movl %eax, %r15d
subl %ecx, %r15d
negl %ecx
leal (%rax,%rcx), %ebp
incl %ebp
movq %r14, %rdi
movl %ebp, %esi
movl 0x8(%rsp), %edx
callq 0x22a4
testl %r15d, %r15d
js 0x2ef5
leal 0x1(%r15), %ebx
xorl %r12d, %r12d
movq %r14, %rdi
movl %r12d, %esi
movl %r12d, %edx
callq 0x24a8
incl %r12d
cmpl %r12d, %ebx
jne 0x2edf
movl %r15d, %r12d
testl %r15d, %r15d
js 0x2f1c
movl %r12d, %edx
imull %r12d, %edx
movq %r14, %rdi
movl %r12d, %esi
callq 0x24a8
leal -0x1(%r12), %eax
testl %r12d, %r12d
movl %eax, %r12d
jg 0x2efd
movl %ebp, 0xc(%rsp)
testl %r15d, %r15d
js 0x2f5b
movl %r15d, %ebx
shrl $0x1f, %ebx
leal 0x1(%r15), %ebp
xorl %r12d, %r12d
movl %r12d, %r13d
imull %r12d, %r13d
movq %r14, %rdi
movl %r13d, %esi
callq 0x24d2
cmpl %eax, %r12d
jne 0x2f68
cmpl %r15d, %r12d
leal 0x1(%r12), %eax
setge %bl
movl %eax, %r12d
cmpl %eax, %ebp
jne 0x2f32
movq %r14, %rdi
callq 0x230c
jmp 0x300b
movl $0x29, %edx
movq 0x4064(%rip), %rdi      # 0x6fd8
leaq 0x13cf(%rip), %rsi      # 0x434a
callq 0x1130
movq 0x4051(%rip), %rdi      # 0x6fd8
movl %r13d, %esi
callq 0x11b0
movq %rax, %r13
movl $0xa, %edx
movq %rax, %rdi
leaq 0x137a(%rip), %rsi      # 0x431b
callq 0x1130
movq %r13, %rdi
movl %r12d, %esi
callq 0x11b0
movq %rax, %r12
movl $0xd, %edx
movq %rax, %rdi
leaq 0x1363(%rip), %rsi      # 0x4326
callq 0x1130
movq %r12, %rdi
movl 0xc(%rsp), %esi
callq 0x11b0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq %r14, %rdi
callq 0x230c
testb $0x1, %bl
je 0x3075
movq 0x10(%rsp), %rax
cmpl $0x63, %eax
leal 0x1(%rax), %eax
setae %cl
movl %eax, %edx
cmpl $0x64, %eax
jne 0x2e8e
leaq 0x1349(%rip), %rsi      # 0x4374
movl $0x15, %edx
movq 0x3fa1(%rip), %rbx      # 0x6fd8
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
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb $0x1, 0x4(%rsp)
jne 0x3024
jmp 0x3066
jmp 0x3084
jmp 0x3084
jmp 0x3084
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x230c
movq %rbx, %rdi
callq 0x11c0