LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x8f2d
movq $0x0, -0x8(%rbp)
jmp 0x8f8a
movq -0x18(%rbp), %rax
movb 0x8(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x8f6a
movq 0xb08b(%rip), %rdi      # 0x13fd0
leaq 0x6a03(%rip), %rsi      # 0xf94f
callq 0x2110
movq %rax, %rdi
movq 0xb065(%rip), %rsi      # 0x13fc0
callq 0x2150
movq $0x0, -0x8(%rbp)
jmp 0x8f8a
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: narges64[P]SIMBA/./common.hh
// Function: sub_request::sub_request(long, int, int, int)
sub_request(int64_t ct, int lpnum, int sn, int op){
		app_id = -1;
		io_num = -1;
		seq_num = sn;
		lpn = lpnum;
		ppn = -1;
		buf_entry = NULL;
		operation = op;
		state = 0;
		begin_time = ct;
		wait_time = 0;
		complete_time = MAX_INT64;
		gc_node = NULL;
		trigger_gc = false; 
		next_node = NULL;
		next_subs = NULL;
		update = NULL;
		location = new local(0,0,0,0,0);
		state_time = new int64_t[SR_MODE_NUM];
		for (int i = 0; i < SR_MODE_NUM; i++) state_time[i] = 0;
		current_time = ct;
		current_state = SR_MODE_WAIT;
		state_current_time = ct;
		next_state = SR_MODE_WAIT;
		next_state_predict_time = ct;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movl -0x18(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl -0x14(%rbp), %ecx
movl %ecx, 0xc(%rax)
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movq $0x0, 0x18(%rax)
movl -0x1c(%rbp), %ecx
movl %ecx, 0x20(%rax)
movl $0x0, 0x40(%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x48(%rax)
movq $0x0, 0x50(%rax)
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
movq %rcx, 0x58(%rax)
movq $0x0, 0x90(%rax)
movb $0x0, 0x98(%rax)
movq $0x0, 0x70(%rax)
movq $0x0, 0x68(%rax)
movq $0x0, 0x78(%rax)
movl $0x18, %edi
callq 0x2130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x38(%rbp)
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x8ae0
jmp 0x9069
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, 0x60(%rax)
movl $0x50, %edi
callq 0x2040
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x80(%rax)
movl $0x0, -0x30(%rbp)
cmpl $0xa, -0x30(%rbp)
jge 0x90d8
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x30(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x9094
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x18, %esi
callq 0x2140
jmp 0x910b
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x28(%rax)
movl $0x0, 0x24(%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x88(%rax)
movl $0x0, 0x30(%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x38(%rax)
addq $0x40, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x2230
nopw %cs:(%rax,%rax)
nop
// File: narges64[P]SIMBA/./common.hh
// Function: buffer_entry::buffer_entry(int)
buffer_entry(int l){
		buffer_entry();
		modified = false; 
		evicted = false ;
		next_entry = NULL; 
		prev_entry = NULL; 
		outlier = false; 
		sub = NULL; 
		lpn = l;
		gc = false; 
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x9320
movq -0x40(%rbp), %rax
movb $0x0, 0x1(%rax)
movb $0x0, 0x2(%rax)
movq $0x0, 0x18(%rax)
movq $0x0, 0x20(%rax)
movb $0x0, 0x8(%rax)
movq $0x0, 0x10(%rax)
movl -0xc(%rbp), %ecx
movl %ecx, 0x4(%rax)
movb $0x0, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x91a8
movb $0x0, -0x1(%rbp)
jmp 0x930e
movq -0x20(%rbp), %rcx
movl 0xc(%rcx), %eax
cmpl 0x8(%rcx), %eax
jl 0x91d5
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movb $0x1, 0x8(%rcx)
cmpq $0x0, 0x20(%rax)
jne 0x91d3
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, 0x20(%rax)
jmp 0x91d5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x9255
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x91f5
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x9220
movq 0xadd4(%rip), %rdi      # 0x13fd0
leaq 0x6599(%rip), %rsi      # 0xf79c
callq 0x2110
movq %rax, %rdi
movq 0xadae(%rip), %rsi      # 0x13fc0
callq 0x2150
movb $0x0, -0x1(%rbp)
jmp 0x930e
movq -0x20(%rbp), %rax
movl $0x1, 0xc(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq 0x10(%rax), %rcx
movq $0x0, 0x20(%rcx)
movq 0x18(%rax), %rax
movq $0x0, 0x18(%rax)
jmp 0x928e
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rdx
movq 0x10(%rax), %rcx
movq %rdx, 0x20(%rcx)
movq 0x10(%rax), %rdx
movq -0x18(%rbp), %rcx
movq %rdx, 0x18(%rcx)
movq -0x18(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%rax), %rcx
movq $0x0, 0x20(%rcx)
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x92cc
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x92cc
movq 0xad25(%rip), %rdi      # 0x13fd0
leaq 0x64fd(%rip), %rsi      # 0xf7af
callq 0x2110
movq %rax, %rdi
movq 0xacff(%rip), %rsi      # 0x13fc0
callq 0x2150
movb $0x0, -0x1(%rbp)
jmp 0x930e
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x930a
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x930a
movq 0xace7(%rip), %rdi      # 0x13fd0
leaq 0x64e5(%rip), %rsi      # 0xf7d5
callq 0x2110
movq %rax, %rdi
movq 0xacc1(%rip), %rsi      # 0x13fc0
callq 0x2150
movb $0x0, -0x1(%rbp)
jmp 0x930e
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: narges64[P]SIMBA/./common.hh
// Function: buffer_entry::buffer_entry()
buffer_entry(){
		modified = false;
		evicted = false;
		lpn = -1;
		next_entry = NULL;
		prev_entry = NULL;
		outlier = false;
		sub = NULL;  
		gc = false; 
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, 0x1(%rax)
movb $0x0, 0x2(%rax)
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq $0x0, 0x18(%rax)
movq $0x0, 0x20(%rax)
movb $0x0, 0x8(%rax)
movq $0x0, 0x10(%rax)
movb $0x0, (%rax)
popq %rbp
retq
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, 0xc(%rax)
jne 0x9387
movq $0x0, -0x8(%rbp)
jmp 0x94d5
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x93c1
movq 0xac37(%rip), %rdi      # 0x13fd0
leaq 0x64cd(%rip), %rsi      # 0xf86d
callq 0x2110
movq %rax, %rdi
movq 0xac11(%rip), %rsi      # 0x13fc0
callq 0x2150
movq $0x0, -0x8(%rbp)
jmp 0x94d5
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x20(%rax)
je 0x93ff
movq 0xabf9(%rip), %rdi      # 0x13fd0
leaq 0x64a4(%rip), %rsi      # 0xf882
callq 0x2110
movq %rax, %rdi
movq 0xabd3(%rip), %rsi      # 0x13fc0
callq 0x2150
movq $0x0, -0x8(%rbp)
jmp 0x94d5
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x10(%rax)
cmpq $0x0, 0x10(%rax)
je 0x9430
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq $0x0, 0x20(%rax)
jmp 0x943c
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq $0x0, 0x18(%rcx)
movq -0x18(%rbp), %rcx
movq $0x0, 0x20(%rcx)
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rax)
cmpq $0x0, 0x10(%rax)
jne 0x9495
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x9495
movq 0xab56(%rip), %rdi      # 0x13fd0
leaq 0x6417(%rip), %rsi      # 0xf898
callq 0x2110
movq %rax, %rdi
movq 0xab30(%rip), %rsi      # 0x13fc0
callq 0x2150
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x94cd
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x94cd
movq 0xab1e(%rip), %rdi      # 0x13fd0
leaq 0x6405(%rip), %rsi      # 0xf8be
callq 0x2110
movq %rax, %rdi
movq 0xaaf8(%rip), %rsi      # 0x13fc0
callq 0x2150
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, 0xc(%rax)
jne 0x9507
movq $0x0, -0x8(%rbp)
jmp 0x9655
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x9541
movq 0xaab7(%rip), %rdi      # 0x13fd0
leaq 0x63c4(%rip), %rsi      # 0xf8e4
callq 0x2110
movq %rax, %rdi
movq 0xaa91(%rip), %rsi      # 0x13fc0
callq 0x2150
movq $0x0, -0x8(%rbp)
jmp 0x9655
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x957f
movq 0xaa79(%rip), %rdi      # 0x13fd0
leaq 0x6386(%rip), %rsi      # 0xf8e4
callq 0x2110
movq %rax, %rdi
movq 0xaa53(%rip), %rsi      # 0x13fc0
callq 0x2150
movq $0x0, -0x8(%rbp)
jmp 0x9655
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq %rcx, 0x18(%rax)
cmpq $0x0, 0x18(%rax)
je 0x95b0
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq $0x0, 0x18(%rax)
jmp 0x95bc
movq -0x20(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq $0x0, 0x20(%rcx)
movq -0x18(%rbp), %rcx
movq $0x0, 0x18(%rcx)
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rax)
cmpq $0x0, 0x10(%rax)
jne 0x9615
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x9615
movq 0xa9d6(%rip), %rdi      # 0x13fd0
leaq 0x6300(%rip), %rsi      # 0xf901
callq 0x2110
movq %rax, %rdi
movq 0xa9b0(%rip), %rsi      # 0x13fc0
callq 0x2150
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x964d
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x964d
movq 0xa99e(%rip), %rdi      # 0x13fd0
leaq 0x62ef(%rip), %rsi      # 0xf928
callq 0x2110
movq %rax, %rdi
movq 0xa978(%rip), %rsi      # 0x13fc0
callq 0x2150
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: narges64[P]SIMBA/flash.cpp
// Function: find_lun_state(ssd_info*, unsigned int, unsigned int)
unsigned int find_lun_state (ssd_info * ssd, unsigned int channel, unsigned int lun){
	lun_info * the_lun = ssd->channel_head[channel]->lun_head[lun]; 
	if (the_lun->next_state_predict_time <= ssd->current_time) 
		return the_lun->next_state; 
	return the_lun->current_state; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movl -0x18(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jg 0x96ac
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x96b6
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: narges64[P]SIMBA/flash.cpp
// Function: find_plane_state(ssd_info*, unsigned int, unsigned int, unsigned int)
unsigned int find_plane_state(ssd_info * ssd , unsigned int channel, unsigned int lun, unsigned int plane){
	plane_info * the_plane = ssd->channel_head[channel]->lun_head[lun]->plane_head[plane]; 
	if (the_plane->next_state_predict_time <= ssd->current_time) 
		return the_plane->next_state; 
	return the_plane->current_state; 	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movl -0x18(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jg 0x9719
movq -0x28(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9723
movq -0x28(%rbp), %rax
movl 0x48(%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: narges64[P]SIMBA/flash.cpp
// Function: find_channel_state(ssd_info*, unsigned int)
unsigned int find_channel_state(ssd_info * ssd, unsigned int channel){
	channel_info * the_channel = ssd->channel_head[channel]; 
	if (the_channel->next_state_predict_time <= ssd->current_time) 
		return the_channel->next_state; 
	return the_channel->current_state; 	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jg 0x976e
movq -0x20(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x9778
movq -0x20(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: narges64[P]SIMBA/flash.cpp
// Function: change_subrequest_state(ssd_info*, sub_request*, unsigned int, long, unsigned int, long)
void change_subrequest_state(ssd_info * ssd, sub_request * sub, unsigned int current_state, int64_t current_time, unsigned int next_state , int64_t next_time){
/*	int state1 = sub->current_state; 
	int state2 = sub->next_state; 
	int64_t state1_time = sub->current_time; 
	int64_t state2_time = sub->next_state_predict_time; 
	
	sub->state_time[state1] += (state2_time - state1_time)>0? state2_time - state1_time : 0; 
	sub->state_time[state2] += (current_time - state2_time)>0? current_time - state2_time : 0;  
*/	
	sub->current_state = current_state; 
	sub->current_time = current_time; 
	sub->next_state = next_state; 
	sub->next_state_predict_time = next_time; 

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x86c0
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x88d0
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0xb960
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl $0x1, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movabsq $0x9184e72a000, %rax    # imm = 0x9184E72A000
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x86c0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x88d0
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
cmpl 0x230(%rcx), %eax
jae 0xad16
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
je 0xac9c
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0xac9e
jmp 0xad08
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x4(%rax)
jle 0xacb6
jmp 0xad08
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x8(%rax)
jne 0xacce
jmp 0xad08
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rax
cmpq -0x20(%rbp), %rax
jg 0xad06
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0xad08
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xac75
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x86c0
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x88d0
movl %eax, -0x1c(%rbp)
callq 0x2090
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
movl %edx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movl -0x20(%rbp), %ecx
movb $0x1, %al
cmpl -0x18(%rbp), %ecx
movb %al, -0x29(%rbp)
je 0xb0cb
movl -0x20(%rbp), %ecx
movb $0x1, %al
cmpl -0x1c(%rbp), %ecx
movb %al, -0x29(%rbp)
je 0xb0cb
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x20(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x4(%rax)
setg %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0xb0d4
jmp 0xb0ee
callq 0x2090
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
movl %edx, -0x20(%rbp)
jmp 0xb098
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x86c0
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x88d0
movl %eax, -0x1c(%rbp)
callq 0x2090
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
movl %edx, -0x20(%rbp)
movl -0x20(%rbp), %ecx
movb $0x1, %al
cmpl -0x18(%rbp), %ecx
movb %al, -0x21(%rbp)
je 0xb1c3
movl -0x20(%rbp), %ecx
movb $0x1, %al
cmpl -0x1c(%rbp), %ecx
movb %al, -0x21(%rbp)
je 0xb1c3
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rax
movl -0x20(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x8(%rax)
sete %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0xb1cc
jmp 0xb1e9
callq 0x2090
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
movl %edx, -0x20(%rbp)
jmp 0xb15f
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0x25c(%rax), %xmm0
movl 0x230(%rax), %eax
cvtsi2ss %rax, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %rax
movl %eax, -0x14(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x86c0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x88d0
movl %eax, -0x20(%rbp)
callq 0x2090
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
movl %edx, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x24(%rbp), %ecx
movb $0x1, %al
cmpl -0x1c(%rbp), %ecx
movb %al, -0x35(%rbp)
je 0xb318
movl -0x24(%rbp), %ecx
movb $0x1, %al
cmpl -0x20(%rbp), %ecx
movb %al, -0x35(%rbp)
je 0xb318
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %eax
cmpl -0x14(%rbp), %eax
jae 0xb2ff
movl -0x34(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdx
movb $0x1, %al
cmpl 0x230(%rdx), %ecx
movb %al, -0x35(%rbp)
jbe 0xb318
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0x4(%rax)
setg %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0xb321
jmp 0xb347
callq 0x2090
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
xorl %edx, %edx
divl 0x230(%rcx)
movl %edx, -0x24(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xb2b6
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: narges64[P]SIMBA/garbage_collection.cpp
// Function: add_gc_node(ssd_info*, gc_operation*)
STATE add_gc_node(ssd_info * ssd, gc_operation * gc_node){
	if (gc_node == NULL) return FAIL;
	gc_operation * gc = ssd->channel_head[gc_node->location->channel]->lun_head[gc_node->location->lun]->plane_head[gc_node->location->plane]->scheduled_gc;

	if (gc == NULL){
		ssd->channel_head[gc_node->location->channel]->lun_head[gc_node->location->lun]->plane_head[gc_node->location->plane]->scheduled_gc = gc_node;
	}else {
		gc->next_node = gc_node; 
	}
	return SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xb50f
movl $0x0, -0x4(%rbp)
jmp 0xb5b7
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x70(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xb5a4
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
movslq (%rdx), %rdx
movq (%rax,%rdx,8), %rax
movq 0x50(%rax), %rax
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
movslq 0x4(%rdx), %rdx
movq (%rax,%rdx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
movslq 0x8(%rdx), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x70(%rax)
jmp 0xb5b0
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xb893
movl $0x0, -0x4(%rbp)
jmp 0xb957
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq 0x4(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x70(%rax)
jne 0xb8e1
movl $0x0, -0x4(%rbp)
jmp 0xb957
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
movslq (%rdx), %rdx
movq (%rax,%rdx,8), %rax
movq 0x50(%rax), %rax
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
movslq 0x4(%rdx), %rdx
movq (%rax,%rdx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
movslq 0x8(%rdx), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x70(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xb950
movq -0x20(%rbp), %rdi
callq 0xbb50
movq -0x20(%rbp), %rdi
movl $0x20, %esi
callq 0x2140
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: 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 %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
cmpl 0x230(%rcx), %eax
jae 0xba01
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0xb9aa
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0xb9ac
jmp 0xb9f6
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0xb9e0
jmp 0xb9f6
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jle 0xb9f4
movl -0x2c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0xb9f6
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb987
movl -0x20(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: narges64[P]SIMBA/./common.hh
// Function: gc_operation::gc_operation(local*, int)
gc_operation(local * loc, int gc_seq_num){
		next_node = NULL;
		state = GC_WAIT;
		if (loc == NULL) return;
		location = new local(loc->channel, loc->lun, loc->plane, 0, 0);
		seq_number = gc_seq_num;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, 0x18(%rax)
movl $0x0, 0xc(%rax)
cmpq $0x0, -0x10(%rbp)
jne 0xbae3
jmp 0xbb21
movl $0x18, %edi
callq 0x2130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0x8ae0
jmp 0xbb10
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movl -0x14(%rbp), %ecx
movl %ecx, 0x8(%rax)
addq $0x40, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x18, %esi
callq 0x2140
movq -0x20(%rbp), %rdi
callq 0x2230
nopw (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x3120(%rip), %rsi      # 0xf02b
callq 0x2190
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0xbf4d
movq 0x80a3(%rip), %rdi      # 0x13fd0
leaq 0x3d98(%rip), %rsi      # 0xfccc
callq 0x2110
movq %rax, %rdi
movq 0x807d(%rip), %rsi      # 0x13fc0
callq 0x2150
jmp 0xbfd2
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xd350
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xbf98
movq -0x20(%rbp), %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rcx, 0x8(%rax)
je 0xbf98
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0xe350
jmp 0xbf9a
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x21(%rbp)
je 0xbfbe
movq -0x20(%rbp), %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rcx, 0x8(%rax)
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0xbf5b
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x2120
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: narges64[P]SIMBA/ssd.cpp
// Function: simulate(ssd_info*)
ssd_info *simulate(ssd_info *ssd){

	int flag=0;
	unsigned int a=0,b=0;
	static int second = 0;

	printf("\n");
	printf("begin simulating.......................\n");
	printf("\n");

	int i = 0;
	while(flag!=100)
	{
		flag=get_requests_consolidation(ssd);
		if(flag == 1)
		{
			distribute(ssd); // in ssd.cpp
		}
		process(ssd); // in ftl.cpp
		trace_output(ssd);
		if(flag == 0 && ssd->request_queue == NULL){
			flag = 100;
		}
		if (ssd->current_time != MAX_INT64 && ssd->current_time / EPOCH_LENGTH  > second){
			print_epoch_statistics(ssd, 1);
			while (ssd->current_time / (EPOCH_LENGTH) > second)
				second++;
		}

//		if (!ssd->dram->buffer->check_buffer()) {
//			cout << "BUFFER FAIL " << endl;
//			break;
//		}
	}

	return ssd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
leaq 0x3f1e(%rip), %rdi      # 0xff26
movb $0x0, %al
callq 0x2050
leaq 0x3c2f(%rip), %rdi      # 0xfc45
movb $0x0, %al
callq 0x2050
leaq 0x3f02(%rip), %rdi      # 0xff26
movb $0x0, %al
callq 0x2050
movl $0x0, -0x18(%rbp)
cmpl $0x64, -0xc(%rbp)
je 0xc0fe
movq -0x8(%rbp), %rdi
callq 0xcba0
movl %eax, -0xc(%rbp)
cmpl $0x1, -0xc(%rbp)
jne 0xc057
movq -0x8(%rbp), %rdi
callq 0x5e50
movq -0x8(%rbp), %rdi
callq 0x6880
movq -0x8(%rbp), %rdi
callq 0xcbf0
cmpl $0x0, -0xc(%rbp)
jne 0xc081
movq -0x8(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0xc081
movl $0x64, -0xc(%rbp)
movq -0x8(%rbp), %rax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rcx, (%rax)
je 0xc0f9
movq -0x8(%rbp), %rax
movq (%rax), %rax
movabsq $0x2540be400, %rcx      # imm = 0x2540BE400
cqto
idivq %rcx
movslq 0x80bb(%rip), %rcx      # 0x1416c
cmpq %rcx, %rax
jle 0xc0f9
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0xc120
movq -0x8(%rbp), %rax
movq (%rax), %rax
movabsq $0x2540be400, %rcx      # imm = 0x2540BE400
cqto
idivq %rcx
movslq 0x808b(%rip), %rcx      # 0x1416c
cmpq %rcx, %rax
jle 0xc0f7
movl 0x8080(%rip), %eax      # 0x1416c
addl $0x1, %eax
movl %eax, 0x8077(%rip)      # 0x1416c
jmp 0xc0c4
jmp 0xc0f9
jmp 0xc032
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: narges64[P]SIMBA/ssd.cpp
// Function: get_requests_consolidation(ssd_info*)
int get_requests_consolidation(ssd_info *ssd)  {
	int64_t  nearest_event_time=find_nearest_event(ssd);
	
	struct request *request1;
	
	// Trace-based 
	if (true) { 

		// read request before nearest_event_time, if any
		request1 = read_request_from_file(ssd, nearest_event_time);

	}
	// Synthetic  
	else {
		request1 = generate_next_request(ssd, nearest_event_time);
	}

	// Add request to the queue 
	int ret = add_fetched_request(ssd, request1, nearest_event_time);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd650
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd820
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0xcd70
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: narges64[P]SIMBA/ssd.cpp
// Function: trace_output(ssd_info*)
void trace_output(ssd_info* ssd){
	int flag = 1;
	int64_t start_time, end_time;
	request *req, *pre_node;
	sub_request *sub, *tmp;

	pre_node=NULL;
	req = ssd->request_queue;

	if(req == NULL)
		return;

	while(req != NULL)
	{
		if(req->response_time != 0)
		{

			collect_statistics(ssd, req);
			remove_request(ssd, &req, &pre_node);
		}
		else
		{
			sub = req->subs;
			flag = 1;
			start_time = 0;
			end_time = 0;

			while(sub != NULL)
			{
				if(start_time == 0)
					start_time = sub->begin_time;
				if(start_time > sub->begin_time)
					start_time = sub->begin_time;
				if (end_time < sub->complete_time){
					end_time = sub->complete_time;
					req->critical_sub = sub;
				}

				// if any sub-request is not completed, the request is not completed
				if( find_subrequest_state(ssd, sub) == SR_MODE_COMPLETE )
				{
					sub = sub->next_subs;
				}
				else
				{
					flag=0;
					break;
				}

			}

			if (flag == 1)
			{
				req->response_time = end_time;
				req->begin_time = start_time;
				collect_statistics(ssd, req );
				remove_request(ssd, &req, &pre_node);

			}
			else
			{
				// request is not complete yet, go to the next node
				pre_node = req;
				req = req->next_node;
			}
		}
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl $0x1, -0xc(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xcc23
jmp 0xcd66
jmp 0xcc25
cmpq $0x0, -0x28(%rbp)
je 0xcd66
movq -0x28(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0xcc5e
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xdb60
movq -0x8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0xddb0
jmp 0xcd61
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x1, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xcd0d
cmpq $0x0, -0x18(%rbp)
jne 0xcc9f
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jle 0xccb9
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jge 0xccdf
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x9d90
cmpl $0x9, %eax
jne 0xccff
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xcd08
movl $0x0, -0xc(%rbp)
jmp 0xcd0d
jmp 0xcc81
cmpl $0x1, -0xc(%rbp)
jne 0xcd4b
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xdb60
movq -0x8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0xddb0
jmp 0xcd5f
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xcd61
jmp 0xcc25
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: narges64[P]SIMBA/ssd.cpp
// Function: add_to_request_queue(ssd_info*, request*)
void add_to_request_queue(ssd_info * ssd, request * req){
	req->begin_time = ssd->current_time;
	if (ssd->request_queue == NULL)          // The queue is empty
	{
		ssd->request_queue = req;
		ssd->request_tail = req;
		ssd->request_queue_length++;
	}
	else
	{
		ssd->request_tail->next_node = req;
		ssd->request_tail = req;
		ssd->request_queue_length++;
	}


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0xd13d
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
jmp 0xd166
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: narges64[P]SIMBA/ssd.cpp
// Function: norm_dist(double, double)
double norm_dist(double mu, double sigma ) {
	const double epsilon = std::numeric_limits<double>::min(); 
	const double two_pi = 2.0 * 3.14159265358979323846; 
	
	static double z0, z1 = 0; 
	static bool generate = false; 
	generate = !generate; 
	
	if (!generate) 
		return z1 * sigma + mu; 

	double u1, u2; 
	do 
	{
		u1 = rand() * (1.0 / RAND_MAX); 
		u2 = rand() * (1.0 / RAND_MAX); 

	}while (u1 <= epsilon); 

	z0 = sqrt(-2.0 * log(u1)) * cos(two_pi * u2); 
	z1 = sqrt(-2.0 * log(u1)) * sin(two_pi * u2); 
	
	return z0 * sigma + mu; 

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
callq 0xe2d0
movsd %xmm0, -0x20(%rbp)
movsd 0x29bc(%rip), %xmm0     # 0xfb50
movsd %xmm0, -0x28(%rbp)
movb 0x6fe1(%rip), %al       # 0x14180
xorb $-0x1, %al
andb $0x1, %al
movb %al, 0x6fd7(%rip)       # 0x14180
testb $0x1, 0x6fd0(%rip)      # 0x14180
jne 0xd1d6
movsd 0x6fbe(%rip), %xmm0     # 0x14178
movsd -0x18(%rbp), %xmm2
movsd -0x10(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xd2cc
jmp 0xd1d8
callq 0x2090
cvtsi2sd %eax, %xmm0
movsd 0x296f(%rip), %xmm1     # 0xfb58
mulsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x2090
cvtsi2sd %eax, %xmm0
movsd 0x2955(%rip), %xmm1     # 0xfb58
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x294c(%rip), %xmm0     # 0xfb60
ucomisd -0x30(%rbp), %xmm0
jae 0xd1d8
movsd -0x30(%rbp), %xmm0
callq 0x20d0
movaps %xmm0, %xmm1
movsd 0x2938(%rip), %xmm0     # 0xfb68
mulsd %xmm1, %xmm0
callq 0x20c0
movsd %xmm0, -0x48(%rbp)
movsd 0x290a(%rip), %xmm0     # 0xfb50
mulsd -0x38(%rbp), %xmm0
callq 0x2250
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x6f0c(%rip)     # 0x14170
movsd -0x30(%rbp), %xmm0
callq 0x20d0
movaps %xmm0, %xmm1
movsd 0x28ef(%rip), %xmm0     # 0xfb68
mulsd %xmm1, %xmm0
callq 0x20c0
movsd %xmm0, -0x40(%rbp)
movsd 0x28c1(%rip), %xmm0     # 0xfb50
mulsd -0x38(%rbp), %xmm0
callq 0x2080
movaps %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x6ecb(%rip)     # 0x14178
movsd 0x6ebb(%rip), %xmm0     # 0x14170
movsd -0x18(%rbp), %xmm2
movsd -0x10(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)