// File: /workspace/github_cpp_makefile_star2_O3/6851-2021[P]Cache-Oblivious-Data-Structures/static_search_trees/test_co_sst.cpp
// Function: test_range_update_uniform(int)
void test_range_update_uniform(const int n) {
    co_static_search_tree tree(n);
    int arr[n];
    for (int i = 0; i < n; ++i) {
        arr[i] = i * 5;
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j){
            arr[j] = j * 5;
        }
        int len = rand() % (n / 2) + 1;
        int R = min(i + len - 1, n - 1);
        tree.range_update(i, R, arr);

        i += (len - 1);
    }
    for (int i = 0; i < (n - 1) * 5; ++i) {
        int result = tree.get(i);
        int expected = ceil(i / 5.0);
        if (result != expected)
        {
            printf("Incorrect index for query value %d, got %d, expected %d\n", i, result, expected);
            exit(-1);
        }
    }
    cout << "Success range update uniform: " << n << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %edi, %ebx
leaq -0x120(%rbp), %rdi
movl %ebx, %esi
callq 0x134c
movq %rsp, -0x40(%rbp)
movl %ebx, %ecx
movq %rsp, %rdx
leaq 0xf(,%rcx,4), %rax
andq $-0x10, %rax
subq %rax, %rdx
movq %rdx, -0x38(%rbp)
movq %rdx, %rsp
movq %rbx, -0x30(%rbp)
testl %ebx, %ebx
jle 0x3664
leaq 0x1(%rcx), %rax
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm5     # xmm5 = xmm0[0,1,0,1]
movq -0x38(%rbp), %rcx
addq $0x4, %rcx
movl %eax, %edx
andl $-0x2, %edx
leaq (%rdx,%rdx,4), %rdx
movdqa 0xc70(%rip), %xmm0      # 0x4170
xorl %esi, %esi
movdqa 0xc76(%rip), %xmm6      # 0x4180
pxor %xmm6, %xmm5
pcmpeqd %xmm1, %xmm1
movdqa 0xc76(%rip), %xmm7      # 0x4190
movdqa %xmm0, %xmm2
pxor %xmm6, %xmm2
movdqa %xmm2, %xmm3
pcmpgtd %xmm5, %xmm3
pcmpeqd %xmm5, %xmm2
pshufd $0xf5, %xmm2, %xmm4     # xmm4 = xmm2[1,1,3,3]
pand %xmm3, %xmm4
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
por %xmm4, %xmm2
movd %xmm2, %edi
notl %edi
testb $0x1, %dil
je 0x354f
movl %esi, -0x4(%rcx)
pxor %xmm1, %xmm2
pextrw $0x4, %xmm2, %edi
testb $0x1, %dil
je 0x3563
leal 0x5(%rsi), %edi
movl %edi, (%rcx)
paddq %xmm7, %xmm0
addq $0x8, %rcx
addq $0xa, %rsi
cmpq %rsi, %rdx
jne 0x351a
cmpl $0x0, -0x30(%rbp)
jle 0x3664
movq -0x30(%rbp), %rcx
movl %ecx, %r15d
shrl %r15d
leal -0x1(%rcx), %ebx
movq -0x38(%rbp), %rcx
addq $0x4, %rcx
movq %rcx, -0x48(%rbp)
andl $-0x2, %eax
leaq (%rax,%rax,4), %r14
xorl %r12d, %r12d
pcmpeqd %xmm4, %xmm4
movdqa %xmm5, -0x60(%rbp)
xorl %eax, %eax
movq -0x48(%rbp), %rcx
movdqa 0xbb8(%rip), %xmm0      # 0x4170
movdqa %xmm0, %xmm1
pxor %xmm6, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm5, %xmm2
pcmpeqd %xmm5, %xmm1
pshufd $0xf5, %xmm1, %xmm3     # xmm3 = xmm1[1,1,3,3]
pand %xmm2, %xmm3
pshufd $0xf5, %xmm2, %xmm1     # xmm1 = xmm2[1,1,3,3]
por %xmm3, %xmm1
movd %xmm1, %edx
notl %edx
testb $0x1, %dl
je 0x35ec
movl %eax, -0x4(%rcx)
pxor %xmm4, %xmm1
pextrw $0x4, %xmm1, %edx
testb $0x1, %dl
je 0x35ff
leal 0x5(%rax), %edx
movl %edx, (%rcx)
paddq %xmm7, %xmm0
addq $0x8, %rcx
addq $0xa, %rax
cmpq %rax, %r14
jne 0x35b8
callq 0x1070
cltd
idivl %r15d
movl %edx, %r13d
addl %r12d, %r13d
cmpl %r13d, %ebx
movl %r13d, %edx
cmovll %ebx, %edx
leaq -0x120(%rbp), %rdi
movl %r12d, %esi
movq -0x38(%rbp), %rcx
callq 0x1a02
incl %r13d
movl %r13d, %r12d
cmpl -0x30(%rbp), %r13d
movdqa -0x60(%rbp), %xmm5
movdqa 0xb2e(%rip), %xmm6      # 0x4180
movdqa 0xb36(%rip), %xmm7      # 0x4190
pcmpeqd %xmm4, %xmm4
jl 0x35aa
movq -0x30(%rbp), %rax
leal (%rax,%rax,4), %ebx
addl $-0x5, %ebx
testl %ebx, %ebx
jle 0x36b0
xorl %r14d, %r14d
leaq -0x120(%rbp), %r15
movq %r15, %rdi
movl %r14d, %esi
callq 0x17bc
movl %eax, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
divsd 0xb06(%rip), %xmm0      # 0x41a0
callq 0x1060
cvttsd2si %xmm0, %ecx
cmpl %ecx, %r12d
jne 0x3721
incl %r14d
cmpl %r14d, %ebx
jne 0x367c
movq 0x3921(%rip), %rdi      # 0x6fd8
leaq 0xdb6(%rip), %rsi       # 0x4474
movl $0x1e, %edx
callq 0x1140
movq 0x3909(%rip), %rdi      # 0x6fd8
movq -0x30(%rbp), %rsi
callq 0x11d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1100
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10b0
movq -0x40(%rbp), %rsp
leaq -0x120(%rbp), %rdi
callq 0x13e6
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcf6(%rip), %rdi       # 0x441e
movl %r14d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x1040
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1160
jmp 0x3743
jmp 0x3743
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x13e6
movq %rbx, %rdi
callq 0x11e0