// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]MQSim/src/ssd/Address_Mapping_Unit_Page_Level.cpp
// Function: SSD_Components::Address_Mapping_Unit_Page_Level::Remove_barrier_for_accessing_lpa(unsigned short, unsigned long)
inline void Address_Mapping_Unit_Page_Level::Remove_barrier_for_accessing_lpa(stream_id_type stream_id, LPA_type lpa)
	{
		auto itr = domains[stream_id]->Locked_LPAs.find(lpa);
		if (itr == domains[stream_id]->Locked_LPAs.end()) {
			PRINT_ERROR("Illegal operation: Unlocking an LPA that has not been locked!");
		}
		domains[stream_id]->Locked_LPAs.erase(itr);

		//If there are read requests waiting behind the barrier, then MQSim assumes they can be serviced with the actual page data that is accessed during GC execution
		auto read_tr = domains[stream_id]->Read_transactions_behind_LPA_barrier.find(lpa);
		while (read_tr != domains[stream_id]->Read_transactions_behind_LPA_barrier.end()) {
			handle_transaction_serviced_signal_from_PHY((*read_tr).second);
			delete (*read_tr).second;
			domains[stream_id]->Read_transactions_behind_LPA_barrier.erase(read_tr);
			read_tr = domains[stream_id]->Read_transactions_behind_LPA_barrier.find(lpa);
		}

		//If there are write requests waiting behind the barrier, then MQSim assumes they can be serviced with the actual page data that is accessed during GC execution. This may not be 100% true for all write requests, but, to avoid more complexity in the simulation, we accept this assumption.
		auto write_tr = domains[stream_id]->Write_transactions_behind_LPA_barrier.find(lpa);
		while (write_tr != domains[stream_id]->Write_transactions_behind_LPA_barrier.end()) {
			handle_transaction_serviced_signal_from_PHY((*write_tr).second);
			delete (*write_tr).second;
			domains[stream_id]->Write_transactions_behind_LPA_barrier.erase(write_tr);
			write_tr = domains[stream_id]->Write_transactions_behind_LPA_barrier.find(lpa);
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq 0xa8(%rdi), %rax
movl %esi, %r13d
movq (%rax,%r13,8), %rdi
movq 0xf8(%rdi), %rdx
leaq 0xf0(%rdi), %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0x304ba
movq %rax, %rcx
xorl %esi, %esi
cmpq %rbx, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x304a2
movq %rax, %rsi
cmpq %rax, %rcx
je 0x304cd
cmpq %rbx, 0x20(%rcx)
cmovaq %rax, %rcx
movq %rcx, %rsi
cmpq %rax, %rsi
je 0x306ed
addq $0xe8, %rdi
callq 0x31060
movq 0xa8(%r14), %rax
movq (%rax,%r13,8), %r12
movq 0x158(%r12), %rcx
addq $0x150, %r12            # imm = 0x150
movq %r12, %rax
testq %rcx, %rcx
je 0x3051e
movq %r12, %rax
xorl %edx, %edx
cmpq %rbx, 0x20(%rcx)
setb %dl
cmovaeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x30507
cmpq %r12, %rax
je 0x3052b
cmpq %rbx, 0x20(%rax)
cmovbeq %rax, %r12
movq 0xa8(%r14), %rax
movq (%rax,%r13,8), %r15
leaq 0x150(%r15), %rax
cmpq %rax, %r12
je 0x305e6
leal (,%r13,8), %ebp
movq 0x28(%r12), %rdi
callq 0x2f856
movq 0x28(%r12), %rdi
testq %rdi, %rdi
je 0x30567
callq 0x7370
movq 0xa8(%r14), %rax
movq (%rax,%rbp), %rdi
movl $0x148, %eax            # imm = 0x148
addq %rax, %rdi
movq %r12, %rsi
callq 0x315aa
movq 0xa8(%r14), %rax
movq (%rax,%rbp), %r12
movq 0x158(%r12), %rcx
addq $0x150, %r12            # imm = 0x150
movq %r12, %rax
testq %rcx, %rcx
je 0x305be
movq %r12, %rax
xorl %edx, %edx
cmpq %rbx, 0x20(%rcx)
setb %dl
cmovaeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x305a7
cmpq %r12, %rax
je 0x305cb
cmpq %rbx, 0x20(%rax)
cmovbeq %rax, %r12
movq 0xa8(%r14), %rax
movq (%rax,%r13,8), %r15
leaq 0x150(%r15), %rax
cmpq %rax, %r12
jne 0x3054e
movq 0x188(%r15), %rcx
addq $0x180, %r15            # imm = 0x180
movq %r15, %rax
testq %rcx, %rcx
je 0x30616
movq %r15, %rax
xorl %edx, %edx
cmpq %rbx, 0x20(%rcx)
setb %dl
cmovaeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x305ff
cmpq %r15, %rax
je 0x30623
cmpq %rbx, 0x20(%rax)
cmovbeq %rax, %r15
movq 0xa8(%r14), %rax
movl $0x180, %ecx            # imm = 0x180
movq (%rax,%r13,8), %rax
addq %rcx, %rax
cmpq %rax, %r15
je 0x306de
leal (,%r13,8), %ebp
movl $0x178, %r12d           # imm = 0x178
movq 0x28(%r15), %rdi
callq 0x2f856
movq 0x28(%r15), %rdi
testq %rdi, %rdi
je 0x30664
callq 0x7370
movq 0xa8(%r14), %rax
movq (%rax,%rbp), %rdi
addq %r12, %rdi
movq %r15, %rsi
callq 0x315aa
movq 0xa8(%r14), %rax
movq (%rax,%rbp), %r15
movq 0x188(%r15), %rcx
addq $0x180, %r15            # imm = 0x180
movq %r15, %rax
testq %rcx, %rcx
je 0x306b5
movq %r15, %rax
xorl %edx, %edx
cmpq %rbx, 0x20(%rcx)
setb %dl
cmovaeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x3069e
cmpq %r15, %rax
je 0x306c2
cmpq %rbx, 0x20(%rax)
cmovbeq %rax, %r15
movq 0xa8(%r14), %rax
movq (%rax,%r13,8), %rax
movl $0x180, %ecx            # imm = 0x180
addq %rcx, %rax
cmpq %rax, %r15
jne 0x3064d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3e8fc(%rip), %rbx     # 0x6eff0
leaq 0x25ead(%rip), %rsi     # 0x565a8
movq %rbx, %rdi
callq 0x7390
leaq 0x286ca(%rip), %rsi     # 0x58dd4
movq %rbx, %rdi
callq 0x7390
movq %rax, %rdi
callq 0x71c0
movq 0x3e8af(%rip), %rdi     # 0x6efd0
callq 0x7430
movl $0x1, %edi
callq 0x7440