// File: /workspace/github_cpp_makefile_star2_O3/6851-2021[P]Cache-Oblivious-Data-Structures/static_search_trees/static_search_trees.cpp
// Function: co_static_search_tree::update_4_base_case(int, int, int, int, int)
inline int co_static_search_tree::update_4_base_case(int block_index, int range_left, int og_height, int index, int value) {
    /*
                                    0
                    1                                   2
            3               6                   9                 12
        4       5       7       8           10       11      13          14                    
    */
    int leafs_og_height = og_height - 3;
    int leaf_index = (index - range_left) >> (leafs_og_height - 1);
    if(leaf_index == 0) {
        this->tree[block_index + 4] = value;
        this->tree[block_index + 3] = max(this->tree[block_index + 4], this->tree[block_index + 5]);
        this->tree[block_index + 1] = max(this->tree[block_index + 3], this->tree[block_index + 6]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    else if(leaf_index == 1) {
        this->tree[block_index + 5] = value;
        this->tree[block_index + 3] = max(this->tree[block_index + 4], this->tree[block_index + 5]);
        this->tree[block_index + 1] = max(this->tree[block_index + 3], this->tree[block_index + 6]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    else if(leaf_index == 2) {
        this->tree[block_index + 7] = value;
        this->tree[block_index + 6] = max(this->tree[block_index + 7], this->tree[block_index + 8]);
        this->tree[block_index + 1] = max(this->tree[block_index + 3], this->tree[block_index + 6]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    else if(leaf_index == 3) {
        this->tree[block_index + 8] = value;
        this->tree[block_index + 6] = max(this->tree[block_index + 7], this->tree[block_index + 8]);
        this->tree[block_index + 1] = max(this->tree[block_index + 3], this->tree[block_index + 6]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    else if(leaf_index == 4) {
        this->tree[block_index + 10] = value;
        this->tree[block_index + 9] = max(this->tree[block_index + 10], this->tree[block_index + 11]);
        this->tree[block_index + 2] = max(this->tree[block_index + 9], this->tree[block_index + 12]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    else if(leaf_index == 5){
        this->tree[block_index + 11] = value;
        this->tree[block_index + 9] = max(this->tree[block_index + 10], this->tree[block_index + 11]);
        this->tree[block_index + 2] = max(this->tree[block_index + 9], this->tree[block_index + 12]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    else if(leaf_index == 6){
        this->tree[block_index + 13] = value;
        this->tree[block_index + 12] = max(this->tree[block_index + 13], this->tree[block_index + 14]);
        this->tree[block_index + 2] = max(this->tree[block_index + 9], this->tree[block_index + 12]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    else if(leaf_index == 7){
        this->tree[block_index + 14] = value;
        this->tree[block_index + 12] = max(this->tree[block_index + 13], this->tree[block_index + 14]);
        this->tree[block_index + 2] = max(this->tree[block_index + 9], this->tree[block_index + 12]);
        this->tree[block_index + 0] = max(this->tree[block_index + 1], this->tree[block_index + 2]);
    }
    return this->tree[block_index];
}

// Assembly:
subl %edx, %r8d
addb $-0x4, %cl
sarl %cl, %r8d
movslq %esi, %rcx
shlq $0x2, %rcx
addq (%rdi), %rcx
cmpl $0x7, %r8d
ja 0x262f
movl %r9d, %eax
leaq 0x1bc1(%rip), %rdx      # 0x4144
movslq (%rdx,%r8,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
movl %eax, 0x10(%rcx)
movl 0x8(%rcx), %edx
movl 0x14(%rcx), %esi
jmp 0x25d6
movl %eax, 0x28(%rcx)
movl 0x4(%rcx), %edx
movl 0x2c(%rcx), %esi
jmp 0x25f9
movl %eax, 0x1c(%rcx)
movl 0x20(%rcx), %edx
jmp 0x25b0
movl %eax, 0x20(%rcx)
movl 0x1c(%rcx), %edx
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, 0x18(%rcx)
movl 0x8(%rcx), %edx
movl 0xc(%rcx), %esi
cmpl %eax, %esi
cmovgl %esi, %eax
jmp 0x25e6
movl %eax, 0x38(%rcx)
movl 0x34(%rcx), %edx
jmp 0x2611
movl %eax, 0x14(%rcx)
movl 0x8(%rcx), %edx
movl 0x10(%rcx), %esi
cmpl %eax, %esi
cmovgl %esi, %eax
movl %eax, 0xc(%rcx)
movl 0x18(%rcx), %esi
cmpl %esi, %eax
cmovlel %esi, %eax
movl %eax, 0x4(%rcx)
cmpl %edx, %eax
cmovlel %edx, %eax
jmp 0x262c
movl %eax, 0x2c(%rcx)
movl 0x4(%rcx), %edx
movl 0x28(%rcx), %esi
cmpl %eax, %esi
cmovgl %esi, %eax
movl %eax, 0x24(%rcx)
movl 0x30(%rcx), %esi
cmpl %esi, %eax
cmovlel %esi, %eax
jmp 0x2624
movl %eax, 0x34(%rcx)
movl 0x38(%rcx), %edx
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, 0x30(%rcx)
movl 0x4(%rcx), %edx
movl 0x24(%rcx), %esi
cmpl %eax, %esi
cmovgl %esi, %eax
movl %eax, 0x8(%rcx)
cmpl %eax, %edx
cmovgl %edx, %eax
movl %eax, (%rcx)
retq
movl (%rcx), %eax
retq