// File: obliviousram[P]oblivious-avl-tree/src/ServerStorage.cpp
// Function: ServerStorage::readBucket(int)
Bucket ServerStorage::readBucket(int position) {
	if (!this->is_capacity_set) {
		throw new runtime_error("Please call setCapacity before reading or writing any block");
	}

	if (position >= this->capacity || position < 0) {
		//std::ostringstream positionStream;
		//positionStream << position;
		throw new runtime_error("You are trying to access Bucket " + to_string(position) + ", but this Server contains only " + to_string(this->capacity) + " buckets.");
	}
	return this->buckets.at(position);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x108(%rbp)
movq %rdi, %rax
movq %rax, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
testb $0x1, 0xa9f2(%rip)      # 0x1e23b
jne 0x138e5
movl $0x8, %edi
callq 0x30d0
movq %rax, -0x118(%rbp)
movl $0x10, %edi
callq 0x3210
movq %rax, -0x110(%rbp)
jmp 0x13873
movq -0x110(%rbp), %rdi
leaq 0x2be1(%rip), %rsi      # 0x16462
callq 0x30a0
jmp 0x13888
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rax
movq %rax, (%rdi)
leaq 0xa250(%rip), %rsi      # 0x1daf0
xorl %eax, %eax
movl %eax, %edx
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x138d4
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x10, %esi
callq 0x3220
movq -0x118(%rbp), %rdi
callq 0x3160
jmp 0x13b26
movq -0xf8(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x20(%rcx), %eax
jge 0x138fe
cmpl $0x0, -0x14(%rbp)
jge 0x13af3
movb $0x1, -0xea(%rbp)
movl $0x8, %edi
callq 0x30d0
movq %rax, -0x128(%rbp)
movl $0x10, %edi
callq 0x3210
movq %rax, -0x120(%rbp)
jmp 0x13929
movb $0x1, -0xe9(%rbp)
movl -0x14(%rbp), %esi
leaq -0xc8(%rbp), %rdi
callq 0x3c10
jmp 0x13941
leaq 0x2b56(%rip), %rsi      # 0x1649e
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x14330
jmp 0x1395d
leaq 0x2b5b(%rip), %rdx      # 0x164bf
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x14210
jmp 0x13979
movq -0xf8(%rbp), %rax
movl 0x20(%rax), %esi
leaq -0xe8(%rbp), %rdi
callq 0x3c10
jmp 0x13991
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x14260
jmp 0x139aa
leaq 0x2b2f(%rip), %rdx      # 0x164e0
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x14210
jmp 0x139c0
movq -0x120(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3330
jmp 0x139d2
movq -0x128(%rbp), %rdi
movq -0x120(%rbp), %rax
movb $0x0, -0xe9(%rbp)
movq %rax, (%rdi)
movb $0x0, -0xea(%rbp)
leaq 0xa0f8(%rip), %rsi      # 0x1daf0
xorl %eax, %eax
movl %eax, %edx
callq 0x3370
jmp 0x13b2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x13ada
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x13abc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x13ab0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x13aa4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x13a98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x13a8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x13a83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3120
leaq -0x68(%rbp), %rdi
callq 0x3120
leaq -0xe8(%rbp), %rdi
callq 0x3120
leaq -0x88(%rbp), %rdi
callq 0x3120
leaq -0xa8(%rbp), %rdi
callq 0x3120
leaq -0xc8(%rbp), %rdi
callq 0x3120
testb $0x1, -0xe9(%rbp)
jne 0x13ac7
jmp 0x13ad8
movq -0x120(%rbp), %rdi
movl $0x10, %esi
callq 0x3220
jmp 0x13ada
testb $0x1, -0xea(%rbp)
jne 0x13ae5
jmp 0x13af1
movq -0x128(%rbp), %rdi
callq 0x3160
jmp 0x13b26
movq -0xf8(%rbp), %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x14380
movq -0x108(%rbp), %rdi
movq %rax, %rsi
callq 0xcfa0
movq -0x100(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x33a0
nop