// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/common.cpp
// Function: ssd_info::ssd_info(parameter_value*, char*)
ssd_info::ssd_info(parameter_value * parameters, char * statistics_filename)
{
	current_time = 0;
	parameter = parameters;
	int over_provide = 100.0 * parameters->overprovide;

	// repeat_times = new int[parameters->consolidation_degree];
	last_times = 0; // new int64_t [parameters->consolidation_degree];
	// for (int cd = 0; cd < parameters->consolidation_degree; cd++){
	repeat_times=0; 
	//	last_times[cd]=0;
	//	tracefile[cd] = NULL;
	// }

	lun_token = 0;

	request_sequence_number = 0;
	subrequest_sequence_number = 0;
	gc_sequence_number = 0;

	request_queue_length = 0;
	request_queue = NULL;
	stats = new statistics(parameters->consolidation_degree);

	dram = new dram_info(parameters);

	channel_head= new channel_info *[parameters->channel_number];
	for (int i = 0; i < parameters->channel_number; i++){
		channel_head[i] = new channel_info(i, parameters);
	}

	statisticfile=fopen(statistics_filename,"w");
	if(statisticfile==NULL)
	{
		printf("the statistic file can't open\n");
		return;
	}

	fprintf(statisticfile,"-----------------------parameter file----------------------\n");
	parameters->print_all_parameters(statisticfile);
	fprintf(statisticfile,"\n");
	fprintf(statisticfile,"-----------------------simulation output----------------------\n");
	fflush(statisticfile);

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
movl %eax, 0x88(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x78(%rdi)
movq %rax, (%rdi)
movq %rsi, 0x58(%rdi)
movq %rax, 0x38(%rdi)
movl %eax, 0x30(%rdi)
movl %eax, 0x1c(%rdi)
movq %rax, 0x68(%rdi)
movups %xmm0, 0x8(%rdi)
movl $0x1d0, %edi            # imm = 0x1D0
callq 0x2190
movq %rax, %r12
movl 0x64(%r14), %esi
movq %rax, %rdi
callq 0x3cf8
movq %r12, 0x98(%rbx)
movl $0x28, %edi
callq 0x2190
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x3ea8
movq %r12, 0x60(%rbx)
movl 0x98(%r14), %r12d
leaq (,%r12,8), %rdi
callq 0x2040
movq %rax, 0x90(%rbx)
testq %r12, %r12
je 0x3b80
xorl %r12d, %r12d
movl $0x60, %edi
callq 0x2190
movq %rax, %r13
movq %rax, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x423c
movq 0x90(%rbx), %rax
movq %r13, (%rax,%r12,8)
incq %r12
movl 0x98(%r14), %eax
cmpq %rax, %r12
jb 0x3b4b
leaq 0x65c4(%rip), %rsi      # 0xa14b
movq %r15, %rdi
callq 0x2200
movq %rax, 0x50(%rbx)
testq %rax, %rax
je 0x3bf7
leaq 0x65ae(%rip), %rdi      # 0xa14d
movl $0x3c, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x2310
movq 0x50(%rbx), %rsi
movq %r14, %rdi
callq 0x3a3e
movq 0x50(%rbx), %rsi
movl $0xa, %edi
callq 0x2220
movq 0x50(%rbx), %rcx
leaq 0x65b4(%rip), %rdi      # 0xa18a
movl $0x3f, %esi
movl $0x1, %edx
callq 0x2310
movq 0x50(%rbx), %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x21f0
leaq 0x6957(%rip), %rdi      # 0xa555
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x22a0
movq %rax, %rbx
movl $0x28, %esi
jmp 0x3c1e
movq %rax, %rbx
movl $0x1d0, %esi            # imm = 0x1D0
movq %r12, %rdi
jmp 0x3c2e
movq %rax, %rbx
movl $0x60, %esi
movq %r13, %rdi
callq 0x21a0
movq %rbx, %rdi
callq 0x22e0
nop