// File: /workspace/github_cpp_makefile_star2_O3/shreyas-gopalakrishna[P]Concurrent-Skip-list/skip_list.cpp
// Function: SkipList::range[abi:cxx11](int, int)
map<int, string> SkipList::range(int start_key, int end_key){

    map<int, string> range_output;

    if(start_key > end_key){
        return range_output;
    }

    Node *curr = head;

    for (int level = max_level; level >= 0; level--){
        while (curr->next[level] != NULL && start_key > curr->next[level]->get_key()){
            if(curr->get_key() >= start_key && curr->get_key() <= end_key){
                range_output.insert(make_pair(curr->get_key(), curr->get_value()));
            }
            curr = curr->next[level];
        }
    }

    while(curr != NULL && end_key >= curr->get_key()){
        if(curr->get_key() >= start_key && curr->get_key() <= end_key){
            range_output.insert(make_pair(curr->get_key(), curr->get_value()));
        }
        curr = curr->next[0];
    }

    return range_output;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, %ebp
leaq 0x8(%rdi), %rax
movl $0x0, 0x8(%rdi)
xorl %ecx, %ecx
movq %rcx, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rdi, 0x50(%rsp)
movq %rcx, 0x28(%rdi)
cmpl %ebp, %edx
jg 0x5c81
movl %edx, %r14d
movq (%rsi), %r15
movslq 0x58a9(%rip), %rbx      # 0xb304
testq %rbx, %rbx
js 0x5b88
movq 0x28(%r15), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x5b76
leaq 0x28(%r15), %r13
callq 0x4c2a
cmpl %r14d, %eax
jge 0x5b76
movq %r15, %rdi
callq 0x4c2a
cmpl %r14d, %eax
jl 0x5b59
movq %r15, %rdi
callq 0x4c2a
cmpl %ebp, %eax
jg 0x5b59
movq %r15, %rdi
callq 0x4c2a
movl %eax, %r12d
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4c30
movl %r12d, 0x28(%rsp)
leaq 0x40(%rsp), %rdx
movq %rdx, 0x30(%rsp)
movq 0x8(%rsp), %rax
leaq 0x18(%rsp), %rcx
cmpq %rcx, %rax
je 0x5aef
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0x5af5
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %rcx, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x600a
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5b3d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2220
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5b59
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2220
movq (%r13), %rax
movq (%rax,%rbx,8), %r15
leaq 0x28(%r15), %r13
movq 0x28(%r15), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
jne 0x5a79
leaq -0x1(%rbx), %rax
testq %rbx, %rbx
movq %rax, %rbx
jg 0x5a64
jmp 0x5b91
testq %r15, %r15
je 0x5c81
leaq 0x8(%rsp), %r13
movq %r15, %rdi
callq 0x4c2a
cmpl %ebp, %eax
jg 0x5c81
movq %r15, %rdi
callq 0x4c2a
cmpl %r14d, %eax
jl 0x5c71
movq %r15, %rdi
callq 0x4c2a
cmpl %ebp, %eax
jg 0x5c71
movq %r15, %rdi
callq 0x4c2a
movl %eax, %r12d
movq %r13, %rdi
movq %r15, %rsi
callq 0x4c30
leaq 0x18(%rsp), %rbx
movl %r12d, 0x28(%rsp)
leaq 0x40(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq 0x8(%rsp), %rax
cmpq %rbx, %rax
je 0x5c0c
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0x5c12
movups (%rbx), %xmm0
movups %xmm0, (%rcx)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %rbx, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x600a
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5c5a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2220
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5c71
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2220
movq 0x28(%r15), %rax
movq (%rax), %r15
testq %r15, %r15
jne 0x5b96
movq 0x50(%rsp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5c9d
jmp 0x5cde
jmp 0x5cde
jmp 0x5cde
movq %rax, %r14
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5cbc
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2220
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5ce1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2220
jmp 0x5ce1
jmp 0x5cde
jmp 0x5cde
movq %rax, %r14
movq 0x50(%rsp), %rdi
callq 0x41a4
movq %r14, %rdi
callq 0x2320
nop