LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::GetSignalValue(int)
int GetSignalValue(int time) //gets value of signal at time
    {
        int j = round(51.0f + 50.0f*sin(M_PI/180.0f*double(time)*360.0f / ro));
        input_vector.clear();
        for(int i=1;i<=NUM_INPUT_NEURONS_X;i++)
        {
            if(i != j)
                input_vector.push_back(0.0f);
            else if(i == j)
                input_vector.push_back(1.0f);
        }
        return j;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cvtsi2sd %esi, %xmm0
mulsd 0x1f38(%rip), %xmm0     # 0x7040
mulsd 0x1f38(%rip), %xmm0     # 0x7048
divsd 0x1d0(%rdi), %xmm0
callq 0x2040
mulsd 0x1f03(%rip), %xmm0     # 0x7028
addsd 0x1f23(%rip), %xmm0     # 0x7050
callq 0x20b0
movq 0x108(%rbx), %rax
cmpq %rax, 0x110(%rbx)
je 0x5149
movq %rax, 0x110(%rbx)
cvttsd2si %xmm0, %eax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0x1c0(%rbx)
je 0x51d8
leaq 0x108(%rbx), %r15
movq -0x38(%rbp), %rax
leal -0x1(%rax), %r13d
xorl %r14d, %r14d
movabsq $0x3ff0000000000000, %r12 # imm = 0x3FF0000000000000
cmpl %r14d, %r13d
jne 0x5194
movq %r12, -0x30(%rbp)
movq 0x110(%rbx), %rsi
cmpq 0x118(%rbx), %rsi
je 0x51c0
movq %r12, (%rsi)
jmp 0x51b3
movq $0x0, -0x30(%rbp)
movq 0x110(%rbx), %rsi
cmpq 0x118(%rbx), %rsi
je 0x51c0
movq $0x0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x110(%rbx)
jmp 0x51cc
movq %r15, %rdi
leaq -0x30(%rbp), %rdx
callq 0x65f6
incl %r14d
cmpl 0x1c0(%rbx), %r14d
jb 0x5176
movq -0x38(%rbp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::OscillateFeedForward(int, int)
void OscillateFeedForward(int signal_value, int time_step)
    {
        int sig_val = GetSignalValue(time_step);
        for(int neuron_index=0;neuron_index<NUM_INPUT_NEURONS_X;neuron_index++)
        {
            UpdateX(neuron_index);
        }
        V = getV(V,y,y_bar);
        U = getU(U,y,y_tilde);
        y = GetY(sig_val);
        y_bar = getYBar(y,y_bar);
        y_tilde = getYTilde(y,y_tilde);

        for(int neuron_index = 0;neuron_index<NUM_INPUT_NEURONS_X;neuron_index++)
        {
            Layer* inputLayer = &(getNetwork()->m_layers[0]);
            Neuron* thisNeuron = &(*inputLayer)[neuron_index];
            double dw = CalculateDelWeights(neuron_index);
            UpdateNeuron(thisNeuron,neuron_index);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl %edx, %esi
callq 0x50e8
movl 0x1c0(%rbx), %ecx
testq %rcx, %rcx
je 0x527a
movq 0x90(%rbx), %rdx
movq 0xa8(%rbx), %rsi
movq 0x108(%rbx), %rdi
xorl %r8d, %r8d
movsd 0x1e2c(%rip), %xmm0     # 0x7058
movsd 0x78(%rbx), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
mulsd (%rdi,%r8,8), %xmm2
mulsd (%rdx,%r8,8), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, (%rdx,%r8,8)
movsd 0x70(%rbx), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
mulsd (%rdi,%r8,8), %xmm2
mulsd (%rsi,%r8,8), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, (%rsi,%r8,8)
incq %r8
cmpq %r8, %rcx
jne 0x522c
movsd 0x290(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
movsd 0x1dc9(%rip), %xmm2     # 0x7058
subsd %xmm1, %xmm2
movapd %xmm0, %xmm3
subsd 0x158(%rbx), %xmm3
mulsd %xmm3, %xmm3
mulsd %xmm2, %xmm3
movsd 0x168(%rbx), %xmm4
mulsd %xmm1, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, 0x168(%rbx)
subsd 0x150(%rbx), %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm2, %xmm0
mulsd 0x160(%rbx), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x160(%rbx)
movq %rbx, %rdi
movl %eax, %esi
callq 0x59d2
movsd %xmm0, 0x290(%rbx)
movsd 0x70(%rbx), %xmm1
movsd 0x78(%rbx), %xmm2
movsd 0x1d51(%rip), %xmm4     # 0x7058
movapd %xmm4, %xmm3
subsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
mulsd 0x158(%rbx), %xmm1
addsd %xmm3, %xmm1
movsd %xmm1, 0x158(%rbx)
movapd %xmm4, %xmm1
subsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
mulsd 0x150(%rbx), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x150(%rbx)
cmpl $0x0, 0x1c0(%rbx)
je 0x5395
movl $0x10, %r15d
xorl %r14d, %r14d
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax), %r12
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5a2e
movq (%r12,%r15), %rax
movq 0xc0(%rbx), %rcx
movsd (%rcx,%r14,8), %xmm0
movsd %xmm0, 0x8(%rax)
incq %r14
movl 0x1c0(%rbx), %eax
addq $0x40, %r15
cmpq %rax, %r14
jb 0x5359
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::GetCorrelationTrace(std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>, int)
double GetCorrelationTrace(vector<double> va, vector<double> vb,int t)
    {
        int time_step = t;
        int lambda_correlation = fmin(11*ro,time_step);
        vector<double> vector_y1;
        vector<double> vector_y2;
        vector_y1.clear();
        vector_y2.clear();


     //       cout<<va.size()<<endl;
     //       cout<<lambda_correlation<<endl;

        for(int i=vb.size()-lambda_correlation;i<vb.size();i++)
        {
            if(i>-1)
            {
             //   cout<<va[i]<<endl;
                vector_y1.push_back(va[i]);
                vector_y2.push_back(vb[i]);
            }
        }
        double val =  pearsoncoeff(va,vb);

  //      cout<<val<<endl;

        if(isnan(val))
            return 0;
        else
            return val;        
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movsd 0x1d0(%rdi), %xmm0
mulsd 0x1ca1(%rip), %xmm0     # 0x7060
cvtsi2sd %ecx, %xmm1
movq %rdx, %rbx
minsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movq %rsi, %r14
xorl %eax, %eax
movq %rax, -0x50(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x60(%rbp)
movq %rax, -0x30(%rbp)
movapd %xmm0, -0x40(%rbp)
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
subq %rax, %rdx
movq %rdx, %rsi
shrq $0x3, %rsi
subl %ecx, %esi
movslq %esi, %r13
sarq $0x3, %rdx
cmpq %r13, %rdx
jbe 0x548d
leaq (,%r13,8), %r15
leaq -0x40(%rbp), %r12
testq %r13, %r13
js 0x5476
movq (%r14), %rdx
addq %r15, %rdx
movq -0x58(%rbp), %rsi
cmpq -0x50(%rbp), %rsi
je 0x543f
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x58(%rbp)
jmp 0x544b
leaq -0x60(%rbp), %rdi
callq 0x6732
movq (%rbx), %rax
leaq (%rax,%r15), %rdx
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x546b
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x5476
movq %r12, %rdi
callq 0x6732
movq (%rbx), %rax
incq %r13
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
addq $0x8, %r15
cmpq %r13, %rcx
ja 0x5418
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x381e
leaq -0x78(%rbp), %rdi
movq %rbx, %rsi
callq 0x381e
leaq -0x90(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3283
movapd %xmm0, -0xa0(%rbp)
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x54ce
callq 0x21a0
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x54df
callq 0x21a0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x54ed
callq 0x21a0
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x54fb
callq 0x21a0
movapd -0xa0(%rbp), %xmm1
movapd %xmm1, %xmm0
cmpordsd %xmm1, %xmm0
andpd %xmm1, %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x5535
callq 0x21a0
jmp 0x5535
movq %rax, %rbx
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x554d
callq 0x21a0
jmp 0x554d
jmp 0x554a
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x555b
callq 0x21a0
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x5569
callq 0x21a0
movq %rbx, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O3/godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::GetOutput(int)
double GetOutput(int signal_value)
    {
        resultUni.clear();
        feedforward(GenerateInputs(signal_value)); //feed input vector into sfa model
        getNetwork()->getResults(resultUni);
        return resultUni.back();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %edx
movq %rdi, %rbx
movq 0x258(%rdi), %rax
cmpq %rax, 0x260(%rdi)
je 0x5add
movq %rax, 0x260(%rbx)
leaq 0x258(%rbx), %r14
leaq -0x30(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5b2e
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x2ac4
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5b0b
callq 0x21a0
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x2c26
movq 0x260(%rbx), %rax
movsd -0x8(%rax), %xmm0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::GenerateInputs(int)
vector<double> GenerateInputs(int number_to_encode)                    
    {
        vector<double> inputVector; //one hot encoding
        inputVector.clear();
        for(int neuron_index=1;neuron_index<=NUM_INPUT_NEURONS_X;neuron_index++)
        {   
            if(number_to_encode == (neuron_index))
            {
                inputVector.push_back(1.0f);
            }
            else
            {
                inputVector.push_back(0.0f);
            }                
        }
        return inputVector;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
cmpl $0x0, 0x1c0(%rsi)
je 0x5bcd
movl %edx, %r14d
movq %rsi, %r15
decl %r14d
xorl %r13d, %r13d
movabsq $0x3ff0000000000000, %r12 # imm = 0x3FF0000000000000
cmpl %r13d, %r14d
jne 0x5b84
movq %r12, -0x30(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5ba7
movq %r12, (%rsi)
jmp 0x5b9d
movq $0x0, -0x30(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5bb5
movq $0x0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x5bc1
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
callq 0x65f6
jmp 0x5bc1
movq %rbx, %rdi
leaq -0x30(%rbp), %rdx
callq 0x65f6
incl %r13d
cmpl 0x1c0(%r15), %r13d
jb 0x5b6c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5be1
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x5bf1
callq 0x21a0
movq %r14, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O3/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::BufferManager(int)
BufferManager::BufferManager(int num_buffers) {
	this->numPages = num_buffers;
	this->pageSize = PAGE_SIZE;
	this->buffers = new Frame[num_buffers];
	for(int i=0;i<num_buffers;i++) {
		buffers[i].data = new char[this->pageSize];
		freeList.push_back(i);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
leaq 0x18(%rdi), %r12
movq %r12, 0x20(%rdi)
movq %r12, 0x18(%rdi)
movq %rax, 0x28(%rdi)
leaq 0x70(%rdi), %rax
movq %rax, 0x40(%rdi)
movq $0x1, 0x48(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rdi)
movl $0x3f800000, 0x60(%rdi) # imm = 0x3F800000
movups %xmm0, 0x68(%rdi)
movl %esi, 0x38(%rdi)
movl $0x1000, 0x3c(%rdi)     # imm = 0x1000
movslq %esi, %r15
movl $0x18, %ecx
movq %r15, %rax
mulq %rcx
movq $-0x1, %rdi
cmovnoq %rax, %rdi
callq 0x2030
testl %r14d, %r14d
je 0x2565
shlq $0x3, %r15
leaq (%r15,%r15,2), %rcx
xorl %edx, %edx
movq $-0x1, 0x4(%rax,%rdx)
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0x24f6
movq %rax, 0x30(%rbx)
testl %r14d, %r14d
jle 0x2569
movl %r14d, %r14d
movl $0x10, %r15d
xorl %r13d, %r13d
movl 0x3c(%rbx), %eax
testl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovsl %ecx, %eax
movslq %eax, %rdi
callq 0x2030
movq 0x30(%rbx), %rcx
movq %rax, (%rcx,%r15)
movl $0x18, %edi
callq 0x21b0
movl %r13d, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%rbx)
incq %r13
addq $0x18, %r15
cmpq %r13, %r14
jne 0x251d
jmp 0x2569
movq %rax, 0x30(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x257a
movq %rax, %r14
leaq 0x40(%rbx), %rdi
callq 0x30c6
movq (%r12), %rdi
cmpq %r12, %rdi
je 0x259f
movq (%rdi), %r15
callq 0x2180
movq %r15, %rdi
cmpq %r12, %r15
jne 0x258f
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x25b7
movq (%rdi), %r15
callq 0x2180
movq %r15, %rdi
cmpq %rbx, %r15
jne 0x25a7
movq %r14, %rdi
callq 0x2280
nop
// File: /workspace/github_cpp_makefile_star2_O3/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::~BufferManager()
BufferManager::~BufferManager() {
	//free up allocated memory
	for(int i=0;i<this->numPages;i++) 
		delete buffers[i].data;
	delete this->buffers;
	freeList.clear();
	usedList.clear();
	hashTable.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x38(%rdi)
jle 0x25f9
movl $0x10, %r14d
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x2180
incq %r15
movslq 0x38(%rbx), %rax
addq $0x18, %r14
cmpq %rax, %r15
jl 0x25dc
movq 0x30(%rbx), %rdi
callq 0x2180
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x261a
movq (%rdi), %r14
callq 0x2180
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x260a
movq %rbx, 0x8(%rbx)
movq %rbx, (%rbx)
movq $0x0, 0x10(%rbx)
leaq 0x18(%rbx), %r15
movq 0x18(%rbx), %rdi
cmpq %r15, %rdi
je 0x2646
movq (%rdi), %r14
callq 0x2180
movq %r14, %rdi
cmpq %r15, %r14
jne 0x2636
movq %r15, 0x20(%rbx)
movq %r15, 0x18(%rbx)
movq $0x0, 0x28(%rbx)
leaq 0x40(%rbx), %r14
movq %r14, %rdi
callq 0x30ee
movq %r14, %rdi
callq 0x30c6
movq 0x18(%rbx), %rdi
cmpq %r15, %rdi
je 0x2683
movq (%rdi), %r14
callq 0x2180
movq %r14, %rdi
cmpq %r15, %r14
jne 0x2673
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x269b
movq (%rdi), %r14
callq 0x2180
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x268b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::GetPage(PageDescriptor)
char* BufferManager::GetPage(PageDescriptor pd) {
	auto slot = hashTable.find(pd);
	if(slot!=hashTable.end()) {
		//already in buffer 
		int slotNo = slot->second;
		// no need to read the page
		// to establish replacement policy, make page MRU 
		usedList.remove(slotNo); 
		usedList.push_front(slotNo); // put at front
		return buffers[slotNo].data;
	}
	else {
		// page not in buffers
		// find a suitable slot to load it
		int slotNo = FindSlot();
		if(slotNo==-1) throw NoBufferSpaceException (); //error no free slot could be obtained 
		// read data to the slot 
		bool _read_res = ReadPage(pd,buffers[slotNo].data);
		if(!_read_res) // read failed 
			throw BufferManagerException("BufferManagerException : Read request failed");
		// insert into hashTable the corresponding slot
		hashTable.insert(make_pair(pd,slotNo));
		// initialize the rest of Frame elements
		InitializeBuffer(pd,slotNo);
		return buffers[slotNo].data;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq -0x28(%rbp), %rax
movq %rsi, (%rax)
leaq 0x40(%rdi), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x319a
testq %rax, %rax
je 0x271e
movl 0x10(%rax), %eax
leaq -0x38(%rbp), %r14
movl %eax, (%r14)
leaq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x3036
movq 0x18(%rbx), %r15
movl $0x18, %edi
callq 0x21b0
movl (%r14), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2050
incq 0x28(%rbx)
movq 0x30(%rbx), %rax
movslq (%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rax,%rcx,8), %rax
jmp 0x277e
movq %rbx, %rdi
callq 0x27de
cmpl $-0x1, %eax
je 0x278b
movl %eax, %r15d
movq -0x28(%rbp), %rsi
movq 0x30(%rbx), %rax
movslq %r15d, %rcx
leaq (%rcx,%rcx,2), %r12
movq 0x10(%rax,%r12,8), %rdx
movq %rbx, %rdi
callq 0x28f6
testb %al, %al
je 0x27a8
movq -0x28(%rbp), %rax
leaq -0x38(%rbp), %rsi
movq %rax, (%rsi)
movl %r15d, 0x8(%rsi)
movq %r14, %rdi
callq 0x323c
movq -0x28(%rbp), %rax
movq 0x30(%rbx), %rcx
movq %rax, 0x4(%rcx,%r12,8)
movw $0x100, (%rcx,%r12,8)   # imm = 0x100
movq 0x10(%rcx,%r12,8), %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x5514(%rip), %rcx      # 0x7cb0
movq %rcx, (%rax)
leaq 0x54ca(%rip), %rsi      # 0x7c70
jmp 0x27ce
movl $0x10, %edi
callq 0x20f0
leaq 0x551f(%rip), %rcx      # 0x7cd8
movq %rcx, (%rax)
leaq 0x285a(%rip), %rcx      # 0x501d
movq %rcx, 0x8(%rax)
leaq 0x54ba(%rip), %rsi      # 0x7c88
movq 0x580b(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O3/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::FindSlot()
int BufferManager::FindSlot() {
	// if free slot available
	if(!freeList.empty()) {
		int slot = freeList.front();
		freeList.pop_front();
		usedList.push_front(slot);
		return slot;
	}
	else {
		// since used list has MRU in front 
		// start search for a unpinned page from last 
		for(auto slot = usedList.rbegin();slot!=usedList.rend();slot++) {
			if(!buffers[*slot].pinned) {
				// page will be replaced
				// if dirty write to the file
				if(buffers[*slot].dirty) {
					int _res = WritePage(buffers[*slot].pageDescriptor,buffers[*slot].data);
					if(_res<0) continue;
					buffers[*slot].dirty=false;
				}
				//remove from hash table , and usedList
				hashTable.erase(buffers[*slot].pageDescriptor);
				// move the slot to MRU (front of used list)
				int slot_val = *slot;
				usedList.remove(slot_val);
				usedList.push_front(slot_val);
				return slot_val;
			}
		}
	}
	return -1; // no slot available
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r15
cmpq %rdi, %r15
je 0x2831
movl 0x10(%r15), %r14d
decq 0x10(%rbx)
movq %r15, %rdi
callq 0x2230
movq %r15, %rdi
callq 0x2180
movq 0x18(%rbx), %r15
movl $0x18, %edi
callq 0x21b0
movl %r14d, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2050
incq 0x28(%rbx)
jmp 0x28e7
leaq 0x18(%rbx), %r14
movq 0x18(%rbx), %rdx
movq 0x30(%rbx), %rax
movq %r14, %rsi
cmpq %rdx, %rsi
je 0x28e1
movq %rsi, %r15
movq 0x8(%rsi), %rsi
movslq 0x10(%rsi), %rcx
leaq (%rcx,%rcx,2), %rdi
cmpb $0x0, 0x1(%rax,%rdi,8)
jne 0x2840
cmpb $0x1, (%rax,%rdi,8)
jne 0x288b
movq 0x4(%rax,%rdi,8), %rsi
movq 0x10(%rax,%rdi,8), %rdx
movq %rbx, %rdi
callq 0x2c78
movq 0x30(%rbx), %rax
movq 0x8(%r15), %rcx
movslq 0x10(%rcx), %rcx
leaq (%rcx,%rcx,2), %rdx
movb $0x0, (%rax,%rdx,8)
leaq 0x40(%rbx), %rdi
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rsi
addq $0x4, %rsi
callq 0x3502
movq 0x8(%r15), %rax
movl 0x10(%rax), %eax
leaq -0x1c(%rbp), %r15
movl %eax, (%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3036
movq 0x18(%rbx), %r14
movl $0x18, %edi
callq 0x21b0
movl (%r15), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2050
incq 0x28(%rbx)
movl (%r15), %r14d
jmp 0x28e7
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::AllocatePage(PageDescriptor)
char* BufferManager::AllocatePage(PageDescriptor pd) {
	auto slot = hashTable.find(pd);
	if(slot!=hashTable.end()) {
		// error page already in buffers
		throw BufferManagerException("BufferManagerException : Page to be allocated already in buffer");
	}
	else {
		// page not in buffers
		// find a suitable slot to load it
		int slotNo = FindSlot();
		if (slotNo==-1) throw NoBufferSpaceException(); //error no free slot could be obtained 
		// insert into hashTable the corresponding slot
		hashTable.insert(make_pair(pd,slotNo));
		// initialize the rest of Frame elements
		InitializeBuffer(pd,slotNo);
		return buffers[slotNo].data;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq -0x20(%rbp), %rax
movq %rsi, (%rax)
leaq 0x40(%rdi), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x319a
testq %rax, %rax
jne 0x29e0
movq %rbx, %rdi
callq 0x27de
cmpl $-0x1, %eax
je 0x2a08
movl %eax, %r15d
movq -0x20(%rbp), %rax
leaq -0x30(%rbp), %rsi
movq %rax, (%rsi)
movl %r15d, 0x8(%rsi)
movq %r14, %rdi
callq 0x323c
movq -0x20(%rbp), %rax
movq 0x30(%rbx), %rcx
movslq %r15d, %rdx
leaq (%rdx,%rdx,2), %rdx
movq %rax, 0x4(%rcx,%rdx,8)
movw $0x100, (%rcx,%rdx,8)   # imm = 0x100
movq 0x10(%rcx,%rdx,8), %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20f0
leaq 0x52e7(%rip), %rcx      # 0x7cd8
movq %rcx, (%rax)
leaq 0x264f(%rip), %rcx      # 0x504a
movq %rcx, 0x8(%rax)
leaq 0x5282(%rip), %rsi      # 0x7c88
jmp 0x2a23
movl $0x8, %edi
callq 0x20f0
leaq 0x5297(%rip), %rcx      # 0x7cb0
movq %rcx, (%rax)
leaq 0x524d(%rip), %rsi      # 0x7c70
movq 0x55b6(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::UnpinPage(PageDescriptor)
bool BufferManager::UnpinPage(PageDescriptor pd) {
	auto slot = hashTable.find(pd); //find slot 
	if(slot==hashTable.end()) {
		//error page not in buffers
		return false;
	}
	int slotNo = slot->second;
	if(!buffers[slotNo].pinned) {
		//error page unpinned
		return false;
	}
	buffers[slotNo].pinned = false; //set unpinned
	// set page as MRU
	usedList.remove(slotNo); 
	usedList.push_front(slotNo); // put at front
	return true;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq -0x30(%rbp), %rax
movq %rsi, (%rax)
addq $0x40, %rdi
movq %rax, %rsi
callq 0x319a
testq %rax, %rax
je 0x2b49
movslq 0x10(%rax), %rcx
movl %ecx, -0x24(%rbp)
movq 0x30(%rbx), %rax
leaq (%rcx,%rcx,2), %rcx
movb 0x1(%rax,%rcx,8), %r14b
cmpb $0x1, %r14b
jne 0x2b4c
leaq (%rax,%rcx,8), %rax
incq %rax
movb $0x0, (%rax)
leaq 0x18(%rbx), %rdi
leaq -0x24(%rbp), %r15
movq %r15, %rsi
callq 0x3036
movq 0x18(%rbx), %r12
movl $0x18, %edi
callq 0x21b0
movl (%r15), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x2050
incq 0x28(%rbx)
jmp 0x2b4c
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::FlushPages(int)
bool BufferManager::FlushPages(int fd) {
	// do a linear scan for all pages belonging to this file
	for(int i=0;i<numPages;i++) {
		if(find(usedList.begin(),usedList.end(),i)==usedList.end()) continue; // skip free slots
		if(buffers[i].pageDescriptor.fd != fd) continue;
		//write back page if dirty
		if(buffers[i].dirty) {
			bool _res = WritePage(PageDescriptor(fd,buffers[i].pageDescriptor.pagenum),buffers[i].data);
			if(!_res) return false;
			buffers[i].dirty = false;
		}
		//remove slot from hashTable and usedList and add to free list
		hashTable.erase(PageDescriptor(fd,buffers[i].pageDescriptor.pagenum));
		usedList.remove(i);
		freeList.push_front(i);
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x0, -0x2c(%rbp)
movl 0x38(%rdi), %r8d
movb $0x1, %al
testl %r8d, %r8d
jle 0x2c64
movl %esi, %r14d
movq %rdi, %r15
leaq 0x18(%rdi), %r12
movl %esi, %eax
movq %rax, -0x40(%rbp)
leaq 0x40(%rdi), %r13
xorl %ecx, %ecx
movq (%r12), %rdx
cmpq %r12, %rdx
je 0x2c54
cmpl %ecx, 0x10(%rdx)
je 0x2bb0
movq (%rdx), %rdx
jmp 0x2b9d
cmpq %r12, %rdx
je 0x2c54
movq 0x30(%r15), %rdx
movslq %ecx, %rsi
leaq (%rsi,%rsi,2), %rdi
cmpl %r14d, 0x4(%rdx,%rdi,8)
jne 0x2c54
leaq (%rdx,%rdi,8), %rax
cmpb $0x1, (%rax)
jne 0x2c04
movq 0x10(%rdx,%rdi,8), %rdx
movl 0x8(%rax), %esi
shlq $0x20, %rsi
addq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x2c78
testb %al, %al
je 0x2c73
movq 0x30(%r15), %rdx
movslq -0x2c(%rbp), %rsi
leaq (%rsi,%rsi,2), %rax
movb $0x0, (%rdx,%rax,8)
leaq (%rsi,%rsi,2), %rax
movl 0x8(%rdx,%rax,8), %eax
movl %r14d, -0x34(%rbp)
movl %eax, -0x30(%rbp)
movq %r13, %rdi
leaq -0x34(%rbp), %rsi
callq 0x3502
movq %r12, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x3036
movq (%r15), %rbx
movl $0x18, %edi
callq 0x21b0
movl -0x2c(%rbp), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%r15)
movl -0x2c(%rbp), %ecx
movl 0x38(%r15), %r8d
incl %ecx
movl %ecx, -0x2c(%rbp)
cmpl %r8d, %ecx
jl 0x2b99
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x2c64
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2d48
movq %rdi, %r14
movq %rsi, %rcx
shrq $0x20, %rcx
leaq 0x18(%rdi), %r15
movq 0x18(%rdi), %rdi
movq 0x30(%r14), %rdx
xorl %r12d, %r12d
cmpq %r15, %rdi
je 0x2d3c
movq %rdi, %r8
movl 0x10(%r8), %r9d
cmpq %r9, %r12
je 0x2d25
movq (%r8), %r8
cmpq %r15, %r8
jne 0x2d12
jmp 0x2d3c
cmpq %r15, %r8
je 0x2d3c
leaq (%r12,%r12,2), %r8
cmpl %esi, 0x4(%rdx,%r8,8)
jne 0x2d3c
cmpl %ecx, 0x8(%rdx,%r8,8)
je 0x2d57
incq %r12
movl %r12d, -0x24(%rbp)
cmpq %rax, %r12
jne 0x2d0a
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x1, (%rdx,%r8,8)
jne 0x2d81
leaq (%rdx,%r8,8), %rax
movq 0x10(%rax), %rdx
movq %r14, %rdi
callq 0x2c78
testb %al, %al
je 0x2dc2
movq 0x30(%r14), %rax
movslq %r12d, %rcx
leaq (%rcx,%rcx,2), %rcx
movb $0x0, (%rax,%rcx,8)
leaq 0x40(%r14), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3502
leaq -0x24(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3036
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 0x2d48
xorl %ebx, %ebx
jmp 0x2d48
// File: /workspace/github_cpp_makefile_star2_O3/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 0x51f2(%rip), %r14      # 0x7fd0
leaq 0x22a5(%rip), %rsi      # 0x508a
movl $0x10, %edx
movq %r14, %rdi
callq 0x21c0
movl 0x38(%rbx), %esi
movq %r14, %rdi
callq 0x2270
movq %rax, %r15
leaq 0x2294(%rip), %rsi      # 0x509b
movl $0xf, %edx
movq %rax, %rdi
callq 0x21c0
movl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x2270
leaq 0x22c6(%rip), %rsi      # 0x50ec
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
leaq 0x2271(%rip), %rsi      # 0x50ab
movl $0x2d, %edx
movq %r14, %rdi
callq 0x21c0
leaq 0x228b(%rip), %rsi      # 0x50d9
movl $0x15, %edx
movq %r14, %rdi
callq 0x21c0
leaq 0x18(%rbx), %rax
movq 0x18(%rbx), %r15
cmpq %rax, %r15
je 0x2f94
movq %rax, -0x30(%rbp)
movslq 0x10(%r15), %r12
movq 0x5155(%rip), %r13      # 0x7fd0
movq %r13, %rdi
movl %r12d, %esi
callq 0x2270
movl $0x5, %edx
movq %rax, %rdi
leaq 0x225a(%rip), %rsi      # 0x50ef
callq 0x21c0
movl $0x7, %edx
movq %r13, %rdi
leaq 0x224c(%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 0x221a(%rip), %rbx      # 0x50f3
movq %rbx, %rsi
callq 0x21c0
movl $0xc, %edx
movq %r13, %rdi
leaq 0x220d(%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 0x21e5(%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 0x21bb(%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 0x2e70
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3026
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 0x3502
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 0x2fc6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x36f8
andb 0x10(%r15), %al
andb %cl, %al
je 0x3721
cmpl 0xc(%r15), %ebx
jge 0x3713
incl %ebx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x37f0
cmpl $-0x1, (%r14)
je 0x36f8
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x4616(%rip), %rcx      # 0x7d48
movq %rcx, (%rax)
leaq 0x45b4(%rip), %rsi      # 0x7cf0
movq 0x489d(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x37c6
movq %rsi, %r15
movq %rdi, %r14
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rdi)
testl %ebx, %ebx
jle 0x37b8
decl %ebx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x37f0
cmpl $-0x1, (%r14)
je 0x379f
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x4571(%rip), %rcx      # 0x7d48
movq %rcx, (%rax)
leaq 0x450f(%rip), %rsi      # 0x7cf0
movq 0x47f8(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3868
movq %rsi, %r14
cmpb $0x0, 0x10(%rsi)
je 0x3868
movl %edx, %r15d
cmpl %edx, 0xc(%r14)
jle 0x3868
movq %rdi, %rbx
movq (%r14), %rdi
movl 0x14(%r14), %esi
movq %r15, %r12
shlq $0x20, %r12
orq %r12, %rsi
callq 0x26a6
cmpl $-0x2, (%rax)
jne 0x384a
movl %r15d, (%rbx)
addq $0x4, %rax
movq %rax, 0x8(%rbx)
jmp 0x385c
movq (%r14), %rdi
movl 0x14(%r14), %eax
orq %rax, %r12
movq %r12, %rsi
callq 0x2ac6
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20f0
leaq 0x44cf(%rip), %rcx      # 0x7d48
movq %rcx, (%rax)
leaq 0x446d(%rip), %rsi      # 0x7cf0
movq 0x4756(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rsi), %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r12
je 0x3905
movq (%r14), %rdi
movl 0x14(%r14), %esi
movq %r12, %r13
shlq $0x20, %r13
orq %r13, %rsi
callq 0x26a6
movq %rax, %r15
movl (%rax), %eax
movl %eax, 0x8(%r14)
jmp 0x3926
movl 0xc(%r14), %r12d
movq (%r14), %rdi
movl 0x14(%r14), %esi
movq %r12, %r13
shlq $0x20, %r13
orq %r13, %rsi
callq 0x2964
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), %esi
orq %r13, %rsi
callq 0x2a32
movl %r12d, (%rbx)
movq %r15, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x39f9
movq %rdi, %r14
cmpb $0x0, 0x10(%rdi)
je 0x39f9
movl %esi, %r12d
cmpl %esi, 0xc(%r14)
jle 0x39f9
movq (%r14), %rdi
movl 0x14(%r14), %esi
movq %r12, %r15
shlq $0x20, %r15
orq %r15, %rsi
callq 0x26a6
cmpl $-0x2, (%rax)
sete %bl
jne 0x39e7
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 0x2a32
movq (%r14), %rdi
movl 0x14(%r14), %eax
orq %rax, %r15
movq %r15, %rsi
callq 0x2ac6
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3a38
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 0x3a49
movb $0x0, 0x11(%rbx)
movq (%rbx), %rdi
movl 0x14(%rbx), %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2b5c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3a8c
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 0x3aa6
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 0x2ccc
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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, 0x46cc(%rip)      # 0x8188
je 0x3aed
movq %rdi, %rbx
movl $0x1, 0x46bd(%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 0x4272(%rip), %rcx      # 0x7d70
movq %rcx, (%rax)
leaq 0x4200(%rip), %rsi      # 0x7d08
movq 0x44d1(%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_O3/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 0x3bea
movl %eax, %r12d
leaq -0x1030(%rbp), %r13
movl $0x1000, %edx           # imm = 0x1000
movq %r13, %rdi
xorl %esi, %esi
callq 0x2110
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
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 0x3c14
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 0x419d(%rip), %rcx      # 0x7d98
movq %rcx, (%rax)
leaq 0x411b(%rip), %rsi      # 0x7d20
movq 0x43d4(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/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)
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 0x3c9d
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 0x40ea(%rip), %rcx      # 0x7d98
movq %rcx, (%rax)
leaq 0x4068(%rip), %rsi      # 0x7d20
movq 0x4321(%rip), %rdx      # 0x7fe0
movq %rax, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3d0e
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x3a04
testb %al, %al
je 0x3d11
movl 0x14(%rbx), %edi
callq 0x22b0
movb $0x0, 0x10(%rbx)
movq $0x0, (%rbx)
movb $0x1, %al
jmp 0x3d13
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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
movl -0x208(%rbp,%rax), %eax
testb $0x5, %al
jne 0x3e7a
movq %rbx, 0x8(%rbx)
movq %rbx, (%rbx)
movq $0x0, 0x10(%rbx)
testb $0x2, %al
jne 0x3e51
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 0x3e12
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 0x414f(%rip), %rdi      # 0x7fd0
leaq 0x1520(%rip), %rsi      # 0x53a8
movl $0x14, %edx
callq 0x21c0
movq 0x4137(%rip), %rdi      # 0x7fd0
movq %r14, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20e0
xorl %edi, %edi
callq 0x21d0
movq %rax, %r14
jmp 0x3ed2
jmp 0x3eb7
movq %rax, %r14
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x3ed2
movq (%rdi), %r15
callq 0x2180
movq %r15, %rdi
cmpq %rbx, %r15
jne 0x3ec2
leaq -0x228(%rbp), %rdi
callq 0x2070
movq %r14, %rdi
callq 0x2280