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

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

	this->buckets.at(position) = bucket_to_write;
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
cmpb $0x0, 0x54c9(%rip)      # 0xd19b
je 0x7d34
movl %esi, %ebp
movq %rdi, %r15
testl %esi, %esi
js 0x7d71
cmpl %ebp, 0x20(%r15)
jle 0x7d71
movl %ebp, %esi
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rdi
subq %rcx, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %rax
cmpq %rsi, %rax
jbe 0x7de6
leaq (%rsi,%rsi,2), %rax
leaq (%rcx,%rax,8), %rdi
movq %rdx, %rsi
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x83c2
movl $0x8, %edi
callq 0x20c0
movq %rax, %rbx
movl $0x10, %edi
callq 0x2180
movq %rax, %r14
leaq 0x172d(%rip), %rsi      # 0x9482
movq %rax, %rdi
callq 0x2090
movq %r14, (%rbx)
leaq 0x4e39(%rip), %rsi      # 0xcba0
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2280
movl $0x8, %edi
callq 0x20c0
movq %rax, %rbx
movl $0x10, %edi
callq 0x2180
movq %rax, %r14
leaq 0x68(%rsp), %rdi
movl %ebp, %esi
callq 0x831f
leaq 0x1720(%rip), %rsi      # 0x94be
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x82af
leaq 0x1728(%rip), %rsi      # 0x94df
leaq 0x88(%rsp), %rdi
callq 0x22d0
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7df7
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x7e04
leaq 0x1495(%rip), %rdi      # 0x9282
movq %rax, %rdx
xorl %eax, %eax
callq 0x2210
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x20(%r15), %esi
leaq 0x48(%rsp), %rdi
callq 0x831f
leaq 0xa8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x8207
leaq 0x16b8(%rip), %rsi      # 0x9500
leaq 0xa8(%rsp), %rdi
callq 0x22d0
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7e76
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
jmp 0x7e83
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %r12b
movq %r14, %rdi
callq 0x2240
movq %r14, (%rbx)
xorl %r12d, %r12d
leaq 0x4ce9(%rip), %rsi      # 0xcba0
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2280
movq %rax, %r15
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7ee3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x7ee3
movq %rax, %r15
movb $0x1, %r12b
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f0c
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x7f0c
movq %rax, %r15
movb $0x1, %r12b
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f2f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x7f2f
movq %rax, %r15
movb $0x1, %r12b
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7f4e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x7f4e
movq %rax, %r15
movb $0x1, %r12b
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f77
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x7f77
movq %rax, %r15
movb $0x1, %r12b
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f9a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x7f9a
movq %rax, %r15
movb $0x1, %r12b
testb %r12b, %r12b
je 0x7fc6
movl $0x10, %esi
movq %r14, %rdi
callq 0x2190
jmp 0x7fc6
movq %rax, %r15
movl $0x10, %esi
movq %r14, %rdi
callq 0x2190
jmp 0x7fd0
movq %rax, %r15
movb $0x1, %r12b
testb %r12b, %r12b
jne 0x7fd0
jmp 0x7fd8
movq %rax, %r15
movq %rbx, %rdi
callq 0x2110
movq %r15, %rdi
callq 0x22a0