LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/common.cpp
// Function: SubQueue::push_head(sub_request*)
void SubQueue::push_head(sub_request * sub){
	if (sub == NULL) return;

	size++;
	if (queue_tail == NULL){
		queue_head = sub;
		queue_tail = sub;
		return;
	}

	sub->next_node = queue_head;
	queue_head = sub;

}

// Assembly:
testq %rsi, %rsi
je 0x4504
incl 0x10(%rdi)
cmpq $0x0, 0x8(%rdi)
je 0x44fa
movq (%rdi), %rax
movq %rax, 0x70(%rsi)
jmp 0x4501
movq %rsi, (%rdi)
addq $0x8, %rdi
movq %rsi, (%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/common.cpp
// Function: SubQueue::target_request(int, int, int)
sub_request * SubQueue::target_request(int plane, int block, int page ){

	sub_request * sub = queue_head;

	while (sub != NULL){
		if (sub->location->plane == plane)
			if (block == -1 || sub->location->block == block )
				if (page == -1 || sub->location->page == page)
					return sub;


		sub = sub->next_node;

	}

	return sub;
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x4587
movq 0x60(%rax), %rdi
cmpl %esi, 0x8(%rdi)
jne 0x4581
cmpl $-0x1, %edx
je 0x4577
cmpl %edx, 0xc(%rdi)
jne 0x4581
cmpl $-0x1, %ecx
je 0x4589
cmpl %ecx, 0x10(%rdi)
je 0x4589
movq 0x70(%rax), %rax
jmp 0x455f
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: get_new_ppn(ssd_info*, int, local const*, bool)
int get_new_ppn(ssd_info *ssd, int lpn, const local * location, bool hot){ // hot specify if we need a page in hot or cold active block 
	local * new_location;
	if (location != NULL) {
		new_location = new local(location->channel, location->lun, location->plane);
	}else {
		new_location = new local(0,0,0);
		allocate_plane(ssd, new_location);
	}
	if (allocate_page_in_plane(ssd, new_location, hot) != SUCCESS){
		delete new_location;
		return -1;
	}
	int ppn = find_ppn(ssd, new_location);
	delete new_location;
	return ppn;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r15
movq %rdi, %r14
movl $0x18, %edi
callq 0x2190
movq %rax, %rbx
testq %r15, %r15
je 0x49cc
movl 0x8(%r15), %eax
movq (%r15), %rcx
movq %rcx, (%rbx)
movl %eax, 0x8(%rbx)
jmp 0x49e5
movq $0x0, (%rbx)
movl $0x0, 0x8(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6187
movzbl %bpl, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x620a
testl %eax, %eax
je 0x4a07
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6289
movl %eax, %ebp
jmp 0x4a0c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21a0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: distribute(ssd_info*)
ssd_info * distribute(ssd_info *ssd){

	if (ssd->dram != NULL)
		ssd->dram->current_time=ssd->current_time;

	request * req = ssd->request_tail; // The request we want to distribute
	if (req->size == 0) {
		cout << "size zero " << endl; 
		return ssd; 
	}
	unsigned lsn  = req->lsn;
	unsigned last_lpn  = (req->lsn+req->size-1)/ssd->parameter->subpage_page;
	unsigned first_lpn = req->lsn/ssd->parameter->subpage_page;
	unsigned lpn  = first_lpn;

	if (req->operation == READ)
	{
		while(lpn<=last_lpn)
		{
			sub_request * sub     = create_sub_request(ssd,lpn, req,req->operation, req->io_num);
			if (service_in_buffer(ssd, sub) != SUCCESS)
				printf("Error in servicing a request in buffer \n");

			lpn++;
		}
	}
	else if(req->operation==WRITE)
	{
		while (lpn<=last_lpn)
		{
			sub_request * sub=create_sub_request(ssd,lpn, req,req->operation, req->io_num);
			if (service_in_buffer(ssd, sub) != SUCCESS)
				printf("Error in servicing write requset in buffer! \n");
			lpn++;
		}
	} else {
		// FIXME for TRIM
	}
	return ssd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x60(%rdi), %rax
testq %rax, %rax
je 0x4b8a
movq (%rbx), %rcx
movq %rcx, 0x8(%rax)
movq 0x70(%rbx), %r14
movl 0x14(%r14), %eax
testl %eax, %eax
je 0x4c23
movl 0x10(%r14), %ecx
movl 0x18(%r14), %esi
addl %ecx, %eax
decl %eax
movq 0x58(%rbx), %rdx
movl 0x238(%rdx), %edi
xorl %edx, %edx
divl %edi
movl %eax, %ebp
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %eax, %r15d
cmpl $0x1, %esi
je 0x4c1c
testl %esi, %esi
je 0x4bf1
jmp 0x4c65
movl 0x4(%r14), %r8d
movl 0x18(%r14), %ecx
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x4c73
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4d9f
incl %r15d
cmpl %ebp, %r15d
jbe 0x4bcd
jmp 0x4c65
movl 0x4(%r14), %r8d
movl 0x18(%r14), %ecx
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x4c73
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4d9f
incl %r15d
cmpl %ebp, %r15d
jbe 0x4bf8
jmp 0x4c65
movq 0x93a6(%rip), %r14      # 0xdfd0
leaq 0x5a52(%rip), %rsi      # 0xa683
movl $0xa, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: create_sub_request(ssd_info*, int, request*, unsigned int, int)
sub_request * create_sub_request( ssd_info * ssd, int lpn,
				 request * req,unsigned int operation, int io_num = -1){

	sub_request * sub = new sub_request(ssd->current_time, lpn,
				ssd->subrequest_sequence_number++, operation);

	if(req!=NULL)
	{
		sub->next_subs = req->subs;
		req->subs = sub;

		sub->app_id = req->app_id;
		sub->io_num = req->io_num;

		sub->state_time[SR_MODE_WAIT] = ssd->current_time - req->time;
		sub->state_current_time = ssd->current_time;
	}
	else
	{
		sub->io_num = io_num;
		sub->state_time[SR_MODE_WAIT] = 0;
		sub->state_current_time = ssd->current_time;
	}

	if (operation == READ)
	{
		sub->ppn = ssd->dram->map->map_entry[lpn].pn;
		if (sub->ppn >= 0) {
			find_location(ssd,sub->ppn, sub->location);
			if (ssd->dram->map->map_entry[lpn].state)
				sub->state = 1;
			else
				sub->state = 0;
		}else {
			sub->state = 0;
		}
	}
	else if(operation == WRITE)
	{
		sub->ppn = -1; // ssd->dram->map->map_entry[lpn].pn;
		sub->state=0;
	}
	else
	{
		delete sub;
		printf("\n FIXME TRIM command \n");
		return NULL;
	}

	return sub;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r12d
movl %ecx, %r15d
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r14
movl $0xa0, %edi
callq 0x2190
movq %rax, %rbx
movq (%r14), %rsi
movl 0xc(%r14), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0xc(%r14)
movq %rbx, %rdi
movl %ebp, %edx
movl %r15d, %r8d
callq 0x67be
testq %r13, %r13
je 0x4cd8
movq 0x30(%r13), %rax
movq %rax, 0x68(%rbx)
movq %rbx, 0x30(%r13)
movl (%r13), %eax
movl %eax, (%rbx)
movl 0x4(%r13), %r12d
movq (%r14), %rax
subq 0x8(%r13), %rax
jmp 0x4cda
xorl %eax, %eax
movq 0x80(%rbx), %rcx
movq %rax, (%rcx)
movq (%r14), %rax
movl %r12d, 0x4(%rbx)
movq %rax, 0x88(%rbx)
testl %r15d, %r15d
je 0x4d42
cmpl $0x1, %r15d
jne 0x4d52
movq 0x60(%r14), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movslq %ebp, %r15
shlq $0x4, %r15
movl (%rax,%r15), %esi
movl %esi, 0x10(%rbx)
testl %esi, %esi
js 0x4d49
movq 0x60(%rbx), %rdx
movq %r14, %rdi
callq 0x4af9
movq 0x60(%r14), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
cmpb $0x1, 0x4(%rax,%r15)
jne 0x4d49
movl $0x1, 0x40(%rbx)
jmp 0x4d75
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movl $0x0, 0x40(%rbx)
jmp 0x4d75
movq %rbx, %rdi
callq 0x65d0
movl $0xa0, %esi
movq %rbx, %rdi
callq 0x21a0
leaq 0x5c5b(%rip), %rdi      # 0xa9c9
callq 0x22a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0xa0, %esi
movq %rbx, %rdi
callq 0x21a0
movq %r14, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: invalid_old_page(ssd_info*, sub_request*)
STATE invalid_old_page(ssd_info * ssd, sub_request * sub){ // const int lpn){
	int lpn = sub->lpn;
	if (ssd->dram->map->map_entry[lpn].state == false){
		#if DUBG 
		cout << "error 1 " << sub->lpn  << endl; 	
		#endif 
		 return FAIL;
	}
	int old_ppn = ssd->dram->map->map_entry[lpn].pn;
	find_location(ssd, old_ppn, sub->location);
	if( update_map_entry(ssd, lpn, -1) == FAIL) {
		cout << "error 2" << endl; 
		return FAIL;
	}
	if (update_physical_page(ssd, old_ppn, -1)  == FAIL) {
		cout << "error 3 " << endl; 
		return FAIL;
	} 
	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movslq 0xc(%rsi), %r14
movq 0x60(%rdi), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
shlq $0x4, %r14
xorl %eax, %eax
cmpb $0x0, 0x4(%rcx,%r14)
je 0x51a5
movq %rdi, %rbx
addq %r14, %rcx
movl (%rcx), %ebp
movq 0x60(%rsi), %rdx
movl %ebp, %esi
callq 0x4af9
movq 0x60(%rbx), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movl $0xffffffff, (%rax,%r14) # imm = 0xFFFFFFFF
movb $0x0, 0x4(%rax,%r14)
movq $0x0, 0x8(%rax,%r14)
movq %rbx, %rdi
movl %ebp, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5fd7
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x51a5
movq 0x8e68(%rip), %rbx      # 0xdfd0
leaq 0x562f(%rip), %rsi      # 0xa79e
movl $0x8, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: process(ssd_info*)
ssd_info *process( ssd_info *ssd)   {
	// use some random to stop always prioritizing a single channel (channel 0)
	int random = rand();
	for(int chan=0;chan<ssd->parameter->channel_number;chan++)
	{
		int c = ( chan + random ) % ssd->parameter->channel_number;
		unsigned int flag=0;
		if(find_channel_state(ssd, c) == CHANNEL_MODE_IDLE)
		{
			services_2_io(ssd, c, &flag);
			if(flag == 0)
				services_2_gc(ssd, c, &flag);
		}
	}
	return ssd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x20a0
movl %eax, %r14d
movq 0x58(%rbx), %rax
movl 0x98(%rax), %ecx
testl %ecx, %ecx
je 0x522a
xorl %r12d, %r12d
leaq 0xc(%rsp), %r15
leal (%r14,%r12), %eax
xorl %edx, %edx
divl %ecx
movl %edx, %ebp
movl $0x0, 0xc(%rsp)
movq %rbx, %rdi
movl %edx, %esi
callq 0x6c1a
testl %eax, %eax
jne 0x5218
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x523a
cmpl $0x0, 0xc(%rsp)
jne 0x5218
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x557f
incl %r12d
movq 0x58(%rbx), %rax
movl 0x98(%rax), %ecx
cmpl %ecx, %r12d
jb 0x51d7
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: allocate_plane(ssd_info*, local*)
STATE allocate_plane( ssd_info * ssd , local * location){
	sub_request * update=NULL;
	unsigned int channel_num=0,lun_num=0,plane_num=0;
	if (location == NULL) location = new local(0,0,0);
	channel_num = ssd->parameter->channel_number;
	lun_num=ssd->parameter->lun_channel[0];
	plane_num=ssd->parameter->plane_lun;

	unsigned int target_lun = get_target_lun(ssd);
	location->channel=target_lun % channel_num;
	location->lun= (target_lun / channel_num) % ssd->parameter->lun_channel[location->channel];
	location->plane= get_target_plane(ssd, location->channel, location->lun);
	return SUCCESS;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
jne 0x619d
movl $0x18, %edi
callq 0x2190
movq %rax, %rsi
movq 0x58(%rbx), %r8
movl 0x14(%rbx), %ecx
leal 0x1(%rcx), %eax
xorl %edx, %edx
divl 0x88(%r8)
movl %edx, %edi
movl %ecx, %eax
xorl %edx, %edx
divl 0x98(%r8)
movl %edi, 0x14(%rbx)
movl %edx, (%rsi)
movslq %edx, %rcx
xorl %edx, %edx
divl 0x9c(%r8,%rcx,4)
movl %edx, 0x4(%rsi)
movq 0x90(%rbx), %rax
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %rcx
movl 0x9c(%rcx), %edi
leal 0x1(%rdi), %eax
xorl %edx, %edx
divl 0x22c(%r8)
movl %edx, 0x9c(%rcx)
movl %edi, 0x8(%rsi)
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: find_ppn(ssd_info*, local const*)
int find_ppn(ssd_info * ssd,const local * location){
	unsigned int channel = location->channel;
	unsigned int lun = location->lun;
	unsigned int plane = location->plane;
	unsigned int block = location->block;
	unsigned int page = location->page;

	int ppn=0;

	int page_plane=0,page_lun=0;
	int page_channel[100];

	page_plane=ssd->parameter->page_block*ssd->parameter->block_plane;
	page_lun=page_plane*ssd->parameter->plane_lun;

	unsigned int i=0;
	while(i<ssd->parameter->channel_number)
	{
		page_channel[i]=ssd->parameter->lun_channel[i]*page_lun;
		i++;
	}


	i=0;
	while(i<channel)
	{
		ppn=ppn+page_channel[i];
		i++;
	}
	ppn=ppn+page_lun*lun+page_plane*plane+block*ssd->parameter->page_block+page;

	return ppn;
}

// Assembly:
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movl (%rsi), %r8d
movq 0x58(%rdi), %rdi
movl 0x98(%rdi), %r9d
movl 0x234(%rdi), %eax
movl 0x230(%rdi), %ecx
imull %eax, %ecx
movl 0x22c(%rdi), %edx
imull %ecx, %edx
testq %r9, %r9
je 0x62d8
xorl %r10d, %r10d
movl 0x9c(%rdi,%r10,4), %r11d
imull %edx, %r11d
movl %r11d, -0x80(%rsp,%r10,4)
incq %r10
cmpq %r10, %r9
jne 0x62bf
movl 0x4(%rsi), %r11d
movl 0x8(%rsi), %r9d
movl 0xc(%rsi), %edi
movl 0x10(%rsi), %esi
testq %r8, %r8
je 0x62ff
xorl %ebx, %ebx
xorl %r10d, %r10d
addl -0x80(%rsp,%rbx,4), %r10d
incq %rbx
cmpq %rbx, %r8
jne 0x62f0
jmp 0x6302
xorl %r10d, %r10d
imull %r11d, %edx
imull %r9d, %ecx
addl %edx, %ecx
imull %edi, %eax
addl %esi, %eax
addl %ecx, %eax
addl %r10d, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: get_active_block(ssd_info*, local*)
int get_active_block(ssd_info *ssd, local * location){
	int channel = location->channel;
	int lun = location->lun;
	int plane = location->plane;

	int active_block = ssd->channel_head[channel]->lun_head[lun]->plane_head[plane]->active_block;
	int free_page_num = ssd->channel_head[channel]->lun_head[lun]->
					plane_head[plane]->blk_head[active_block]->free_page_num;
	int cold_active_block = ssd->channel_head[channel]->lun_head[lun]->plane_head[plane]->cold_active_block; 
	int count=0;
	while(((free_page_num==0))&&(count<ssd->parameter->block_plane))
	{
		active_block=(active_block+1)%ssd->parameter->block_plane;
		if (active_block == cold_active_block) 
			active_block=(active_block+1)%ssd->parameter->block_plane;
		free_page_num=ssd->channel_head[channel]->lun_head[lun]->
					plane_head[plane]->blk_head[active_block]->free_page_num;
		count++;
	}
	if (count == ssd->parameter->block_plane) {
		cout << "could not find active_block " << endl;
		return -1;
	}
	ssd->channel_head[channel]->lun_head[lun]->plane_head[plane]->active_block=active_block;

	return active_block;
}

// Assembly:
pushq %rbx
movslq (%rsi), %rax
movslq 0x4(%rsi), %rcx
movslq 0x8(%rsi), %rdx
movq 0x58(%rdi), %rsi
movq 0x90(%rdi), %rdi
movq (%rdi,%rax,8), %rax
movq 0x50(%rax), %rax
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq (%rax,%rdx,8), %rcx
movq 0x10(%rcx), %rax
movq 0x20(%rcx), %r8
movslq %eax, %rdx
movq (%r8,%rdx,8), %rdx
xorl %edi, %edi
cmpl $0x0, 0x4(%rdx)
movl 0x230(%rsi), %esi
jne 0x63e7
movl 0x18(%rcx), %r9d
xorl %r10d, %r10d
xorl %edi, %edi
cmpl %edi, %esi
je 0x63eb
incl %eax
xorl %edx, %edx
divl %esi
leal 0x1(%rdx), %eax
cmpl %esi, %eax
cmovel %r10d, %eax
cmpl %r9d, %edx
cmovnel %edx, %eax
movslq %eax, %rdx
incl %edi
movq (%r8,%rdx,8), %rdx
cmpl $0x0, 0x4(%rdx)
je 0x63bf
cmpl %esi, %edi
jne 0x6434
movq 0x7bde(%rip), %rbx      # 0xdfd0
leaq 0x43ae(%rip), %rsi      # 0xa7a7
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x643b
movslq %eax, %rdx
movq %rdx, 0x10(%rcx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ftl.cpp
// Function: get_cold_active_block(ssd_info*, local*)
int get_cold_active_block(ssd_info *ssd, local * location){
	int channel = location->channel;
	int lun = location->lun;
	int plane = location->plane;

	int cold_active_block = ssd->channel_head[channel]->lun_head[lun]->plane_head[plane]->cold_active_block;
	int free_page_num = ssd->channel_head[channel]->lun_head[lun]->
					plane_head[plane]->blk_head[cold_active_block]->free_page_num;
	int active_block = ssd->channel_head[channel]->lun_head[lun]->plane_head[plane]->active_block; 
	int count=0;
	while(((free_page_num==0))&&(count<ssd->parameter->block_plane))
	{
		cold_active_block=(cold_active_block+1)%ssd->parameter->block_plane;
		if (cold_active_block == active_block) 
			cold_active_block=(cold_active_block+1)%ssd->parameter->block_plane;
		free_page_num=ssd->channel_head[channel]->lun_head[lun]->
					plane_head[plane]->blk_head[cold_active_block]->free_page_num;
		count++;
	}
	if (count == ssd->parameter->block_plane) {
		cout << "could not find cold active_block " << endl;
		return -1;
	}
	ssd->channel_head[channel]->lun_head[lun]->plane_head[plane]->cold_active_block=cold_active_block;

	return cold_active_block;
}

// Assembly:
pushq %rbx
movslq (%rsi), %rax
movslq 0x4(%rsi), %rcx
movslq 0x8(%rsi), %rdx
movq 0x58(%rdi), %rsi
movq 0x90(%rdi), %rdi
movq (%rdi,%rax,8), %rax
movq 0x50(%rax), %rax
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq (%rax,%rdx,8), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %r8
movslq %eax, %rdx
movq (%r8,%rdx,8), %rdx
xorl %edi, %edi
cmpl $0x0, 0x4(%rdx)
movl 0x230(%rsi), %esi
jne 0x64b5
movl 0x10(%rcx), %r9d
xorl %r10d, %r10d
xorl %edi, %edi
cmpl %edi, %esi
je 0x64b9
incl %eax
xorl %edx, %edx
divl %esi
leal 0x1(%rdx), %eax
cmpl %esi, %eax
cmovel %r10d, %eax
cmpl %r9d, %edx
cmovnel %edx, %eax
movslq %eax, %rdx
incl %edi
movq (%r8,%rdx,8), %rdx
cmpl $0x0, 0x4(%rdx)
je 0x648d
cmpl %esi, %edi
jne 0x6502
movq 0x7b10(%rip), %rbx      # 0xdfd0
leaq 0x42fd(%rip), %rsi      # 0xa7c4
movl $0x21, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6509
movslq %eax, %rdx
movq %rdx, 0x18(%rcx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/./common.hh
// Function: write_buffer::hit_read(buffer_entry*)
void hit_read(buffer_entry * entry){
		if (entry == NULL) {
			cout << "Error in hit read " << endl;
			return;
		}
		read_hit++;
		if (entry->outlier) 
			cout << "outlier shouldn't get a hit in read " << endl; 
	}

// Assembly:
pushq %rbx
testq %rsi, %rsi
je 0x652f
incl (%rdi)
cmpb $0x1, 0x8(%rsi)
jne 0x6576
movq 0x7aaf(%rip), %rdi      # 0xdfd0
leaq 0x42d1(%rip), %rsi      # 0xa7f9
movl $0x24, %edx
jmp 0x6542
movq 0x7a9a(%rip), %rdi      # 0xdfd0
leaq 0x42a9(%rip), %rsi      # 0xa7e6
movl $0x12, %edx
callq 0x21e0
movq 0x7a82(%rip), %rbx      # 0xdfd0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
popq %rbx
jmp 0x20f0
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/./common.hh
// Function: write_buffer::hit_write(buffer_entry*)
void hit_write(buffer_entry * entry){
		if (entry == NULL){
		//	cout << "Error in hit write " << endl;
			return;
		}
		write_hit++;
		entry->modified = true;
		if (entry->outlier) 
			cout << "outlier shouldn't get a hit in write " << endl; 
	}

// Assembly:
testq %rsi, %rsi
je 0x65ce
incl 0x4(%rdi)
movb $0x1, 0x1(%rsi)
cmpb $0x1, 0x8(%rsi)
jne 0x65ce
pushq %rbx
movq 0x7a3e(%rip), %rbx      # 0xdfd0
leaq 0x42be(%rip), %rsi      # 0xa857
movl $0x25, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
popq %rbx
jmp 0x20f0
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/./common.hh
// Function: write_buffer::remove_entry(buffer_entry*)
buffer_entry * remove_entry (buffer_entry * entry){
		if (entry == NULL) return NULL;
		if (entry_count == 0) return NULL;
		if (entry == buffer_first_outlier) {
			buffer_first_outlier = entry->prev_entry; 
		} 
		if (entry == buffer_head) {
			return remove_head();
		}
		if (entry == buffer_tail){
			return remove_tail();
		}
		entry->prev_entry->next_entry = entry->next_entry;
		entry->next_entry->prev_entry = entry->prev_entry;
		entry->next_entry = NULL;
		entry->prev_entry = NULL;
		entry_count--;

		if (buffer_head == NULL && buffer_tail != NULL){
			cout << "**** Buffer head and tail problem 1 8" << endl;

		}
		if (buffer_head != NULL && buffer_tail == NULL){
			cout << "**** Buffer head and tail problem 2 8" << endl;
		}
	
		return entry;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x6733
movq %rdi, %r14
movl 0xc(%rdi), %ecx
testl %ecx, %ecx
je 0x6733
movq %rsi, %rbx
cmpq %rsi, 0x20(%r14)
jne 0x6651
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r14)
movq 0x10(%r14), %rax
cmpq %rbx, %rax
je 0x673e
cmpq %rbx, 0x18(%r14)
je 0x674b
movq 0x18(%rbx), %rdx
movq 0x20(%rbx), %rsi
movq %rdx, 0x18(%rsi)
movq %rsi, 0x20(%rdx)
decl %ecx
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movl %ecx, 0xc(%r14)
testq %rax, %rax
setne %dl
movq 0x18(%r14), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
jne 0x66e5
movq 0x792e(%rip), %r15      # 0xdfd0
leaq 0x41d4(%rip), %rsi      # 0xa87d
movl $0x25, %edx
movq %r15, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
movq 0x10(%r14), %rax
movq 0x18(%r14), %rcx
testq %rax, %rax
je 0x6735
testq %rcx, %rcx
jne 0x6735
movq 0x78da(%rip), %r14      # 0xdfd0
leaq 0x41a6(%rip), %rsi      # 0xa8a3
movl $0x25, %edx
movq %r14, %rdi
callq 0x21e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
jmp 0x6735
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6948
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6a88
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/./common.hh
// Function: write_buffer::move_outlier()
buffer_entry * move_outlier(){
		buffer_entry * temp = buffer_first_outlier;

		if (temp == NULL) return NULL; 
	
		if (temp->outlier == false) {
			cout << "error outlier is not outlier " << endl;
			return NULL;  
		}

		buffer_first_outlier = temp->prev_entry;  	
		temp->outlier = false; 
		
		return temp; 
	}

// Assembly:
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x6774
cmpb $0x0, 0x8(%rax)
je 0x6777
movq 0x20(%rax), %rcx
movq %rcx, 0x20(%rdi)
movb $0x0, 0x8(%rax)
retq
xorl %eax, %eax
retq
pushq %rbx
movq 0x7851(%rip), %rbx      # 0xdfd0
leaq 0x4225(%rip), %rsi      # 0xa9ab
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/./common.hh
// Function: write_buffer::add_head(buffer_entry*)
bool add_head(buffer_entry * entry){
		if (entry == NULL) return false;
		if (entry_count >= buffer_capacity){
			entry->outlier = true;
			if (buffer_first_outlier == NULL) 
				buffer_first_outlier = entry; 
		}
		if (buffer_head == NULL) {
			if (buffer_tail != NULL || entry_count != 0){
				cout << "error in add head " << endl;
				return false;
			}
			entry_count = 1;
			buffer_head = entry;
			buffer_tail = entry;
			buffer_head->prev_entry = NULL; // just to make sure everything is fine
			buffer_tail->next_entry = NULL; // just to make sure everything is fine
		}else {
			buffer_head->prev_entry = entry;
			entry->next_entry = buffer_head;
			buffer_head = entry;
			buffer_head->prev_entry = NULL;
			entry_count++;
		}

		if (buffer_head == NULL && buffer_tail != NULL){
			cout << "**** Buffer head and tail problem 1 7" << endl;
			return false;
		}
		if (buffer_head != NULL && buffer_tail == NULL){
			cout << "**** Buffer head and tail problem 2 7" << endl;
			return false;
		}

		return true;
	}

// Assembly:
testq %rsi, %rsi
je 0x68b9
movl 0xc(%rdi), %eax
cmpl 0x8(%rdi), %eax
jl 0x6894
movb $0x1, 0x8(%rsi)
cmpq $0x0, 0x20(%rdi)
jne 0x6894
movq %rsi, 0x20(%rdi)
pushq %rbx
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x68bc
movq %rsi, 0x20(%rcx)
movq %rcx, 0x18(%rsi)
movq %rsi, 0x10(%rdi)
movq $0x0, 0x20(%rsi)
incl %eax
movl %eax, 0xc(%rdi)
jmp 0x68df
xorl %eax, %eax
retq
cmpq $0x0, 0x18(%rdi)
jne 0x68fd
cmpl $0x0, 0xc(%rdi)
jne 0x68fd
movl $0x1, 0xc(%rdi)
movq %rsi, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsi)
movb $0x1, %al
cmpq $0x0, 0x18(%rdi)
jne 0x6945
movq 0x76e1(%rip), %rdi      # 0xdfd0
leaq 0x3f3b(%rip), %rsi      # 0xa831
movl $0x25, %edx
jmp 0x6910
movq 0x76cc(%rip), %rdi      # 0xdfd0
leaq 0x3f13(%rip), %rsi      # 0xa81e
movl $0x12, %edx
callq 0x21e0
movq 0x76b4(%rip), %rbx      # 0xdfd0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/./common.hh
// Function: write_buffer::remove_head()
buffer_entry * remove_head(){
		if (entry_count == 0) return NULL;
		if (buffer_head == NULL) {
				cout << "error in remove head" << endl;
				return NULL;
		}
		if (buffer_head->prev_entry != NULL) {
				cout << "error in remove head " << endl;
				return NULL;
		}

		buffer_entry * temp = buffer_head;
		buffer_head = temp->next_entry;
		if (buffer_head != NULL)
			buffer_head->prev_entry = NULL;
		else
			buffer_tail = NULL;
		temp->next_entry = NULL;
		temp->prev_entry = NULL;
		entry_count--;

		if (buffer_head == NULL && buffer_tail != NULL){
			cout << "**** Buffer head and tail problem 1 9" << endl;

		}
		if (buffer_head != NULL && buffer_tail == NULL){
			cout << "**** Buffer head and tail problem 2 9" << endl;

		}

		return temp;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0xc(%rdi), %ecx
testl %ecx, %ecx
je 0x697c
movq %rdi, %r14
movq 0x10(%rdi), %rbx
testq %rbx, %rbx
je 0x6980
cmpq $0x0, 0x20(%rbx)
je 0x69d1
movq 0x7662(%rip), %rdi      # 0xdfd0
leaq 0x3f69(%rip), %rsi      # 0xa8de
movl $0x15, %edx
jmp 0x6993
xorl %ebx, %ebx
jmp 0x69c8
movq 0x7649(%rip), %rdi      # 0xdfd0
leaq 0x3f3b(%rip), %rsi      # 0xa8c9
movl $0x14, %edx
callq 0x21e0
xorl %ebx, %ebx
movq 0x762f(%rip), %r14      # 0xdfd0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movq 0x18(%rbx), %rax
movq %rax, 0x10(%r14)
leaq 0x18(%r14), %rdx
leaq 0x20(%rax), %rsi
decl %ecx
testq %rax, %rax
cmoveq %rdx, %rsi
movq $0x0, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movl %ecx, 0xc(%r14)
setne %dl
movq 0x18(%r14), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
jne 0x6a59
movq 0x75ba(%rip), %r15      # 0xdfd0
leaq 0x3ed7(%rip), %rsi      # 0xa8f4
movl $0x25, %edx
movq %r15, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
movq 0x10(%r14), %rax
movq 0x18(%r14), %rcx
testq %rax, %rax
je 0x69c8
testq %rcx, %rcx
jne 0x69c8
movq 0x755e(%rip), %rdi      # 0xdfd0
leaq 0x3ea1(%rip), %rsi      # 0xa91a
movl $0x25, %edx
callq 0x21e0
jmp 0x699a
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/./common.hh
// Function: write_buffer::remove_tail()
buffer_entry * remove_tail(){
		if (entry_count == 0) return NULL;
		if (buffer_tail == NULL) {
			cout << "error in buffer tail remove " << endl;
			return NULL;
		}
		if (buffer_tail->next_entry != NULL) {
			cout << "error in buffer tail remove " << endl;
			return NULL;
		}
		buffer_entry * temp = buffer_tail;
		buffer_tail = temp->prev_entry;
		if (buffer_tail != NULL)
			buffer_tail->next_entry = NULL;
		else
			buffer_head = NULL;
		temp->prev_entry = NULL;
		temp->next_entry = NULL;
		entry_count--;

		if (buffer_head == NULL && buffer_tail != NULL){
			cout << "**** Buffer head and tail problem 1 10" << endl;

		}
		if (buffer_head != NULL && buffer_tail == NULL){
			cout << "**** Buffer head and tail problem 2 10" << endl;

		}

		return temp;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl 0xc(%rdi), %eax
testl %eax, %eax
je 0x6af1
movq %rdi, %r14
movq 0x18(%rdi), %rbx
testq %rbx, %rbx
je 0x6aa7
cmpq $0x0, 0x18(%rbx)
je 0x6afc
movq 0x7522(%rip), %rdi      # 0xdfd0
leaq 0x3e8b(%rip), %rsi      # 0xa940
movl $0x1c, %edx
callq 0x21e0
xorl %ebx, %ebx
movq 0x7508(%rip), %r14      # 0xdfd0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
jmp 0x6af3
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x18(%rbx), %rcx
movq 0x20(%rbx), %rdx
movq %rdx, 0x18(%r14)
testq %rdx, %rdx
je 0x6b1f
movq $0x0, 0x18(%rdx)
cmpq $0x0, 0x10(%r14)
setne %dl
jmp 0x6b29
movq $0x0, 0x10(%r14)
xorl %edx, %edx
decl %eax
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movl %eax, 0xc(%r14)
movq 0x18(%r14), %rax
testq %rax, %rax
sete %cl
orb %dl, %cl
jne 0x6b89
movq 0x7486(%rip), %r15      # 0xdfd0
leaq 0x3e0c(%rip), %rsi      # 0xa95d
movl $0x26, %edx
movq %r15, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
movq 0x18(%r14), %rax
cmpq $0x0, 0x10(%r14)
je 0x6af3
testq %rax, %rax
jne 0x6af3
movq 0x742c(%rip), %rdi      # 0xdfd0
leaq 0x3dd9(%rip), %rsi      # 0xa984
movl $0x26, %edx
callq 0x21e0
jmp 0x6ac1
nop
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: move_page(ssd_info*, local const*, gc_operation*)
STATE move_page(ssd_info * ssd,  const local * location, gc_operation * gc_node){

	sub_request * rsub = create_gc_sub_request(ssd, location, READ, gc_node);
	ssd->channel_head[rsub->location->channel]->lun_head[rsub->location->lun]->GCSubs.push_tail(rsub);


	sub_request * wsub = create_gc_sub_request(ssd, location, WRITE, gc_node);
	wsub->location = new local(location->channel, location->lun, location->plane);
	invalid_old_page(ssd, wsub);
	wsub->ppn = get_new_ppn(ssd, wsub->lpn, wsub->location, false); // false---> cold block 
	if( wsub->ppn == -1 || write_page(ssd, wsub->lpn, wsub->ppn) == FAIL) {
		cout << "error in move page " << endl; 
		return FAIL; 
	}
		
	find_location(ssd, wsub->ppn, wsub->location);	

	buffer_entry * buf_ent = ssd->dram->map->map_entry[wsub->lpn].buf_ent; 
	if (buf_ent == NULL){
		ssd->channel_head[wsub->location->channel]->lun_head[wsub->location->lun]->GCSubs.push_tail(wsub);
	} else {
		if (!buf_ent->gc) 
			ssd->dram->buffer->hit_write(buf_ent); 
		else 
			ssd->dram->gc_buffer->hit_write(buf_ent); 	
		delete wsub; 
	}	

	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0x1, %edx
movq %r14, %rcx
callq 0x724a
movq 0x90(%rbx), %rcx
movq 0x60(%rax), %rdx
movslq (%rdx), %rsi
movq (%rcx,%rsi,8), %rcx
movq 0x50(%rcx), %rcx
movslq 0x4(%rdx), %rdx
movq (%rcx,%rdx,8), %rdi
addq $0x48, %rdi
movq %rax, %rsi
callq 0x44b8
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x724a
movq %rax, %r14
movl $0x18, %edi
callq 0x2190
movl 0x8(%r15), %ecx
movq (%r15), %rdx
movq %rdx, (%rax)
movl %ecx, 0x8(%rax)
movq %rax, 0x60(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x50ed
movl 0xc(%r14), %esi
movq 0x60(%r14), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x499c
movl %eax, 0x10(%r14)
cmpl $-0x1, %eax
je 0x71ca
movl 0xc(%r14), %esi
movq %rbx, %rdi
movl %eax, %edx
callq 0x4a26
testl %eax, %eax
je 0x71ca
movl 0x10(%r14), %esi
movq 0x60(%r14), %rdx
movq %rbx, %rdi
callq 0x4af9
movq 0x60(%rbx), %rax
movq 0x10(%rax), %rcx
movq (%rcx), %rcx
movl 0xc(%r14), %edx
shlq $0x4, %rdx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x720e
movzbl (%rsi), %ecx
movq 0x18(%rax,%rcx,8), %rdi
callq 0x6578
movq %r14, %rdi
callq 0x65d0
movl $0xa0, %esi
movq %r14, %rdi
callq 0x21a0
jmp 0x7238
movq 0x6dff(%rip), %rbx      # 0xdfd0
leaq 0x399e(%rip), %rsi      # 0xab76
movl $0x13, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x20f0
jmp 0x723d
movq 0x90(%rbx), %rax
movq 0x60(%r14), %rcx
movslq (%rcx), %rdx
movq (%rax,%rdx,8), %rax
movq 0x50(%rax), %rax
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x48, %rdi
movq %r14, %rsi
callq 0x44b8
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: greedy_algorithm(ssd_info*, local*)
STATE greedy_algorithm(ssd_info * ssd,  local * location){
	int active_block = get_active_block(ssd,location);
	int cold_active_block = get_cold_active_block(ssd, location); 
	location->block = best_cost(ssd, ssd->channel_head[location->channel]->lun_head[location->lun]->plane_head[location->plane], active_block, cold_active_block);
	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x636f
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x643d
movq 0x90(%r14), %rcx
movslq (%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x50(%rcx), %rcx
movslq 0x4(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx), %rcx
movslq 0x8(%rbx), %rdx
movq (%rcx,%rdx,8), %rsi
movq %r14, %rdi
movl %ebp, %edx
movl %eax, %ecx
callq 0x7e1b
movl %eax, 0xc(%rbx)
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: fifo_algorithm(ssd_info*, local*)
STATE fifo_algorithm(ssd_info * ssd,  local * location){
	int block = -1;
	int64_t min_time = 10000000000000;
	plane_info * the_plane = ssd->channel_head[location->channel]->lun_head[location->lun]->plane_head[location->plane]; 
	int active_block = get_active_block(ssd,location);
	int cold_active_block = get_cold_active_block(ssd, location); 
	for (int i = 0; i < ssd->parameter->block_plane; i++){
		if ((i == active_block) || (i == cold_active_block)) continue;
		if(the_plane->blk_head[i]->free_page_num > 0) continue; 
		if(the_plane->blk_head[i]->invalid_page_num == 0) continue; 

		if (the_plane->blk_head[i]->last_write_time <= min_time){
			min_time = the_plane->blk_head[i]->last_write_time;
			block = i;
		}
	}
	location->block = block;
	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x90(%rdi), %rax
movslq (%rsi), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movslq 0x4(%rsi), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movslq 0x8(%rsi), %rcx
movq (%rax,%rcx,8), %r15
callq 0x636f
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x643d
movq 0x58(%r14), %rcx
movl 0x230(%rcx), %ecx
testq %rcx, %rcx
je 0x765d
movl %eax, %eax
movl %ebp, %esi
movabsq $0x9184e72a000, %rdi    # imm = 0x9184E72A000
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
cmpq %r8, %rsi
je 0x7653
cmpq %r8, %rax
je 0x7653
movq 0x20(%r15), %r9
movq (%r9,%r8,8), %r9
cmpl $0x0, 0x4(%r9)
jg 0x7653
cmpl $0x0, 0x8(%r9)
je 0x7653
movq 0x18(%r9), %r9
cmpq %rdi, %r9
cmovlq %r9, %rdi
cmovlel %r8d, %edx
incq %r8
cmpq %r8, %rcx
jne 0x7624
jmp 0x7662
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, 0xc(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: RANDOM_algorithm(ssd_info*, local*)
STATE RANDOM_algorithm(ssd_info * ssd, local * location){
	unsigned int block = -1;
	int active_block = get_active_block(ssd,location);
	int cold_active_block = get_cold_active_block(ssd, location); 
	unsigned int rand_block = rand() % ssd->parameter->block_plane;
	plane_info * the_plane = ssd->channel_head[location->channel]->lun_head[location->lun]->plane_head[location->plane]; 
	while ((rand_block == active_block) || (rand_block == cold_active_block) || (the_plane->blk_head[rand_block]->free_page_num > 0))
		rand_block = rand() % ssd->parameter->block_plane;

	location->block = rand_block;
	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x636f
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x643d
movl %eax, %r15d
callq 0x20a0
movq 0x58(%r14), %rcx
movq 0x90(%r14), %rsi
xorl %edx, %edx
divl 0x230(%rcx)
movslq (%rbx), %rax
movq (%rsi,%rax,8), %rax
movq 0x50(%rax), %rax
movslq 0x4(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movslq 0x8(%rbx), %rcx
movq (%rax,%rcx,8), %r12
cmpl %ebp, %edx
je 0x7904
cmpl %r15d, %edx
je 0x7904
movq 0x20(%r12), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x4(%rax)
jle 0x7917
callq 0x20a0
movq 0x58(%r14), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
jmp 0x78ea
movl %edx, 0xc(%rbx)
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: RANDOM_p_algorithm(ssd_info*, local*)
STATE RANDOM_p_algorithm(ssd_info * ssd, local * location){
	unsigned int block = -1;
	int active_block = get_active_block(ssd,location);
	int cold_active_block = get_cold_active_block(ssd, location); 

	unsigned int rand_block = rand() % ssd->parameter->block_plane;
	while ((rand_block == active_block) || (rand_block == cold_active_block) || ssd->channel_head[location->channel]->lun_head[location->lun]->plane_head[location->plane]->blk_head[rand_block]->invalid_page_num == 0)
		rand_block = rand() % ssd->parameter->block_plane;

	location->block = rand_block;

	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x636f
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x643d
movl %eax, %r15d
callq 0x20a0
movq 0x58(%r14), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
cmpl %ebp, %edx
je 0x794a
cmpl %r15d, %edx
je 0x794a
movq 0x90(%r14), %rax
movslq (%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movslq 0x4(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movslq 0x8(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x8(%rax)
je 0x794a
movl %edx, 0xc(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: RANDOM_pp_algorithm(ssd_info*, local*)
STATE RANDOM_pp_algorithm(ssd_info * ssd, local * location){
	unsigned int least_invalid = ssd->parameter->overprovide * ssd->parameter->block_plane;

	unsigned int block = -1;
	int active_block = get_active_block(ssd,location);
	int cold_active_block = get_cold_active_block(ssd, location); 
	unsigned int rand_block = rand() % ssd->parameter->block_plane;
	plane_info * the_plane = ssd->channel_head[location->channel]->lun_head[location->lun]->plane_head[location->plane]; 
	int counter = 0;
	while ((rand_block == active_block) || (rand_block == cold_active_block )||(the_plane->blk_head[rand_block]->invalid_page_num < least_invalid && counter <= ssd->parameter->block_plane)
				|| (the_plane->blk_head[rand_block]->free_page_num > 0)){
		rand_block = rand() % ssd->parameter->block_plane;
		counter++;
	}

	location->block = rand_block;
	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x58(%rdi), %rax
movl 0x230(%rax), %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x25c(%rax), %xmm0
cvttss2si %xmm0, %r12
callq 0x636f
movl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x643d
movl %eax, %r15d
callq 0x20a0
movq 0x58(%r14), %rcx
movq 0x90(%r14), %rsi
movl 0x230(%rcx), %ecx
xorl %r13d, %r13d
xorl %edx, %edx
divl %ecx
movslq (%rbx), %rax
movq (%rsi,%rax,8), %rax
movq 0x50(%rax), %rax
movslq 0x4(%rbx), %rsi
movq (%rax,%rsi,8), %rax
movq (%rax), %rax
movq %rbx, (%rsp)
movslq 0x8(%rbx), %rsi
movq (%rax,%rsi,8), %rbx
cmpl %ebp, %edx
je 0x7a51
cmpl %r15d, %edx
je 0x7a51
movq 0x20(%rbx), %rax
movl %edx, %esi
movq (%rax,%rsi,8), %rax
cmpl %r12d, 0x8(%rax)
jae 0x7a4b
cmpl %ecx, %r13d
jbe 0x7a51
cmpl $0x0, 0x4(%rax)
jle 0x7a69
callq 0x20a0
movq 0x58(%r14), %rcx
movl 0x230(%rcx), %ecx
xorl %edx, %edx
divl %ecx
incl %r13d
jmp 0x7a2d
movq (%rsp), %rax
movl %edx, 0xc(%rax)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: Schedule_GC(ssd_info*, sub_request*)
bool Schedule_GC(ssd_info * ssd, sub_request * sub){
		
	local * location = sub->location; 
	unsigned int free_page = ssd->channel_head[location->channel]->lun_head[location->lun]->plane_head[location->plane]->free_page;
	unsigned int invalid_page = ssd->channel_head[location->channel]->lun_head[location->lun]->plane_head[location->plane]->invalid_page;
	unsigned int all_page = ssd->parameter->page_block*ssd->parameter->block_plane;
	gc_operation * gc_node = NULL;



	if (free_page > (all_page * ssd->parameter->gc_down_threshold)){
		return false;
	}
	gc_node = new gc_operation(location, ssd->gc_sequence_number++);

	if (add_gc_node(ssd, gc_node) != SUCCESS){
		delete gc_node;
		return false;
	}

	sub->trigger_gc = true; 	
	
	//int invalid_00 = ssd->channel_head[0]->lun_head[0]->plane_head[location->plane]->invalid_page;
	//int invalid_01 = ssd->channel_head[0]->lun_head[1]->plane_head[location->plane]->invalid_page;
	//int invalid_10 = ssd->channel_head[1]->lun_head[0]->plane_head[location->plane]->invalid_page;
	//int invalid_11 = ssd->channel_head[1]->lun_head[1]->plane_head[location->plane]->invalid_page;
	//cout << "GC starts for planes " << location->channel << location->lun << " with (" << invalid_00 << "," << invalid_01 << "," << invalid_10 << "," << invalid_11 << ")\n";
	gc_for_plane(ssd, gc_node);

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x60(%rsi), %rax
movq 0x58(%rdi), %rcx
movq 0x90(%rdi), %rdx
movslq (%rax), %r13
movq (%rdx,%r13,8), %rdx
movq 0x50(%rdx), %rdx
movslq 0x4(%rax), %rbp
movq (%rdx,%rbp,8), %rdx
movq (%rdx), %rdx
movslq 0x8(%rax), %r14
movq (%rdx,%r14,8), %r12
movl 0x230(%rcx), %eax
imull 0x234(%rcx), %eax
movl (%r12), %edx
cvtsi2ss %rdx, %xmm0
cvtsi2ss %rax, %xmm1
mulss 0x28c(%rcx), %xmm1
ucomiss %xmm1, %xmm0
ja 0x7b89
movq %rdi, %rbx
movss %xmm1, (%rsp)
movss %xmm0, 0x4(%rsp)
movq %rsi, 0x10(%rsp)
movl $0x20, %edi
callq 0x2190
movq %rax, %r15
movl 0x10(%rbx), %eax
movq %rax, 0x8(%rsp)
incl %eax
movl %eax, 0x10(%rbx)
movq $0x0, 0x18(%r15)
movl $0x0, 0xc(%r15)
movl $0x18, %edi
callq 0x2190
movl %r13d, (%rax)
movl %ebp, 0x4(%rax)
movl %r14d, 0x8(%rax)
movq $0x0, 0xc(%rax)
movq %rax, (%r15)
movq 0x8(%rsp), %rax
movl %eax, 0x8(%r15)
movq 0x70(%r12), %rax
addq $0x70, %r12
leaq 0x18(%rax), %rcx
testq %rax, %rax
cmoveq %r12, %rcx
movq %r15, (%rcx)
movq 0x10(%rsp), %rax
movb $0x1, 0x98(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6d90
movss 0x4(%rsp), %xmm0
movss (%rsp), %xmm1
ucomiss %xmm1, %xmm0
setbe %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x20, %esi
movq %r15, %rdi
callq 0x21a0
movq %rbx, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: delete_gc_node(ssd_info*, gc_operation*)
STATE delete_gc_node(ssd_info * ssd, gc_operation * gc_node){
	if (gc_node == NULL) return FAIL;
	if (ssd->channel_head[gc_node->location->channel]->lun_head[gc_node->location->lun]->plane_head[gc_node->location->plane]->scheduled_gc == NULL) return FAIL;
	ssd->channel_head[gc_node->location->channel]->lun_head[gc_node->location->lun]->plane_head[gc_node->location->plane]->scheduled_gc = gc_node->next_node;
	delete gc_node;
	return SUCCESS;
}

// Assembly:
xorl %eax, %eax
testq %rsi, %rsi
je 0x7e1a
pushq %rbx
movq %rsi, %rbx
movq 0x90(%rdi), %rcx
movq (%rsi), %rdi
movslq (%rdi), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x50(%rcx), %rcx
movslq 0x4(%rdi), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx), %rcx
movslq 0x8(%rdi), %rdx
movq (%rcx,%rdx,8), %rcx
cmpq $0x0, 0x70(%rcx)
je 0x7e19
movq 0x18(%rbx), %rax
movq %rax, 0x70(%rcx)
movl $0x18, %esi
callq 0x21a0
movl $0x20, %esi
movq %rbx, %rdi
callq 0x21a0
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/garbage_collection.cpp
// Function: best_cost(ssd_info*, plane_info*, int, int)
unsigned int best_cost(ssd_info * ssd, plane_info * the_plane, int active_block, int cold_active_block){
	int max_invalid = -1; // ssd->parameter->page_block; 
	int selected_block = -1; 
	for (int i = 0; i < ssd->parameter->block_plane; i++){
		if ((i == active_block) || (i == cold_active_block)) continue; 
		int free_count = the_plane->blk_head[i]->free_page_num; 
		int invalid_count = the_plane->blk_head[i]->invalid_page_num; 
		
		if (free_count > 0) continue; 
		if (invalid_count > max_invalid) {
			max_invalid = invalid_count; 
			selected_block = i; 
		} 
	}	
	return selected_block; 
}

// Assembly:
pushq %rbx
movq 0x58(%rdi), %rax
movl 0x230(%rax), %edi
testq %rdi, %rdi
je 0x7e7f
movl %ecx, %ecx
movl %edx, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %r9, %rdx
sete %r10b
cmpq %r9, %rcx
sete %r11b
orb %r10b, %r11b
jne 0x7e75
movq 0x20(%rsi), %r10
movq (%r10,%r9,8), %r10
movl 0x8(%r10), %r11d
cmpl %r8d, %r11d
movl %eax, %ebx
cmovgl %r9d, %ebx
cmovlel %r8d, %r11d
cmpl $0x0, 0x4(%r10)
cmovlel %ebx, %eax
cmovlel %r11d, %r8d
incq %r9
cmpq %r9, %rdi
jne 0x7e3d
jmp 0x7e84
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/narges64[P]SIMBA/ssd.cpp
// Function: generate_trace_file(ssd_info*, char*)
void generate_trace_file(ssd_info * ssd, char * trace_filename){
	ssd->tracefile = fopen(trace_filename, "w"); 
	if (ssd->tracefile == NULL) {
		cout << "file is not ready " << endl; 
		return; 
	} 
	int64_t nearest_event_time = MAX_INT64; 
	struct request * request1; 
	do {
		request1 = generate_next_request(ssd, nearest_event_time);
		if (request1 != NULL && request1->time != MAX_INT64)
			request1->print_to_file(ssd->tracefile); 
	}while(request1 != NULL && request1->time != MAX_INT64);
	
	fclose(ssd->tracefile); 		

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x20b7(%rip), %rsi      # 0xa14b
movq %rax, %rdi
callq 0x2200
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x8117
movabsq $0x7fffffffffffffff, %r14 # imm = 0x7FFFFFFFFFFFFFFF
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8f86
testq %rax, %rax
je 0x8103
leaq 0x2f90(%rip), %r15      # 0xb056
leaq 0x2f9b(%rip), %r12      # 0xb068
movq 0x8(%rax), %rdx
cmpq %r14, %rdx
je 0x8103
movq 0x48(%rbx), %rdi
cmpl $0x0, 0x18(%rax)
movl 0x10(%rax), %ecx
movl 0x14(%rax), %r8d
movq %r12, %rsi
cmoveq %r15, %rsi
xorl %eax, %eax
callq 0x2280
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8f86
testq %rax, %rax
jne 0x80cd
movq 0x48(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2180
movq 0x5eb2(%rip), %rbx      # 0xdfd0
leaq 0x2bc9(%rip), %rsi      # 0xacee
movl $0x12, %edx
movq %rbx, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x20f0