LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: godofecht[P]Slow-Feature-Analysis/./Network.cpp
// Function: Network::feedForward(std::vector<double, std::allocator<double>>&)
void Network::feedForward(vector <double> &inputVals)
{
	assert(inputVals.size() == m_layers[0].size());
	// Assign (latch) the input values into the input neurons
	for (unsigned i = 0; i < inputVals.size(); i++) {
		m_layers[0][i].setOutputVal(inputVals[i]);
	}
	// forward propagate
	for (unsigned layerNum = 1; layerNum < m_layers.size(); ++layerNum) {
		Layer &prevLayer = m_layers[layerNum - 1];
		for (unsigned n = 0; n < m_layers[layerNum].size(); n++) {
			m_layers[layerNum][n].feedForward(prevLayer);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x42b0
movq -0x38(%rbp), %rdi
movq %rax, -0x30(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x4260
movq %rax, %rdi
callq 0x3f90
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jne 0x2f88
jmp 0x2fa7
leaq 0xb115(%rip), %rdi      # 0xe0a4
leaq 0xb135(%rip), %rsi      # 0xe0cb
movl $0x7c, %edx
leaq 0xb137(%rip), %rcx      # 0xe0d9
callq 0x2100
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x42b0
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0x300e
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4260
movq %rax, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0x3fb0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0x42d0
movq -0x48(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x2750
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2fae
movl $0x1, -0x18(%rbp)
movq -0x38(%rbp), %rdi
movl -0x18(%rbp), %eax
movq %rax, -0x50(%rbp)
callq 0x4230
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x30be
movq -0x38(%rbp), %rdi
movl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x4260
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x38(%rbp), %rdi
movl -0x24(%rbp), %eax
movq %rax, -0x58(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x4260
movq %rax, %rdi
callq 0x3f90
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0x30ae
movq -0x38(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x4260
movq %rax, %rdi
movl -0x24(%rbp), %eax
movl %eax, %esi
callq 0x3fb0
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x2670
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3053
jmp 0x30b0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3015
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: godofecht[P]Slow-Feature-Analysis/./Network.cpp
// Function: Network::GetWeights() const
vector<double>  Network::GetWeights() const
{
	//this will hold the weights
	vector<double> weights;
	//for each layer
	for (int i = 0; i<m_layers.size()-1; ++i)
	{
		//for each neuron
		for (int j = 0; j<m_layers[i].size(); ++j)
		{
			//for each weight
			for (int k = 0; k<m_layers[i][j].m_outputWeights.size(); ++k)
			{
				weights.push_back(m_layers[i][j].m_outputWeights[k].weight);
			}
		}
	}
	return weights;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x48(%rbp)
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x4340
movl $0x0, -0x18(%rbp)
movq -0x38(%rbp), %rdi
movslq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0x4230
movq %rax, %rcx
movq -0x50(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x32b7
movl $0x0, -0x1c(%rbp)
movq -0x38(%rbp), %rdi
movslq -0x1c(%rbp), %rax
movq %rax, -0x58(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x4360
movq %rax, %rdi
callq 0x3f90
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0x32a7
movl $0x0, -0x20(%rbp)
movq -0x38(%rbp), %rdi
movslq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x4360
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x4380
movq %rax, %rdi
addq $0x10, %rdi
callq 0x3fd0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x3297
movq -0x38(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0x4360
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x4380
movq %rax, %rdi
addq $0x10, %rdi
movslq -0x20(%rbp), %rsi
callq 0x4410
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x43a0
jmp 0x3273
jmp 0x3275
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3203
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x4430
jmp 0x32d4
jmp 0x3299
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x31cf
jmp 0x32a9
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x31a3
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x32ca
movq -0x48(%rbp), %rdi
callq 0x4430
movq -0x40(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x22f0
nopl (%rax)
// File: godofecht[P]Slow-Feature-Analysis/./Network.cpp
// Function: Network::PutWeights(std::vector<double, std::allocator<double>>&)
void Network::PutWeights(vector<double> &weights)
{
	int cWeight = 0;
	//for each layer
	for (int i = 0; i<m_layers.size()-1; ++i)
	{
		//for each neuron
		for (int j = 0; j<m_layers[i].size(); ++j)
		{
			//for each weight
			for (int k = 0; k<m_layers[i][j].m_outputWeights.size(); ++k)
			{
				m_layers[i][j].m_outputWeights[k].weight = weights[cWeight++];
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0x4230
movq %rax, %rcx
movq -0x30(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x341f
movl $0x0, -0x1c(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x1c(%rbp), %rax
movq %rax, -0x38(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x4260
movq %rax, %rdi
callq 0x3f90
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0x340f
movl $0x0, -0x20(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x4260
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3fb0
movq %rax, %rdi
addq $0x10, %rdi
callq 0x3fd0
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0x33ff
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %eax, %rsi
callq 0x42d0
movq -0x28(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movslq -0x18(%rbp), %rsi
callq 0x4260
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3fb0
movq %rax, %rdi
addq $0x10, %rdi
movslq -0x20(%rbp), %rsi
callq 0x3f10
movsd -0x48(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3366
jmp 0x3401
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3332
jmp 0x3411
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3306
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: godofecht[P]Slow-Feature-Analysis/./stats.h
// Function: sum(std::vector<double, std::allocator<double>>)
double sum(vector<double> a)
{
	double s = 0;
	for (int i = 0; i < a.size(); i++)
	{
		s += a[i];
	}
	return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x20(%rbp)
movq %rdi, -0x8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x14(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0x42b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0x3492
movq -0x20(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0x42d0
movsd (%rax), %xmm0
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x344f
movsd -0x10(%rbp), %xmm0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: godofecht[P]Slow-Feature-Analysis/./stats.h
// Function: sqsum(std::vector<double, std::allocator<double>>)
double sqsum(vector<double> a)
{
	double s = 0;
	for (int i = 0; i < a.size(); i++)
	{
		s += pow(a[i], 2);
	}
	return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x20(%rbp)
movq %rdi, -0x8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x14(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0x42b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0x358c
movq -0x20(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0x42d0
movsd (%rax), %xmm0
movl $0x2, %edi
callq 0x4280
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x353f
movsd -0x10(%rbp), %xmm0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: godofecht[P]Slow-Feature-Analysis/./stats.h
// Function: operator-(std::vector<double, std::allocator<double>>, double)
vector<double> operator-(vector<double> a, double b)
{
	vector<double> retvect;
	for (int i = 0; i < a.size(); i++)
	{
		retvect.push_back(a[i] - b);
	}
	return retvect;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rsi, -0x50(%rbp)
movq %rdi, -0x48(%rbp)
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x4340
movl $0x0, -0x20(%rbp)
movq -0x50(%rbp), %rdi
movslq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0x42b0
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0x3763
movq -0x50(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x42d0
movq -0x48(%rbp), %rdi
movsd (%rax), %xmm0
movsd -0x18(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x4310
jmp 0x373f
jmp 0x3741
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x36f4
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x4430
jmp 0x3780
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x3776
movq -0x48(%rbp), %rdi
callq 0x4430
movq -0x40(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x22f0
nopl (%rax)
// File: godofecht[P]Slow-Feature-Analysis/./stats.h
// Function: operator*(std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>)
vector<double> operator*(vector<double> a, vector<double> b)
{
	vector<double> retvect;
	for (int i = 0; i < a.size() ; i++)
	{
		retvect.push_back(a[i] * b[i]);
	}
	return retvect;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdx, -0x58(%rbp)
movq %rsi, -0x50(%rbp)
movq %rdi, -0x48(%rbp)
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x4340
movl $0x0, -0x20(%rbp)
movq -0x50(%rbp), %rdi
movslq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
callq 0x42b0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x384c
movq -0x50(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x42d0
movq -0x58(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movslq -0x20(%rbp), %rsi
callq 0x42d0
movsd -0x68(%rbp), %xmm0
movq -0x48(%rbp), %rdi
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x4310
jmp 0x3828
jmp 0x382a
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x37c7
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x4430
jmp 0x3869
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x385f
movq -0x48(%rbp), %rdi
callq 0x4430
movq -0x40(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x22f0
nopw %cs:(%rax,%rax)
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
cvtsi2sdl -0xc(%rbp), %xmm1
movsd 0x6444(%rip), %xmm0     # 0xe068
mulsd %xmm1, %xmm0
movsd 0x6430(%rip), %xmm1     # 0xe060
mulsd %xmm1, %xmm0
divsd 0x1d0(%rax), %xmm0
callq 0x2050
movsd 0x63e7(%rip), %xmm1     # 0xe030
mulsd %xmm1, %xmm0
movsd 0x6403(%rip), %xmm1     # 0xe058
addsd %xmm1, %xmm0
callq 0x20b0
movq -0x30(%rbp), %rdi
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
addq $0x108, %rdi            # imm = 0x108
callq 0x42f0
movl $0x1, -0x14(%rbp)
movq -0x30(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x1c0(%rcx), %eax
ja 0x7ce9
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
je 0x7cb1
movq -0x30(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x4310
jmp 0x7cdc
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x7cda
movq -0x30(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
movsd 0x6354(%rip), %xmm0     # 0xe020
movsd %xmm0, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x4310
jmp 0x7cdc
jmp 0x7cde
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7c7c
movl -0x10(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: 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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x40(%rbp)
movl -0x10(%rbp), %esi
callq 0x7c00
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x40(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x1c0(%rcx), %eax
jae 0x7d52
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x8930
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7d2c
movq -0x40(%rbp), %rdi
movsd 0x168(%rdi), %xmm0
movsd 0x290(%rdi), %xmm1
movsd 0x158(%rdi), %xmm2
callq 0x8a20
movq -0x40(%rbp), %rdi
movsd %xmm0, 0x168(%rdi)
movsd 0x160(%rdi), %xmm0
movsd 0x290(%rdi), %xmm1
movsd 0x150(%rdi), %xmm2
callq 0x8ab0
movq -0x40(%rbp), %rdi
movsd %xmm0, 0x160(%rdi)
movl -0x14(%rbp), %esi
callq 0x8b40
movq -0x40(%rbp), %rdi
movsd %xmm0, 0x290(%rdi)
movsd 0x290(%rdi), %xmm0
movsd 0x158(%rdi), %xmm1
callq 0x8ba0
movq -0x40(%rbp), %rdi
movsd %xmm0, 0x158(%rdi)
movsd 0x290(%rdi), %xmm0
movsd 0x150(%rdi), %xmm1
callq 0x8be0
movq -0x40(%rbp), %rax
movsd %xmm0, 0x150(%rax)
movl $0x0, -0x1c(%rbp)
movq -0x40(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl 0x1c0(%rcx), %eax
jae 0x7e6a
movq -0x40(%rbp), %rdi
callq 0x7e70
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4260
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x3fb0
movq -0x40(%rbp), %rdi
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %esi
callq 0x8c30
movq -0x40(%rbp), %rdi
movsd %xmm0, -0x38(%rbp)
movq -0x30(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x8da0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7e05
addq $0x40, %rsp
popq %rbp
retq
// File: godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::CalculateDelWeights(int)
double CalculateDelWeights(int i)
    {
        double alphaV = alpha/V;
        double alphaU = alpha/U;

  /*      if(isnan(alphaV))
            alphaV = 0.0f;
        if(isnan(alphaU))
            alphaU = 0.0f;
    */
    
            
        double dely = y-y_bar;
        double delyt = y-y_tilde;
        double hebbian = alphaV * dely * (input_vector[i] - x_bar_vector[i]);
        double antihebbian = -1.0f*(alphaU * delyt * (input_vector[i] - x_tilde_vector[i]));
        del_weight_vector[i] = hebbian + antihebbian;

        return del_weight_vector[i];
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x48(%rbp)
movsd 0x68(%rdi), %xmm0
divsd 0x168(%rdi), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd 0x68(%rdi), %xmm0
divsd 0x160(%rdi), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd 0x290(%rdi), %xmm0
subsd 0x158(%rdi), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x290(%rdi), %xmm0
subsd 0x150(%rdi), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x18(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
addq $0x108, %rdi            # imm = 0x108
movslq -0xc(%rbp), %rsi
callq 0x42d0
movq -0x48(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
addq $0xa8, %rdi
movslq -0xc(%rbp), %rsi
callq 0x42d0
movsd -0x70(%rbp), %xmm1
movsd -0x68(%rbp), %xmm0
movq -0x48(%rbp), %rdi
subsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x20(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
addq $0x108, %rdi            # imm = 0x108
movslq -0xc(%rbp), %rsi
callq 0x42d0
movq -0x48(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
addq $0x90, %rdi
movslq -0xc(%rbp), %rsi
callq 0x42d0
movsd -0x60(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movq -0x48(%rbp), %rdi
subsd (%rax), %xmm0
mulsd %xmm0, %xmm1
movsd 0x52c2(%rip), %xmm0     # 0xe008
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
addq $0xc0, %rdi
movslq -0xc(%rbp), %rsi
callq 0x42d0
movsd -0x50(%rbp), %xmm0
movq -0x48(%rbp), %rdi
movsd %xmm0, (%rax)
addq $0xc0, %rdi
movslq -0xc(%rbp), %rsi
callq 0x42d0
movsd (%rax), %xmm0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: 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
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x48(%rbp)
addq $0x258, %rdi            # imm = 0x258
callq 0x42f0
movq -0x48(%rbp), %rsi
movl -0xc(%rbp), %edx
leaq -0x28(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x8f80
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x8f50
jmp 0x8ee6
leaq -0x28(%rbp), %rdi
callq 0x4430
movq -0x48(%rbp), %rdi
callq 0x7e70
movq -0x48(%rbp), %rsi
movq %rax, %rdi
addq $0x258, %rsi            # imm = 0x258
callq 0x30d0
movq -0x48(%rbp), %rdi
addq $0x258, %rdi            # imm = 0x258
callq 0x9060
movsd (%rax), %xmm0
addq $0x50, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4430
movq -0x30(%rbp), %rdi
callq 0x22f0
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: 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
subq $0x60, %rsp
movq %rdi, -0x48(%rbp)
movq %rdi, %rax
movq %rax, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movb $0x0, -0x15(%rbp)
callq 0x4340
movq -0x48(%rbp), %rdi
callq 0x42f0
movl $0x1, -0x1c(%rbp)
movq -0x50(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl 0x1c0(%rcx), %eax
ja 0x9032
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x900c
movq -0x48(%rbp), %rdi
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x4310
jmp 0x8ff3
jmp 0x9025
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x4430
jmp 0x904f
movq -0x48(%rbp), %rdi
movq $0x0, -0x40(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x4310
jmp 0x9023
jmp 0x9025
jmp 0x9027
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8fbf
movb $0x1, -0x15(%rbp)
testb $0x1, -0x15(%rbp)
jne 0x9045
movq -0x48(%rbp), %rdi
callq 0x4430
movq -0x58(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x22f0
nopl (%rax,%rax)
// File: 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
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movq %rdi, %rax
movq %rax, -0x50(%rbp)
callq 0x35b0
movq -0x38(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x48(%rbp)
callq 0x35b0
movq -0x38(%rbp), %rdi
addq $0x40, %rdi
movq %rdi, -0x40(%rbp)
callq 0x35d0
movq -0x38(%rbp), %rax
movl -0xc(%rbp), %ecx
movl %ecx, 0x38(%rax)
movl $0x1000, 0x3c(%rax)     # imm = 0x1000
movslq -0xc(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x18, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, -0x28(%rbp)
jmp 0x251f
movq -0x30(%rbp), %rax
cmpq $0x0, %rax
je 0x2567
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
imulq $0x18, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x35f0
jmp 0x2552
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %rax
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x58(%rbp)
jne 0x2543
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, 0x30(%rax)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x25f9
movq -0x50(%rbp), %rax
movslq 0x3c(%rax), %rdi
testq %rdi, %rdi
movq $-0x1, %rax
cmovsq %rax, %rdi
callq 0x2030
movq %rax, -0x70(%rbp)
jmp 0x25a3
movq -0x50(%rbp), %rdi
movq -0x70(%rbp), %rdx
movq 0x30(%rdi), %rax
movslq -0x20(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
leaq -0x20(%rbp), %rsi
callq 0x3610
jmp 0x25c7
jmp 0x25c9
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x257a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x25ff
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x21e0
jmp 0x25ff
addq $0x70, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3650
movq -0x48(%rbp), %rdi
callq 0x3670
movq -0x38(%rbp), %rdi
callq 0x3670
movq -0x18(%rbp), %rdi
callq 0x2270
nopw %cs:(%rax,%rax)
// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x268e
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x2681
movq -0x20(%rbp), %rdi
callq 0x2180
jmp 0x2683
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x264b
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x26a9
movq -0x28(%rbp), %rdi
callq 0x2180
movq -0x18(%rbp), %rdi
callq 0x3690
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x3690
movq -0x18(%rbp), %rdi
addq $0x40, %rdi
callq 0x36c0
movq -0x18(%rbp), %rdi
addq $0x40, %rdi
callq 0x3650
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x3670
movq -0x18(%rbp), %rdi
callq 0x3670
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::ReadPage(PageDescriptor, char*)
bool BufferManager::ReadPage(PageDescriptor pd,char *dest) {
	// calculate file offset
	long offset = pd.pagenum*(long)pageSize + FILE_HDR_SIZE;
	lseek(pd.fd,offset,0); // seek to location
	int count = -1;
	count = read(pd.fd, dest, pageSize);
	if(count != pageSize) //read failed
		return false;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rsi, -0xc(%rbp)
movq %rdi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq %rcx, -0x38(%rbp)
movslq -0x8(%rbp), %rax
movslq 0x3c(%rcx), %rcx
imulq %rcx, %rax
addq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %edi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x22c0
movq -0x38(%rbp), %rax
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movl -0xc(%rbp), %edi
movq -0x20(%rbp), %rsi
movslq 0x3c(%rax), %rdx
callq 0x2200
movq -0x38(%rbp), %rcx
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl 0x3c(%rcx), %eax
je 0x2be0
movb $0x0, -0x1(%rbp)
jmp 0x2be4
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nop
// File: 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
subq $0x90, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x70(%rbp)
addq $0x40, %rdi
leaq -0x8(%rbp), %rsi
callq 0x36e0
movq -0x70(%rbp), %rdi
movq %rax, -0x18(%rbp)
addq $0x40, %rdi
callq 0x3740
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3710
testb $0x1, %al
jne 0x2cb0
jmp 0x2d03
movl $0x10, %edi
callq 0x20e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
leaq 0x7383(%rip), %rsi      # 0xa04e
callq 0x3920
jmp 0x2cd2
movq -0x78(%rbp), %rdi
leaq 0xcfa3(%rip), %rsi      # 0xfc80
leaq 0xc8c(%rip), %rdx       # 0x3970
callq 0x2250
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x2130
jmp 0x2dd2
movq -0x70(%rbp), %rdi
callq 0x2940
movl %eax, -0x30(%rbp)
cmpl $-0x1, -0x30(%rbp)
jne 0x2d52
movl $0x8, %edi
callq 0x20e0
movq %rax, %rdi
movq %rdi, -0x80(%rbp)
xorl %esi, %esi
movl $0x8, %edx
callq 0x2100
movq -0x80(%rbp), %rdi
callq 0x38c0
movq -0x80(%rbp), %rdi
leaq 0xcf22(%rip), %rsi      # 0xfc68
leaq 0xbb3(%rip), %rdx       # 0x3900
callq 0x2250
movq -0x70(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x88(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x39d0
movq -0x88(%rbp), %rdi
movl %edx, -0x48(%rbp)
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x3c(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x34(%rbp)
leaq -0x3c(%rbp), %rsi
callq 0x3990
movq -0x70(%rbp), %rdi
movq %rax, -0x60(%rbp)
movb %dl, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x30(%rbp), %edx
movq -0x68(%rbp), %rsi
callq 0x2bf0
movq -0x70(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x2270
nopl (%rax,%rax)
// File: akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::MarkDirty(PageDescriptor)
bool BufferManager::MarkDirty(PageDescriptor pd) {
	auto slot = hashTable.find(pd);
	if(slot==hashTable.end()) {
		//error page not in buffers
		return false;
	}
	int slotNo = slot->second;
	if(!buffers[slotNo].pinned) {
		//error page unpinned
		return false;
	}
	// set page dirty
	buffers[slotNo].dirty=true;
	//make this page MRU in buffers
	usedList.remove(slotNo); 
	usedList.push_front(slotNo); // put at front	
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rsi, -0xc(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq %rdi, -0x38(%rbp)
addq $0x40, %rdi
leaq -0xc(%rbp), %rsi
callq 0x36e0
movq -0x38(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x40, %rdi
callq 0x3740
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3a10
testb $0x1, %al
jne 0x2e2d
jmp 0x2e33
movb $0x0, -0x1(%rbp)
jmp 0x2e9c
leaq -0x20(%rbp), %rdi
callq 0x3770
movq %rax, %rcx
movq -0x38(%rbp), %rax
movl 0x8(%rcx), %ecx
movl %ecx, -0x2c(%rbp)
movq 0x30(%rax), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
testb $0x1, 0x1(%rax)
jne 0x2e64
movb $0x0, -0x1(%rbp)
jmp 0x2e9c
movq -0x38(%rbp), %rdi
movq 0x30(%rdi), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb $0x1, (%rax)
addq $0x18, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x37a0
movq -0x38(%rbp), %rdi
addq $0x18, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x3880
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
subq $0x40, %rsp
movq %rsi, -0xc(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq %rdi, -0x38(%rbp)
addq $0x40, %rdi
leaq -0xc(%rbp), %rsi
callq 0x36e0
movq -0x38(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x40, %rdi
callq 0x3740
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3a10
testb $0x1, %al
jne 0x2efd
jmp 0x2f03
movb $0x0, -0x1(%rbp)
jmp 0x2f6d
leaq -0x20(%rbp), %rdi
callq 0x3770
movq %rax, %rcx
movq -0x38(%rbp), %rax
movl 0x8(%rcx), %ecx
movl %ecx, -0x2c(%rbp)
movq 0x30(%rax), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
testb $0x1, 0x1(%rax)
jne 0x2f34
movb $0x0, -0x1(%rbp)
jmp 0x2f6d
movq -0x38(%rbp), %rdi
movq 0x30(%rdi), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x1(%rax)
addq $0x18, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x37a0
movq -0x38(%rbp), %rdi
addq $0x18, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x3880
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x58(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x3118
movq -0x58(%rbp), %rdi
addq $0x18, %rdi
callq 0x3ac0
movq -0x58(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x18, %rdi
callq 0x3af0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x3a70
movq -0x58(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x18, %rdi
callq 0x3af0
movq %rax, -0x38(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3a40
testb $0x1, %al
jne 0x3009
jmp 0x300e
jmp 0x310a
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x14(%rbp), %eax
je 0x302e
jmp 0x310a
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
testb $0x1, (%rax)
je 0x30b2
movq -0x58(%rbp), %rax
movl -0x14(%rbp), %esi
movq 0x30(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
leaq -0x44(%rbp), %rdi
callq 0x3b20
movq -0x58(%rbp), %rdi
movq 0x30(%rdi), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdx
movq -0x44(%rbp), %rsi
callq 0x3130
andb $0x1, %al
movb %al, -0x39(%rbp)
testb $0x1, -0x39(%rbp)
jne 0x309c
movb $0x0, -0x1(%rbp)
jmp 0x311c
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x40, %rcx
movq %rcx, -0x60(%rbp)
movl -0x14(%rbp), %esi
movq 0x30(%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
leaq -0x4c(%rbp), %rdi
callq 0x3b20
movq -0x60(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
callq 0x3b40
movq -0x58(%rbp), %rdi
addq $0x18, %rdi
leaq -0x18(%rbp), %rsi
callq 0x37a0
movq -0x58(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3880
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2f9e
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::WritePage(PageDescriptor, char*)
bool BufferManager::WritePage(PageDescriptor pd,char *src) {
	// calculate file offset
	long offset = pd.pagenum*(long)pageSize + FILE_HDR_SIZE;
	lseek(pd.fd,offset,0); // seek to location
	if(write(pd.fd,src,pageSize)!=pageSize) //write failed
		return false;
	return true;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rsi, -0xc(%rbp)
movq %rdi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movslq -0x8(%rbp), %rax
movslq 0x3c(%rcx), %rcx
imulq %rcx, %rax
addq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %edi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x22c0
movq -0x30(%rbp), %rax
movl -0xc(%rbp), %edi
movq -0x20(%rbp), %rsi
movslq 0x3c(%rax), %rdx
callq 0x2080
movq -0x30(%rbp), %rcx
movslq 0x3c(%rcx), %rcx
cmpq %rcx, %rax
je 0x3197
movb $0x0, -0x1(%rbp)
jmp 0x319b
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
subq $0x60, %rsp
movq %rsi, -0xc(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x58(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x330e
movq -0x58(%rbp), %rdi
addq $0x18, %rdi
callq 0x3ac0
movq -0x58(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x18, %rdi
callq 0x3af0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x3a70
movq -0x58(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x18, %rdi
callq 0x3af0
movq %rax, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3a40
testb $0x1, %al
jne 0x323a
jmp 0x323f
jmp 0x3300
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rdi
movslq -0x1c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq -0xc(%rbp), %rsi
callq 0x3b70
testb $0x1, %al
jne 0x3268
jmp 0x3300
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
testb $0x1, (%rax)
je 0x32cf
movq -0x58(%rbp), %rdi
movq -0xc(%rbp), %rax
movq %rax, -0x4c(%rbp)
movq 0x30(%rdi), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdx
movq -0x4c(%rbp), %rsi
callq 0x3130
andb $0x1, %al
movb %al, -0x41(%rbp)
testb $0x1, -0x41(%rbp)
jne 0x32b9
movb $0x0, -0x1(%rbp)
jmp 0x3312
movq -0x58(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movq -0x58(%rbp), %rdi
addq $0x40, %rdi
leaq -0xc(%rbp), %rsi
callq 0x3b40
movq -0x58(%rbp), %rdi
addq $0x18, %rdi
leaq -0x1c(%rbp), %rsi
callq 0x37a0
movq -0x58(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x3880
jmp 0x330e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x31cf
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x3c20
xorb $-0x1, %al
testb $0x1, %al
jne 0x3559
jmp 0x35aa
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x3c40
movq -0x18(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xc(%rbp)
addq $0x18, %rdi
callq 0x3c70
movq -0x18(%rbp), %rax
movq %rax, %rdi
addq $0x40, %rdi
movq 0x30(%rax), %rsi
movslq -0xc(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rsi
addq $0x4, %rsi
callq 0x3b40
movq -0x18(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x3880
jmp 0x3544
addq $0x20, %rsp
popq %rbp
retq
// File: 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
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, 0x10(%rax)
movb $0x0, 0x11(%rax)
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
movq $0x0, (%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movb 0x10(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x10(%rax)
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movb 0x11(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x11(%rax)
movq -0x10(%rbp), %rcx
movl 0x14(%rcx), %ecx
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: 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
subq $0x50, %rsp
movq %rdi, -0x40(%rbp)
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0x6740
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x6c10
testb $0x1, %al
jne 0x699e
cmpl $-0x1, -0x14(%rbp)
je 0x699e
movl $0x8, %edi
callq 0x20e0
movq %rax, %rdi
movq %rdi, -0x48(%rbp)
xorl %esi, %esi
movl $0x8, %edx
callq 0x2100
movq -0x48(%rbp), %rdi
callq 0x73c0
movq -0x48(%rbp), %rdi
leaq 0x9356(%rip), %rsi      # 0xfce8
leaq 0xa67(%rip), %rdx       # 0x7400
callq 0x2250
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x30(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0xc(%rcx), %eax
jg 0x69ef
movq -0x30(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x28(%rbp), %rdi
callq 0x6b20
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, (%rdi)
movq -0x20(%rbp), %rax
movq %rax, 0x8(%rdi)
callq 0x6820
cmpl $-0x1, %eax
je 0x69e2
jmp 0x69ef
jmp 0x69e4
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x69a7
movq -0x38(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
subq $0x50, %rsp
movq %rdi, -0x40(%rbp)
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movl -0x14(%rbp), %esi
callq 0x6c10
testb $0x1, %al
jne 0x6abb
movq -0x30(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0xc(%rcx), %eax
je 0x6abb
movl $0x8, %edi
callq 0x20e0
movq %rax, %rdi
movq %rdi, -0x48(%rbp)
xorl %esi, %esi
movl $0x8, %edx
callq 0x2100
movq -0x48(%rbp), %rdi
callq 0x73c0
movq -0x48(%rbp), %rdi
leaq 0x9239(%rip), %rsi      # 0xfce8
leaq 0x94a(%rip), %rdx       # 0x7400
callq 0x2250
movq -0x40(%rbp), %rdi
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
callq 0x6740
cmpl $0x0, -0x14(%rbp)
jl 0x6b0f
movq -0x30(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x28(%rbp), %rdi
callq 0x6b20
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, (%rdi)
movq -0x20(%rbp), %rax
movq %rax, 0x8(%rdi)
callq 0x6820
cmpl $-0x1, %eax
je 0x6b02
jmp 0x6b0f
jmp 0x6b04
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6acd
movq -0x38(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
subq $0x60, %rsp
movq %rdi, -0x48(%rbp)
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x6740
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x6c10
testb $0x1, %al
jne 0x6b98
movl $0x8, %edi
callq 0x20e0
movq %rax, %rdi
movq %rdi, -0x50(%rbp)
xorl %esi, %esi
movl $0x8, %edx
callq 0x2100
movq -0x50(%rbp), %rdi
callq 0x73c0
movq -0x50(%rbp), %rdi
leaq 0x915c(%rip), %rsi      # 0xfce8
leaq 0x86d(%rip), %rdx       # 0x7400
callq 0x2250
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x58(%rbp)
movl 0x14(%rax), %esi
movl -0x14(%rbp), %edx
leaq -0x28(%rbp), %rdi
callq 0x3b20
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2700
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $-0x2, (%rax)
jne 0x6beb
movq -0x48(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rcx
addq $0x4, %rcx
movq %rcx, 0x8(%rax)
jmp 0x6bf7
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x6c50
movq -0x40(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)