// File: /workspace/github_cpp_makefile_star2_O1/CMU-SAFARI[P]MQSim/src/ssd/Host_Interface_NVMe.cpp
// Function: SSD_Components::Request_Fetch_Unit_NVMe::Process_pcie_write_message(unsigned long, void*, unsigned int)
void Request_Fetch_Unit_NVMe::Process_pcie_write_message(uint64_t address, void *payload, unsigned int payload_size)
{
	Host_Interface_NVMe *hi = (Host_Interface_NVMe *)host_interface;
	uint64_t val = (uint64_t)payload;
	switch (address)
	{
	case SUBMISSION_QUEUE_REGISTER_1:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(0, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_1:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(0, (uint16_t)val);
		break;
	case SUBMISSION_QUEUE_REGISTER_2:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(1, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_2:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(1, (uint16_t)val);
		break;
	case SUBMISSION_QUEUE_REGISTER_3:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(2, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_3:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(2, (uint16_t)val);
		break;
	case SUBMISSION_QUEUE_REGISTER_4:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(3, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_4:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(3, (uint16_t)val);
		break;
	case SUBMISSION_QUEUE_REGISTER_5:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(4, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_5:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(4, (uint16_t)val);
		break;
	case SUBMISSION_QUEUE_REGISTER_6:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(5, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_6:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(5, (uint16_t)val);
		break;
	case SUBMISSION_QUEUE_REGISTER_7:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(6, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_7:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(6, (uint16_t)val);
		break;
	case SUBMISSION_QUEUE_REGISTER_8:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Submission_queue_tail_pointer_update(7, (uint16_t)val);
		break;
	case COMPLETION_QUEUE_REGISTER_8:
		((Input_Stream_Manager_NVMe *)(hi->input_stream_manager))->Completion_queue_head_pointer_update(7, (uint16_t)val);
		break;
	default:
		throw std::invalid_argument("Unknown register is written!");
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x8(%rdi), %rax
cmpq $0x104f, %rsi           # imm = 0x104F
jg 0x41ac8
cmpq $0x102f, %rsi           # imm = 0x102F
jg 0x41b6d
cmpq $0x101f, %rsi           # imm = 0x101F
jg 0x41c9d
cmpq $0x1010, %rsi           # imm = 0x1010
je 0x41ee4
cmpq $0x1013, %rsi           # imm = 0x1013
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq (%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq (%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq (%rax), %rax
jmp 0x41ec4
cmpq $0x106f, %rsi           # imm = 0x106F
jg 0x41c05
cmpq $0x105f, %rsi           # imm = 0x105F
jg 0x41d28
cmpq $0x1050, %rsi           # imm = 0x1050
je 0x41f1f
cmpq $0x1053, %rsi           # imm = 0x1053
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x20(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq 0x20(%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq 0x20(%rax), %rax
jmp 0x41ec4
cmpq $0x103f, %rsi           # imm = 0x103F
jg 0x41db3
cmpq $0x1030, %rsi           # imm = 0x1030
je 0x41f5f
cmpq $0x1033, %rsi           # imm = 0x1033
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq 0x10(%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
jmp 0x41ec4
cmpq $0x107f, %rsi           # imm = 0x107F
jg 0x41e3e
cmpq $0x1070, %rsi           # imm = 0x1070
je 0x41f9f
cmpq $0x1073, %rsi           # imm = 0x1073
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x30(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq 0x30(%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq 0x30(%rax), %rax
jmp 0x41ec4
cmpq $0x1020, %rsi           # imm = 0x1020
je 0x41fdf
cmpq $0x1023, %rsi           # imm = 0x1023
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq 0x8(%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
jmp 0x41ec4
cmpq $0x1060, %rsi           # imm = 0x1060
je 0x4201f
cmpq $0x1063, %rsi           # imm = 0x1063
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x28(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq 0x28(%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq 0x28(%rax), %rax
jmp 0x41ec4
cmpq $0x1040, %rsi           # imm = 0x1040
je 0x4205c
cmpq $0x1043, %rsi           # imm = 0x1043
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x18(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq 0x18(%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq 0x18(%rax), %rax
jmp 0x41ec4
cmpq $0x1080, %rsi           # imm = 0x1080
je 0x42095
cmpq $0x1083, %rsi           # imm = 0x1083
jne 0x420f6
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x38(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x420f0
movq 0xa0(%rax), %rbx
movq 0x10(%rbx), %r14
decq %rcx
movq %rcx, 0xb0(%rax)
movq %rbx, %rdi
callq 0x7580
movq %rbx, %rdi
callq 0x7370
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq 0x58(%rax), %rdi
movq 0x38(%rcx), %rax
movzwl 0x7c(%rax), %edx
movq %r14, %rsi
callq 0x423be
movq 0x10(%r15), %rax
movq 0x38(%rax), %rax
leaq 0x82(%rax), %rcx
movzwl 0x82(%rax), %edx
incl %edx
movw %dx, 0x82(%rax)
addq $0x78, %rax
jmp 0x420e5
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq (%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
xorl %esi, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq (%rax), %rax
jmp 0x420cc
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq 0x20(%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movl $0x4, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq 0x20(%rax), %rax
jmp 0x420cc
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rax
jmp 0x420cc
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq 0x30(%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movl $0x6, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq 0x30(%rax), %rax
jmp 0x420cc
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq 0x8(%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq 0x8(%rax), %rax
jmp 0x420cc
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq 0x28(%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movl $0x5, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq 0x28(%rax), %rax
jmp 0x420cc
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq 0x18(%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movl $0x3, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq 0x18(%rax), %rax
jmp 0x420cc
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq 0x38(%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x420f0
movq 0x8(%rbx), %rax
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movl $0x7, %esi
callq *0x10(%rax)
movq 0x10(%rbx), %rax
movq 0x38(%rax), %rax
incw 0xd0(%rax)
leaq 0x7a(%rax), %rcx
movzwl 0x7a(%rax), %edx
incl %edx
movw %dx, 0x7a(%rax)
addq $0x68, %rax
xorl %esi, %esi
cmpw (%rax), %dx
cmovel %esi, %edx
movw %dx, (%rcx)
popq %rbx
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x71d0
movq %rax, %rbx
leaq 0x17e53(%rip), %rsi     # 0x59f5d
movq %rax, %rdi
callq 0x7680
movq 0x2ceaf(%rip), %rsi     # 0x6efc8
movq 0x2ce90(%rip), %rdx     # 0x6efb0
movq %rbx, %rdi
callq 0x75e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x72c0
movq %r14, %rdi
callq 0x7620
nop