LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x41dc(%rip), %rsi      # 0xa7c7
movq %rbx, %rdi
callq 0x2220
movq 0x10(%r14), %rsi
subq 0x8(%r14), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x2110
leaq 0x41c7(%rip), %rsi      # 0xa7dd
movq %rbx, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x2110
leaq 0x41c5(%rip), %rsi      # 0xa7f2
movq %rbx, %rdi
callq 0x2220
xorl %r15d, %r15d
leaq 0x41d8(%rip), %r12      # 0xa817
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
jbe 0x66ac
movq (%rax,%r15,8), %r13
cmpl $0x2, 0x48(%r13)
je 0x66ac
movq %rbx, %rdi
leaq 0x3fe7(%rip), %rsi      # 0xa64f
callq 0x2220
leaq 0x8(%r13), %rsi
movq %rax, %rdi
callq 0x2200
movq %rax, %rdi
leaq 0x4188(%rip), %rsi      # 0xa80b
callq 0x2220
movl (%r13), %esi
movq %rax, %rdi
callq 0x2370
movq %rax, %rdi
movq %r12, %rsi
callq 0x2220
movq %rax, %rdi
callq 0x2110
incq %r15
jmp 0x663f
leaq 0x4142(%rip), %rsi      # 0xa7f5
movq %rbx, %rdi
callq 0x2220
movq %rax, %rdi
movl %r15d, %esi
callq 0x2370
movq %rax, %rdi
callq 0x2110
leaq 0x413a(%rip), %rsi      # 0xa80f
movq %rbx, %rdi
callq 0x2220
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2110
nop
// File: /workspace/github_cpp_makefile_star2_O2/kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::output_rule_table(std::basic_ofstream<char, std::char_traits<char>>&)
void xbytes::output_rule_table(std::ofstream& ss)
{
	for(int i = 0; i < rules.size(); ++i)
	{	
		ss << "/*"<< std::setw(4)  << i << "*/{\"";

		ss << (rules[i]->left)->name;
		if(rules[i]->left_alias.size() > 0)
		{
			ss << "(" << rules[i]->left_alias << ")";
		}
		ss <<" ->";
		for(int j = 0; j < rules[i]->rights.size(); ++j)
		{
			ss << " " << rules[i]->rights[j]->name;
			if(rules[i]->right_alias[j].size() > 0)
			{
				ss << "(" << rules[i]->right_alias[j] << ")";
			}
		}

		ss << "\", " << rules[i]->left->index << ", ";
		ss << rules[i]->rights.size() << "}," << std::endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movq 0x28(%r14), %rax
subq 0x20(%r14), %rax
sarq $0x3, %rax
cmpq %r15, %rax
jbe 0x6984
movq %rbx, %rdi
leaq 0x4031(%rip), %rsi      # 0xa813
callq 0x2220
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movq %rax, %rdi
movl %r15d, %esi
callq 0x2370
movq %rax, %rdi
leaq 0x400d(%rip), %rsi      # 0xa819
callq 0x2220
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x2200
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rax
cmpq $0x0, 0x18(%rax)
je 0x686a
movq %rbx, %rdi
leaq 0x3ced(%rip), %rsi      # 0xa52f
callq 0x2220
movq 0x20(%r14), %rcx
movq (%rcx,%r15,8), %rsi
addq $0x10, %rsi
movq %rax, %rdi
callq 0x2200
movq %rax, %rdi
leaq 0x3c1d(%rip), %rsi      # 0xa482
callq 0x2220
movq %rbx, %rdi
leaq 0x3cbd(%rip), %rsi      # 0xa531
callq 0x2220
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x38(%rax), %rcx
subq 0x30(%rax), %rcx
sarq $0x3, %rcx
movq %rbx, %rdi
cmpq %r13, %rcx
jbe 0x6918
leaq 0x3d33(%rip), %rsi      # 0xa5d5
callq 0x2220
movq 0x20(%r14), %rcx
movq (%rcx,%r15,8), %rcx
movq 0x30(%rcx), %rcx
movq (%rcx,%r13,8), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x2200
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x8(%rax,%r12)
je 0x690c
movq %rbx, %rdi
leaq 0x3c4e(%rip), %rsi      # 0xa52f
callq 0x2220
movq 0x20(%r14), %rcx
movq (%rcx,%r15,8), %rcx
movq 0x48(%rcx), %rsi
addq %r12, %rsi
movq %rax, %rdi
callq 0x2200
movq %rax, %rdi
leaq 0x3b7b(%rip), %rsi      # 0xa482
callq 0x2220
incq %r13
addq $0x20, %r12
jmp 0x687f
leaq 0x3eff(%rip), %rsi      # 0xa81e
callq 0x2220
movq 0x20(%r14), %rcx
movq (%rcx,%r15,8), %rcx
movq 0x8(%rcx), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x2370
movq %rax, %rdi
leaq 0x3edb(%rip), %rsi      # 0xa81f
callq 0x2220
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rax
movq 0x38(%rax), %rsi
subq 0x30(%rax), %rsi
sarq $0x3, %rsi
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
leaq 0x3ef1(%rip), %rsi      # 0xa860
callq 0x2220
movq %rax, %rdi
callq 0x2110
incq %r15
jmp 0x67c3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x228(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2220
leaq -0x1b0(%rbp), %rdi
callq 0x2080
testb %al, %al
je 0x293b
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq -0x228(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x2120
leaq -0x228(%rbp), %r14
leaq -0x1c(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2120
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2912
movq %rbx, %rdi
movq %r15, %rsi
callq 0x369a
jmp 0x28ec
leaq -0x228(%rbp), %rdi
callq 0x2060
leaq -0x228(%rbp), %rdi
callq 0x2090
movq %rbx, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rsi
leaq 0x2726(%rip), %rdi      # 0x506b
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %rdi
callq 0x2190
jmp 0x2956
movq %rax, %r14
movq %rbx, %rdi
callq 0x377c
leaq -0x228(%rbp), %rdi
callq 0x2090
movq %r14, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/eva23511[P]OS-Virtual-Memory-Management/main.cpp
// Function: GetPager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<int, std::allocator<int>>, int)
Pager * GetPager(string algo, vector<int> randoms, int num_frames) {
    if (algo == "f") {
        return new FifoPager();
    } else if (algo == "r") {
        return new RandomPager(randoms);
    } else if (algo == "c") {
        return new ClockPager();
    } else if (algo == "e") {
        return new NruPager(a_option);
    } else if (algo == "a") {
        return new AgingPager(a_option, num_frames);
    } else if (algo == "w") {
        return new WorkingSetPager(a_option);
    }
    
    printf("Wrong Pager Specification: %s\n", algo.c_str());
    exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x2620(%rip), %rsi      # 0x5044
callq 0x3665
testb %al, %al
je 0x2a45
pushq $0x10
popq %rdi
callq 0x2170
movq %rax, %rbx
movq %rax, %rdi
callq 0x4518
jmp 0x2b3f
leaq 0x25fa(%rip), %rsi      # 0x5046
movq %rbx, %rdi
callq 0x3665
testb %al, %al
je 0x2a89
pushq $0x28
popq %rdi
callq 0x2170
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x3540
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x4562
leaq -0x30(%rbp), %rdi
callq 0x377c
jmp 0x2b3f
leaq 0x2770(%rip), %rsi      # 0x5200
movq %rbx, %rdi
callq 0x3665
testb %al, %al
je 0x2ab4
pushq $0x10
popq %rdi
callq 0x2170
movq %rax, %rbx
movq %rax, %rdi
callq 0x45ec
jmp 0x2b3f
leaq 0x26c1(%rip), %rsi      # 0x517c
movq %rbx, %rdi
callq 0x3665
testb %al, %al
je 0x2ae2
pushq $0x18
popq %rdi
callq 0x2170
movq %rax, %rbx
movl 0x56b8(%rip), %esi      # 0x8190
movq %rax, %rdi
callq 0x4660
jmp 0x2b3f
leaq 0x255f(%rip), %rsi      # 0x5048
movq %rbx, %rdi
callq 0x3665
testb %al, %al
je 0x2b13
pushq $0x28
popq %rdi
callq 0x2170
movq %rax, %rbx
movl 0x568a(%rip), %esi      # 0x8190
movq %rax, %rdi
movl %r14d, %edx
callq 0x47fe
jmp 0x2b3f
leaq 0x2530(%rip), %rsi      # 0x504a
movq %rbx, %rdi
callq 0x3665
testb %al, %al
je 0x2b4d
pushq $0x18
popq %rdi
callq 0x2170
movq %rax, %rbx
movl 0x5659(%rip), %esi      # 0x8190
movq %rax, %rdi
callq 0x49e0
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rsi
leaq 0x24f5(%rip), %rdi      # 0x504c
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %rdi
callq 0x2190
jmp 0x2b6a
jmp 0x2b81
movq %rax, %r14
pushq $0x18
jmp 0x2b8d
jmp 0x2b88
movq %rax, %r14
leaq -0x30(%rbp), %rdi
callq 0x377c
jmp 0x2b84
movq %rax, %r14
pushq $0x28
jmp 0x2b8d
movq %rax, %r14
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x2180
movq %r14, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x1fd3(%rip), %rdi      # 0x50d8
xorl %eax, %eax
callq 0x2030
movq 0x5085(%rip), %r15      # 0x8198
movq 0x5086(%rip), %r12      # 0x81a0
leaq 0x1fc2(%rip), %rbx      # 0x50e3
leaq 0x1fb4(%rip), %r14      # 0x50dc
cmpq %r12, %r15
je 0x3157
movq (%r15), %rax
movl 0x4(%rax), %esi
cmpl $-0x1, %esi
je 0x3147
movl 0x8(%rax), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2030
jmp 0x3151
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
addq $0x8, %r15
jmp 0x3128
pushq $0xa
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %r14
movq 0x8(%rdi), %r15
cmpq %r15, %r14
je 0x319d
movq (%r14), %rbx
movq %rbx, %rdi
callq 0x3fd2
movq %rbx, %rdi
callq 0x4018
addq %rax, 0x5049(%rip)      # 0x81e0
addq $0x8, %r14
jmp 0x3178
movq 0x5024(%rip), %rsi      # 0x81c8
movq 0x5025(%rip), %rdx      # 0x81d0
movq 0x5026(%rip), %rcx      # 0x81d8
imulq $0x79, %rdx, %rax
imulq $0xaf, %rcx, %rdi
movq %rsi, %r8
subq %rdx, %r8
subq %rcx, %r8
addq %rax, %r8
addq %rdi, %r8
addq 0x500d(%rip), %r8       # 0x81e0
movq %r8, 0x5006(%rip)       # 0x81e0
leaq 0x1edb(%rip), %rdi      # 0x50bc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2030
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq -0x28(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x38(%rbp), %rsi
callq 0x3450
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
jne 0x323c
movq -0x38(%rbp), %rax
cmpb $0x23, (%rax)
jne 0x3240
xorl %ebx, %ebx
jmp 0x327b
leaq -0x1b8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x2260
leaq -0x1b8(%rbp), %rdi
movq %r14, %rsi
callq 0x21b0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2120
leaq -0x1b8(%rbp), %rdi
callq 0x2100
movb $0x1, %bl
leaq -0x38(%rbp), %rdi
callq 0x20f0
movl %ebx, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x32a7
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x2100
jmp 0x32aa
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %esi
leaq 0x1d53(%rip), %rdi      # 0x502b
xorl %eax, %eax
callq 0x2030
movq 0x20(%r14), %r12
movq 0x28(%r14), %r13
cmpq %r13, %r12
je 0x3395
movq (%r12), %r15
movl (%r15), %eax
testb $0x1, %al
je 0x3384
movq 0x4e92(%rip), %rcx      # 0x8198
shrl $0x3, %eax
andl $0x3f8, %eax            # imm = 0x3F8
movq (%rcx,%rax), %rax
movq %rax, -0x30(%rbp)
incq 0x48(%r14)
cmpl $0x0, 0x4e53(%rip)      # 0x8174
je 0x3337
movl 0x4(%rax), %esi
movl 0x8(%rax), %edx
leaq 0x1ce4(%rip), %rdi      # 0x5014
xorl %eax, %eax
callq 0x2030
movl (%r15), %eax
notl %eax
testb $0x14, %al
jne 0x3359
incq 0x70(%r14)
cmpl $0x0, 0x4e29(%rip)      # 0x8174
je 0x3359
leaq 0x1e4d(%rip), %rdi      # 0x51a1
callq 0x2200
movq -0x30(%rbp), %rdi
callq 0x4506
movl (%r15), %esi
shrl $0x6, %esi
andl $0x7f, %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
leaq 0x4e35(%rip), %rdi      # 0x81b0
leaq -0x30(%rbp), %rsi
callq 0x35f0
movq %r15, %rdi
callq 0x44e6
addq $0x8, %r12
jmp 0x32e7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq 0x4dfa(%rip), %rax      # 0x81b0
leaq 0x4df3(%rip), %rcx      # 0x81b0
cmpq %rcx, %rax
je 0x33d4
movq 0x10(%rax), %rbx
leaq 0x4de3(%rip), %rdi      # 0x81b0
callq 0x3658
jmp 0x3422
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4db7(%rip), %rsi      # 0x8198
leaq -0x40(%rbp), %rdi
callq 0x3600
leaq -0x28(%rbp), %rdi
movq %r14, %rsi
callq 0x3598
movq 0x4dcb(%rip), %rcx      # 0x81c8
movq (%rbx), %rax
leaq -0x40(%rbp), %rsi
leaq -0x28(%rbp), %rdx
movq %rbx, %rdi
callq *(%rax)
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x382a
leaq -0x40(%rbp), %rdi
callq 0x373e
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x382a
jmp 0x343f
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x373e
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r14
pushq %rbx
movq (%rdi), %rax
leaq 0x4ce0(%rip), %rcx      # 0x8174
leaq 0x4ce1(%rip), %rdx      # 0x817c
leaq 0x4cd6(%rip), %rsi      # 0x8178
leaq 0x4cd7(%rip), %rdi      # 0x8180
leaq 0x4ce0(%rip), %r8       # 0x8190
leaq 0x4cd5(%rip), %r9       # 0x818c
leaq 0x4cc6(%rip), %r10      # 0x8184
leaq 0x4cc3(%rip), %r11      # 0x8188
movzbl (%rax), %ebx
cmpl $0x46, %ebx
je 0x3517
movq %rcx, %r14
cmpl $0x4f, %ebx
je 0x351a
cmpl $0x50, %ebx
je 0x3512
cmpl $0x53, %ebx
je 0x350d
cmpl $0x61, %ebx
je 0x34f9
cmpl $0x66, %ebx
je 0x3503
cmpl $0x78, %ebx
je 0x34fe
cmpl $0x79, %ebx
je 0x3508
testl %ebx, %ebx
jne 0x3521
jmp 0x3526
movq %r8, %r14
jmp 0x351a
movq %r10, %r14
jmp 0x351a
movq %r9, %r14
jmp 0x351a
movq %r11, %r14
jmp 0x351a
movq %rdi, %r14
jmp 0x351a
movq %rsi, %r14
jmp 0x351a
movq %rdx, %r14
movl $0x1, (%r14)
incq %rax
jmp 0x34c5
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rcx, %rax
je 0x3fca
movq (%rax), %rdx
cmpl %esi, (%rdx)
jg 0x3f89
cmpl %esi, 0x4(%rdx)
jge 0x3f8f
addq $0x8, %rax
jmp 0x3f78
movl 0x8(%rdx), %r8d
movslq %esi, %rsi
movq 0x20(%rdi), %r9
movq (%r9,%rsi,8), %r9
movl (%r9), %r10d
andl $0x1, %r8d
andl $-0x9, %r10d
leal (%r10,%r8,8), %r8d
movl %r8d, (%r9)
movl 0xc(%rdx), %edx
movq 0x20(%rdi), %rdi
movq (%rdi,%rsi,8), %rsi
movl (%rsi), %edi
shll $0x4, %edx
andl $0x10, %edx
andl $-0x11, %edi
orl %edx, %edi
movl %edi, (%rsi)
cmpq %rcx, %rax
setne %al
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %esi
leaq 0x1160(%rip), %rdi      # 0x51ec
xorl %eax, %eax
callq 0x2030
pushq $0x2d
popq %r14
pushq $0x53
popq %r15
leaq 0x1155(%rip), %r12      # 0x51f7
xorl %r13d, %r13d
cmpq $0x40, %r13
je 0x4106
movq 0x20(%rbx), %rax
movq (%rax,%r13,8), %rax
movl (%rax), %eax
testb $0x1, %al
jne 0x40c6
testb $0x20, %al
jne 0x40f3
leaq 0x101f(%rip), %rdi      # 0x50e3
jmp 0x40fa
testb $0x2, %al
pushq $0x52
popq %rdx
cmovel %r14d, %edx
movl %eax, %ecx
andl $0x4, %ecx
leal 0x2d(,%rcx,8), %ecx
testb $0x20, %al
movl %r15d, %r8d
cmovel %r14d, %r8d
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x2030
jmp 0x4101
leaq 0x10fa(%rip), %rdi      # 0x51f4
xorl %eax, %eax
callq 0x2030
incq %r13
jmp 0x40a5
pushq $0xa
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/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
movslq 0x8(%rdi), %rax
incq %rax
movl %eax, 0x8(%rdi)
movq (%rsi), %rcx
movq 0x8(%rsi), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
ja 0x4553
andl $0x0, 0x8(%rdi)
xorl %eax, %eax
cltq
movq (%rcx,%rax,8), %rax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
movslq 0xc(%rdi), %rax
incq %rax
movl %eax, 0xc(%rdi)
movq 0x10(%rdi), %rcx
movq 0x18(%rdi), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
ja 0x45c0
andl $0x0, 0xc(%rdi)
xorl %eax, %eax
cltq
movslq (%rcx,%rax,4), %rax
movq (%rsi), %rcx
movq 0x8(%rsi), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
xorl %edx, %edx
divq %rsi
movl %edx, 0x8(%rdi)
movslq %edx, %rax
movq (%rcx,%rax,8), %rax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/eva23511[P]OS-Virtual-Memory-Management/pager.cpp
// Function: ClockPager::SelectVictimFrame(std::vector<Frame*, std::allocator<Frame*>>, std::vector<Process*, std::allocator<Process*>>, unsigned long)
Frame * ClockPager::SelectVictimFrame(vector<Frame *> frame_table, vector<Process *> processes, unsigned long timestamp) {
    hand++;
    if (hand >= frame_table.size()) {
        hand = 0;
    }
    
    while (processes[frame_table[hand]->pid]->page_table[frame_table[hand]->vpage]->referenced) {
        processes[frame_table[hand]->pid]->page_table[frame_table[hand]->vpage]->referenced = 0;

        hand++;
        if (hand >= frame_table.size()) {
            hand = 0;
        }
    }
    return frame_table[hand];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq 0x8(%rdi), %rax
incq %rax
movl %eax, 0x8(%rdi)
movq (%rsi), %rcx
movq 0x8(%rsi), %r8
subq %rcx, %r8
sarq $0x3, %r8
cmpq %rax, %r8
jbe 0x4650
cltq
movq (%rcx,%rax,8), %rax
movslq 0x4(%rax), %rcx
movq (%rdx), %r8
movq (%r8,%rcx,8), %rcx
movslq 0x8(%rax), %r8
movq 0x20(%rcx), %rcx
movq (%rcx,%r8,8), %rcx
movl (%rcx), %r8d
testb $0x2, %r8b
je 0x4658
andl $-0x3, %r8d
movl %r8d, (%rcx)
jmp 0x4604
andl $0x0, 0x8(%rdi)
xorl %eax, %eax
jmp 0x4621
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/macfergus[P]baduk/cppsrc/apps/randomplay.cpp
// Function: main
int main() {
    auto game = baduk::newGame(19, 7.5);
    baduk::RandomBot black_bot;
    baduk::RandomBot white_bot;

    while (!game->isOver()) {
        std::cout << game->board() << "\n";
        auto next_agent =
            game->nextPlayer() == baduk::Stone::black ?
                &black_bot :
                &white_bot;
        const auto next_move = next_agent->selectMove(*game);

        game = game->applyMove(next_move);
    }
    std::cout << game->board() << "\n";

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x8(%rsp), %rdi
pushq $0x13
popq %rsi
movss 0x976(%rip), %xmm0      # 0x115f4
callq 0x3add
leaq 0x48(%rsp), %rdi
callq 0x58cc
leaq 0x38(%rsp), %rdi
callq 0x58cc
leaq 0x30(%rsp), %r15
movq 0x630d(%rip), %r12      # 0x16fb0
leaq 0x924(%rip), %r13       # 0x115ce
leaq 0x28(%rsp), %rbp
leaq 0x18(%rsp), %r14
leaq 0x8(%rsp), %rbx
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq 0x8(%rsp), %rdi
movq (%rdi), %rcx
movq 0x10(%rcx), %rcx
testb %al, %al
jne 0x10d41
callq *%rcx
movq %r12, %rdi
movq %rax, %rsi
callq 0x1059f
movq %rax, %rdi
movq %r13, %rsi
callq 0x3160
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x48(%rsp), %rdi
testl %eax, %eax
je 0x10d05
leaq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq (%rdi), %rax
callq *(%rax)
movq %rax, 0x18(%rsp)
movb %dl, 0x20(%rsp)
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
movq %rbp, %rdi
movq %r14, %rdx
callq *0x28(%rax)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x650a
movq %r15, %rdi
callq 0x3c58
jmp 0x10cb9
callq *%rcx
movq 0x6266(%rip), %rdi      # 0x16fb0
movq %rax, %rsi
callq 0x1059f
leaq 0x875(%rip), %rsi       # 0x115ce
movq %rax, %rdi
callq 0x3160
leaq 0x10(%rsp), %rdi
callq 0x3c58
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10d86
jmp 0x10d86
jmp 0x10d86
jmp 0x10d86
jmp 0x10d86
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3c58
movq %rbx, %rdi
callq 0x32b0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/BOB.cpp
// Function: BOBSim::BOB::ReportCallback(BOBSim::BusPacket*, unsigned int)
void BOB::ReportCallback(BusPacket *bp, unsigned i)
{
	if(bp->busPacketType==ACTIVATE)
	{
		for(unsigned p=0; p<pendingReads.size(); p++)
		{
			if(pendingReads[p]->transactionID==bp->transactionID)
			{
				pendingReads[p]->dramStartTime = currentClockCycle;
				pendingReads[p]->cyclesInWorkQueue=bp->queueWaitTime;
				break;
			}
		}
	}
	else if(bp->busPacketType==WRITE_P)
	{
		if (writeIssuedCB)
		{
			(*writeIssuedCB)(bp->port, bp->address);
		}
	}
	else if(bp->busPacketType==WRITE_DATA)
	{
		committedWrites++;
	}
	else if(bp->busPacketType==READ_DATA)
	{
		for(unsigned p=0; p<pendingReads.size(); p++)
		{
			if(pendingReads[p]->transactionID==bp->transactionID)
			{
				pendingReads[p]->dramTimeTotal = currentClockCycle - pendingReads[p]->dramStartTime;
				break;
			}
		}
	}
	else
	{
		ERROR("== Error - Wrong type of packet received in bob");
		ERROR(*bp);
		exit(0);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl 0x4(%rsi), %eax
addl $-0x3, %eax
cmpl $0x5, %eax
ja 0x3136
leaq 0xbf88(%rip), %rcx      # 0xf004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1d8(%rdi), %rdi
testq %rdi, %rdi
je 0x3127
movl 0x1c(%rbx), %esi
movq 0x30(%rbx), %rdx
movq (%rdi), %rax
movq 0x10(%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq 0x70(%rdi), %rax
movq 0x78(%rdi), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
xorl %esi, %esi
movl %esi, %esi
cmpq %rsi, %rcx
jbe 0x3127
movq (%rax,%rsi,8), %rdx
movl 0x18(%rdx), %r8d
incl %esi
cmpl 0x18(%rbx), %r8d
jne 0x30c4
movq 0x8(%rdi), %rax
subq 0x70(%rdx), %rax
movq %rax, 0x78(%rdx)
jmp 0x3127
incl 0x1d0(%rdi)
jmp 0x3127
movq 0x70(%rdi), %rax
movq 0x78(%rdi), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
xorl %esi, %esi
movl %esi, %esi
cmpq %rsi, %rcx
jbe 0x3127
movq (%rax,%rsi,8), %rdx
movl 0x18(%rdx), %r8d
incl %esi
cmpl 0x18(%rbx), %r8d
jne 0x3102
movq 0x8(%rdi), %rax
movq %rax, 0x70(%rdx)
movl 0x20(%rbx), %eax
movl %eax, 0x5c(%rdx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12eb3(%rip), %r14     # 0x15ff0
leaq 0xc03c(%rip), %r15      # 0xf180
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0xc033(%rip), %r12      # 0xf189
movq %rax, %rdi
movq %r12, %rsi
callq 0x2180
leaq 0xbfc1(%rip), %r13      # 0xf129
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %rdi
movl $0x449, %esi            # imm = 0x449
callq 0x22e0
leaq 0xc00a(%rip), %rbp      # 0xf191
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
leaq 0xc5d3(%rip), %rsi      # 0xf76c
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %rdi
movl $0x44a, %esi            # imm = 0x44A
callq 0x22e0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
movq %rbx, %rsi
callq 0x98b8
movq %rax, %rdi
callq 0x20b0
xorl %edi, %edi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/./Globals.h
// Function: BOBSim::log2(unsigned int)
uint inline log2(unsigned value)
{
	uint logbase2 = 0;
	unsigned orig = value;
	value>>=1;
	while(value>0)
	{
		value >>= 1;
		logbase2++;
	}
	if(1<<logbase2<orig)logbase2++;
	return logbase2;
}

// Assembly:
xorl %eax, %eax
movl %edi, %ecx
cmpl $0x2, %ecx
jb 0x515f
shrl %ecx
incl %eax
jmp 0x5154
pushq $0x1
popq %rdx
movl %eax, %ecx
shll %cl, %edx
cmpl %edi, %edx
adcl $0x0, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/./Globals.h
// Function: BOBSim::log2_64(unsigned long)
uint inline log2_64(uint64_t value)
{
	uint logbase2 = 0;
	uint64_t orig = value;
	value>>=1;
	while(value>0)
	{
		value>>=1;
		logbase2++;
	}
	if(1<<logbase2<orig)logbase2++;
	return logbase2;
}

// Assembly:
xorl %eax, %eax
movq %rdi, %rcx
cmpq $0x2, %rcx
jb 0x517e
shrq %rcx
incl %eax
jmp 0x5171
pushq $0x1
popq %rdx
movl %eax, %ecx
shll %cl, %edx
movslq %edx, %rcx
cmpq %rdi, %rcx
adcl $0x0, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/BOBWrapper.cpp
// Function: BOBSim::getPageWalkLogicOp(unsigned long, std::vector<unsigned long, std::allocator<unsigned long>>*)
void *getPageWalkLogicOp(uint64_t baseAddr, vector<uint64_t> *args)
{
	if (!args)
	{
		ERROR(" == Got a logic op without an arguments vector");
	}

	LogicOperation *lo = new LogicOperation(LogicOperation::PAGE_TABLE_WALK, *args);
	return (void*)(lo);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
testq %rsi, %rsi
jne 0x7742
movq 0xe90b(%rip), %rdi      # 0x15ff0
leaq 0x7a94(%rip), %rsi      # 0xf180
callq 0x2180
leaq 0x84b5(%rip), %rsi      # 0xfbad
movq %rax, %rdi
callq 0x2180
leaq 0x7a22(%rip), %rsi      # 0xf129
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movl $0xc7, %esi
callq 0x22e0
leaq 0x7a6e(%rip), %rsi      # 0xf191
movq %rax, %rdi
callq 0x2180
leaq 0x848a(%rip), %rsi      # 0xfbbc
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
pushq $0x20
popq %rdi
callq 0x2190
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0xb8cc
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/BOBWrapper.cpp
// Function: BOBSim::BOBWrapper::AddTransaction(unsigned long, bool, int, void*)
bool BOBWrapper::AddTransaction(uint64_t addr, bool isWrite, int coreID, void *logicOperation)
{
	int openPort;
	bool isLogicOp = logicOperation != NULL;
	TransactionType type = isLogicOp ? LOGIC_OPERATION : (isWrite ? DATA_WRITE : DATA_READ) ;
	Transaction *trans;

	if ((openPort = FindOpenPort(coreID)) > -1)
	{
		trans = new Transaction(type, TRANSACTION_SIZE, addr);
		trans->portID = openPort;
		trans->coreID=coreID;
		if (isLogicOp)
		{
			trans->logicOpContents = logicOperation;
		}
		if(currentClockCycle<5000)
		{
			DEBUG("!! "<<*trans<<" to port "<<openPort);
		}
		if (isWrite)
			writesPerCycle++;
		else
			readsPerCycle++;

		AddTransaction(trans, openPort);
	}
	else 
	{
		return false;
	}

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r12
movl %ecx, %ebp
movl %edx, %r15d
movq %rsi, %r13
movq %rdi, %r14
movl %ecx, %esi
callq 0x90aa
movl %eax, %ebx
testl %eax, %eax
js 0x7862
testq %r12, %r12
movzbl %r15b, %ecx
movq %r13, 0x10(%rsp)
pushq $0x3
popq %r13
movq %rcx, 0x8(%rsp)
cmovel %ecx, %r13d
movl $0x90, %edi
callq 0x2190
movq %rax, %r15
pushq $0x40
popq %rdx
movq %rax, %rdi
movl %r13d, %esi
movq 0x10(%rsp), %rcx
callq 0xe6e0
movl %ebx, 0x1c(%r15)
movl %ebp, 0x20(%r15)
testq %r12, %r12
je 0x77f3
movq %r12, 0x28(%r15)
cmpq $0x1387, 0x8(%r14)      # imm = 0x1387
ja 0x7848
leaq 0xe9b0(%rip), %rax      # 0x161b4
cmpl $0x0, (%rax)
je 0x7848
movq 0xe7b8(%rip), %rdi      # 0x15fc8
leaq 0x83d4(%rip), %rsi      # 0xfbeb
callq 0x2180
movq %rax, %rdi
movq %r15, %rsi
callq 0xe728
leaq 0x83c1(%rip), %rsi      # 0xfbef
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movl %ebx, %esi
callq 0x22e0
movq %rax, %rdi
callq 0x20b0
movq 0x8(%rsp), %rax
incq 0xb8(%r14,%rax,8)
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x788e
testl %ebx, %ebx
setns %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x90, %esi
movq %r15, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/BankState.cpp
// Function: BOBSim::BankState::UpdateStateChange()
void BankState::UpdateStateChange()
{
	if(stateChangeCountdown>0)
	{
		stateChangeCountdown--;

		if(stateChangeCountdown==0)
		{
			switch(lastCommand)
			{
			case REFRESH:
				currentBankState = IDLE;
				break;
			case WRITE_P:
			case READ_P:
				currentBankState = PRECHARGING;
				stateChangeCountdown = tRP;
				lastCommand = PRECHARGE;
				break;
			case PRECHARGE:
				currentBankState = IDLE;
				break;
			default:
				ERROR("== WTF STATE? : "<<lastCommand);
				exit(0);
			}
		}
	}
}

// Assembly:
pushq %rbx
movl 0x3c(%rdi), %eax
testl %eax, %eax
je 0x95c5
movq %rdi, %rbx
decl %eax
movl %eax, 0x3c(%rdi)
jne 0x95c5
movl 0x38(%rbx), %eax
decl %eax
cmpl $0x5, %eax
ja 0x95c7
leaq 0x6a7d(%rip), %rcx      # 0x10020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2, (%rbx)
movabsq $0x900000006, %rax      # imm = 0x900000006
movq %rax, 0x38(%rbx)
jmp 0x95c5
andl $0x0, (%rbx)
popq %rbx
retq
movq 0xca22(%rip), %rdi      # 0x15ff0
leaq 0x5bab(%rip), %rsi      # 0xf180
callq 0x2180
leaq 0x6a67(%rip), %rsi      # 0x10048
movq %rax, %rdi
callq 0x2180
leaq 0x5b39(%rip), %rsi      # 0xf129
movq %rax, %rdi
callq 0x2180
pushq $0x4a
popq %rsi
movq %rax, %rdi
callq 0x22e0
leaq 0x5b87(%rip), %rsi      # 0xf191
movq %rax, %rdi
callq 0x2180
leaq 0x6a3d(%rip), %rsi      # 0x10056
movq %rax, %rdi
callq 0x2180
movl 0x38(%rbx), %esi
movq %rax, %rdi
callq 0x22e0
movq %rax, %rdi
callq 0x20b0
xorl %edi, %edi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/BusPacket.cpp
// Function: BOBSim::BusPacket::PrintVerification(unsigned long)
void BusPacket::PrintVerification(uint64_t currentCycle)
{
	switch(busPacketType)
	{
	case ACTIVATE:
		verificationOutput << currentCycle <<": activate (" << rank << "," << bank << "," << row <<");"<<endl;
		break;
	case READ_P:
		verificationOutput << currentCycle << ": read ("<<rank<<","<<bank<<","<<column<<",1,0);"<<endl;
		break;
	case WRITE_P:
		verificationOutput << currentCycle << ": write ("<<rank<<","<<bank<<","<<column<<",1,0,'h0);"<<endl;
		break;
	case REFRESH:
		verificationOutput << currentCycle <<": refresh (" << rank << ");"<<endl;
		break;
	case WRITE_DATA:

		break;
	default:
		ERROR("== Error - Unsupported bus packet type in verification");
		exit(0);
		break;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x4(%rdi), %eax
decl %eax
cmpl $0x7, %eax
ja 0x984f
movq %rdi, %rbx
leaq 0x69d4(%rip), %rcx      # 0x100bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xcc28(%rip), %rdi      # 0x16320
callq 0x2100
leaq 0x6a09(%rip), %rsi      # 0x1010d
movq %rax, %rdi
callq 0x2180
movl 0x14(%rbx), %esi
movq %rax, %rdi
callq 0x2100
leaq 0x5e7c(%rip), %r14      # 0xf59a
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
movl 0x10(%rbx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
leaq 0x69d0(%rip), %r14      # 0x10116
jmp 0x9827
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xcbc6(%rip), %rdi      # 0x16320
callq 0x2100
leaq 0x699a(%rip), %rsi      # 0x10100
movq %rax, %rdi
callq 0x2180
movl 0x14(%rbx), %esi
movq %rax, %rdi
callq 0x2100
leaq 0x5e1a(%rip), %r14      # 0xf59a
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
movl 0x10(%rbx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
leaq 0x6972(%rip), %r14      # 0x1011a
pushq $0xc
jmp 0x9829
leaq 0xcb6d(%rip), %rdi      # 0x16320
callq 0x2100
leaq 0x6973(%rip), %rsi      # 0x10132
movq %rax, %rdi
callq 0x2180
leaq 0x694c(%rip), %r14      # 0x1011a
pushq $0x14
jmp 0x9829
leaq 0xcb47(%rip), %rdi      # 0x16320
callq 0x2100
leaq 0x6938(%rip), %rsi      # 0x1011d
movq %rax, %rdi
callq 0x2180
movl 0x14(%rbx), %esi
movq %rax, %rdi
callq 0x2100
leaq 0x5d9b(%rip), %r14      # 0xf59a
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
movl 0x10(%rbx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
leaq 0x6900(%rip), %r14      # 0x10127
pushq $0x8
popq %rcx
movl (%rbx,%rcx), %esi
movq %rax, %rdi
callq 0x2100
movq %rax, %rdi
movq %r14, %rsi
callq 0x2180
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20b0
movq 0xc79a(%rip), %rdi      # 0x15ff0
leaq 0x5923(%rip), %rsi      # 0xf180
callq 0x2180
leaq 0x68d5(%rip), %rsi      # 0x1013e
movq %rax, %rdi
callq 0x2180
leaq 0x58b1(%rip), %rsi      # 0xf129
movq %rax, %rdi
callq 0x2180
pushq $0x58
popq %rsi
movq %rax, %rdi
callq 0x22e0
leaq 0x58ff(%rip), %rsi      # 0xf191
movq %rax, %rdi
callq 0x2180
leaq 0x68ab(%rip), %rsi      # 0x1014c
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
xorl %edi, %edi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/DRAMChannel.cpp
// Function: BOBSim::DRAMChannel::ReceiveOnCmdBus(BOBSim::BusPacket*, unsigned int)
void DRAMChannel::ReceiveOnCmdBus(BusPacket *busPacket, unsigned id)
{
	if(inFlightCommandPacket!=NULL)
	{
		ERROR("== Error - Bus collision while trying to receive from controller");
		ERROR("   Existing : "<<*inFlightCommandPacket);
		ERROR("   Incoming : "<<*busPacket);
		exit(0);
	}

	if(DEBUG_CHANNEL) DEBUG("     == Putting command on bus : " << *busPacket);

	//Report the time we waited in the queue
	if(busPacket->busPacketType==ACTIVATE)
	{
		(*ReportCallback)(busPacket, 0);
	}
	//Report the WRITE is finally going
	else if(busPacket->busPacketType==WRITE_P)
	{
		(*ReportCallback)(busPacket, 0);
	}

	inFlightCommandPacket = busPacket;
	inFlightCommandCountdown = tCMDS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, 0x260(%rdi)
jne 0xa0ab
movl 0x4(%rbx), %eax
addl $-0x3, %eax
cmpl $0x1, %eax
ja 0xa08a
movq 0x250(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
xorl %edx, %edx
callq *0x10(%rax)
movq %rbx, 0x260(%r14)
movl $0x1, 0x268(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xbf3e(%rip), %r12      # 0x15ff0
leaq 0x50c7(%rip), %rsi      # 0xf180
movq %r12, %rdi
callq 0x2180
leaq 0x6183(%rip), %r13      # 0x1024b
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
leaq 0x504f(%rip), %rbp      # 0xf129
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
movl $0xd8, %esi
callq 0x22e0
leaq 0x5098(%rip), %r15      # 0xf191
movq %rax, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0x61cd(%rip), %rsi      # 0x102d8
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
movq %r12, %rdi
leaq 0x505b(%rip), %rsi      # 0xf180
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
movl $0xd9, %esi
callq 0x22e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0x61ba(%rip), %rsi      # 0x10319
movq %rax, %rdi
callq 0x2180
movq 0x260(%r14), %rsi
movq %rax, %rdi
callq 0x98b8
movq %rax, %rdi
callq 0x20b0
movq %r12, %rdi
leaq 0x4ff8(%rip), %rsi      # 0xf180
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2180
movq %rax, %rdi
movl $0xda, %esi
callq 0x22e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2180
leaq 0x6166(%rip), %rsi      # 0x10328
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movq %rbx, %rsi
callq 0x98b8
movq %rax, %rdi
callq 0x20b0
xorl %edi, %edi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/DRAMChannel.cpp
// Function: BOBSim::DRAMChannel::AddTransaction(BOBSim::Transaction*, unsigned int)
bool DRAMChannel::AddTransaction(Transaction *trans, unsigned notused)
{
	if(DEBUG_CHANNEL)DEBUG("    In AddTransaction - got : "<<*trans);

	if(trans->transactionType==LOGIC_OPERATION)
	{
		if(SendToLogicLayer!=NULL)
		{
			(*SendToLogicLayer)(trans,0);
		}
		else
		{
			ERROR("== Logic Layers are not registered, yet receiving a logic operation.  Please register");
			exit(0);
		}
	}
	else if(trans->transactionType==LOGIC_RESPONSE)
	{
		if(pendingLogicResponse==NULL)
		{
			if (DEBUG_LOGIC) DEBUG("== Made it back to channel on cycle "<<currentClockCycle<<" : "<<*trans);
			pendingLogicResponse = trans;
		}
		else return false;
	}
	else
	{
		if(simpleController.waitingACTS<CHANNEL_WORK_Q_MAX)
		{
			simpleController.AddTransaction(trans);
		}
		else return false;
	}

	return true;
}

// Assembly:
pushq %rax
movl (%rsi), %eax
cmpl $0x4, %eax
je 0xa207
cmpl $0x3, %eax
jne 0xa21a
movq 0x258(%rdi), %rdi
testq %rdi, %rdi
je 0xa234
movq (%rdi), %rax
xorl %edx, %edx
callq *0x10(%rax)
jmp 0xa22c
cmpq $0x0, 0x1f0(%rdi)
jne 0xa230
movq %rsi, 0x1f0(%rdi)
jmp 0xa22c
cmpl $0xf, 0x104(%rdi)
ja 0xa230
addq $0x10, %rdi
callq 0xdde4
movb $0x1, %al
jmp 0xa232
xorl %eax, %eax
popq %rcx
retq
movq 0xbdb5(%rip), %rdi      # 0x15ff0
leaq 0x4f3e(%rip), %rsi      # 0xf180
callq 0x2180
leaq 0x5ffd(%rip), %rsi      # 0x1024b
movq %rax, %rdi
callq 0x2180
leaq 0x4ecc(%rip), %rsi      # 0xf129
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
movl $0xbb, %esi
callq 0x22e0
leaq 0x4f18(%rip), %rsi      # 0xf191
movq %rax, %rdi
callq 0x2180
leaq 0x5ffa(%rip), %rsi      # 0x10282
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20b0
xorl %edi, %edi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/LogicLayerInterface.cpp
// Function: BOBSim::LogicLayerInterface::ReceiveLogicOperation(BOBSim::Transaction*, unsigned int)
void LogicLayerInterface::ReceiveLogicOperation(Transaction *trans, unsigned i)
{
	if (DEBUG_LOGIC) DEBUG("== Received in logic layer "<<simpleControllerID<<" on cycle "<<currentClockCycle<<" : "<<*trans);
	if (trans->transactionType == LOGIC_OPERATION)
	{
		pendingLogicOpsQueue.push_back(trans);
	}
	else
	{
		newOperationQueue.push_back(trans);
	}
}

// Assembly:
pushq %rax
movq %rsi, (%rsp)
cmpl $0x3, (%rsi)
jne 0xad4e
addq $0x28, %rdi
movq %rsp, %rsi
callq 0xb3ca
jmp 0xad5a
addq $0x78, %rdi
movq %rsp, %rsi
callq 0x53ac
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/RandomStreamSim.cpp
// Function: FillTransactionBuffer(int)
void FillTransactionBuffer(int port)
{
	useCounters[port] = 0;

	//Fill with a random number of requests between 2 and 5 or 6
	unsigned randomCount = rand_r(&randomSeeds[port]) % 5 + 2;
	//cout<<"port "<<port<<" - random count is "<<randomCount<<endl;
	for(unsigned i=0; i<randomCount; i++)
	{
		unsigned long temp = rand();
		unsigned long physicalAddress = (temp<<32)|rand_r(&randomSeeds[port]);
		Transaction *newTrans;
		
		if(physicalAddress%1000<READ_WRITE_RATIO*10)
		{
			newTrans = new Transaction(DATA_READ,TRANSACTION_SIZE,physicalAddress);
			//cout<<*newTrans<<endl;
			useCounters[port]+= RD_REQUEST_PACKET_OVERHEAD/PORT_WIDTH+!!(RD_REQUEST_PACKET_OVERHEAD%PORT_WIDTH);
		}
		else
		{
			newTrans = new Transaction(DATA_WRITE,TRANSACTION_SIZE,physicalAddress);
			//cout<<*newTrans<<endl;
			useCounters[port]+=(WR_REQUEST_PACKET_OVERHEAD + TRANSACTION_SIZE)/PORT_WIDTH +
				!!((WR_REQUEST_PACKET_OVERHEAD + TRANSACTION_SIZE)%PORT_WIDTH);
		}
		
		transactionBuffer[port].push_back(newTrans);
	}
	
	//cout<<"use for "<<port<<" is "<<useCounters[port]<<endl;
	//figure out how much idle time between requests
	waitCounters[port] = ceil(useCounters[port]/PORT_UTILIZATION) - useCounters[port];
	//cout<<"wait for "<<port<<" is "<<waitCounters[port]<<endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq %edi, %r14
movq 0xaae7(%rip), %rax      # 0x16550
andl $0x0, (%rax,%r14,4)
leaq (,%r14,4), %rax
movq 0xaaa3(%rip), %rdi      # 0x16520
movq %rax, 0x8(%rsp)
addq %rax, %rdi
callq 0x21a0
pushq $0x5
popq %rcx
cltd
idivl %ecx
movl %edx, %ebx
addl $0x2, %ebx
imulq $0x18, %r14, %r15
subl $0x1, %ebx
jb 0xbb3c
callq 0x2060
movl %eax, %r12d
shlq $0x20, %r12
movq 0xaa6b(%rip), %rdi      # 0x16520
addq 0x8(%rsp), %rdi
callq 0x21a0
movslq %eax, %r13
orq %r12, %r13
movq %r13, %rax
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
divq %rcx
movq %rdx, %rbp
movl $0x90, %edi
callq 0x2190
movq %rax, %r12
cmpl $0x299, %ebp            # imm = 0x299
ja 0xbaff
movq %r12, %rdi
xorl %esi, %esi
pushq $0x40
popq %rdx
movq %r13, %rcx
callq 0xe6e0
pushq $0x1
popq %rax
jmp 0xbb13
movq %r12, %rdi
pushq $0x1
popq %rsi
pushq $0x40
popq %rdx
movq %r13, %rcx
callq 0xe6e0
pushq $0x5
popq %rax
movq %r12, 0x10(%rsp)
movq 0xaa31(%rip), %rcx      # 0x16550
addl %eax, (%rcx,%r14,4)
movq 0xaa3e(%rip), %rdi      # 0x16568
addq %r15, %rdi
leaq 0x10(%rsp), %rsi
callq 0x53ac
jmp 0xba99
movq 0xaa0d(%rip), %rax      # 0x16550
movl (%rax,%r14,4), %eax
cvtsi2ss %rax, %xmm0
subss %xmm0, %xmm0
cvttss2si %xmm0, %rax
movq 0xa9dc(%rip), %rcx      # 0x16538
movl %eax, (%rcx,%r14,4)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbb71
movq %rax, %rbx
movl $0x90, %esi
movq %r12, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O2/dramninjasUMD[P]BOBSim/Rank.cpp
// Function: BOBSim::Rank::Update()
void Rank::Update()
{
	for(unsigned i=0; i<NUM_BANKS; i++)
	{
		bankStates[i].UpdateStateChange();
	}

	for(unsigned i=0; i<readReturnCountdown.size(); i++)
	{
		readReturnCountdown[i]--;
	}
	if(readReturnCountdown.size()>0 && readReturnCountdown[0]==0)
	{
		(*ReadReturnCallback)(readReturnQueue[0],id);
		readReturnCountdown.erase(readReturnCountdown.begin());
		readReturnQueue.erase(readReturnQueue.begin());
	}

	//increment clock cycle
	currentClockCycle++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
cmpq $0x200, %r14            # imm = 0x200
je 0xc46a
movq 0x50(%rbx), %rdi
addq %r14, %rdi
callq 0x9580
addq $0x40, %r14
jmp 0xc44f
leaq 0x18(%rbx), %r14
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
xorl %esi, %esi
movl %esi, %esi
cmpq %rsi, %rdx
jbe 0xc490
decl (%rax,%rsi,4)
incl %esi
jmp 0xc482
cmpq %rax, %rcx
je 0xc4ca
cmpl $0x0, (%rax)
jne 0xc4ca
movq 0x48(%rbx), %rdi
leaq 0x30(%rbx), %r15
movq 0x30(%rbx), %rax
movq (%rax), %rsi
movl 0x10(%rbx), %edx
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xcd02
movq 0x30(%rbx), %rsi
movq %r15, %rdi
callq 0xcd3c
incq 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq