// File: CMU-SAFARI[P]MQSim/src/ssd/Data_Cache_Manager_Flash_Advanced.cpp
// Function: SSD_Components::Data_Cache_Manager_Flash_Advanced::Do_warmup(std::vector<Utils::Workload_Statistics*, std::allocator<Utils::Workload_Statistics*>>)
void Data_Cache_Manager_Flash_Advanced::Do_warmup(std::vector<Utils::Workload_Statistics*> workload_stats)
	{
		double total_write_arrival_rate = 0, total_read_arrival_rate = 0;
		switch (sharing_mode) {
			case Cache_Sharing_Mode::SHARED:
				//Estimate read arrival and write arrival rate
				//Estimate the queue length based on the arrival rate
				for (auto &stat : workload_stats) {
					switch (caching_mode_per_input_stream[stat->Stream_id]) {
						case Caching_Mode::TURNED_OFF:
							break;
						case Caching_Mode::READ_CACHE:
							if (stat->Type == Utils::Workload_Type::SYNTHETIC) {
							} else {
							}
							break;
						case Caching_Mode::WRITE_CACHE:
							if (stat->Type == Utils::Workload_Type::SYNTHETIC) {
								unsigned int total_pages_accessed = 1;
								switch (stat->Address_distribution_type)
								{
								case Utils::Address_Distribution_Type::STREAMING:
									break;
								case Utils::Address_Distribution_Type::RANDOM_HOTCOLD:
									break;
								case Utils::Address_Distribution_Type::RANDOM_UNIFORM:
									break;
								}
							} else {
							}
							break;
						case Caching_Mode::WRITE_READ_CACHE:
							//Put items on cache based on the accessed addresses
							if (stat->Type == Utils::Workload_Type::SYNTHETIC) {
							} else {
							}
							break;
					}
				}
				break;
			case Cache_Sharing_Mode::EQUAL_PARTITIONING:
				for (auto &stat : workload_stats) {
					switch (caching_mode_per_input_stream[stat->Stream_id])
					{
						case Caching_Mode::TURNED_OFF:
							break;
						case Caching_Mode::READ_CACHE:
							//Put items on cache based on the accessed addresses
							if (stat->Type == Utils::Workload_Type::SYNTHETIC) {
							} else {
							}
							break;
						case Caching_Mode::WRITE_CACHE:
							//Estimate the request arrival rate
							//Estimate the request service rate
							//Estimate the average size of requests in the cache
							//Fillup the cache space based on accessed adddresses to the estimated average cache size
							if (stat->Type == Utils::Workload_Type::SYNTHETIC) {
								//Estimate average write service rate
								unsigned int total_pages_accessed = 1;
								/*double average_write_arrival_rate, stdev_write_arrival_rate;
								double average_read_arrival_rate, stdev_read_arrival_rate;
								double average_write_service_time, average_read_service_time;*/
								switch (stat->Address_distribution_type)
								{
									case Utils::Address_Distribution_Type::STREAMING:
										break;
									case Utils::Address_Distribution_Type::RANDOM_HOTCOLD:
										break;
									case Utils::Address_Distribution_Type::RANDOM_UNIFORM:
										break;
								}
							} else {
							}
							break;
						case Caching_Mode::WRITE_READ_CACHE:
							//Put items on cache based on the accessed addresses
							if (stat->Type == Utils::Workload_Type::SYNTHETIC) {
							} else {
							}
							break;
					}
				}
				break;
		}
	}

// Assembly:
subq $0x98, %rsp
movq %rsi, 0x20(%rsp)
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x90(%rsp), %rax
movq $0x0, 0x80(%rsp)
movq $0x0, 0x78(%rsp)
movl 0x70(%rax), %eax
movl %eax, 0x28(%rsp)
testl %eax, %eax
je 0x6ab58
jmp 0x6ab46
movl 0x28(%rsp), %eax
subl $0x1, %eax
je 0x6ac6f
jmp 0x6ad83
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdi
callq 0x20280
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rdi
callq 0x202b0
movq %rax, 0x60(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x202e0
testb $0x1, %al
jne 0x6ab98
jmp 0x6ac6a
leaq 0x68(%rsp), %rdi
callq 0x20320
movq %rax, 0x58(%rsp)
leaq 0x6fb3a(%rip), %rax     # 0xda6e8
movq (%rax), %rax
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
movzwl 0x4(%rcx), %ecx
movl (%rax,%rcx,4), %eax
movq %rax, 0x18(%rsp)
subq $0x3, %rax
ja 0x6ac59
movq 0x18(%rsp), %rax
leaq 0x4264d(%rip), %rcx     # 0xad228
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x6ac59
movq 0x58(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jne 0x6abf5
jmp 0x6abf7
jmp 0x6abf7
jmp 0x6ac59
movq 0x58(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jne 0x6ac42
movl $0x1, 0x54(%rsp)
movq 0x58(%rsp), %rax
movq (%rax), %rax
movl 0x58(%rax), %eax
movl %eax, 0x14(%rsp)
subl $0x1, %eax
je 0x6ac3a
jmp 0x6ac24
movl 0x14(%rsp), %eax
subl $0x2, %eax
je 0x6ac3e
jmp 0x6ac2f
movl 0x14(%rsp), %eax
subl $0x3, %eax
je 0x6ac3c
jmp 0x6ac40
jmp 0x6ac40
jmp 0x6ac40
jmp 0x6ac40
jmp 0x6ac44
jmp 0x6ac44
jmp 0x6ac59
movq 0x58(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jne 0x6ac55
jmp 0x6ac57
jmp 0x6ac57
jmp 0x6ac59
jmp 0x6ac5b
leaq 0x68(%rsp), %rdi
callq 0x203c0
jmp 0x6ab80
jmp 0x6ad83
movq 0x20(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
callq 0x20280
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
callq 0x202b0
movq %rax, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x202e0
testb $0x1, %al
jne 0x6acaf
jmp 0x6ad81
leaq 0x40(%rsp), %rdi
callq 0x20320
movq %rax, 0x30(%rsp)
leaq 0x6fa23(%rip), %rax     # 0xda6e8
movq (%rax), %rax
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
movzwl 0x4(%rcx), %ecx
movl (%rax,%rcx,4), %eax
movq %rax, 0x8(%rsp)
subq $0x3, %rax
ja 0x6ad70
movq 0x8(%rsp), %rax
leaq 0x42526(%rip), %rcx     # 0xad218
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x6ad70
movq 0x30(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jne 0x6ad0c
jmp 0x6ad0e
jmp 0x6ad0e
jmp 0x6ad70
movq 0x30(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jne 0x6ad59
movl $0x1, 0x2c(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movl 0x58(%rax), %eax
movl %eax, 0x4(%rsp)
subl $0x1, %eax
je 0x6ad51
jmp 0x6ad3b
movl 0x4(%rsp), %eax
subl $0x2, %eax
je 0x6ad55
jmp 0x6ad46
movl 0x4(%rsp), %eax
subl $0x3, %eax
je 0x6ad53
jmp 0x6ad57
jmp 0x6ad57
jmp 0x6ad57
jmp 0x6ad57
jmp 0x6ad5b
jmp 0x6ad5b
jmp 0x6ad70
movq 0x30(%rsp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jne 0x6ad6c
jmp 0x6ad6e
jmp 0x6ad6e
jmp 0x6ad70
jmp 0x6ad72
leaq 0x40(%rsp), %rdi
callq 0x203c0
jmp 0x6ac97
jmp 0x6ad83
addq $0x98, %rsp
retq
nopl (%rax,%rax)