// File: /workspace/github_cpp_makefile_star2_O3/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 0x41080
cmpq $0x102f, %rsi           # imm = 0x102F
jg 0x41125
cmpq $0x101f, %rsi           # imm = 0x101F
jg 0x41255
cmpq $0x1010, %rsi           # imm = 0x1010
je 0x4148c
cmpq $0x1013, %rsi           # imm = 0x1013
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq (%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq (%rax), %rax
jmp 0x4147c
cmpq $0x106f, %rsi           # imm = 0x106F
jg 0x411bd
cmpq $0x105f, %rsi           # imm = 0x105F
jg 0x412e0
cmpq $0x1050, %rsi           # imm = 0x1050
je 0x414c7
cmpq $0x1053, %rsi           # imm = 0x1053
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x20(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq 0x20(%rax), %rax
jmp 0x4147c
cmpq $0x103f, %rsi           # imm = 0x103F
jg 0x4136b
cmpq $0x1030, %rsi           # imm = 0x1030
je 0x41507
cmpq $0x1033, %rsi           # imm = 0x1033
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq 0x10(%rax), %rax
jmp 0x4147c
cmpq $0x107f, %rsi           # imm = 0x107F
jg 0x413f6
cmpq $0x1070, %rsi           # imm = 0x1070
je 0x41547
cmpq $0x1073, %rsi           # imm = 0x1073
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x30(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq 0x30(%rax), %rax
jmp 0x4147c
cmpq $0x1020, %rsi           # imm = 0x1020
je 0x41587
cmpq $0x1023, %rsi           # imm = 0x1023
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
jmp 0x4147c
cmpq $0x1060, %rsi           # imm = 0x1060
je 0x415c7
cmpq $0x1063, %rsi           # imm = 0x1063
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x28(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq 0x28(%rax), %rax
jmp 0x4147c
cmpq $0x1040, %rsi           # imm = 0x1040
je 0x41604
cmpq $0x1043, %rsi           # imm = 0x1043
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x18(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq 0x18(%rax), %rax
jmp 0x4147c
cmpq $0x1080, %rsi           # imm = 0x1080
je 0x4163d
cmpq $0x1083, %rsi           # imm = 0x1083
jne 0x41699
movq 0x50(%rax), %r15
movq 0x10(%r15), %rax
movq 0x38(%rax), %rax
movw %dx, 0x80(%rax)
movq 0xb0(%rax), %rcx
testq %rcx, %rcx
je 0x41693
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 0x41954
movq 0x10(%r15), %rax
movq 0x38(%rax), %rax
leaq 0x82(%rax), %rcx
addq $0x78, %rax
jmp 0x41683
movq 0x50(%rax), %rbx
movq 0x10(%rbx), %rax
movq (%rax), %rax
movw %dx, 0x7e(%rax)
movzwl 0xd0(%rax), %eax
cmpl %eax, 0x28(%rbx)
jbe 0x41693
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 0x41674
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 0x41693
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 0x41674
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 0x41693
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 0x41674
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 0x41693
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 0x41674
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 0x41693
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 0x41674
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 0x41693
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 0x41674
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 0x41693
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 0x41674
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 0x41693
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
addq $0x68, %rax
movzwl (%rcx), %edx
incl %edx
xorl %esi, %esi
cmpw (%rax), %dx
cmovnel %edx, %esi
movw %si, (%rcx)
popq %rbx
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x71d0
movq %rax, %rbx
leaq 0x188b0(%rip), %rsi     # 0x59f5d
movq %rax, %rdi
callq 0x7680
movq 0x2d90c(%rip), %rsi     # 0x6efc8
movq 0x2d8e5(%rip), %rdx     # 0x6efa8
movq %rbx, %rdi
callq 0x75e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x72c0
movq %r14, %rdi
callq 0x7620