// File: /workspace/github_cpp_makefile_star2_O2/6851-2021[P]Cache-Oblivious-Data-Structures/static_search_trees/test_simple_sst.cpp
// Function: test_get_update_1(bool)
void test_get_update_1(bool recursive) {
    // Test with a tree of size 15.
    int n = 15;
    simple_static_search_tree tree(n, recursive);
    int a[15];
    a[0] = rand() % 10;
    for (int i = 1; i < n; ++i) {
        a[i] = a[i - 1] + rand() % 10;
        tree.update(i, a[i]);
    }

    for (int i = 0; i < n; ++i) {
        tree.update(i, a[i]);
    }

    int index;

    index = tree.get(a[13]);
    if (index != 13)
    {
        print_array(a, n);
        printf("test_get_update_1 failed: expected %d at index 13, got: %d\n", a[13], index);
        return;
    }

    index = tree.get(a[5]);
    if (index != 5)
    {
        print_array(a, n);
        printf("test_get_update_1 failed: expected %d at index 5, got: %d\n", a[5], index);
        return;
    }

    index = tree.get(a[0]);
    if (index != 0)
    {
        print_array(a, n);
        printf("test_get_update_1 failed: expected %d at index 0, got: %d\n", a[0], index);
        return;
    }

    index = tree.get(a[13]);
    if (index != 13)
    {
        print_array(a, n);
        printf("test_get_update_1 failed: expected %d at index 13, got: %d\n", a[13], index);
        return;
    }
    cout << "test_get_update_1: OK" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movl %edi, %edx
movq %rsp, %r14
pushq $0xf
popq %rsi
movq %r14, %rdi
callq 0x1f62
callq 0x1050
pushq $0xa
popq %r12
cltd
idivl %r12d
movl %edx, %ebx
movl %edx, 0x20(%rsp)
pushq $0x1
popq %r15
movl %edx, %ebp
cmpq $0xf, %r15
je 0x27f2
callq 0x1050
cltd
idivl %r12d
addl %edx, %ebp
movl %ebp, 0x20(%rsp,%r15,4)
movq %r14, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0x2130
incq %r15
jmp 0x27ca
xorl %r14d, %r14d
movq %rsp, %r15
cmpq $0xf, %r14
je 0x2813
movl 0x20(%rsp,%r14,4), %edx
movq %r15, %rdi
movl %r14d, %esi
callq 0x2130
incq %r14
jmp 0x27f8
movl 0x54(%rsp), %ebp
movq %rsp, %rdi
movl %ebp, %esi
callq 0x2156
movl %eax, %r14d
cmpl $0xd, %eax
jne 0x286a
movl 0x34(%rsp), %r14d
movq %rsp, %rdi
movl %r14d, %esi
callq 0x2156
movl %eax, %r15d
cmpl $0x5, %eax
jne 0x2885
movq %rsp, %rdi
movl %ebx, %esi
callq 0x2156
movl %eax, %r14d
testl %eax, %eax
je 0x28bb
leaq 0x20(%rsp), %rdi
pushq $0xf
popq %rsi
callq 0x273c
leaq 0x98f(%rip), %rdi       # 0x31f5
movl %ebx, %esi
jmp 0x2880
leaq 0x20(%rsp), %rdi
pushq $0xf
popq %rsi
callq 0x273c
leaq 0x900(%rip), %rdi       # 0x317e
movl %ebp, %esi
movl %r14d, %edx
jmp 0x289f
leaq 0x20(%rsp), %rdi
pushq $0xf
popq %rsi
callq 0x273c
leaq 0x921(%rip), %rdi       # 0x31ba
movl %r14d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x1030
movq %rsp, %rdi
callq 0x1fa4
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %rdi
movl %ebp, %esi
callq 0x2156
movl %eax, %ebx
cmpl $0xd, %eax
jne 0x28e9
movq 0x3705(%rip), %rdi      # 0x5fd8
leaq 0x956(%rip), %rsi       # 0x3230
callq 0x10f0
movq %rax, %rdi
callq 0x1090
jmp 0x28a6
leaq 0x20(%rsp), %rdi
pushq $0xf
popq %rsi
callq 0x273c
leaq 0x881(%rip), %rdi       # 0x317e
movl %ebp, %esi
movl %ebx, %edx
jmp 0x289f
jmp 0x2907
jmp 0x2907
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1fa4
movq %rbx, %rdi
callq 0x11b0