// File: /workspace/github_cpp_makefile_star2_O3/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, 0x533f(%rip)      # 0xd19b
je 0x7ebe
movl %esi, %ebp
movq %rdi, %r15
testl %esi, %esi
js 0x7efb
cmpl %ebp, 0x20(%r15)
jle 0x7efb
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 0x7f71
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 0x854e
movl $0x8, %edi
callq 0x20c0
movq %rax, %rbx
movl $0x10, %edi
callq 0x2180
movq %rax, %r14
leaq 0x15d3(%rip), %rsi      # 0x94b2
movq %rax, %rdi
callq 0x2090
movq %r14, (%rbx)
leaq 0x4caf(%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 0x28(%rsp), %rdi
movl %ebp, %esi
callq 0x84ab
leaq 0x15c6(%rip), %rsi      # 0x94ee
leaq 0x88(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x843b
leaq 0x15ce(%rip), %rsi      # 0x950f
leaq 0x88(%rsp), %rdi
callq 0x22d0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7f82
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x7f8f
leaq 0x15c2(%rip), %rdi      # 0x953a
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 0x68(%rsp), %rdi
callq 0x84ab
leaq 0xa8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x8393
leaq 0x155d(%rip), %rsi      # 0x9530
leaq 0xa8(%rsp), %rdi
callq 0x22d0
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x8001
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
jmp 0x800e
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %r13b
movq %r14, %rdi
callq 0x2240
movq %r14, (%rbx)
xorl %r13d, %r13d
leaq 0x4b5e(%rip), %rsi      # 0xcba0
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2280
movq %rax, %r15
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x806e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x806e
movq %rax, %r15
movb $0x1, %r13b
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8097
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x8097
movq %rax, %r15
movb $0x1, %r13b
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x80ba
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x80ba
movq %rax, %r15
movb $0x1, %r13b
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x80d9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x80d9
movq %rax, %r15
movb $0x1, %r13b
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x80fa
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8115
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
testb %r13b, %r13b
jne 0x8141
jmp 0x815d
movq %rax, %r15
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8141
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x8141
jmp 0x813e
movq %rax, %r15
movl $0x10, %esi
movq %r14, %rdi
callq 0x2190
jmp 0x8155
jmp 0x8152
movq %rax, %r15
movq %rbx, %rdi
callq 0x2110
movq %r15, %rdi
callq 0x22a0
nop