LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::FlushPage(PageDescriptor)
bool BufferManager::FlushPage(PageDescriptor pd) {
	// do a linear scan to find the corresponding page 
	for(int i=0;i<numPages;i++) {
		if(find(usedList.begin(),usedList.end(),i)==usedList.end()) continue; // skip free slots
		if(!(buffers[i].pageDescriptor== pd)) continue;
		//write back page if dirty
		if(buffers[i].dirty) {
			bool _res = WritePage(pd,buffers[i].data);
			if(!_res) return false;
			buffers[i].dirty = false;
		}
		//remove slot from hashTable and usedList and add to free list
		hashTable.erase(pd);
		usedList.remove(i);
		freeList.push_front(i);
		break; // only once instance 
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, -0x30(%rbp)
movslq 0x38(%rdi), %rax
movl $0x0, -0x24(%rbp)
movb $0x1, %bl
testq %rax, %rax
jle 0x2dda
movq %rdi, %r14
leaq 0x18(%rdi), %r15
movq 0x18(%rdi), %rdx
movq 0x30(%rdi), %rcx
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edi
xorl %r8d, %r8d
movq %rdx, %r9
cmpq %r15, %rdx
je 0x2d43
movq %rdx, %r9
movl 0x10(%r9), %r10d
cmpq %r10, %r8
je 0x2d43
movq (%r9), %r9
cmpq %r15, %r9
jne 0x2d32
cmpq %r15, %r9
je 0x2d5a
leaq (%r8,%r8,2), %r9
cmpl 0x4(%rcx,%r9,8), %esi
jne 0x2d5a
cmpl 0x8(%rcx,%r9,8), %edi
je 0x2d68
incq %r8
movl %r8d, -0x24(%rbp)
cmpq %rax, %r8
jne 0x2d27
jmp 0x2dda
cmpb $0x1, (%rcx,%r9,8)
jne 0x2d97
leaq (%rcx,%r9,8), %rax
movq -0x30(%rbp), %rsi
movq 0x10(%rax), %rdx
movq %r14, %rdi
callq 0x2c92
testb %al, %al
je 0x2dd8
movq 0x30(%r14), %rax
movslq -0x24(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x0, (%rax,%rcx,8)
leaq 0x40(%r14), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3524
leaq -0x24(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x305a
movq (%r14), %r15
movl $0x18, %edi
callq 0x21b0
movl (%r12), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2050
incq 0x10(%r14)
jmp 0x2dda
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::PrintBuffer()
void BufferManager::PrintBuffer() {
	cout << "Buffer contains " << numPages << " pages of size "
      << pageSize <<".\n";
   cout << "Contents in order from most recently used to "
      << "least recently used.\n";

    for(auto slot:usedList) {
    	cout << slot << " :: \n";
      	cout << "  fd = " << buffers[slot].pageDescriptor.fd << "\n";
      	cout << "  pageNum = " << buffers[slot].pageDescriptor.pagenum << "\n";
      	cout << "  Dirty = " << buffers[slot].dirty << "\n";
      	cout << "  pinned = " << buffers[slot].pinned << "\n";
      
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x51ce(%rip), %r14      # 0x7fd0
leaq 0x2281(%rip), %rsi      # 0x508a
movl $0x10, %edx
movq %r14, %rdi
callq 0x21c0
movl 0x38(%rbx), %esi
movq %r14, %rdi
callq 0x2270
movq %rax, %r15
leaq 0x2270(%rip), %rsi      # 0x509b
movl $0xf, %edx
movq %rax, %rdi
callq 0x21c0
movl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x2270
leaq 0x22a2(%rip), %rsi      # 0x50ec
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
leaq 0x224d(%rip), %rsi      # 0x50ab
movl $0x2d, %edx
movq %r14, %rdi
callq 0x21c0
leaq 0x2267(%rip), %rsi      # 0x50d9
movl $0x15, %edx
movq %r14, %rdi
callq 0x21c0
leaq 0x18(%rbx), %rax
movq 0x18(%rbx), %r15
cmpq %rax, %r15
je 0x2fb8
movq %rax, -0x30(%rbp)
movslq 0x10(%r15), %r12
movq 0x5131(%rip), %r13      # 0x7fd0
movq %r13, %rdi
movl %r12d, %esi
callq 0x2270
movl $0x5, %edx
movq %rax, %rdi
leaq 0x2236(%rip), %rsi      # 0x50ef
callq 0x21c0
movl $0x7, %edx
movq %r13, %rdi
leaq 0x2228(%rip), %rsi      # 0x50f5
callq 0x21c0
movq 0x30(%rbx), %rax
shlq $0x3, %r12
leaq (%r12,%r12,2), %r12
movl 0x4(%rax,%r12), %esi
movq %r13, %rdi
callq 0x2270
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %r14
leaq 0x21f6(%rip), %rbx      # 0x50f3
movq %rbx, %rsi
callq 0x21c0
movl $0xc, %edx
movq %r13, %rdi
leaq 0x21e9(%rip), %rsi      # 0x50fd
callq 0x21c0
movq 0x30(%r14), %rax
movl 0x8(%rax,%r12), %esi
movq %r13, %rdi
callq 0x2270
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21c0
movl $0xa, %edx
movq %r13, %rdi
leaq 0x21c1(%rip), %rsi      # 0x510a
callq 0x21c0
movq 0x30(%r14), %rax
movzbl (%rax,%r12), %esi
movq %r13, %rdi
callq 0x2250
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21c0
movl $0xb, %edx
movq %r13, %rdi
leaq 0x2197(%rip), %rsi      # 0x5115
callq 0x21c0
movq 0x30(%r14), %rax
movzbl 0x1(%rax,%r12), %esi
movq %r13, %rdi
callq 0x2250
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rbx
callq 0x21c0
movq -0x30(%rbp), %rax
movq (%r15), %r15
cmpq %rax, %r15
jne 0x2e94
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::ClearBuffer()
void BufferManager::ClearBuffer() {
	while(!usedList.empty()) {
		int slot = usedList.front();
		usedList.pop_front(); // remove front usedList
		hashTable.erase(buffers[slot].pageDescriptor); //remove from hash table
		freeList.push_front(slot); // add to free list
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x18(%rdi), %r12
movq 0x18(%rdi), %r15
cmpq %r12, %r15
je 0x304a
movq %rdi, %rbx
leaq 0x40(%rdi), %r14
movslq 0x10(%r15), %r13
decq 0x28(%rbx)
movq %r15, %rdi
callq 0x2230
movq %r15, %rdi
callq 0x2180
movq 0x30(%rbx), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
leaq (%rax,%rcx,8), %rsi
addq $0x4, %rsi
movq %r14, %rdi
callq 0x3524
movq (%rbx), %r15
movl $0x18, %edi
callq 0x21b0
movl %r13d, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2050
incq 0x10(%rbx)
movq 0x18(%rbx), %r15
cmpq %r12, %r15
jne 0x2fea
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::FileHandler()
FileHandler::FileHandler() {
	isOpen = false;
	hdrChanged = false;
	unix_file_desc = -1;
	bufferManager = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw $0x0, 0x10(%rdi)
movl $0xffffffff, 0x14(%rdi) # imm = 0xFFFFFFFF
movq $0x0, (%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::FileHandler(FileHandler const&)
FileHandler::FileHandler(const FileHandler &fileHandle) {
	this->isOpen = fileHandle.isOpen;
	this->hdr = fileHandle.hdr;
	this->bufferManager = fileHandle.bufferManager;
	this->hdrChanged = fileHandle.hdrChanged;
	this->unix_file_desc = fileHandle.unix_file_desc;
	this->fileName = fileHandle.fileName;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb 0x10(%rsi), %al
movb %al, 0x10(%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movq (%rsi), %rax
movq %rax, (%rdi)
movb 0x11(%rsi), %al
movb %al, 0x11(%rdi)
movl 0x14(%rsi), %eax
movl %eax, 0x14(%rdi)
movq 0x18(%rsi), %rax
movq %rax, 0x18(%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::NextPage(int)
PageHandler FileHandler::NextPage(int page_number) {
	PageHandler pageHandle;
	if(!checkPageValid(page_number) && page_number!=-1) { //allow -1
		// return invalid page
		throw InvalidPageException();
	}
	// start searching for next valid(used) page 
	page_number = page_number + 1;
	for(;page_number<=hdr.totalPages;page_number++) { // MR: page_number <= totalpages to ensure that it runs this at least once if file contains only one page
		pageHandle = PageAt(page_number);
		// if page retrieved without error, stop checking further
		if(pageHandle.GetPageNum()!=-1) break;
	}
	return pageHandle;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rdi)
testl %edx, %edx
setns %al
cmpl %edx, 0xc(%rsi)
setg %cl
cmpl $-0x1, %edx
je 0x372c
andb 0x10(%r15), %al
andb %cl, %al
je 0x3755
cmpl 0xc(%r15), %ebx
jge 0x3747
incl %ebx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x3824
cmpl $-0x1, (%r14)
je 0x372c
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x45e2(%rip), %rcx      # 0x7d48
movq %rcx, (%rax)
leaq 0x4580(%rip), %rsi      # 0x7cf0
movq 0x4869(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::PrevPage(int)
PageHandler FileHandler::PrevPage(int page_number) {
	if(!checkPageValid(page_number) && page_number!=hdr.totalPages) { //allow totalPages (call from LastPage)
		// return invalid page
		throw InvalidPageException();
	}
	// start searching for prev valid(used) page 
	page_number = page_number - 1;
	PageHandler pageHandle;
	for(;page_number>=0;page_number--) {
		pageHandle = PageAt(page_number);
		// if page retrieved without error, stop checking further
		if(pageHandle.GetPageNum()!=-1) break;
	}
	return pageHandle;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
testl %edx, %edx
setns %al
andb 0x10(%rsi), %al
cmpl %edx, 0xc(%rsi)
setg %cl
sete %dl
andb %al, %cl
orb %dl, %cl
je 0x37fa
movq %rsi, %r15
movq %rdi, %r14
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rdi)
testl %ebx, %ebx
jle 0x37ec
decl %ebx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x3824
cmpl $-0x1, (%r14)
je 0x37d3
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x453d(%rip), %rcx      # 0x7d48
movq %rcx, (%rax)
leaq 0x44db(%rip), %rsi      # 0x7cf0
movq 0x47c4(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::PageAt(int)
PageHandler FileHandler::PageAt(int page_number) {
	PageHandler pageHandle;
	if(!checkPageValid(page_number)) {
		// return invalid page
		throw InvalidPageException();
	}
	// get page from bufferManager
 
	char *page_in_buffer = bufferManager->GetPage(PageDescriptor(this->unix_file_desc,page_number));	
	// get page header
	PageHdr *page_hdr = (PageHdr*) page_in_buffer;
	// if slot is not free
	// set page number 
	// and set page data to point to starting position of data part in page obtained from buffer manager
	if (page_hdr->nextFreePage==NOT_FREE) {
		pageHandle.pageNum = page_number;
		pageHandle.data = page_in_buffer+sizeof(PageHdr);
	}
	else {
		// unpin page according to redbase logic
		UnpinPage(page_number);
	}
	return pageHandle;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rdi)
testl %edx, %edx
js 0x389c
movq %rsi, %r14
cmpb $0x0, 0x10(%rsi)
je 0x389c
movl %edx, %r15d
cmpl %edx, 0xc(%r14)
jle 0x389c
movq %rdi, %rbx
movq (%r14), %rdi
movl 0x14(%r14), %esi
movq %r15, %r12
shlq $0x20, %r12
orq %r12, %rsi
callq 0x26b4
cmpl $-0x2, (%rax)
jne 0x387e
movl %r15d, (%rbx)
addq $0x4, %rax
movq %rax, 0x8(%rbx)
jmp 0x3890
movq (%r14), %rdi
movl 0x14(%r14), %eax
orq %rax, %r12
movq %r12, %rsi
callq 0x2ae0
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x449b(%rip), %rcx      # 0x7d48
movq %rcx, (%rax)
leaq 0x4439(%rip), %rsi      # 0x7cf0
movq 0x4722(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::NewPage()
PageHandler FileHandler::NewPage() {
	int page_number ; // new page number
	char *page_buffer ; //to store page read from buffer manager
	PageHandler pageHandle;
	//if free list not empty 
	if(hdr.firstFreePage!= END_FREE) {
		// first free page number will be the new page number 
		page_number = hdr.firstFreePage;
		//contents of page are read using the buffer manager
		page_buffer = bufferManager->GetPage(PageDescriptor(this->unix_file_desc,page_number));
		// update the head of free page list for file	
		hdr.firstFreePage = ((PageHdr*)page_buffer)->nextFreePage;
	}
	else { // free pages
		page_number = hdr.totalPages; // new page will be added at the end of file
		page_buffer = bufferManager->AllocatePage(PageDescriptor(this->unix_file_desc,page_number)); //allocate and load the page in buffer manager
		//increase number of pages by one
		hdr.totalPages++;
	}
	//mark file header is changed
	this->hdrChanged = true;
	// mark the new page as used
    ((PageHdr *)page_buffer)->nextFreePage = NOT_FREE;
    //overwrite page contents
    memset(page_buffer+sizeof(PageHdr),0,PAGE_CONTENT_SIZE);
    //mark the page dirty due to next pointer of free list changed
    MarkDirty(page_number);
    pageHandle.pageNum = page_number;
    pageHandle.data = page_buffer+sizeof(PageHdr);
 
    return pageHandle;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rdi)
movl 0x8(%rsi), %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r12
je 0x3944
movq (%r14), %rdi
movl 0x14(%r14), %eax
movq %r12, %rsi
shlq $0x20, %rsi
orq %rax, %rsi
callq 0x26b4
movq %rax, %r15
movl (%rax), %eax
movl %eax, 0x8(%r14)
jmp 0x3965
movl 0xc(%r14), %r12d
movq (%r14), %rdi
movl 0x14(%r14), %eax
movq %r12, %rsi
shlq $0x20, %rsi
orq %rax, %rsi
callq 0x297e
movq %rax, %r15
incl 0xc(%r14)
movb $0x1, 0x11(%r14)
movl $0xfffffffe, (%r15)     # imm = 0xFFFFFFFE
addq $0x4, %r15
movl $0xffc, %edx            # imm = 0xFFC
movq %r15, %rdi
xorl %esi, %esi
callq 0x2110
movq (%r14), %rdi
movl 0x14(%r14), %eax
movq %r12, %rsi
shlq $0x20, %rsi
orq %rax, %rsi
callq 0x2a4c
movl %r12d, (%rbx)
movq %r15, 0x8(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::DisposePage(int)
bool FileHandler::DisposePage(int page_number) {

	if(!checkPageValid(page_number)) return false; // invalid request
	// read the page from the buffer manager 
	char *page_buffer;
	page_buffer = bufferManager->GetPage(PageDescriptor(this->unix_file_desc,page_number));
	PageHdr * page_header = (PageHdr*) page_buffer;
	// if already free - 
	if (page_header->nextFreePage!=NOT_FREE) {
		UnpinPage(page_number); // since page read into buffer manager
		return false;
	}
	// update the head of free list by adding this page at the head
	page_header->nextFreePage = hdr.firstFreePage;
	hdr.firstFreePage = page_number;
	this->hdrChanged = true;
	// mark the page as dirty and then unpin it 
	MarkDirty(page_number);
	UnpinPage(page_number);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testl %esi, %esi
js 0x3a39
movq %rdi, %r14
cmpb $0x0, 0x10(%rdi)
je 0x3a39
movl %esi, %r12d
cmpl %esi, 0xc(%r14)
jle 0x3a39
movq (%r14), %rdi
movl 0x14(%r14), %esi
movq %r12, %r15
shlq $0x20, %r15
orq %r15, %rsi
callq 0x26b4
cmpl $-0x2, (%rax)
sete %bl
jne 0x3a27
movl 0x8(%r14), %ecx
movl %ecx, (%rax)
movl %r12d, 0x8(%r14)
movb $0x1, 0x11(%r14)
movq (%r14), %rdi
movl 0x14(%r14), %esi
orq %r15, %rsi
callq 0x2a4c
movq (%r14), %rdi
movl 0x14(%r14), %eax
orq %rax, %r15
movq %r15, %rsi
callq 0x2ae0
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::FlushPages()
bool FileHandler::FlushPages() {
	if(this->hdrChanged) {
		lseek(this->unix_file_desc,0,0); // seek file pointer to start
		int _wr_res = write(this->unix_file_desc,(char *)&hdr,sizeof(FileHdr));
		if(_wr_res<0) return false; //write error
		this->hdrChanged =false;
	}
	return bufferManager->FlushPages(this->unix_file_desc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x11(%rdi)
jne 0x3a78
movl 0x14(%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a0
movl 0x14(%rbx), %edi
leaq 0x8(%rbx), %rsi
movl $0x8, %edx
callq 0x2090
testl %eax, %eax
js 0x3a89
movb $0x0, 0x11(%rbx)
movq (%rbx), %rdi
movl 0x14(%rbx), %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2b76
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileHandler::FlushPage(int)
bool FileHandler::FlushPage(int page_number) {
	if(this->hdrChanged) {
		lseek(this->unix_file_desc,0,0); // seek file pointer to start
		int _wr_res = write(this->unix_file_desc,(char *)&hdr,sizeof(FileHdr));
		if(_wr_res<0) return false; //write error
		this->hdrChanged =false;
	}
	return bufferManager->FlushPage(PageDescriptor(this->unix_file_desc,page_number));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
cmpb $0x1, 0x11(%rdi)
jne 0x3acc
movl 0x14(%r14), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a0
movl 0x14(%r14), %edi
leaq 0x8(%r14), %rsi
movl $0x8, %edx
callq 0x2090
testl %eax, %eax
js 0x3ae6
movb $0x0, 0x11(%r14)
movq (%r14), %rdi
movl 0x14(%r14), %eax
shlq $0x20, %rbx
orq %rax, %rbx
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x2ce6
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileManager::FileManager()
FileManager::FileManager() {
	// intialize manager with a buffer manager
	// thus buffer manager will be hidden from student API access 
	if(FileManagerInstanceCount==1) {
		throw FileManagerInstanceException();
	}
	FileManagerInstanceCount = 1;
	bufferManager = new BufferManager(BUFFER_SIZE);
 
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpl $0x1, 0x468c(%rip)      # 0x8188
je 0x3b2d
movq %rdi, %rbx
movl $0x1, 0x467d(%rip)      # 0x8188
movl $0x78, %edi
callq 0x21b0
movq %rax, %r14
movq %rax, %rdi
movl $0x3, %esi
callq 0x246c
movq %r14, (%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x4232(%rip), %rcx      # 0x7d70
movq %rcx, (%rax)
leaq 0x41c0(%rip), %rsi      # 0x7d08
movq 0x4491(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
movq %rax, %rbx
movq %r14, %rdi
callq 0x2180
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileManager::CreateFile(char const*)
FileHandler FileManager::CreateFile(const char* filename) {
	// open file for writing
	int fd = open(filename,O_CREAT|O_EXCL|O_RDWR,0660); // updated to fail if file already exists
	if(fd==-1) throw InvalidFileException();
	// write out the initial header
	char hdr_buf[FILE_HDR_SIZE];
	memset(hdr_buf,0,FILE_HDR_SIZE);
	FileHdr *hdr= (FileHdr*) hdr_buf;
	hdr->firstFreePage = END_FREE;
	hdr->totalPages = 0;
	write(fd,hdr_buf,FILE_HDR_SIZE);
	close(fd);
	return OpenFile(filename);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rdx, %rdi
movl $0xc2, %esi
movl $0x1b0, %edx            # imm = 0x1B0
xorl %eax, %eax
callq 0x2140
cmpl $-0x1, %eax
je 0x3c33
movl %eax, %r12d
leaq -0x1030(%rbp), %r13
movl $0x1000, %edx           # imm = 0x1000
movq %r13, %rdi
xorl %esi, %esi
callq 0x2110
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, (%r13)
movl $0x1000, %edx           # imm = 0x1000
movl %r12d, %edi
movq %r13, %rsi
callq 0x2090
movl %r12d, %edi
callq 0x22b0
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3c5e
movq %rbx, %rax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x4154(%rip), %rcx      # 0x7d98
movq %rcx, (%rax)
leaq 0x40d2(%rip), %rsi      # 0x7d20
movq 0x438b(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileManager::OpenFile(char const*)
FileHandler FileManager::OpenFile(const char *filename) {
	FileHandler fileHandle; 
	// open file 
	fileHandle.fileName = new char[strlen(filename)+1];
	strcpy(fileHandle.fileName, filename);
 

	fileHandle.unix_file_desc = open(filename,O_RDWR);
	if(fileHandle.unix_file_desc==-1) throw InvalidFileException();
	//read header
	fileHandle.hdr.firstFreePage = 0;
	fileHandle.hdr.totalPages = 0;
	int _temp_res = read(fileHandle.unix_file_desc,(char *)&fileHandle.hdr,
            sizeof(FileHdr));
    // update file metadata
    fileHandle.isOpen = true;
    fileHandle.hdrChanged = false;
    fileHandle.bufferManager = bufferManager;
    return fileHandle;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movw $0x0, 0x10(%rdi)
movl $0xffffffff, 0x14(%rdi) # imm = 0xFFFFFFFF
movq $0x0, (%rdi)
movq %rdx, %rdi
callq 0x20c0
leaq 0x1(%rax), %rdi
callq 0x2030
movq %rax, 0x18(%rbx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movq %r15, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x2140
movl %eax, 0x14(%rbx)
cmpl $-0x1, %eax
je 0x3cee
leaq 0x8(%rbx), %rsi
movq $0x0, 0x8(%rbx)
movl $0x8, %edx
movl %eax, %edi
callq 0x2200
movw $0x1, 0x10(%rbx)
movq (%r14), %rax
movq %rax, (%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x4099(%rip), %rcx      # 0x7d98
movq %rcx, (%rax)
leaq 0x4017(%rip), %rsi      # 0x7d20
movq 0x42d0(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/file_manager.cpp
// Function: FileManager::CloseFile(FileHandler&)
bool FileManager::CloseFile(FileHandler &fileHandle) {
	if(!fileHandle.isOpen) return false; // if not already open
	if(!fileHandle.FlushPages()) return false; //flush pages to file, if error in flushing all pages , return false
	close(fileHandle.unix_file_desc); // close the file
 

	//update meta data
	fileHandle.isOpen = false;
	fileHandle.bufferManager = NULL;	
	return true;
}

// Assembly:
cmpb $0x1, 0x10(%rsi)
jne 0x3d5e
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x3a44
testb %al, %al
je 0x3d61
movl 0x14(%rbx), %edi
callq 0x22b0
movb $0x0, 0x10(%rbx)
movq $0x0, (%rbx)
movb $0x1, %al
jmp 0x3d63
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/check.cpp
// Function: getValue[abi:cxx11](char const*)
list<int> getValue(const char *filename){
	ifstream myfile(filename);
	if(!myfile){
		cout<<"could not open file " << filename <<endl;
		exit (0);
	}
	list<int> num;
	int n;
	while(!myfile.eof()){
		myfile >> n;
		num.push_back(n);
	}
	myfile.close();
	return num;
}

// 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), %r15
movq %r15, %rdi
movl $0x8, %edx
callq 0x2290
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x208(%rbp,%rax)
jne 0x3eda
movq %rbx, 0x8(%rbx)
movq %rbx, (%rbx)
movq $0x0, 0x10(%rbx)
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x208(%rbp,%rax)
jne 0x3eb1
leaq -0x228(%rbp), %r14
leaq -0x1c(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2120
movl $0x18, %edi
callq 0x21b0
movl -0x1c(%rbp), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x208(%rbp,%rax)
je 0x3e72
leaq -0x228(%rbp), %rdi
callq 0x2060
leaq -0x228(%rbp), %rdi
callq 0x2070
movq %rbx, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x40ef(%rip), %rdi      # 0x7fd0
leaq 0x14c0(%rip), %rsi      # 0x53a8
movl $0x14, %edx
callq 0x21c0
movq 0x40d7(%rip), %rdi      # 0x7fd0
movq %r14, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20e0
xorl %edi, %edi
callq 0x21d0
movq %rax, %r14
jmp 0x3f32
jmp 0x3f17
movq %rax, %r14
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x3f32
movq (%rdi), %r15
callq 0x2180
movq %r15, %rdi
cmpq %rbx, %r15
jne 0x3f22
leaq -0x228(%rbp), %rdi
callq 0x2070
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/check.cpp
// Function: checkPage(std::__cxx11::list<int, std::allocator<int>>, char*)
list<int> checkPage(list<int> lst, char* pageData){
	int n;
	int num = lst.front();
	list<int> position;
	int i = 0;
	for(; i< PAGE_CONTENT_SIZE/sizeof(int); i++){
		memcpy (&n, &pageData[i*sizeof(int)], sizeof(int));
		if (n == INT_MIN){
			break;
		}
		if (n > num){
			lst.pop_front();
			position.push_back(i);
			i--;
			if(lst.empty()){
				break;
			}
			num = lst.front();
		}
	}
	while( !lst.empty() ){
		position.push_back(i);
		lst.pop_front();
	}
	return position;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movl 0x10(%rax), %eax
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
movq $0x0, 0x10(%rdi)
xorl %r13d, %r13d
movl %r13d, %ecx
movl (%r15,%rcx,4), %ecx
movl %ecx, %edx
negl %edx
jo 0x400e
cmpl %eax, %ecx
jle 0x3fcc
movq (%r14), %r12
decq 0x10(%r14)
movq %r12, %rdi
callq 0x2230
movq %r12, %rdi
callq 0x2180
movl $0x18, %edi
callq 0x21b0
movl %r13d, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
decl %r13d
movq (%r14), %rax
cmpq %r14, %rax
je 0x400e
movl 0x10(%rax), %eax
incl %r13d
cmpl $0x3ff, %r13d           # imm = 0x3FF
jb 0x3f75
jmp 0x400e
movl $0x18, %edi
callq 0x21b0
movl %r13d, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
movq (%r14), %r15
decq 0x10(%r14)
movq %r15, %rdi
callq 0x2230
movq %r15, %rdi
callq 0x2180
cmpq %r14, (%r14)
jne 0x3fda
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4027
movq %rax, %r14
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x4042
movq (%rdi), %r15
callq 0x2180
movq %r15, %rdi
cmpq %rbx, %r15
jne 0x4032
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/check.cpp
// Function: InsertValue(int, int, int, FileHandler&)
void InsertValue(int num, int position, int pageNo, FileHandler &fh){
	try{
		PageHandler ph = fh.PageAt(pageNo);
		bool pin = fh.MarkDirty(pageNo);
		char *pageData = ph.GetData();
		int n;
		int max_data = PAGE_CONTENT_SIZE/sizeof(int);
		for(int i = position; i< max_data; i++){
			memcpy (&n, &pageData[i*sizeof(int)], sizeof(int));
			if( n == INT_MIN ){
				if (i == max_data -1){
					fh.UnpinPage(pageNo);
					InsertValue(num, 0, pageNo + 1, fh);
					return;
				}
				else {
					memcpy (&pageData[i*sizeof(int)], &num, sizeof(int));
					memcpy (&pageData[(i+1)*sizeof(int)], &n, sizeof(int));
					break;
				}
			}
			memcpy (&pageData[i*sizeof(int)], &num, sizeof(int));
			num = n;
		}
		return;
	}
	catch(InvalidPageException args){
		//create New Page
		PageHandler ph = fh.NewPage();
		char *pageData = ph.GetData();
		int m = INT_MIN;
		memcpy (&pageData[0], &m, sizeof(int));
		InsertValue(num, 0, ph.GetPageNum(), fh);
		return;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %rbx
movl %edx, %r15d
movl %esi, %r12d
movl %edi, %r14d
leaq -0x38(%rbp), %rdi
movq %rcx, %rsi
callq 0x3824
movq %rbx, %rdi
movl %r15d, %esi
callq 0x39ae
leaq -0x38(%rbp), %rdi
callq 0x366c
cmpl $0x3fe, %r12d           # imm = 0x3FE
jg 0x410b
movabsq $0x100000000, %rsi      # imm = 0x100000000
movslq %r12d, %rdx
movq %rdx, %rcx
shlq $0x20, %rcx
addq %rsi, %rcx
incq %rdx
movl -0x4(%rax,%rdx,4), %edi
movl %edi, %r8d
negl %r8d
jo 0x40d2
movl %r14d, -0x4(%rax,%rdx,4)
addq %rsi, %rcx
movq %rdx, %r8
incq %r8
movl %edi, %r14d
cmpl $0x3ff, %edx            # imm = 0x3FF
movq %r8, %rdx
jne 0x40a8
jmp 0x410b
cmpq $0x3ff, %rdx            # imm = 0x3FF
jne 0x40fb
movq %rbx, %rdi
movl %r15d, %esi
callq 0x38dc
incl %r15d
movl %r14d, %edi
xorl %esi, %esi
movl %r15d, %edx
movq %rbx, %rcx
callq 0x404a
jmp 0x410b
movl %r14d, -0x4(%rax,%rdx,4)
sarq $0x1e, %rcx
movl $0x80000000, (%rax,%rcx) # imm = 0x80000000
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x411e
jmp 0x411e
jmp 0x411e
movq %rax, %r15
cmpl $0x1, %edx
jne 0x4199
movq %r15, %rdi
callq 0x21e0
leaq 0x3c13(%rip), %rax      # 0x7d48
movq %rax, -0x28(%rbp)
movq %r15, %rdi
callq 0x20b0
leaq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x38f6
leaq -0x38(%rbp), %rdi
callq 0x366c
movl $0x80000000, (%rax)     # imm = 0x80000000
leaq -0x38(%rbp), %rdi
callq 0x3676
movl %r14d, %edi
xorl %esi, %esi
movl %eax, %edx
movq %rbx, %rcx
callq 0x404a
leaq -0x28(%rbp), %rdi
callq 0x22c8
callq 0x2240
jmp 0x410b
jmp 0x4188
jmp 0x4188
movq %rax, %r15
leaq -0x28(%rbp), %rdi
callq 0x22c8
callq 0x2240
movq %r15, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x3160
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/check.cpp
// Function: PrintPage(PageHandler)
void PrintPage(PageHandler ph){
	char* data = ph.GetData ();
	int temp_num;
	// Output the all integers
	for(int i=0; i<1022 ; i++){
		memcpy (&temp_num, &data[i*4], sizeof(int));
		cout << i<< "th number: " << temp_num << endl;
		if(temp_num == INT_MIN) break;
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x366c
movq %rax, %rbx
xorl %r14d, %r14d
leaq 0x11f4(%rip), %r12      # 0x53bd
movl (%rbx,%r14,4), %r13d
movq 0x3dfc(%rip), %rdi      # 0x7fd0
movl %r14d, %esi
callq 0x2270
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21c0
movq %r15, %rdi
movl %r13d, %esi
callq 0x2270
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
negl %r13d
jo 0x4239
leaq 0x1(%r14), %rax
cmpq $0x3fd, %r14            # imm = 0x3FD
movq %rax, %r14
jne 0x41c9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/akgupta007[P]DBMS-query-processing-Algotihms/check.cpp
// Function: main
int main(int argc, char* argv[]) {
	//read input file
	
	FileManager fm;
	FileHandler fh;
	
	// Reopen the same file, but for reading this time
	fh = fm.OpenFile (argv[1]);
	
	PageHandler ph_last = fh.LastPage ();
	int total_pages = ph_last.GetPageNum ()+1;
	for(int i = 0; i<total_pages; i++){
		cout<< "Page : "<<i <<endl;
		ph_last = fh.PageAt(i);
		PrintPage(ph_last);
		fh.UnpinPage(i);
	}
	cout<<total_pages<<endl;
	fh.FlushPages();
	fm.CloseFile (fh);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rbx
leaq -0x30(%rbp), %rdi
callq 0x3aee
leaq -0x70(%rbp), %rdi
callq 0x367e
movq 0x8(%rbx), %rdx
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3c5e
leaq -0x50(%rbp), %rdi
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
leaq -0x70(%rbp), %rsi
movaps %xmm1, 0x10(%rsi)
movaps %xmm0, (%rsi)
callq 0x3780
leaq -0x50(%rbp), %rdi
callq 0x3676
leal 0x1(%rax), %ebx
testl %eax, %eax
js 0x49d6
xorl %r14d, %r14d
leaq -0x70(%rbp), %r12
leaq -0x90(%rbp), %r13
movl $0x7, %edx
movq 0x3681(%rip), %rdi      # 0x7fd0
leaq 0xa73(%rip), %rsi       # 0x53c9
callq 0x21c0
movq 0x366e(%rip), %rdi      # 0x7fd0
movl %r14d, %esi
callq 0x2270
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
leaq -0x80(%rbp), %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0x3824
movups -0x80(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
movq %r13, %rdi
leaq -0x50(%rbp), %rsi
callq 0x3640
movq %r13, %rdi
callq 0x41a9
movq %r12, %rdi
movl %r14d, %esi
callq 0x38dc
incl %r14d
cmpl %r14d, %ebx
jne 0x4943
movq 0x35f3(%rip), %rdi      # 0x7fd0
movl %ebx, %esi
callq 0x2270
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2130
leaq -0x70(%rbp), %rdi
callq 0x3a44
leaq -0x30(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3d2c
leaq -0x30(%rbp), %rdi
callq 0x3b6a
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4a48
jmp 0x4a48
jmp 0x4a48
jmp 0x4a48
jmp 0x4a48
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x3b6a
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/server_fail.cpp
// Function: server_shutdown(int)
void server_shutdown (int s)
{
    (void) s;
    cout << "\n";
    cout << "Initiating Server Shutdown...\n";
    cout << "Closing All Connections... ";
    site.close ();
    cout << "\nAll Connections Closed. Exiting...\n\n";
    exit (EXIT_SUCCESS);
}

// Assembly:
pushq %rbx
movq 0x979c(%rip), %rbx      # 0xbfd0
leaq 0x69b9(%rip), %rsi      # 0x91f4
movq %rbx, %rdi
callq 0x2250
leaq 0x67de(%rip), %rsi      # 0x9028
movq %rbx, %rdi
callq 0x2250
leaq 0x67ee(%rip), %rsi      # 0x9047
movq %rbx, %rdi
callq 0x2250
leaq 0x99b0(%rip), %rdi      # 0xc218
callq 0x69d8
leaq 0x67ef(%rip), %rsi      # 0x9063
movq %rbx, %rdi
callq 0x2250
xorl %edi, %edi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
int Socket::connect (string host, int port)
{
    /* Creating the socket. */
    if ((socketFD = socket (AF_INET, SOCK_STREAM, 0)) < 0)
    {
        int errsv = errno;
        std::cerr << "Cannot Create Socket, Error ";
        std::cerr << errsv << "\n";
        exit (1);
    }
    /* Determining server's IP address. */
    stringstream s1;
    s1 << port;
    int status;
    addrinfo hints;
    addrinfo* servinfo;
    memset (&hints, 0, sizeof (hints));
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    if ((status = getaddrinfo (host.c_str (), s1.str ().c_str (), &hints,
                               &servinfo)) != 0)
        return -1;

    /* Connecting to the server. */
    return ::connect (socketFD, servinfo->ai_addr, servinfo->ai_addrlen);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1f0, %rsp            # imm = 0x1F0
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2080
movl %eax, (%rbx)
testl %eax, %eax
js 0x6694
leaq 0x68(%rsp), %rdi
callq 0x2190
leaq 0x78(%rsp), %rdi
movl %ebp, %esi
callq 0x23b0
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x34(%rsp)
movq (%r14), %r14
leaq 0x80(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x2390
movq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
callq 0x2330
movl %eax, %r14d
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6649
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2270
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r14d, %r14d
jne 0x6668
movl (%rbx), %edi
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x21f0
movl %eax, %ebp
movq 0x5949(%rip), %rsi      # 0xbfb8
leaq 0x68(%rsp), %rdi
callq 0x21c0
leaq 0xe8(%rsp), %rdi
callq 0x20d0
movl %ebp, %eax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbx
popq %r14
popq %rbp
retq
callq 0x2050
movl (%rax), %ebx
movq 0x594e(%rip), %r14      # 0xbff0
leaq 0x2ce0(%rip), %rsi      # 0x9389
movq %r14, %rdi
callq 0x2250
movq %r14, %rdi
movl %ebx, %esi
callq 0x23b0
leaq 0x2b32(%rip), %rsi      # 0x91f4
movq %rax, %rdi
callq 0x2250
movl $0x1, %edi
callq 0x22f0
jmp 0x66f8
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66fb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2270
jmp 0x66fb
jmp 0x66f8
movq %rax, %rbx
movq 0x58b6(%rip), %rsi      # 0xbfb8
leaq 0x68(%rsp), %rdi
callq 0x21c0
leaq 0xe8(%rsp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x23c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::recv[abi:cxx11](unsigned long)
string Socket::recv (size_t len)
{
    char* recv_buf = new char[len + 1];
    int recv_len = ::recv (socketFD, recv_buf, len, 0);
    if (recv_len < 0)
        return string ("");
    recv_buf[recv_len] = '\0';
    return string (recv_buf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x1(%rdx), %rdi
callq 0x2030
movq %rax, %r14
movl (%r12), %edi
movq %rax, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
testl %eax, %eax
js 0x6799
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, (%r14,%rax)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x2100
movq %r14, %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x67ad
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x2a4e(%rip), %rdx      # 0x91f5
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x5cf4
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::bind(int)
int Socket::bind (int port)
{
    /* Creating the socket. */
    if ((socketFD = socket (AF_INET, SOCK_STREAM, 0)) < 0)
    {
        int errsv = errno;
        std::cerr << "Cannot Create Socket, Error ";
        std::cerr << errsv << "\n";
        exit (1);
    }
    sockaddr_in myaddr;
    memset ((char*)&myaddr, 0, sizeof(myaddr));
    myaddr.sin_family = AF_INET;
    myaddr.sin_addr.s_addr = htonl (INADDR_ANY);
    myaddr.sin_port = htons (port);
    return ::bind (socketFD, (sockaddr *)&myaddr, sizeof (myaddr));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2080
movl %eax, (%r14)
testl %eax, %eax
js 0x6821
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
rolw $0x8, %bx
movw %bx, 0x2(%rsi)
movl %eax, %edi
movl $0x10, %edx
callq 0x2060
addq $0x18, %rsp
popq %rbx
popq %r14
retq
callq 0x2050
movl (%rax), %ebx
movq 0x57c1(%rip), %r14      # 0xbff0
leaq 0x2b53(%rip), %rsi      # 0x9389
movq %r14, %rdi
callq 0x2250
movq %r14, %rdi
movl %ebx, %esi
callq 0x23b0
leaq 0x29a5(%rip), %rsi      # 0x91f4
movq %rax, %rdi
callq 0x2250
movl $0x1, %edi
callq 0x22f0
nop
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::accept()
Socket Socket::accept ()
{
    sockaddr_storage incoming;
    socklen_t addr_size;
    int tmp_fd = ::accept (socketFD, (sockaddr*)&incoming, &addr_size);
    return (Socket (tmp_fd));
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
movl (%rsi), %edi
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x20b0
movb $0x1, 0x4(%rbx)
movl %eax, (%rbx)
movq %rbx, %rax
addq $0x90, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::getSourceAddr[abi:cxx11]()
string Socket::getSourceAddr ()
{
    char src[INET_ADDRSTRLEN];
    sockaddr_storage tmp;
    socklen_t addr_size = sizeof (sockaddr);
    getsockname (socketFD, (sockaddr*)&tmp, &addr_size);
    sockaddr_in* src_addr = (sockaddr_in*)&tmp;
    inet_ntop (AF_INET, &src_addr->sin_addr, src, sizeof (src));
    return string (src);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %rdx
movl $0x10, (%rdx)
movl (%rsi), %edi
leaq 0x28(%rsp), %rsi
callq 0x2220
leaq 0x2c(%rsp), %rsi
leaq 0x10(%rsp), %r14
movl $0x2, %edi
movq %r14, %rdx
movl $0x10, %ecx
callq 0x22b0
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x2100
leaq (%rsp,%rax), %rdx
addq $0x10, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5cf4
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::getSourcePort()
int Socket::getSourcePort ()
{
    sockaddr_in src_addr;
    socklen_t addr_size = sizeof (sockaddr);
    getsockname (socketFD, (sockaddr*)&src_addr, &addr_size);
    return ntohs (src_addr.sin_port);
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
leaq 0xc(%rsp), %rdx
movl $0x10, (%rdx)
movl (%rdi), %edi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x2220
movzwl 0x2(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::getDestPort()
int Socket::getDestPort ()
{
    sockaddr_in dest_addr;
    socklen_t addr_size = sizeof (sockaddr);
    getpeername (socketFD, (sockaddr*)&dest_addr, &addr_size);
    return ntohs (dest_addr.sin_port);
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
leaq 0xc(%rsp), %rdx
movl $0x10, (%rdx)
movl (%rdi), %edi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x21b0
movzwl 0x2(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::enableBlocking()
int Socket::enableBlocking ()
{
    if (socketFD < 0 && blockingEnabled)
        return -1;

    int flags;
    if ((flags = fcntl (socketFD, F_GETFL, 0)) < 0)
        return -1;

    int rval = fcntl (socketFD, F_SETFL, flags | O_NONBLOCK);
    if (rval < 0)
        return rval;
    else
        blockingEnabled = false;

    return rval;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
testl %edi, %edi
jns 0x6a07
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpb $0x0, 0x4(%rbx)
jne 0x6a3d
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x6a38
movl (%rbx), %edi
orl $0x800, %eax            # imm = 0x800
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x6a3d
movb $0x0, 0x4(%rbx)
jmp 0x6a3d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/socket.cpp
// Function: Socket::disableBlocking()
int Socket::disableBlocking ()
{
    if (socketFD < 0 && (!blockingEnabled))
        return -1;

    int flags;
    if ((flags = fcntl (socketFD, F_GETFL, 0)) < 0)
        return -1;

    int rval = fcntl (socketFD, F_SETFL, flags & (~O_NONBLOCK));
    if (rval < 0)
        return rval;
    else
        blockingEnabled = true;

    return rval;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
testl %edi, %edi
jns 0x6a55
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpb $0x1, 0x4(%rbx)
jne 0x6a8b
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x6a86
movl (%rbx), %edi
andl $0x7ffff7ff, %eax       # imm = 0x7FFFF7FF
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
js 0x6a8b
movb $0x1, 0x4(%rbx)
jmp 0x6a8b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/message.cpp
// Function: split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void split(const std::string& line, char delim, std::vector<std::string>& val) {
    std::string::size_type i = 0;
    std::string::size_type j = line.find (delim);

    while (j != std::string::npos)
    {
        val.push_back (line.substr (i, j-i));
        i = ++j;
        j = line.find (delim, j);

        if (j == std::string::npos)
            val.push_back (line.substr (i, line.length ()));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
xorl %edx, %edx
callq 0x2340
cmpq $-0x1, %rax
je 0x6b5b
movq %rax, %r15
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movsbl %bpl, %ebp
movq %r15, %rcx
subq %r13, %rcx
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2290
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6ff8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6b01
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2270
movq %r15, %r13
incq %r13
movq %r14, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x2340
movq %rax, %r15
cmpq $-0x1, %rax
jne 0x6ac6
movq 0x8(%r14), %rcx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2290
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6ff8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6b5b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2270
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6b6c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6b8b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2270
movq %rbx, %rdi
callq 0x23c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/rohitrangan[P]3PC/src/message.cpp
// Function: Message::parseMessage()
void Message::parseMessage ()
{
    std::vector<std::string> m_parsed;
    split (message_str, DELIM, m_parsed);
    this->message = messageIndex (m_parsed[0]);
    this->transaction_id = std::stoi (m_parsed[1]);
    this->site_id = std::stoi (m_parsed[2]);
    this->failed_id = std::stoi (m_parsed[3]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r14
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
addq $0x10, %rdi
movl $0x2c, %esi
callq 0x6a90
movq 0x10(%rsp), %rax
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x5c64
leaq 0x28(%rsp), %rbx
movq %rbx, %rsi
callq 0x6f38
movl %eax, (%r14)
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x6ca9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2270
movq 0x10(%rsp), %rax
movq 0x20(%rax), %r15
callq 0x2050
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x2350
cmpq %r15, (%r12)
je 0x6dc3
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x6dcf
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x6dcf
testl %ecx, %ecx
jne 0x6cfe
movl %ebp, (%rbx)
movl %eax, 0x4(%r14)
movq 0x10(%rsp), %rax
movq 0x40(%rax), %r15
movl (%rbx), %ebp
movl $0x0, (%rbx)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x2350
cmpq %r15, (%r12)
je 0x6ddb
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rcx
cmpq %r13, %rcx
jb 0x6de7
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x6de7
testl %ecx, %ecx
jne 0x6d5d
movl %ebp, (%rbx)
movl %eax, 0x8(%r14)
movq 0x10(%rsp), %rax
movq 0x60(%rax), %r15
movl (%rbx), %ebp
movl $0x0, (%rbx)
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x2350
cmpq %r15, (%r12)
je 0x6df3
leaq -0x80000000(%rax), %rcx
cmpq %r13, %rcx
jb 0x6dff
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x6dff
testl %ecx, %ecx
jne 0x6da6
movl %ebp, (%rbx)
movl %eax, 0xc(%r14)
leaq 0x10(%rsp), %rdi
callq 0x6f9c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x258f(%rip), %rdi      # 0x9359
callq 0x2160
leaq 0x2583(%rip), %rdi      # 0x9359
callq 0x2360
leaq 0x2577(%rip), %rdi      # 0x9359
callq 0x2160
leaq 0x256b(%rip), %rdi      # 0x9359
callq 0x2360
leaq 0x255f(%rip), %rdi      # 0x9359
callq 0x2160
leaq 0x2553(%rip), %rdi      # 0x9359
callq 0x2360
jmp 0x6e0f
jmp 0x6e0f
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x6e1e
movl %ebp, (%rbx)
jmp 0x6e1e
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x6f9c
movq %r14, %rdi
callq 0x23c0