// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]MQSim/src/host/SATA_HBA.cpp
// Function: Host_Components::SATA_HBA::SATA_HBA(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned short, unsigned long, Host_Components::PCIe_Root_Complex*, std::vector<Host_Components::IO_Flow_Base*, std::allocator<Host_Components::IO_Flow_Base*>>*)
SATA_HBA::SATA_HBA(sim_object_id_type id, uint16_t ncq_size, sim_time_type hba_processing_delay, PCIe_Root_Complex* pcie_root_complex, std::vector<Host_Components::IO_Flow_Base*>* IO_flows) :
		MQSimEngine::Sim_Object(id), ncq_size(ncq_size), hba_processing_delay(hba_processing_delay), pcie_root_complex(pcie_root_complex), IO_flows(IO_flows)
	{
		for (uint16_t cmdid = 0; cmdid < (uint16_t)(0xffffffff); cmdid++) {
			available_command_ids.insert(cmdid);
		}
		Host_IO_Request* t = NULL;
		for (uint16_t cmdid = 0; cmdid < ncq_size; cmdid++) {
			request_queue_in_memory.push_back(t);
		}
		sata_ncq.Submission_queue_size = ncq_size;
		sata_ncq.Submission_queue_head = 0;
		sata_ncq.Submission_queue_tail = 0;
		sata_ncq.Completion_queue_size = ncq_size;
		sata_ncq.Completion_queue_head = 0;
		sata_ncq.Completion_queue_tail = 0;
		sata_ncq.Submission_queue_memory_base_address = SUBMISSION_QUEUE_MEMORY_1;
		sata_ncq.Submission_tail_register_address_on_device = NCQ_SUBMISSION_REGISTER;
		sata_ncq.Completion_queue_memory_base_address = COMPLETION_QUEUE_MEMORY_1;
		sata_ncq.Completion_head_register_address_on_device = NCQ_COMPLETION_REGISTER;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movl %edx, %ebp
movq %rdi, %rbx
callq 0x11bca
leaq 0x43dd8(%rip), %rax     # 0x60d70
movq %rax, (%rbx)
movw %bp, 0x2a(%rbx)
movq %r12, 0x30(%rbx)
movq %r15, 0x38(%rbx)
movq %r14, 0x40(%rbx)
leaq 0xa8(%rbx), %rax
movq %rax, 0x78(%rbx)
movq $0x1, 0x80(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x88(%rbx)
movl $0x3f800000, 0x98(%rbx) # imm = 0x3F800000
movups %xmm0, 0xa0(%rbx)
leaq 0xb0(%rbx), %r14
andl $0x0, 0xb8(%rbx)
leaq 0xb8(%rbx), %rax
andq $0x0, 0xc0(%rbx)
movq %rax, 0xc8(%rbx)
movq %rax, 0xd0(%rbx)
leaq 0xe0(%rbx), %r15
leaq 0xf8(%rbx), %r12
movups %xmm0, 0xd8(%rbx)
movups %xmm0, 0xe8(%rbx)
movq %r12, 0x100(%rbx)
movq %r12, 0xf8(%rbx)
andq $0x0, 0x108(%rbx)
leaq 0x110(%rbx), %r13
movq %r13, %rdi
movq %r12, 0x18(%rsp)
callq 0x1d770
movq %r13, 0x10(%rsp)
leaq 0x160(%rbx), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1d78c
xorl %eax, %eax
leaq 0x6(%rsp), %r13
movw %ax, 0x6(%rsp)
cmpw $-0x1, %ax
je 0x1d089
movq %r14, %rdi
movq %r13, %rsi
callq 0x19a84
movzwl 0x6(%rsp), %eax
incl %eax
jmp 0x1d06a
leaq 0x20(%rsp), %r13
andq $0x0, (%r13)
movl %ebp, %r12d
subw $0x1, %r12w
jb 0x1d0aa
movq %r15, %rdi
movq %r13, %rsi
callq 0x1993a
jmp 0x1d096
movw %bp, 0x4c(%rbx)
andl $0x0, 0x48(%rbx)
movw %bp, 0x64(%rbx)
andl $0x0, 0x60(%rbx)
movabsq $0x10000000000, %rax    # imm = 0x10000000000
movq %rax, 0x58(%rbx)
movq $0x1000, 0x50(%rbx)     # imm = 0x1000
movabsq $0x1f000000000, %rax    # imm = 0x1F000000000
movq %rax, 0x70(%rbx)
movq $0x1003, 0x68(%rbx)     # imm = 0x1003
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbp
jmp 0x1d10e
movq %rax, %rbp
jmp 0x1d118
jmp 0x1d101
movq %rax, %rbp
movq 0x8(%rsp), %rdi
callq 0x1d7a8
movq 0x10(%rsp), %rdi
callq 0x1d7f4
leaq 0x78(%rbx), %r13
movq 0x18(%rsp), %rdi
callq 0x19a0a
movq %r15, %rdi
callq 0x19a76
movq %r14, %rdi
callq 0x19a2e
movq %r13, %rdi
callq 0x19984
movq %rbx, %rdi
callq 0x11c8c
movq %rbp, %rdi
callq 0x75d0