// File: shreyas-gopalakrishna[P]Concurrent-Skip-list/benchmark.cpp
// Function: low_contention_benchmark()
void low_contention_benchmark(){

    vector<thread> threads;

    // generating insert data
    for(size_t i = 1; i <= max_number; i++){
        numbers_insert.push_back(i);
    }

    skiplist = SkipList(numbers_insert.size(), 0.5);

    // insert
    int chunk_size = ceil(float(numbers_insert.size()) / num_threads);
    for(size_t i = 0; i < numbers_insert.size(); i = i + chunk_size){
        threads.push_back(thread(skiplist_add, i, i+chunk_size));
    }
    for (auto &th : threads) {
        th.join();
    }

    threads.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
leaq -0x18(%rbp), %rdi
callq 0x57c0
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq 0x127e1(%rip), %rax     # 0x17228
ja 0x4a82
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
leaq 0x128aa(%rip), %rdi     # 0x17300
leaq -0x24(%rbp), %rsi
callq 0x5cf0
jmp 0x4a61
jmp 0x4a63
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x4a3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4ca0
leaq 0x12877(%rip), %rdi     # 0x17300
callq 0x55e0
movl %eax, %esi
leaq -0x48(%rbp), %rdi
movss 0xa594(%rip), %xmm0     # 0xf030
callq 0xae20
jmp 0x4aa3
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x12822(%rip)    # 0x172d0
leaq -0x48(%rbp), %rdi
callq 0xca30
leaq 0x12842(%rip), %rdi     # 0x17300
callq 0x55e0
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x90(%rbp)
testq %rax, %rax
movss %xmm0, -0x8c(%rbp)
js 0x4b04
movss -0x90(%rbp), %xmm0
movss %xmm0, -0x8c(%rbp)
movss -0x8c(%rbp), %xmm0
movss %xmm0, -0x9c(%rbp)
movq 0x12705(%rip), %rax     # 0x17220
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x98(%rbp)
testq %rax, %rax
movss %xmm0, -0x94(%rbp)
js 0x4b5c
movss -0x98(%rbp), %xmm0
movss %xmm0, -0x94(%rbp)
movss -0x9c(%rbp), %xmm0
movss -0x94(%rbp), %xmm1
divss %xmm1, %xmm0
callq 0x57e0
movss %xmm0, -0xa0(%rbp)
jmp 0x4b7f
movss -0xa0(%rbp), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x4c(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq 0x12758(%rip), %rdi     # 0x17300
callq 0x55e0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jae 0x4c25
movq -0x58(%rbp), %rax
movslq -0x4c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
leaq -0x1212(%rip), %rsi     # 0x39c0
leaq -0x60(%rbp), %rdi
leaq -0x58(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x5830
jmp 0x4be5
leaq -0x18(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5800
jmp 0x4bf4
leaq -0x60(%rbp), %rdi
callq 0x5900
movq -0x58(%rbp), %rax
movslq -0x4c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
jmp 0x4b96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5900
jmp 0x4ca0
leaq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x5930
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
callq 0x5960
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x5990
testb $0x1, %al
jne 0x4c5a
jmp 0x4c85
leaq -0x78(%rbp), %rdi
callq 0x59d0
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
callq 0x33a0
jmp 0x4c78
jmp 0x4c7a
leaq -0x78(%rbp), %rdi
callq 0x59f0
jmp 0x4c47
leaq -0x18(%rbp), %rdi
callq 0x5a10
leaq -0x18(%rbp), %rdi
callq 0x5a30
addq $0xb0, %rsp
popq %rbp
retq
leaq -0x18(%rbp), %rdi
callq 0x5a30
movq -0x30(%rbp), %rdi
callq 0x33b0
nopw %cs:(%rax,%rax)