LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::add_lr_state(xbytes::lr_state&)
int xbytes::add_lr_state(lr_state& s)
{
	for(int i = 0; i < states.size(); ++i)
	{
		lr_state& ls = *(states[i]);
		if(is_merge_lr_state(ls, s))
		{
			s.state = states[i]->state;
			if(is_same_lr_state(ls, s)) return 0;
			return merge_lr_state(ls, s);
		}
	}

	s.state = states.size();

	lr_state* ls = new lr_state();
	*ls = s;
	ls->is_completed = false;
	states.push_back(ls);

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x38(%rbp), %rdi
movslq -0x1c(%rbp), %rax
movq %rax, -0x40(%rbp)
addq $0x38, %rdi
callq 0xc550
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0x896b
movq -0x38(%rbp), %rdi
addq $0x38, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xc570
movq -0x38(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x8e40
testb $0x1, %al
jne 0x8903
jmp 0x895b
movq -0x38(%rbp), %rdi
addq $0x38, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xc570
movq -0x38(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x8f30
testb $0x1, %al
jne 0x8936
jmp 0x8942
movl $0x0, -0x4(%rbp)
jmp 0x89db
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x9010
movl %eax, -0x4(%rbp)
jmp 0x89db
jmp 0x895d
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x88af
movq -0x38(%rbp), %rdi
addq $0x38, %rdi
callq 0xc550
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x70, %edi
callq 0x32f0
movq %rax, %rdi
movq %rdi, -0x48(%rbp)
xorl %esi, %esi
movl $0x70, %edx
callq 0x3170
movq -0x48(%rbp), %rdi
callq 0xc730
movq -0x48(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0xc800
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
movb $0x0, 0x68(%rax)
addq $0x38, %rdi
leaq -0x30(%rbp), %rsi
callq 0xc880
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::is_merge_lr_state(xbytes::lr_state&, xbytes::lr_state&)
bool xbytes::is_merge_lr_state(lr_state& l, lr_state& r)
{
	if(l.terms.size() != r.terms.size()) return false;

	for(int i = 0; i < l.terms.size(); ++i)
	{
		term* lt = l.terms[i];
		term* rt = r.terms[i];

		if(lt->r != rt->r || lt->dot != rt->dot) return false;
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
je 0x8e87
movb $0x0, -0x1(%rbp)
jmp 0x8f19
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x8f15
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc5b0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc5b0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x8eff
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x38(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x8f05
movb $0x0, -0x1(%rbp)
jmp 0x8f19
jmp 0x8f07
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x8e8e
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::is_same_lr_state(xbytes::lr_state&, xbytes::lr_state&)
bool xbytes::is_same_lr_state(lr_state& l, lr_state& r)
{
	if(l.terms.size() != r.terms.size()) return false;
	
	for(int i = 0; i < l.terms.size(); ++i)
	{
		if(!is_same_term(*(l.terms[i]), *(r.terms[i]))) return false;
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
je 0x8f7c
movb $0x0, -0x1(%rbp)
jmp 0x8ff8
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0x8ff4
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc5b0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc5b0
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq (%rax), %rdx
callq 0x90c0
testb $0x1, %al
jne 0x8fe7
movb $0x0, -0x1(%rbp)
jmp 0x8ff8
jmp 0x8fe9
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x8f83
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::merge_lr_state(xbytes::lr_state&, xbytes::lr_state&)
int xbytes::merge_lr_state(lr_state& l, lr_state& r)
{
	int cc = 0;
	for(int i = 0; i < l.terms.size(); ++i)
	{
		term* lt = l.terms[i];
		term* rt = r.terms[i];

		cc += merge_symbol_set(lt->forwards, rt->forwards);
	}

	return cc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movslq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0x90b5
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movslq -0x20(%rbp), %rsi
callq 0xc5b0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movslq -0x20(%rbp), %rsi
callq 0xc5b0
movq -0x38(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rsi
addq $0x10, %rsi
movq -0x30(%rbp), %rdx
addq $0x10, %rdx
callq 0x8450
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x903a
movl -0x1c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::is_same_term(xbytes::term&, xbytes::term&)
bool xbytes::is_same_term(term& l, term& r)
{
	if(l.r != r.r || l.dot != r.dot || l.forwards.size() != r.forwards.size()) return false;
	for(int i = 0; i < l.forwards.size(); ++i)
	{
		if(l.forwards[i] != r.forwards[i]) return false;
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x911e
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x911e
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0xc4d0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
je 0x9124
movb $0x0, -0x1(%rbp)
jmp 0x9198
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0x9194
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc4f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq (%rcx), %rax
je 0x9187
movb $0x0, -0x1(%rbp)
jmp 0x9198
jmp 0x9189
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x912b
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::add_term(xbytes::lr_state&, xbytes::term&)
int xbytes::add_term(lr_state& s, term& tt)
{	
	for(int i = 0; i < s.terms.size(); ++i)
	{
		//完全一样则返回
		term& t = *(s.terms[i]);
		if(is_same_term(t, tt)) return 0;

		//如果是向前看符号集不一样则合并向前看符号集
		if(t.r == tt.r && t.dot == tt.dot)
		{
			return merge_symbol_set(t.forwards, tt.forwards);
		}
	}

	term* t = new term();
	*t = tt;
	t->is_completed = false;
	s.terms.push_back(t);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0xc590
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x9281
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc5b0
movq -0x40(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x90c0
testb $0x1, %al
jne 0x9227
jmp 0x9233
movl $0x0, -0x4(%rbp)
jmp 0x92dc
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x9271
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x9271
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x10, %rsi
movq -0x20(%rbp), %rdx
addq $0x10, %rdx
callq 0x8450
movl %eax, -0x4(%rbp)
jmp 0x92dc
jmp 0x9273
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x91d3
movl $0x30, %edi
callq 0x32f0
movq %rax, %rdi
movq %rdi, -0x50(%rbp)
xorl %esi, %esi
movl $0x30, %edx
callq 0x3170
movq -0x50(%rbp), %rdi
callq 0xc770
movq -0x50(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0xcca0
movq -0x38(%rbp), %rax
movb $0x0, 0x28(%rax)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
leaq -0x38(%rbp), %rsi
callq 0xc790
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::find_symbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
symbol* xbytes::find_symbol(const string& name)
{
	for(int i = 0; i < symbols.size(); ++i)
	{
		if(symbols[i]->name == name)
		{
			return symbols[i];
		}
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x1c(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0x9bfe
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0xd580
testb $0x1, %al
jne 0x9bd7
jmp 0x9bf1
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x9c06
jmp 0x9bf3
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9b8f
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::dump()
void xbytes::dump()
{
	dump_symbol();
	dump_rule();
	dump_first_set();
	dump_follow_set();
	dump_lr_state();
	dump_action_table();
	dump_associativity();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
callq 0x9f60
movq -0x10(%rbp), %rdi
callq 0xa390
movq -0x10(%rbp), %rdi
callq 0xa4d0
movq -0x10(%rbp), %rdi
callq 0xa640
movq -0x10(%rbp), %rdi
callq 0xa7b0
movq -0x10(%rbp), %rdi
callq 0xace0
movq -0x10(%rbp), %rdi
callq 0xb170
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::dump_rule()
void xbytes::dump_rule()
{
	std::cout << "==============RULE============" << std::endl;
	for(int i = 0; i < rules.size(); ++i)
	{	
		std::cout << i << ": " << rules[i]->str_rule;

		if(rules[i]->code.size() > 0)
		{
			std::cout << "	[" << rules[i]->code << "].";
		}
		std::cout << std::endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x19c2d(%rip), %rdi     # 0x23fd8
leaq 0xf28f(%rip), %rsi      # 0x19641
callq 0x32e0
movq %rax, %rdi
movq 0x19c07(%rip), %rsi     # 0x23fc8
callq 0x3320
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x20(%rbp)
addq $0x20, %rdi
callq 0xc510
movq %rax, %rcx
movq -0x20(%rbp), %rax
cmpq %rcx, %rax
jae 0xa4c3
movl -0xc(%rbp), %esi
movq 0x19bdc(%rip), %rdi     # 0x23fd8
callq 0x34d0
movq %rax, %rdi
leaq 0xf17d(%rip), %rsi      # 0x19588
callq 0x32e0
movq -0x18(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc530
movq -0x28(%rbp), %rdi
movq (%rax), %rsi
addq $0x80, %rsi
callq 0x3290
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc530
movq (%rax), %rdi
addq $0x60, %rdi
callq 0x3200
cmpq $0x0, %rax
jbe 0xa4a2
movq 0x19b76(%rip), %rdi     # 0x23fd8
leaq 0xf1f7(%rip), %rsi      # 0x19660
callq 0x32e0
movq -0x18(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc530
movq -0x30(%rbp), %rdi
movq (%rax), %rsi
addq $0x60, %rsi
callq 0x3290
movq %rax, %rdi
leaq 0xf1c6(%rip), %rsi      # 0x19663
callq 0x32e0
movq 0x19b2f(%rip), %rdi     # 0x23fd8
movq 0x19b18(%rip), %rsi     # 0x23fc8
callq 0x3320
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa3cd
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::dump_first_set()
void xbytes::dump_first_set()
{
	std::cout << "==============FIRST SET============" << std::endl;
	for(int i = 0; i < symbols.size(); ++i)
	{
		symbol* s = symbols[i];
		if(s->type == ST_TERMINAL) continue;

		std::cout << s->name << "[";
		for(int j = 0; j < s->first_set.size(); ++j)
		{
			std::cout << s->first_set[j]->name << ",";
		}
		std::cout << "]" << std::endl;
	}
	std::cout << std::endl << std::endl;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq 0x19aed(%rip), %rdi     # 0x23fd8
leaq 0xf174(%rip), %rsi      # 0x19666
callq 0x32e0
movq %rax, %rdi
movq 0x19ac7(%rip), %rsi     # 0x23fc8
callq 0x3320
movl $0x0, -0xc(%rbp)
movq -0x28(%rbp), %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0xa612
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x48(%rax)
jne 0xa559
jmp 0xa604
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movq 0x19a70(%rip), %rdi     # 0x23fd8
callq 0x3290
movq %rax, %rdi
leaq 0xf0ea(%rip), %rsi      # 0x19661
callq 0x32e0
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
addq $0x70, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0xa5e2
movq -0x18(%rbp), %rdi
addq $0x70, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rsi
addq $0x8, %rsi
movq 0x19a15(%rip), %rdi     # 0x23fd8
callq 0x3290
movq %rax, %rdi
leaq 0xf235(%rip), %rsi      # 0x19807
callq 0x32e0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa583
movq 0x199ef(%rip), %rdi     # 0x23fd8
leaq 0xefd8(%rip), %rsi      # 0x195c8
callq 0x32e0
movq %rax, %rdi
movq 0x199c9(%rip), %rsi     # 0x23fc8
callq 0x3320
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa50d
movq 0x199bf(%rip), %rdi     # 0x23fd8
movq 0x199a8(%rip), %rsi     # 0x23fc8
callq 0x3320
movq %rax, %rdi
movq 0x19999(%rip), %rsi     # 0x23fc8
callq 0x3320
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::dump_follow_set()
void xbytes::dump_follow_set()
{
	std::cout << "==============FOLLOW SET============" << std::endl;
	for(int i = 0; i < symbols.size(); ++i)
	{
		symbol* s = symbols[i];
		if(s->type == ST_TERMINAL) continue;

		std::cout << s->name << "[";
		for(int j = 0; j < s->follow_set.size(); ++j)
		{
			std::cout << s->follow_set[j]->name << ",";
		}
		std::cout << "]" << std::endl;
	}
	std::cout << std::endl << std::endl;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq 0x1997d(%rip), %rdi     # 0x23fd8
leaq 0xf028(%rip), %rsi      # 0x1968a
callq 0x32e0
movq %rax, %rdi
movq 0x19957(%rip), %rsi     # 0x23fc8
callq 0x3320
movl $0x0, -0xc(%rbp)
movq -0x28(%rbp), %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x8, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0xa788
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x48(%rax)
jne 0xa6c9
jmp 0xa77a
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movq 0x19900(%rip), %rdi     # 0x23fd8
callq 0x3290
movq %rax, %rdi
leaq 0xef7a(%rip), %rsi      # 0x19661
callq 0x32e0
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0xa758
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
movslq -0x1c(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rsi
addq $0x8, %rsi
movq 0x1989f(%rip), %rdi     # 0x23fd8
callq 0x3290
movq %rax, %rdi
leaq 0xf0bf(%rip), %rsi      # 0x19807
callq 0x32e0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa6f3
movq 0x19879(%rip), %rdi     # 0x23fd8
leaq 0xee62(%rip), %rsi      # 0x195c8
callq 0x32e0
movq %rax, %rdi
movq 0x19853(%rip), %rsi     # 0x23fc8
callq 0x3320
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xa67d
movq 0x19849(%rip), %rdi     # 0x23fd8
movq 0x19832(%rip), %rsi     # 0x23fc8
callq 0x3320
movq %rax, %rdi
movq 0x19823(%rip), %rsi     # 0x23fc8
callq 0x3320
addq $0x40, %rsp
popq %rbp
retq
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::dump_associativity()
void xbytes::dump_associativity()
{
	std::cout << "==============ASSOCIATIVITY============" << std::endl;
	for(int i = 0; i < assoc_precs.size(); ++i)
	{
		std::cout << "precedence=" << i;
		if(assoc_precs[i].associativity == AT_LEFT)
		{
			std::cout << " LEFT<< ";
		}
		else if(assoc_precs[i].associativity == AT_RIGHT)
		{
			std::cout << " RIGHT<< ";
		}
		else
		{
			std::cout << " ERROR<< ";
		}
		for(int m = 0; m < assoc_precs[i].symbol_names.size(); ++m)
		{
			std::cout << assoc_precs[i].symbol_names[m] << " ";
		}
		std::cout << ">>" << std::endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x18e4d(%rip), %rdi     # 0x23fd8
leaq 0xe5d1(%rip), %rsi      # 0x19763
callq 0x32e0
movq %rax, %rdi
movq 0x18e27(%rip), %rsi     # 0x23fc8
callq 0x3320
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x20(%rbp)
addq $0x698, %rdi            # imm = 0x698
callq 0xd040
movq %rax, %rcx
movq -0x20(%rbp), %rax
cmpq %rcx, %rax
jae 0xb31f
movq 0x18dfc(%rip), %rdi     # 0x23fd8
leaq 0xe5a8(%rip), %rsi      # 0x1978b
callq 0x32e0
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x34d0
movq -0x18(%rbp), %rdi
addq $0x698, %rdi            # imm = 0x698
movslq -0xc(%rbp), %rsi
callq 0xd020
cmpl $0x1, (%rax)
jne 0xb221
movq 0x18dc5(%rip), %rdi     # 0x23fd8
leaq 0xe57d(%rip), %rsi      # 0x19797
callq 0x32e0
jmp 0xb264
movq -0x18(%rbp), %rdi
addq $0x698, %rdi            # imm = 0x698
movslq -0xc(%rbp), %rsi
callq 0xd020
cmpl $0x2, (%rax)
jne 0xb24f
movq 0x18d97(%rip), %rdi     # 0x23fd8
leaq 0xe558(%rip), %rsi      # 0x197a0
callq 0x32e0
jmp 0xb262
movq 0x18d82(%rip), %rdi     # 0x23fd8
leaq 0xe54d(%rip), %rsi      # 0x197aa
callq 0x32e0
jmp 0xb264
movl $0x0, -0x10(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x698, %rdi            # imm = 0x698
movslq -0xc(%rbp), %rsi
callq 0xd020
movq %rax, %rdi
addq $0x8, %rdi
callq 0xd540
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0xb2ef
movq -0x18(%rbp), %rdi
addq $0x698, %rdi            # imm = 0x698
movslq -0xc(%rbp), %rsi
callq 0xd020
movq %rax, %rdi
addq $0x8, %rdi
movslq -0x10(%rbp), %rsi
callq 0xd560
movq %rax, %rsi
movq 0x18d0b(%rip), %rdi     # 0x23fd8
callq 0x3290
movq %rax, %rdi
leaq 0xe2e9(%rip), %rsi      # 0x195c5
callq 0x32e0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb26b
movq 0x18ce2(%rip), %rdi     # 0x23fd8
leaq 0xe4b7(%rip), %rsi      # 0x197b4
callq 0x32e0
movq %rax, %rdi
movq 0x18cbc(%rip), %rsi     # 0x23fc8
callq 0x3320
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb1ad
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::output_declare_symbol(std::basic_ofstream<char, std::char_traits<char>>&)
void xbytes::output_declare_symbol(std::ofstream& ss)
{
	ss << "#define SYMBOL_COUNT " << symbols.size() << std::endl;
	ss << "enum TERMINAL_SYMBOL" << std::endl;
	ss << "{\n";
	int i = 0;
	for(i = 0; i < symbols.size(); ++i)
	{
		symbol* s = symbols[i];
		if(s->type == ST_NONTERMINAL) break;

		ss << "	" << s->name << " = " << s->index << "," << std::endl;
	}
	ss << "	TERMINAL_SYMBOL_COUNT = " << i << std::endl;
	ss << "};\n";
	ss << std::endl;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xe464(%rip), %rsi      # 0x197b7
callq 0x32e0
movq -0x30(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x8, %rdi
callq 0xc4d0
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x30a0
movq %rax, %rdi
movq 0x18c49(%rip), %rsi     # 0x23fc8
callq 0x3320
movq -0x10(%rbp), %rdi
leaq 0xe43e(%rip), %rsi      # 0x197cd
callq 0x32e0
movq %rax, %rdi
movq 0x18c2a(%rip), %rsi     # 0x23fc8
callq 0x3320
movq -0x10(%rbp), %rdi
leaq 0xe434(%rip), %rsi      # 0x197e2
callq 0x32e0
movl $0x0, -0x14(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x14(%rbp), %rax
movq %rax, -0x38(%rbp)
addq $0x8, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0xb473
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x2, 0x48(%rax)
jne 0xb40a
jmp 0xb473
movq -0x10(%rbp), %rdi
leaq 0xe22a(%rip), %rsi      # 0x1963f
callq 0x32e0
movq %rax, %rdi
movq -0x20(%rbp), %rsi
addq $0x8, %rsi
callq 0x3290
movq %rax, %rdi
leaq 0xe3c7(%rip), %rsi      # 0x197fb
callq 0x32e0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movl (%rax), %esi
callq 0x34d0
movq %rax, %rdi
leaq 0xe3b6(%rip), %rsi      # 0x19807
callq 0x32e0
movq %rax, %rdi
movq 0x18b68(%rip), %rsi     # 0x23fc8
callq 0x3320
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xb3c1
movq -0x10(%rbp), %rdi
leaq 0xe367(%rip), %rsi      # 0x197e5
callq 0x32e0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x34d0
movq %rax, %rdi
movq 0x18b30(%rip), %rsi     # 0x23fc8
callq 0x3320
movq -0x10(%rbp), %rdi
leaq 0xe357(%rip), %rsi      # 0x197ff
callq 0x32e0
movq -0x10(%rbp), %rdi
movq 0x18b10(%rip), %rsi     # 0x23fc8
callq 0x3320
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: ParseRandFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<int> ParseRandFile(string filename) {
    ifstream rand_file(filename);
    
    if (!rand_file.is_open()) {
        printf("Could not open rand file: %s\n", filename.c_str());
        exit (EXIT_FAILURE);
    }
    
    int num;
    vector<int> randoms;
    
    rand_file >> num;
    while (rand_file >> num) {
        randoms.push_back(num);
    }
    
    rand_file.close();
    return randoms;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rsi, -0x250(%rbp)
movq %rdi, -0x248(%rbp)
movq %rdi, %rax
movq %rax, -0x240(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x218(%rbp), %rdi
movq %rdi, -0x238(%rbp)
movl $0x8, %edx
callq 0x32d0
movq -0x238(%rbp), %rdi
callq 0x32c0
movb %al, -0x22a(%rbp)
jmp 0x3c87
movb -0x22a(%rbp), %al
testb $0x1, %al
jne 0x3cd3
jmp 0x3c93
movq -0x250(%rbp), %rdi
callq 0x30e0
movq %rax, %rsi
leaq 0xa4c4(%rip), %rdi      # 0xe16d
xorl %eax, %eax
callq 0x3030
jmp 0x3cb2
movl $0x1, %edi
callq 0x3220
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x3dc0
movq -0x248(%rbp), %rdi
movb $0x0, -0x229(%rbp)
callq 0x57f0
leaq -0x218(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x3140
jmp 0x3cfb
jmp 0x3cfd
leaq -0x218(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x3140
movq %rax, -0x258(%rbp)
jmp 0x3d19
movq -0x258(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3250
movb %al, -0x259(%rbp)
jmp 0x3d37
movb -0x259(%rbp), %al
testb $0x1, %al
jne 0x3d43
jmp 0x3d7a
movq -0x248(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x5810
jmp 0x3d58
jmp 0x3cfd
movq -0x248(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x5260
jmp 0x3dc0
leaq -0x218(%rbp), %rdi
callq 0x3070
jmp 0x3d88
movb $0x1, -0x229(%rbp)
testb $0x1, -0x229(%rbp)
jne 0x3da4
movq -0x248(%rbp), %rdi
callq 0x5260
leaq -0x218(%rbp), %rdi
callq 0x3090
movq -0x240(%rbp), %rax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
leaq -0x218(%rbp), %rdi
callq 0x3090
movq -0x220(%rbp), %rdi
callq 0x3320
nopl (%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: PrintFrameTable()
void PrintFrameTable() {
    printf("FT:");
    for (Frame * f : frame_table) {
        if (f->pid != -1) {
            printf(" %d:%d", f->pid, f->vpage);
        } else {
            printf(" *");
        }
    }
    printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x9830(%rip), %rdi      # 0xe22f
movb $0x0, %al
callq 0x3030
leaq 0x107fb(%rip), %rax     # 0x15208
movq %rax, -0x8(%rbp)
leaq 0x107f0(%rip), %rdi     # 0x15208
callq 0x5a10
movq %rax, -0x10(%rbp)
leaq 0x107e0(%rip), %rdi     # 0x15208
callq 0x5a40
movq %rax, -0x18(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x5a70
testb $0x1, %al
jne 0x4a44
jmp 0x4a97
leaq -0x10(%rbp), %rdi
callq 0x5ab0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
je 0x4a7c
movq -0x20(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x20(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x97c0(%rip), %rdi      # 0xe233
movb $0x0, %al
callq 0x3030
jmp 0x4a8a
leaq 0x97b7(%rip), %rdi      # 0xe23a
movb $0x0, %al
callq 0x3030
jmp 0x4a8c
leaq -0x10(%rbp), %rdi
callq 0x5ad0
jmp 0x4a31
leaq 0x9671(%rip), %rdi      # 0xe10f
movb $0x0, %al
callq 0x3030
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: PrintSummary(std::vector<Process*, std::allocator<Process*>>)
void PrintSummary(vector<Process *> processes) {
    for (Process * p : processes) {
        p->PrintStatistics();
        cost += p->ComputeCost();
    }
    
    cost += (long long)(inst_count - ctx_switches - process_exits) + (long long)(ctx_switches) * 121 + (long long)(process_exits) * 175;
    
    printf("TOTALCOST %lu %lu %lu %llu\n", inst_count, ctx_switches, process_exits, cost);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5930
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5960
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x5990
testb $0x1, %al
jne 0x4aed
jmp 0x4b28
leaq -0x18(%rbp), %rdi
callq 0x59d0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x91b0
movq -0x28(%rbp), %rdi
callq 0x9220
addq 0x1073a(%rip), %rax     # 0x15250
movq %rax, 0x10733(%rip)     # 0x15250
leaq -0x18(%rbp), %rdi
callq 0x59f0
jmp 0x4ada
movq 0x10709(%rip), %rax     # 0x15238
subq 0x1070a(%rip), %rax     # 0x15240
subq 0x1070b(%rip), %rax     # 0x15248
imulq $0x79, 0x106fb(%rip), %rcx # 0x15240
addq %rcx, %rax
imulq $0xaf, 0x106f5(%rip), %rcx # 0x15248
addq %rcx, %rax
addq 0x106f3(%rip), %rax     # 0x15250
movq %rax, 0x106ec(%rip)     # 0x15250
movq 0x106cd(%rip), %rsi     # 0x15238
movq 0x106ce(%rip), %rdx     # 0x15240
movq 0x106cf(%rip), %rcx     # 0x15248
movq 0x106d0(%rip), %r8      # 0x15250
leaq 0x968c(%rip), %rdi      # 0xe213
movb $0x0, %al
callq 0x3030
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: GetNextInstruction(std::basic_ifstream<char, std::char_traits<char>>&, char&, int&)
bool GetNextInstruction(ifstream &input_file, char &operation, int &vpage) {
    string line;
    SkipComments(input_file, line);
    
    if (input_file.eof() || line[0] == '#') {
        return false;
    }
    
    istringstream input(line);
    input >> operation >> vpage;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x3280
movq -0x1d8(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x4f70
jmp 0x4bd9
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3350
movb %al, -0x1d9(%rbp)
jmp 0x4bf4
movb -0x1d9(%rbp), %al
testb $0x1, %al
jne 0x4c25
jmp 0x4c00
xorl %eax, %eax
movl %eax, %esi
leaq -0x40(%rbp), %rdi
callq 0x3370
movq %rax, -0x1e8(%rbp)
jmp 0x4c16
movq -0x1e8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x4c46
movb $0x0, -0x1(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x4cbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4cd2
leaq -0x1d0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x8, %edx
callq 0x3310
jmp 0x4c5d
movq -0x18(%rbp), %rsi
leaq -0x1d0(%rbp), %rdi
callq 0x3260
movq %rax, -0x1f0(%rbp)
jmp 0x4c76
movq -0x1f0(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3140
jmp 0x4c88
movb $0x1, -0x1(%rbp)
movl $0x1, -0x50(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x3110
jmp 0x4cbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x3110
jmp 0x4cd2
leaq -0x40(%rbp), %rdi
callq 0x3150
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x3150
movq -0x48(%rbp), %rdi
callq 0x3320
nopw %cs:(%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: ExitProcess(Process*, Pager*)
void ExitProcess(Process * curr_process, Pager * pager) {
    printf("EXIT current process %d\n", curr_process->pid);
    for (Pte * pte : curr_process->page_table) {
        if (pte->present) {
            // Unmap the page (UNMAP)
            Frame * curr_frame = frame_table[pte->physical_frame];
            curr_process->unmap_count++;
            if (O_option) {
                printf(" UNMAP %d:%d\n", curr_frame->pid, curr_frame->vpage);
            }
                        
            // Save frame to disk (FOUT): FOUT modified filemapped pages
            // Note that dirty non-fmapped (anonymous) pages are not written back (OUT) as the process exits.
            if (pte->modified && pte->file_mapped) {
                curr_process->fout_count++;
                if (O_option) {
                    printf(" FOUT\n");
                }
            }
            // Reset the used frame and Returned it to the free pool
            curr_frame->ResetFrame();
            pager->ResetPager(pte->physical_frame);
            free_frames.push_back(curr_frame);
        }
        pte->ResetPte();
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %esi
leaq 0x941e(%rip), %rdi      # 0xe12b
movb $0x0, %al
callq 0x3030
movq -0x8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5450
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5480
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x54b0
testb $0x1, %al
jne 0x4d50
jmp 0x4e5b
leaq -0x20(%rbp), %rdi
callq 0x54f0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4e44
movq -0x30(%rbp), %rax
movl (%rax), %eax
shrl $0x6, %eax
andl $0x7f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x1047f(%rip), %rdi     # 0x15208
callq 0x5510
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x48(%rax)
cmpl $0x0, 0x10438(%rip)     # 0x151e4
je 0x4dca
movq -0x38(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x38(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x9328(%rip), %rdi      # 0xe0eb
movb $0x0, %al
callq 0x3030
movq -0x30(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4e15
movq -0x30(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4e15
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x70(%rax)
cmpl $0x0, 0x103e1(%rip)     # 0x151e4
je 0x4e13
leaq 0x92ed(%rip), %rdi      # 0xe0f9
movb $0x0, %al
callq 0x3030
jmp 0x4e15
movq -0x38(%rbp), %rdi
callq 0xaa40
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movl (%rax), %esi
shrl $0x6, %esi
andl $0x7f, %esi
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x103e5(%rip), %rdi     # 0x15220
leaq -0x38(%rbp), %rsi
callq 0x5530
movq -0x30(%rbp), %rdi
callq 0xa9b0
leaq -0x20(%rbp), %rdi
callq 0x5570
jmp 0x4d3a
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: GetFrame(Pager*, std::vector<Process*, std::allocator<Process*>>)
Frame * GetFrame(Pager * pager, vector<Process *> processes) {
    if (free_frames.empty()) {
        return pager->SelectVictimFrame(frame_table, processes, inst_count);
    }
    Frame * frame = free_frames.front();
    free_frames.pop_front();
    return frame;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rsi, -0x68(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq 0x10392(%rip), %rdi     # 0x15220
callq 0x5590
testb $0x1, %al
jne 0x4e9c
jmp 0x4f2e
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x1035d(%rip), %rsi     # 0x15208
leaq -0x30(%rbp), %rdi
callq 0x55b0
movq -0x68(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x52c0
jmp 0x4ec3
movq -0x70(%rbp), %rdi
movq 0x1036a(%rip), %rcx     # 0x15238
movq (%rdi), %rax
movq (%rax), %rax
leaq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq *%rax
movq %rax, -0x78(%rbp)
jmp 0x4ee4
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x53b0
leaq -0x30(%rbp), %rdi
callq 0x50d0
jmp 0x4f55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4f23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x53b0
leaq -0x30(%rbp), %rdi
callq 0x50d0
jmp 0x4f62
leaq 0x102eb(%rip), %rdi     # 0x15220
callq 0x56a0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
leaq 0x102d8(%rip), %rdi     # 0x15220
callq 0x56d0
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x3320
nopl (%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: ParseOptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void ParseOptions(string options) {
    for (int i = 0; options[i]; i++) {
        switch (options[i]) {
            case 'O':
              O_option = 1;
              break;
            case 'P':
              P_option = 1;
              break;
            case 'F':
              F_option = 1;
              break;
            case 'S':
              S_option = 1;
              break;
            case 'x':
              x_option = 1;
              break;
            case 'y':
              y_option = 1;
              break;
            case 'f':
              f_option = 1;
              break;
            case 'a':
              a_option = 1;
              break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x18(%rbp)
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x3370
cmpb $0x0, (%rax)
je 0x509d
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x3370
movsbl (%rax), %eax
addl $-0x46, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x33, %eax
ja 0x508d
movq -0x20(%rbp), %rax
leaq 0x8fde(%rip), %rcx      # 0xe004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x101ab(%rip)     # 0x151e4
jmp 0x508d
movl $0x1, 0x101a3(%rip)     # 0x151e8
jmp 0x508d
movl $0x1, 0x1019b(%rip)     # 0x151ec
jmp 0x508d
movl $0x1, 0x10193(%rip)     # 0x151f0
jmp 0x508d
movl $0x1, 0x1018b(%rip)     # 0x151f4
jmp 0x508d
movl $0x1, 0x10183(%rip)     # 0x151f8
jmp 0x508d
movl $0x1, 0x1017b(%rip)     # 0x151fc
jmp 0x508d
movl $0x1, 0x10173(%rip)     # 0x15200
jmp 0x508f
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x4fe7
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/process.cpp
// Function: Process::InVmas(int)
bool Process::InVmas(int vpage) {
    for (Vma * vma: vmas) {
        if (vpage >= vma->starting_vpage && vpage <= vma->ending_vpage) {
            page_table[vpage]->write_protect = vma->write_protected;
            page_table[vpage]->file_mapped = vma->filemapped;
            return true;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x95c0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x95f0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x9620
testb $0x1, %al
jne 0x90ff
jmp 0x919c
leaq -0x28(%rbp), %rdi
callq 0x9660
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jl 0x918c
movl -0x14(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jg 0x918c
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x48(%rbp)
addq $0x20, %rdi
movslq -0x14(%rbp), %rsi
callq 0x5430
movl -0x48(%rbp), %edx
movq -0x40(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %ecx
andl $0x1, %edx
shll $0x3, %edx
andl $-0x9, %ecx
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x44(%rbp)
addq $0x20, %rdi
movslq -0x14(%rbp), %rsi
callq 0x5430
movl -0x44(%rbp), %edx
movq (%rax), %rax
movl (%rax), %ecx
andl $0x1, %edx
shll $0x4, %edx
andl $-0x11, %ecx
orl %edx, %ecx
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x91a0
jmp 0x918e
leaq -0x28(%rbp), %rdi
callq 0x9680
jmp 0x90e9
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/process.cpp
// Function: Process::PrintPagetable()
void Process::PrintPagetable() {
    printf("PT[%d]:", pid);
    for(int i = 0; i < kVpageSize; i++) {
        if (!page_table[i]->present) {
            if (page_table[i]->pagedout) {
                printf(" #");
            } else {
                printf(" *");
            }
            continue;
        }
        printf(" %d:%c%c%c", i, page_table[i]->referenced ? 'R' : '-', page_table[i]->modified ? 'M' : '-', page_table[i]->pagedout ? 'S' : '-');
    }
    printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl (%rax), %esi
leaq 0x5019(%rip), %rdi      # 0xe2c6
movb $0x0, %al
callq 0x3030
movl $0x0, -0xc(%rbp)
cmpl $0x40, -0xc(%rbp)
jge 0x93fd
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0x5430
movq (%rax), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x9327
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0x5430
movq (%rax), %rax
movl (%rax), %eax
shrl $0x5, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x9314
leaq 0x4fc3(%rip), %rdi      # 0xe2ce
movb $0x0, %al
callq 0x3030
jmp 0x9322
leaq 0x4f1f(%rip), %rdi      # 0xe23a
movb $0x0, %al
callq 0x3030
jmp 0x93ef
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0x5430
movq (%rax), %rax
movl (%rax), %ecx
shrl %ecx
andl $0x1, %ecx
movb $0x52, %al
movb $0x2d, %dl
movb %dl, -0x1a(%rbp)
cmpl $0x0, %ecx
movb %al, -0x19(%rbp)
jne 0x935d
movb -0x1a(%rbp), %al
movb %al, -0x19(%rbp)
movq -0x18(%rbp), %rdi
movb -0x19(%rbp), %al
movsbl %al, %eax
movl %eax, -0x28(%rbp)
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0x5430
movq (%rax), %rax
movl (%rax), %ecx
shrl $0x2, %ecx
andl $0x1, %ecx
movb $0x4d, %al
movb $0x2d, %dl
movb %dl, -0x22(%rbp)
cmpl $0x0, %ecx
movb %al, -0x21(%rbp)
jne 0x9397
movb -0x22(%rbp), %al
movb %al, -0x21(%rbp)
movq -0x18(%rbp), %rdi
movb -0x21(%rbp), %al
movsbl %al, %eax
movl %eax, -0x30(%rbp)
addq $0x20, %rdi
movslq -0xc(%rbp), %rsi
callq 0x5430
movq (%rax), %rax
movl (%rax), %ecx
shrl $0x5, %ecx
andl $0x1, %ecx
movb $0x53, %al
movb $0x2d, %dl
movb %dl, -0x2a(%rbp)
cmpl $0x0, %ecx
movb %al, -0x29(%rbp)
jne 0x93d1
movb -0x2a(%rbp), %al
movb %al, -0x29(%rbp)
movl -0x30(%rbp), %ecx
movl -0x28(%rbp), %edx
movl -0x20(%rbp), %esi
movb -0x29(%rbp), %al
movsbl %al, %r8d
leaq 0x4ee9(%rip), %rdi      # 0xe2d1
movb $0x0, %al
callq 0x3030
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x92bb
leaq 0x4d0b(%rip), %rdi      # 0xe10f
movb $0x0, %al
callq 0x3030
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/pte.cpp
// Function: Pte::UpdatePte(char)
void Pte::UpdatePte(char operation) {
    present = 1;
    referenced = 1;
    
    if (operation == 'w' && !write_protect) {
        modified = 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl (%rax), %ecx
andl $-0x2, %ecx
orl $0x1, %ecx
movl %ecx, (%rax)
movl (%rax), %ecx
andl $-0x3, %ecx
orl $0x2, %ecx
movl %ecx, (%rax)
movsbl -0x9(%rbp), %eax
cmpl $0x77, %eax
jne 0xa9a2
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x3, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xa9a2
movq -0x18(%rbp), %rax
movl (%rax), %ecx
andl $-0x5, %ecx
orl $0x4, %ecx
movl %ecx, (%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/pte.cpp
// Function: Pte::ResetPte()
void Pte::ResetPte() {
    present = 0;
    referenced = 0;
    modified = 0;
    write_protect = 0;
    file_mapped = 0;
    pagedout = 0;
    physical_frame = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $-0x2, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movl (%rax), %ecx
andl $-0x3, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movl (%rax), %ecx
andl $-0x5, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movl (%rax), %ecx
andl $-0x9, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movl (%rax), %ecx
andl $-0x11, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movl (%rax), %ecx
andl $-0x21, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movl (%rax), %ecx
andl $0xffffe03f, %ecx       # imm = 0xFFFFE03F
orl $0x0, %ecx
movl %ecx, (%rax)
popq %rbp
retq
nopw (%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/pager.cpp
// Function: FifoPager::SelectVictimFrame(std::vector<Frame*, std::allocator<Frame*>>, std::vector<Process*, std::allocator<Process*>>, unsigned long)
Frame * FifoPager::SelectVictimFrame(vector<Frame *> frame_table, vector<Process *> processes, unsigned long timestamp) {
    hand++;
    if (hand >= frame_table.size()) {
        hand = 0;
    }
    return frame_table[hand];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rsi, -0x40(%rbp)
movq %rdi, %rax
movq -0x40(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movslq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x7450
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jb 0xab1c
movq -0x30(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq 0x8(%rax), %rsi
callq 0x5510
movq (%rax), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: eva23511[P]OS-Virtual-Memory-Management/pager.cpp
// Function: RandomPager::SelectVictimFrame(std::vector<Frame*, std::allocator<Frame*>>, std::vector<Process*, std::allocator<Process*>>, unsigned long)
Frame * RandomPager::SelectVictimFrame(vector<Frame *> frame_table, vector<Process *> processes, unsigned long timestamp) {
    ofs++;
    
    if (ofs >= randoms.size()) {
        ofs = 0;
    }
    
    hand = randoms[ofs] % frame_table.size();
    return frame_table[hand];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movl 0xc(%rdi), %eax
addl $0x1, %eax
movl %eax, 0xc(%rdi)
movslq 0xc(%rdi), %rax
movq %rax, -0x28(%rbp)
addq $0x10, %rdi
callq 0x6340
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jb 0xac15
movq -0x30(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x30(%rbp), %rax
movq %rax, %rdi
addq $0x10, %rdi
movslq 0xc(%rax), %rsi
callq 0xb9d0
movq -0x38(%rbp), %rdi
movslq (%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x7450
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movq -0x40(%rbp), %rax
xorl %edx, %edx
divq %rcx
movq -0x30(%rbp), %rax
movl %edx, %ecx
movl %ecx, 0x8(%rax)
movslq 0x8(%rax), %rsi
callq 0x5510
movq (%rax), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)