LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/scope.cpp
// Function: scope::addSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, scopeValue)
bool scope::addSymbol(string identifier, bool global, scopeValue value){
	map<string, scopeValue>::iterator it;
	it = localTable.find(identifier);
	if(it != localTable.end()) return false;
	else{
		if(value.type != TYPE_PROCEDURE){
			value.FPoffset = totalBytes;
			if( value.size > 0 ) totalBytes += value.size;
			else totalBytes += 1;
		}
		
		if(global) globalTable[identifier] = value;
		localTable[identifier] = value;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r12
leaq 0x30(%rdi), %r15
movq %r15, %rdi
callq 0xf4a0
leaq 0x38(%r12), %rcx
cmpq %rcx, %rax
je 0xeaac
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x11e, (%rbx)          # imm = 0x11E
je 0xead7
movl 0x80(%r12), %eax
movl %eax, 0x44(%rbx)
movl 0x4(%rbx), %ecx
cmpl $0x2, %ecx
movl $0x1, %edx
cmovgel %ecx, %edx
addl %eax, %edx
movl %edx, 0x80(%r12)
testb %bpl, %bpl
je 0xeaf2
movq %r12, %rdi
movq %r14, %rsi
callq 0xf128
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf1a4
movq %r15, %rdi
movq %r14, %rsi
callq 0xf128
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf1a4
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/scope.cpp
// Function: scope::checkSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
bool scope::checkSymbol(string identifier, bool global){
	map<string, scopeValue>::iterator it;
	if(global){
		it = globalTable.find(identifier);
		if( it != globalTable.end() ) return true;
		else return false;
	}
	else{
		it = localTable.find(identifier);
		if( it != localTable.end() ) return true;
		else return false;
	}
}

// Assembly:
pushq %rbx
leaq 0x30(%rdi), %rax
leaq 0x38(%rdi), %rcx
leaq 0x8(%rdi), %rbx
testl %edx, %edx
cmoveq %rax, %rdi
cmoveq %rcx, %rbx
callq 0xf4a0
cmpq %rbx, %rax
setne %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/scope.cpp
// Function: scope::getSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
scopeValue scope::getSymbol(string identifier){
	map<string, scopeValue>::iterator it;
	it = localTable.find(identifier);
	if(it != localTable.end())
		return it->second;
	else{
		scopeValue nullVal;
		nullVal.type = T_UNKNOWN;
		vector<scopeValue> nullVector;
		nullVal.arguments = nullVector;
		return nullVal;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x30(%rsi), %rdi
movq %rdx, %rsi
callq 0xf4a0
addq $0x38, %r15
cmpq %r15, %rax
je 0xeb96
movq %rax, %r14
movq 0x40(%rax), %rax
movq %rax, (%rbx)
leaq 0x8(%rbx), %r15
movq %r14, %rsi
addq $0x48, %rsi
movq %r15, %rdi
callq 0xdfee
leaq 0x20(%rbx), %rdi
leaq 0x30(%rbx), %rax
movq %rax, 0x20(%rbx)
movq 0x60(%r14), %rsi
movq 0x68(%r14), %rdx
addq %rsi, %rdx
callq 0x3bac
movq 0x80(%r14), %rax
movq %rax, 0x40(%rbx)
jmp 0xebd4
leaq 0x8(%rbx), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
xorl %eax, %eax
movq %rax, 0x18(%rbx)
leaq 0x30(%rbx), %rcx
movq %rcx, 0x20(%rbx)
movq %rax, 0x28(%rbx)
movb $0x0, 0x30(%rbx)
movl $0x15e, (%rbx)          # imm = 0x15E
movq %rsp, %rsi
movq %rax, 0x10(%rsi)
movaps %xmm0, (%rsi)
callq 0xf1e2
movq %rsp, %rdi
callq 0xdda4
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rsp, %rdi
callq 0xdda4
movq %rbx, %rdi
callq 0xdd7a
jmp 0xec01
movq %rax, %r14
movq %r15, %rdi
callq 0xdda4
movq %r14, %rdi
callq 0x2330
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/scopeTracker.cpp
// Function: scopeTracker::newScope()
void scopeTracker::newScope(){
	if(curPtr != nullptr){
		//Add procedure scope
		tmpPtr = curPtr;
		curPtr = new scope(false);
		curPtr->prevScope = tmpPtr;
	}
	else{
		//Add program scope
		curPtr = new scope(true);
		curPtr->prevScope = tmpPtr;
		outermost = curPtr;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0xfa98
movq %rax, 0x8(%r14)
movl $0x90, %edi
callq 0x21f0
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
callq 0xe990
movq %rbx, (%r14)
movq 0x8(%r14), %rax
movq %rax, 0x88(%rbx)
jmp 0xfac4
movl $0x90, %edi
callq 0x21f0
movq %rax, %rbx
movq %rax, %rdi
movl $0x1, %esi
callq 0xe990
movq %rbx, (%r14)
movq 0x8(%r14), %rax
movq %rax, 0x88(%rbx)
movq %rbx, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
jmp 0xface
movq %rax, %r14
movl $0x90, %esi
movq %rbx, %rdi
callq 0x2200
movq %r14, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/scopeTracker.cpp
// Function: scopeTracker::exitScope()
void scopeTracker::exitScope(){
	if(curPtr != nullptr){
		if(debug) curPtr->printScope();
		tmpPtr = curPtr;
		curPtr = curPtr->prevScope;
		delete tmpPtr;
	}
	else if(debug) cout << "not in a scope!" << endl;
	return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rbx
movb 0x18(%rdi), %al
testq %rbx, %rbx
je 0xfb31
movq %rdi, %r14
testb %al, %al
je 0xfb07
movq %rbx, %rdi
callq 0xec0a
movq (%r14), %rbx
movq %rbx, 0x8(%r14)
movq 0x88(%rbx), %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0xea40
movl $0x90, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2200
testb %al, %al
je 0xfb7e
movq 0x1249c(%rip), %rbx     # 0x21fd8
leaq 0xae3b(%rip), %rsi      # 0x1a97e
movl $0xf, %edx
movq %rbx, %rdi
callq 0x2230
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2140
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/scopeTracker.cpp
// Function: scopeTracker::addSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, scopeValue, bool)
bool scopeTracker::addSymbol(string identifier, scopeValue value, bool global){
	if(curPtr != nullptr){
		if(!curPtr->checkSymbol(identifier, false)){
			curPtr->addSymbol(identifier, global, value);
			return true;
		}
		else return false;
	}
	else return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq (%rdi), %r13
testq %r13, %r13
je 0xfbf7
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl %ecx, 0xc(%rsp)
leaq 0x40(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rsi), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
callq 0x3bac
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xeb08
movl %eax, %ebp
movq 0x30(%rsp), %rdi
cmpq %rbx, %rdi
je 0xfbf2
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bpl, %bpl
je 0xfbfe
xorl %ebx, %ebx
jmp 0xfcb2
movq (%r12), %r12
leaq 0x20(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x3bac
movq (%r14), %rax
leaq 0x58(%rsp), %r15
movq %rax, -0x8(%r15)
leaq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0xdfee
leaq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
addq %rsi, %rdx
callq 0x3bac
movq 0x40(%r14), %rax
leaq 0x50(%rsp), %rcx
movq %rax, 0x40(%rcx)
movzbl 0xc(%rsp), %edx
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0xea78
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0xfc91
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq %r15, %rdi
callq 0xdda4
movq 0x10(%rsp), %rdi
movb $0x1, %bl
cmpq %rbp, %rdi
je 0xfcb2
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0xdd7a
jmp 0xfce5
movq %rax, %r14
movq %r15, %rdi
callq 0xdda4
jmp 0xfce5
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfcfb
movq (%rbp), %rsi
incq %rsi
callq 0x2200
movq %r14, %rdi
callq 0x2330
movq %rax, %r14
movq 0x30(%rsp), %rdi
movq %rbx, %rbp
cmpq %rbx, %rdi
jne 0xfcef
jmp 0xfcfb
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/scopeTracker.cpp
// Function: scopeTracker::prevAddSymbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, scopeValue, bool)
bool scopeTracker::prevAddSymbol(string identifier, scopeValue value, bool global){
	scope* prevPtr = curPtr->prevScope;
	if(prevPtr != nullptr){
		if(!prevPtr->checkSymbol(identifier, false)){
			prevPtr->addSymbol(identifier, global, value);
			return true;
		}
		else return false;
	}
	else return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq (%rdi), %rax
movq 0x88(%rax), %r14
testq %r14, %r14
je 0xfd8c
movq %rdx, %r15
movq %rsi, %r12
movl %ecx, 0xc(%rsp)
leaq 0x40(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rsi), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %r13
movq %r13, %rdi
callq 0x3bac
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0xeb08
movl %eax, %ebp
movq 0x30(%rsp), %rdi
cmpq %rbx, %rdi
je 0xfd87
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bpl, %bpl
je 0xfd93
xorl %ebx, %ebx
jmp 0xfe46
leaq 0x20(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x3bac
movq (%r15), %rax
leaq 0x58(%rsp), %r12
movq %rax, -0x8(%r12)
leaq 0x8(%r15), %rsi
movq %r12, %rdi
callq 0xdfee
leaq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
callq 0x3bac
movq 0x40(%r15), %rax
leaq 0x50(%rsp), %rcx
movq %rax, 0x40(%rcx)
movzbl 0xc(%rsp), %edx
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0xea78
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0xfe25
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq %r12, %rdi
callq 0xdda4
movq 0x10(%rsp), %rdi
movb $0x1, %bl
cmpq %rbp, %rdi
je 0xfe46
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0xdd7a
jmp 0xfe79
movq %rax, %r14
movq %r12, %rdi
callq 0xdda4
jmp 0xfe79
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0xfe8f
movq (%rbp), %rsi
incq %rsi
callq 0x2200
movq %r14, %rdi
callq 0x2330
movq %rax, %r14
movq 0x30(%rsp), %rdi
movq %rbx, %rbp
cmpq %rbx, %rdi
jne 0xfe83
jmp 0xfe8f
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::~codeGenerator()
codeGenerator::~codeGenerator(){
	if( testOutFile() ){
		buildBranchTable();
		buildHeap();
		fprintf( oFile, "\nPROGRAM_END:\n" );
		footer();
		fclose( oFile );
	}
	else if( oFile != nullptr ){ 
			fclose( oFile );
	//Remove the generated file if there was an error
	}
	if( ContinueToGenerate == false && outputName.compare("") != 0 ) remove(outputName.c_str());
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x308(%rdi), %r14
testq %r14, %r14
je 0x107c3
movq %r14, %rdi
callq 0x2370
testl %eax, %eax
je 0x10782
movq %r14, %rdi
jmp 0x107be
movq %rbx, %rdi
callq 0x10964
movq %rbx, %rdi
callq 0x109be
movq 0x308(%rbx), %rcx
leaq 0xa246(%rip), %rdi      # 0x1a9e6
movl $0xe, %esi
movl $0x1, %edx
callq 0x2390
movq %rbx, %rdi
callq 0x10af4
movq 0x308(%rbx), %rdi
callq 0x21e0
cmpb $0x0, 0x330(%rbx)
jne 0x107ee
leaq 0x310(%rbx), %r14
leaq 0xa183(%rip), %rsi      # 0x1a95d
movq %r14, %rdi
callq 0x20a0
testl %eax, %eax
je 0x107ee
movq (%r14), %rdi
callq 0x2350
movq 0x310(%rbx), %rdi
leaq 0x320(%rbx), %rax
cmpq %rax, %rdi
je 0x1080c
movq (%rax), %rsi
incq %rsi
callq 0x2200
leaq 0x2b8(%rbx), %rdi
callq 0x1704a
leaq 0x250(%rbx), %rdi
callq 0x170a2
movq 0x230(%rbx), %rdi
leaq 0x240(%rbx), %rax
cmpq %rax, %rdi
je 0x10842
movq (%rax), %rsi
incq %rsi
callq 0x2200
leaq 0x1d0(%rbx), %rdi
callq 0xddd4
leaq 0x180(%rbx), %rdi
callq 0xddd4
leaq 0x130(%rbx), %rdi
callq 0xddd4
leaq 0xf0(%rbx), %rdi
callq 0x1724e
movq 0xc8(%rbx), %rdi
leaq 0xd8(%rbx), %rax
cmpq %rax, %rdi
je 0x10890
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq 0xa8(%rbx), %rdi
leaq 0xb8(%rbx), %rax
cmpq %rax, %rdi
je 0x108ae
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq 0x88(%rbx), %rdi
leaq 0x98(%rbx), %rax
cmpq %rax, %rdi
je 0x108cc
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq 0x68(%rbx), %rdi
leaq 0x78(%rbx), %rax
cmpq %rax, %rdi
je 0x108e4
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq 0x48(%rbx), %rdi
leaq 0x58(%rbx), %rax
cmpq %rax, %rdi
je 0x108fc
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq 0x28(%rbx), %rdi
leaq 0x38(%rbx), %rax
cmpq %rax, %rdi
je 0x10914
movq (%rax), %rsi
incq %rsi
callq 0x2200
movq 0x8(%rbx), %rdi
addq $0x18, %rbx
cmpq %rbx, %rdi
je 0x10933
movq (%rbx), %rsi
incq %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2200
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x3aac
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::buildBranchTable()
bool codeGenerator::buildBranchTable(){
	fprintf( oFile, "\n   goto PROGRAM_END;\n" );
	fprintf( oFile, "\nBRANCH_TABLE:\n" );
	if( !branchTable.empty() ){
		createEntry(0, branchTable.size() - 1);
	}
	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x308(%rdi), %rcx
leaq 0xaa92(%rip), %rdi      # 0x1b408
movl $0x16, %esi
movl $0x1, %edx
callq 0x2390
movq 0x308(%rbx), %rcx
leaq 0xaa8c(%rip), %rdi      # 0x1b41f
movl $0xf, %esi
movl $0x1, %edx
callq 0x2390
movq 0x118(%rbx), %rdx
testq %rdx, %rdx
je 0x109ba
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x16c2a
movb $0x1, %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::buildHeap()
void codeGenerator::buildHeap(){
	fprintf( oFile, "\nBUILD_HEAP:\n" );
	while( string_heap.size() > 0 ){
		stringEntry = string_heap.front();
		string_heap.pop();
		fprintf( oFile, "   strcpy((char*)&MM[%d], %s);\n", stringEntry.MMlocation, stringEntry.contents.c_str() );
		fprintf( oFile, "   TP_reg = %d;\n", stringEntry.MMlocation );
	}
	fprintf( oFile, "   goto Label_0_Begin_Program;\n" );
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x308(%rdi), %rcx
leaq 0xa4b3(%rip), %rdi      # 0x1ae8d
movl $0xd, %esi
movl $0x1, %edx
callq 0x2390
leaq 0x250(%rbx), %r14
leaq 0x230(%rbx), %r15
movabsq $0x3333333333333333, %rbp # imm = 0x3333333333333333
leaq 0xa493(%rip), %r12      # 0x1ae9b
leaq 0xa4ac(%rip), %r13      # 0x1aebb
movq 0x298(%rbx), %rax
movq %rax, %rcx
subq 0x278(%rbx), %rcx
sarq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
leaq (%rcx,%rcx,2), %rax
movq 0x280(%rbx), %rcx
subq 0x288(%rbx), %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
leaq (%rcx,%rax,4), %rax
movq 0x260(%rbx), %rsi
movq 0x270(%rbx), %rcx
subq %rsi, %rcx
sarq $0x3, %rcx
imulq %rbp, %rcx
cmpq %rcx, %rax
je 0x10ac8
movl (%rsi), %eax
movl %eax, 0x228(%rbx)
addq $0x8, %rsi
movq %r15, %rdi
callq 0x2120
movq %r14, %rdi
callq 0x17ab0
movq 0x308(%rbx), %rdi
movl 0x228(%rbx), %edx
movq 0x230(%rbx), %rcx
movq %r12, %rsi
xorl %eax, %eax
callq 0x22a0
movq 0x308(%rbx), %rdi
movl 0x228(%rbx), %edx
movq %r13, %rsi
xorl %eax, %eax
callq 0x22a0
jmp 0x10a0f
movq 0x308(%rbx), %rcx
leaq 0xa3f6(%rip), %rdi      # 0x1aecc
movl $0x1f, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2390
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::attachOutputFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool codeGenerator::attachOutputFile(string filename){
	outputName = filename;
	oFile = fopen( filename.c_str(), "w" );
	if( testOutFile() ){
		header();
		return true;
	}
	else{
		perror("Failed to open output file for writing.");
		fclose( oFile );
		ContinueToGenerate = false;
		return false;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x310, %rdi            # imm = 0x310
callq 0x2120
movq (%r14), %rdi
leaq 0x9e91(%rip), %rsi      # 0x1a9f5
callq 0x2250
movq %rax, 0x308(%rbx)
testq %rax, %rax
je 0x10b93
movq %rax, %rdi
callq 0x2370
testl %eax, %eax
jne 0x10b93
movq %rbx, %rdi
callq 0x10bb6
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9e5d(%rip), %rdi      # 0x1a9f7
callq 0x21a0
movq 0x308(%rbx), %rdi
callq 0x21e0
movb $0x0, 0x330(%rbx)
xorl %eax, %eax
jmp 0x10b8b
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::comment(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void codeGenerator::comment(string str, bool multi_line){
	if( multi_line ){
		fprintf( oFile, "\n" );
		fprintf( oFile, "// %s\n", str.c_str() );
		fprintf( oFile, "\n" );
	}
	else fprintf( oFile, "// %s\n", str.c_str() );
	return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq 0x308(%rdi), %rax
testl %edx, %edx
je 0x11072
movq %rdi, %rbx
movl $0xa, %edi
movq %rax, %rsi
callq 0x2280
movq 0x308(%rbx), %rdi
movq (%r14), %rdx
leaq 0x99cc(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq 0x308(%rbx), %rsi
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2280
movq (%r14), %rdx
leaq 0x99a3(%rip), %rsi      # 0x1aa1f
movq %rax, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x22a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::typeString[abi:cxx11](int)
string codeGenerator::typeString( int type ){
	switch( type ){
		case TYPE_CHAR: 
			return "char";
		case TYPE_INTEGER:
			return "int";
		case TYPE_FLOAT:
			return"float";
		case TYPE_BOOL:
			return "int";
		case TYPE_STRING: 
			return "char*";
		default: 
			return "ERROR:";
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
addl $0xfffffef6, %edx       # imm = 0xFFFFFEF6
cmpl $0x4, %edx
ja 0x119ba
leaq 0x901f(%rip), %rax      # 0x1a990
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x93db(%rip), %rsi      # 0x1ad5c
leaq 0x93d7(%rip), %rdx      # 0x1ad5f
jmp 0x119c8
leaq 0x93c6(%rip), %rsi      # 0x1ad57
leaq 0x93c3(%rip), %rdx      # 0x1ad5b
jmp 0x119c8
leaq 0x93bf(%rip), %rsi      # 0x1ad60
leaq 0x93bd(%rip), %rdx      # 0x1ad65
jmp 0x119c8
leaq 0x93b5(%rip), %rsi      # 0x1ad66
leaq 0x93b3(%rip), %rdx      # 0x1ad6b
jmp 0x119c8
leaq 0x93ab(%rip), %rsi      # 0x1ad6c
leaq 0x93aa(%rip), %rdx      # 0x1ad72
movq %rbx, %rdi
callq 0x3c42
movq %rbx, %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::pushStack(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char, int)
void codeGenerator::pushStack( string value, char stackID, int type ){
	if( !ShouldGenerate() ) return;
	switch( stackID ){
		case 'L':
			leftStack.push( value );
			break;
		case 'E':
			exprStack.push( value );
			if( type == TYPE_FLOAT ) freg_in_use++;
			else ireg_in_use++;
			break;
		case 'R':
			rightStack.push( value );
			break;
		default:
			cout << "Not a valid expression stack!\n";
			break;
	}
	return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpb $0x1, 0x330(%rdi)
jne 0x11a57
movq %rdi, %rbx
movsbl %dl, %eax
cmpl $0x45, %eax
je 0x11a15
cmpl $0x52, %eax
je 0x11a00
cmpl $0x4c, %eax
jne 0x11a33
addq $0x1d0, %rbx            # imm = 0x1D0
jmp 0x11a07
addq $0x180, %rbx            # imm = 0x180
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x17610
movl %ecx, %ebp
leaq 0x130(%rbx), %rdi
callq 0x17610
cmpl $0x10b, %ebp            # imm = 0x10B
jne 0x11a51
incl 0x124(%rbx)
jmp 0x11a57
movq 0x1059e(%rip), %rdi     # 0x21fd8
leaq 0x9332(%rip), %rsi      # 0x1ad73
movl $0x1e, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2230
incl 0x120(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::NegateTopRegisters(int, int)
void codeGenerator::NegateTopRegisters( int type, int size ){
	if( !ShouldGenerate() ) return;
	string reg;
	int i;
	// Ensure size is at least 1 for loops
	if( size == 0 ) size++;
	
	for( i = 0; i < size; i++ ){
		reg = popStack('E', type);
		pushStack( reg, 'L', type );
	}
	for( i = 0; i < size; i++ ){
		reg = popStack('L', type);
		pushStack( reg, 'E', type );
		fprintf( oFile, "   %s = -%s;\n", reg.c_str(), reg.c_str() );
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
cmpb $0x1, 0x330(%rdi)
jne 0x138a3
movl %edx, %r13d
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpl $0x1, %edx
adcl $0x0, %r13d
testl %r13d, %r13d
jle 0x13887
movl %esi, %ebp
movq %rdi, %r14
leaq 0x38(%rsp), %r15
leaq 0x1d0(%rdi), %rax
movq %rax, (%rsp)
leaq 0x48(%rsp), %r12
movl %r13d, %ebx
movq %r12, %rdi
movq %r14, %rsi
movl $0x45, %edx
movl %ebp, %ecx
callq 0x11a5e
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x2270
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x13751
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq %r15, 0x28(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x3bac
cmpb $0x1, 0x330(%r14)
jne 0x13785
movq (%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x17610
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x1379c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
decl %ebx
jne 0x13716
testl %r13d, %r13d
jle 0x13887
leaq 0x78(%rsp), %r15
leaq 0x130(%r14), %rax
movq %rax, (%rsp)
leaq 0x48(%rsp), %r12
leaq 0x68(%rsp), %rbx
movq %r12, %rdi
movq %r14, %rsi
movl $0x4c, %edx
movl %ebp, %ecx
callq 0x11a5e
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x2270
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x13802
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq %r15, 0x68(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3bac
cmpb $0x1, 0x330(%r14)
jne 0x1384a
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x17610
cmpl $0x10b, %ebp            # imm = 0x10B
jne 0x13843
incl 0x124(%r14)
jmp 0x1384a
incl 0x120(%r14)
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x13861
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%r14), %rdi
movq 0x8(%rsp), %rcx
leaq 0x7678(%rip), %rsi      # 0x1aeec
movq %rcx, %rdx
xorl %eax, %eax
callq 0x22a0
decl %r13d
jne 0x137c7
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x138a3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x138ee
movq 0x78(%rsp), %rsi
jmp 0x138db
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x138ee
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x138ee
jmp 0x138eb
jmp 0x138eb
jmp 0x138eb
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1390a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::setProcedurePointers(int)
void codeGenerator::setProcedurePointers( int frameSize ){
	if( !ShouldGenerate() ) return;
	comment( "Set FP and SP using the caller's FP/SP values and the new frame size" );
	fprintf( oFile, "   FP_reg = SP_reg;\n" );
	fprintf( oFile, "   SP_reg = FP_reg + %d;\n", frameSize);
	return;
}

// Assembly:
cmpb $0x1, 0x330(%rdi)
jne 0x16096
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4fc7(%rip), %rsi      # 0x1afdd
leaq 0x5004(%rip), %rdx      # 0x1b021
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3c42
movq 0x308(%r14), %rdi
movq (%r15), %rdx
leaq 0x49e4(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x16057
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%r14), %rcx
leaq 0x4fbd(%rip), %rdi      # 0x1b022
movl $0x14, %esi
movl $0x1, %edx
callq 0x2390
movq 0x308(%r14), %rdi
leaq 0x4fb5(%rip), %rsi      # 0x1b037
movl %ebx, %edx
xorl %eax, %eax
callq 0x22a0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::callProcedure(scopeValue, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void codeGenerator::callProcedure( scopeValue procValue, string id ){
	if( !ShouldGenerate() ) return;
	
	comment( "Call procedure" );
	fprintf( oFile, "   MM[SP_reg] = FP_reg;\n" );
	fprintf( oFile, "   MM[SP_reg + 1] = %d;\n", call_count );
	fprintf( oFile, "   goto %s;\n", procValue.CallLabel.c_str() );
	
	string retLabel = newReturnLabel(id);
	placeLabel( retLabel );
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
cmpb $0x1, 0x330(%rdi)
jne 0x1621b
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x4f83(%rip), %rsi      # 0x1b051
leaq 0x4f8a(%rip), %rdx      # 0x1b05f
leaq 0x60(%rsp), %r12
movq %r12, %rdi
callq 0x3c42
movq 0x308(%rbx), %rdi
movq (%r12), %rdx
leaq 0x492b(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x16111
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%rbx), %rcx
leaq 0x4f41(%rip), %rdi      # 0x1b060
movl $0x18, %esi
movl $0x1, %edx
callq 0x2390
movq 0x308(%rbx), %rdi
movl 0xe8(%rbx), %edx
leaq 0x4f37(%rip), %rsi      # 0x1b079
xorl %eax, %eax
callq 0x22a0
movq 0x308(%rbx), %rdi
movq 0x20(%r15), %rdx
leaq 0x4f37(%rip), %rsi      # 0x1b092
xorl %eax, %eax
callq 0x22a0
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x3bac
movq %rsp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1625a
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x161a7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x3bac
cmpb $0x1, 0x330(%rbx)
jne 0x161e9
movq 0x308(%rbx), %rdi
movq 0x20(%rsp), %rdx
leaq 0x4df5(%rip), %rsi      # 0x1afd7
xorl %eax, %eax
callq 0x22a0
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x16200
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1621b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq -0x10(%r15), %rdi
jmp 0x16242
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x16252
movq (%r15), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::ProcedureReturn()
void codeGenerator::ProcedureReturn(){
	if( !ShouldGenerate() ) return;
	comment( "Procedure return" );
	fprintf( oFile, "   TP_reg = MM[FP_reg + 1];\n" );
	fprintf( oFile, "   FP_reg = MM[FP_reg];\n" );
	fprintf( oFile, "   goto BRANCH_TABLE;\n" );
	return;
}

// Assembly:
cmpb $0x1, 0x330(%rdi)
jne 0x165d4
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4b6a(%rip), %rsi      # 0x1b09f
leaq 0x4b73(%rip), %rdx      # 0x1b0af
movq %rsp, %r14
movq %r14, %rdi
callq 0x3c42
movq 0x308(%rbx), %rdi
movq (%r14), %rdx
leaq 0x44c7(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x16574
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%rbx), %rcx
leaq 0x4b2e(%rip), %rdi      # 0x1b0b0
movl $0x1c, %esi
movl $0x1, %edx
callq 0x2390
movq 0x308(%rbx), %rcx
leaq 0x4b2e(%rip), %rdi      # 0x1b0cd
movl $0x18, %esi
movl $0x1, %edx
callq 0x2390
movq 0x308(%rbx), %rcx
leaq 0x4b2a(%rip), %rdi      # 0x1b0e6
movl $0x16, %esi
movl $0x1, %edx
callq 0x2390
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::condBranch(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void codeGenerator::condBranch( string labelTrue, string labelFalse ){
	if( !ShouldGenerate() ) return;
	string cond = popStack('E', TYPE_BOOL);
	comment("Conditional branch");
	// goto true condition
	fprintf( oFile, "   if( %s ) goto %s;\n", cond.c_str(), labelTrue.c_str() );
	// goto else condition if one exists
	if( labelFalse.compare("") != 0 ) fprintf( oFile, "   goto %s;\n", labelFalse.c_str() );
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpb $0x1, 0x330(%rdi)
jne 0x166e6
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl $0x45, %edx
movl $0x10c, %ecx            # imm = 0x10C
callq 0x11a5e
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4abc(%rip), %rsi      # 0x1b0fd
leaq 0x4ac7(%rip), %rdx      # 0x1b10f
leaq 0x28(%rsp), %rdi
callq 0x3c42
movq 0x308(%r14), %rdi
movq 0x28(%rsp), %rdx
leaq 0x43ba(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x16683
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%r14), %rdi
movq 0x8(%rsp), %rdx
movq (%r15), %rcx
leaq 0x4a77(%rip), %rsi      # 0x1b110
xorl %eax, %eax
callq 0x22a0
leaq 0x42b6(%rip), %rsi      # 0x1a95d
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
je 0x166cb
movq 0x308(%r14), %rdi
movq (%rbx), %rdx
leaq 0x49ce(%rip), %rsi      # 0x1b092
xorl %eax, %eax
callq 0x22a0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x166e6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x16710
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::branch(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void codeGenerator::branch( string label ){
	if( !ShouldGenerate() ) return;
	comment("Unconditional branch");
	fprintf( oFile, "   goto %s;\n", label.c_str() );
	return;
}

// Assembly:
cmpb $0x1, 0x330(%rdi)
jne 0x167ab
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x49df(%rip), %rsi      # 0x1b126
leaq 0x49ec(%rip), %rdx      # 0x1b13a
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3c42
movq 0x308(%r14), %rdi
movq (%r15), %rdx
leaq 0x42b3(%rip), %rsi      # 0x1aa1f
xorl %eax, %eax
callq 0x22a0
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x16788
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x308(%r14), %rdi
movq (%rbx), %rdx
leaq 0x48f9(%rip), %rsi      # 0x1b092
xorl %eax, %eax
callq 0x22a0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::setArgument(scopeValue, bool, int, bool)
void codeGenerator::setArgument( scopeValue value, bool isGlobal, int index, bool indirect ){
	if( !ShouldGenerate() ) return;
	savedArgument.paramType = value.paramType;
	savedArgument.type = value.type;
	savedArgument.size = value.size;
	savedArgument.index = index;
	savedArgument.indirect = indirect;
	savedArgument.offset = value.FPoffset;
	savedArgument.isGlobal = isGlobal;
	savedArgument.set = true;
	return;
}

// Assembly:
cmpb $0x1, 0x330(%rdi)
jne 0x1680f
movl 0x40(%rsi), %eax
movl %eax, 0x2a0(%rdi)
movq (%rsi), %rax
movq %rax, 0x2a4(%rdi)
movl %ecx, 0x2ac(%rdi)
movb %r8b, 0x2b4(%rdi)
movl 0x44(%rsi), %eax
movl %eax, 0x2b0(%rdi)
movb %dl, 0x2b5(%rdi)
movb $0x1, 0x2b6(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::createEntry(int, int)
void codeGenerator::createEntry( int lPos, int uPos ){
	if( lPos == uPos ){
		fprintf( oFile, "   goto %s;\n", ( branchTable[lPos] ).c_str() );
	}
	else{
		int mPos = ( lPos + uPos )/2;
		int key = mPos;
		string branchTrue = branchTableLabelTrue(mPos, true);
		string branchFalse = branchTableLabelTrue(mPos, false);

		fprintf( oFile, "   iReg[0] = %d;\n", key );
		fprintf( oFile, "   iReg[0] = TP_reg > iReg[0];\n" );
		
		fprintf( oFile, "   if( iReg[0] ) goto %s;\n", branchTrue.c_str() );
		fprintf( oFile, "   goto %s;\n", branchFalse.c_str() );
		
		fprintf( oFile, "\n%s:\n", branchTrue.c_str() );
		createEntry( mPos + 1, uPos );
		
		fprintf( oFile, "\n%s:\n", branchFalse.c_str() );
		createEntry( lPos, mPos );
		return;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl %esi, 0x4(%rsp)
cmpl %edx, %esi
jne 0x16c74
movq 0x308(%rbx), %r14
addq $0xf0, %rbx
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x16fe4
movq (%rax), %rdx
leaq 0x442d(%rip), %rsi      # 0x1b092
movq %r14, %rdi
xorl %eax, %eax
callq 0x22a0
jmp 0x16d9c
movl %edx, %r12d
movl %esi, %r14d
leal (%r12,%r14), %eax
movl %eax, %r15d
shrl $0x1f, %r15d
addl %eax, %r15d
sarl %r15d
leaq 0x28(%rsp), %rdi
movl %r15d, %edx
movl $0x1, %ecx
callq 0x16dee
leaq 0x8(%rsp), %rdi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x16dee
movq 0x308(%rbx), %rdi
leaq 0x4775(%rip), %rsi      # 0x1b42f
movl %r15d, %edx
xorl %eax, %eax
callq 0x22a0
movq 0x308(%rbx), %rcx
leaq 0x476f(%rip), %rdi      # 0x1b441
movl $0x1f, %esi
movl $0x1, %edx
callq 0x2390
movq 0x308(%rbx), %rdi
movq 0x28(%rsp), %rdx
leaq 0x476d(%rip), %rsi      # 0x1b461
xorl %eax, %eax
callq 0x22a0
movq 0x308(%rbx), %rdi
movq 0x8(%rsp), %rdx
leaq 0x4384(%rip), %rsi      # 0x1b092
xorl %eax, %eax
callq 0x22a0
movq 0x308(%rbx), %rdi
movq 0x28(%rsp), %rdx
leaq 0x42af(%rip), %rsi      # 0x1afd7
xorl %eax, %eax
callq 0x22a0
leal 0x1(%r15), %esi
movq %rbx, %rdi
movl %r12d, %edx
callq 0x16c2a
movq 0x308(%rbx), %rdi
movq 0x8(%rsp), %rdx
leaq 0x4286(%rip), %rsi      # 0x1afd7
xorl %eax, %eax
callq 0x22a0
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x16c2a
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x16d81
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x16d9c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
jmp 0x16dcb
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x16dcb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x16de6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/em.cc
// Function: initialize_cache(int)
void initialize_cache(int N){
	iterations = 0;
	best_assignment = new int[N];
	best_distortion = 1000000000000000;//infinite	
	for (int i=0; i<N; i++) best_assignment[i] = -1;
	return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
movl $0x0, 0x82fd(%rip)      # 0xc208
movl %edi, %ebx
shlq $0x2, %rbx
testl %edi, %edi
movq $-0x1, %rdi
cmovnsq %rbx, %rdi
callq 0x2030
movq %rax, 0x82ce(%rip)      # 0xc1f8
movabsq $0x430c6bf526340000, %rcx # imm = 0x430C6BF526340000
movq %rcx, 0x82c5(%rip)      # 0xc200
testl %ebp, %ebp
jle 0x3f55
movq %rax, %rdi
movl $0xff, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2130
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/em.cc
// Function: exceed_max_iterations(int, int, int*, double&)
bool exceed_max_iterations(int N, int K, int *assignment, double &distortion){
	iterations++;
	if (iterations>max_iterations){
		distortion = best_distortion;
		for(int n=0; n<N; n++) assignment[n] = best_assignment[n];	
		return true;
	}
	else{
		if (distortion < best_distortion){
			iterations = 0;
			for(int n=0; n<N; n++) best_assignment[n] = assignment[n];	
			best_distortion = distortion;
		}
	}	
	return false;
}

// Assembly:
movl 0x82a6(%rip), %eax      # 0xc208
leal 0x1(%rax), %esi
movl %esi, 0x829d(%rip)      # 0xc208
movl 0x826f(%rip), %esi      # 0xc1e0
cmpl %esi, %eax
jl 0x3fa3
movsd 0x8283(%rip), %xmm0     # 0xc200
movsd %xmm0, (%rcx)
testl %edi, %edi
jle 0x3fe7
movq 0x826c(%rip), %rcx      # 0xc1f8
movl %edi, %edi
xorl %r8d, %r8d
movl (%rcx,%r8,4), %r9d
movl %r9d, (%rdx,%r8,4)
incq %r8
cmpq %r8, %rdi
jne 0x3f91
jmp 0x3fe7
movsd (%rcx), %xmm0
movsd 0x8251(%rip), %xmm1     # 0xc200
ucomisd %xmm0, %xmm1
jbe 0x3fe7
movl $0x0, 0x8249(%rip)      # 0xc208
testl %edi, %edi
jle 0x3fdf
movq 0x822e(%rip), %rcx      # 0xc1f8
movl %edi, %edi
xorl %r8d, %r8d
movl (%rdx,%r8,4), %r9d
movl %r9d, (%rcx,%r8,4)
incq %r8
cmpq %r8, %rdi
jne 0x3fcf
movsd %xmm0, 0x8219(%rip)     # 0xc200
cmpl %esi, %eax
setge %al
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/dists.cc
// Function: euclidean_distance(double*, double*, int, double*, double*, double*, double*)
double euclidean_distance(double *centroid, double *y, int L, double* xt, 
						  double *quality, double *expected_qual, double *expected_freq)
{
	double S = 0;
	double z;
	for(int i=0; i<L; i++){
		z = centroid[i] - quality[i];
		S += z*z;
	}
	return S;
}

// Assembly:
testl %edx, %edx
jle 0x4ea8
movl %edx, %eax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
movsd (%rdi,%rcx,8), %xmm1
subsd (%r8,%rcx,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0x4e8c
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/dists.cc
// Function: kl_distance(double*, double*, int, double*, double*, double*, double*)
double kl_distance(double *centroid, double *p, int L, double* centroid_tilde, 
				   double *quality, double *expected_qual, double *expected_freq)
{
	double total_count = 0;
	for(int i=0; i<L; ++i){
		total_count += quality[i];
	}
	double S = 0;
	for(int i=0; i<L; i++){
		S += quality[i] * log(quality[i]/(total_count * centroid[i]));
	}
	return S;
}

// Assembly:
testl %edx, %edx
jle 0x4f3e
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rdi, %r14
movl %edx, %r15d
xorpd %xmm0, %xmm0
xorl %eax, %eax
addsd (%rbx,%rax,8), %xmm0
incq %rax
cmpq %rax, %r15
jne 0x4ece
xorpd %xmm1, %xmm1
testl %edx, %edx
jle 0x4f31
xorl %r12d, %r12d
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd (%rbx,%r12,8), %xmm2
movsd %xmm2, (%rsp)
movsd (%r14,%r12,8), %xmm1
mulsd %xmm0, %xmm1
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
callq 0x2180
movsd 0x8(%rsp), %xmm1
mulsd (%rsp), %xmm0
addsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
incq %r12
cmpq %r12, %r15
jne 0x4ee6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f42
xorpd %xmm1, %xmm1
movapd %xmm1, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/dists.cc
// Function: symkl_distance(double*, double*, int, double*, double*, double*, double*)
double symkl_distance(double *centroid, double *p, int L, double* centroid_tilde, 
					  double *quality, double *expected_qual, double *expected_freq)
{
	double total_count = 0;
	for(int i=0; i<L; ++i){
		total_count += quality[i];
	}
	double S = 0;
	for(int i=0; i<L; i++){
		S += (quality[i]-total_count*centroid[i]) * log(quality[i]/(total_count*centroid[i]));
	}
	return S;
}

// Assembly:
testl %edx, %edx
jle 0x4ff4
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %rbx
movq %rdi, %r14
movl %edx, %r15d
xorpd %xmm2, %xmm2
xorl %eax, %eax
addsd (%rbx,%rax,8), %xmm2
incq %rax
cmpq %rax, %r15
jne 0x4f69
testl %edx, %edx
jle 0x4ff8
movapd 0x3bce(%rip), %xmm0     # 0x8b50
xorpd %xmm2, %xmm0
movapd %xmm0, 0x10(%rsp)
xorpd %xmm0, %xmm0
xorl %r12d, %r12d
movsd %xmm0, (%rsp)
movapd %xmm2, 0x20(%rsp)
movsd (%rbx,%r12,8), %xmm0
movsd (%r14,%r12,8), %xmm1
movapd 0x10(%rsp), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rsp)
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x2180
movapd 0x20(%rsp), %xmm2
mulsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r12
cmpq %r12, %r15
jne 0x4f93
jmp 0x4ffc
xorps %xmm0, %xmm0
retq
xorpd %xmm0, %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/dists.cc
// Function: d2_distance(double*, double*, int, double*, double*, double*, double*)
double d2_distance(double *centroid, double *p, int L, double* centroid_tilde, 
				   double *quality, double *expected_qual, double *expected_freq)
{
	double norm = 0;
	double S = 0;
	for(int i=0; i<L; i++){
		norm += quality[i] * quality[i];
	}
	norm = sqrt(norm);
	for(int i=0; i<L; i++){
		S += centroid[i] * quality[i] / norm;
	}
	return 1 - S;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testl %edx, %edx
jle 0x5049
movq %r8, %rbx
movl %edx, %ebp
movq %rdi, %r14
movl %edx, %r15d
xorpd %xmm0, %xmm0
xorl %eax, %eax
movsd (%rbx,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %r15
jne 0x5024
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jb 0x504f
sqrtsd %xmm0, %xmm0
jmp 0x5058
xorpd %xmm2, %xmm2
jmp 0x5079
callq 0x2170
xorpd %xmm2, %xmm2
testl %ebp, %ebp
jle 0x5079
xorl %eax, %eax
movsd (%r14,%rax,8), %xmm1
mulsd (%rbx,%rax,8), %xmm1
divsd %xmm0, %xmm1
addsd %xmm1, %xmm2
incq %rax
cmpq %rax, %r15
jne 0x505e
movsd 0x2f87(%rip), %xmm0     # 0x8008
subsd %xmm2, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/dists.cc
// Function: chi2_distance(double*, double*, int, double*, double*, double*, double*)
double chi2_distance(double *centroid, double *p, int L, double* centroid_tilde, 
					 double *quality, double *expected_qual, double *expected_freq)
{
	double chi2 = 0;
	double total_count = 0;
	for(int i=0; i<L; i++){
		total_count += quality[i];
	}
	for(int i=0; i<L; i++){
		double exp_count = centroid[i] * total_count;
		chi2 += (quality[i] - exp_count) * (quality[i] - exp_count) / exp_count;
	}
	//return (chi2 - (L-3) * log(chi2))/2;
	return chi2;
}

// Assembly:
testl %edx, %edx
jle 0x50dc
movl %edx, %eax
xorpd %xmm1, %xmm1
xorl %ecx, %ecx
addsd (%r8,%rcx,8), %xmm1
incq %rcx
cmpq %rcx, %rax
jne 0x509c
testl %edx, %edx
jle 0x50dc
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
movsd (%rdi,%rcx,8), %xmm2
mulsd %xmm1, %xmm2
movsd (%r8,%rcx,8), %xmm3
subsd %xmm2, %xmm3
mulsd %xmm3, %xmm3
divsd %xmm2, %xmm3
addsd %xmm3, %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0x50b4
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/dists.cc
// Function: d2ast_distance(double*, double*, int, double*, double*, double*, double*)
double d2ast_distance(double *centroid, double *p, int L, double* centroid_tilde,
					  double *quality, double *expected_qual, double *expected_freq)
{
	//Determines what data to use: global(expected_freq) or local(centroid)
	double * exp_freq;
	if (expected_freq==NULL) exp_freq = centroid;
	else exp_freq = expected_freq;
	
	double x[L];
	memcpy(x, quality, L*sizeof(*quality));
	double total_count = 0;
	for(int i=0; i<L; i++){
		total_count += p[i];
	}
	double S = 0;
	for(int l=0; l<L; ++l){
		x[l] -= total_count * exp_freq[l] * expected_qual[l];
		x[l] /= sqrt(exp_freq[l] * expected_qual[l]);
		S += x[l] * x[l];
	}
	S = sqrt(S);
	for(int l=0; l<L; ++l){
		x[l] /= S;
	}	
	S = 0;
	for(int l=0; l<L; ++l){
		S += x[l] * centroid_tilde[l];
	}
	return (1-S)/2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r12
movq %rcx, -0x40(%rbp)
movq %rsi, %r15
movq %rdi, %r13
movq 0x10(%rbp), %rax
testq %rax, %rax
cmovneq %rax, %r13
movl %edx, %ebx
movq %rsp, %r14
leaq 0xf(,%rbx,8), %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
movl %edx, -0x2c(%rbp)
movslq %edx, %rax
movq %rax, -0x38(%rbp)
leaq (,%rax,8), %rdx
movq %r14, %rdi
movq %r8, %rsi
callq 0x2190
cmpl $0x0, -0x38(%rbp)
jle 0x51fb
xorpd %xmm2, %xmm2
xorl %eax, %eax
addsd (%r15,%rax,8), %xmm2
incq %rax
cmpq %rax, %rbx
jne 0x514d
cmpl $0x0, -0x2c(%rbp)
jle 0x51fb
xorpd 0x39e3(%rip), %xmm2     # 0x8b50
xorpd %xmm4, %xmm4
xorl %r15d, %r15d
xorpd %xmm3, %xmm3
movapd %xmm2, -0x60(%rbp)
movsd (%r13,%r15,8), %xmm0
movsd (%r12,%r15,8), %xmm1
movapd %xmm0, %xmm5
mulsd %xmm2, %xmm5
mulsd %xmm1, %xmm5
addsd (%r14,%r15,8), %xmm5
mulsd %xmm1, %xmm0
ucomisd %xmm4, %xmm0
jb 0x51ac
sqrtsd %xmm0, %xmm0
jmp 0x51ce
movsd %xmm3, -0x38(%rbp)
movsd %xmm5, -0x48(%rbp)
callq 0x2170
movsd -0x48(%rbp), %xmm5
xorpd %xmm4, %xmm4
movsd -0x38(%rbp), %xmm3
movapd -0x60(%rbp), %xmm2
divsd %xmm0, %xmm5
movsd %xmm5, (%r14,%r15,8)
mulsd %xmm5, %xmm5
addsd %xmm5, %xmm3
incq %r15
cmpq %r15, %rbx
jne 0x517d
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm3
jb 0x5201
xorps %xmm0, %xmm0
sqrtsd %xmm3, %xmm0
jmp 0x520e
xorpd %xmm2, %xmm2
jmp 0x5255
movapd %xmm3, %xmm0
callq 0x2170
xorpd %xmm2, %xmm2
movq -0x40(%rbp), %rcx
cmpl $0x0, -0x2c(%rbp)
jle 0x5255
xorl %eax, %eax
movsd (%r14,%rax,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r14,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x521a
cmpl $0x0, -0x2c(%rbp)
jle 0x5255
xorpd %xmm2, %xmm2
xorl %eax, %eax
movsd (%r14,%rax,8), %xmm0
mulsd (%rcx,%rax,8), %xmm0
addsd %xmm0, %xmm2
incq %rax
cmpq %rax, %rbx
jne 0x523e
movsd 0x2dab(%rip), %xmm0     # 0x8008
subsd %xmm2, %xmm0
mulsd 0x39ff(%rip), %xmm0     # 0x8c68
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/CominLab[P]QCluster/centroid.cc
// Function: mean_centroid(int, int, double**, int, double**, double*, double*, double**, double*, double**, double*)
void mean_centroid(int N, int row_length, double** freq, int num_nt,
double** freq_1, double* centroid, double* centroid_tilde, 
double **quality, double *expected_qual, double **quality_1,
double *expected_freq)
{
	memset(centroid, 0, row_length * sizeof(*centroid));
	for(int n=0; n<N; n++){
		for(int l=0; l<row_length; l++){
			centroid[l] += quality[n][l];
		}
	}

	for(int l=0; l<row_length; l++){
		centroid[l] /= N;
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %r9, %rbx
movl %esi, %r14d
movl %edi, %ebp
movslq %esi, %rdx
shlq $0x3, %rdx
movq %r9, %rdi
xorl %esi, %esi
callq 0x2130
movl %r14d, %eax
testl %ebp, %ebp
jle 0x52d3
movq 0x28(%rsp), %rcx
movl %ebp, %edx
xorl %esi, %esi
testl %r14d, %r14d
jle 0x52cb
movq (%rcx,%rsi,8), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
addsd (%rbx,%r8,8), %xmm0
movsd %xmm0, (%rbx,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0x52b1
incq %rsi
cmpq %rdx, %rsi
jne 0x52a5
testl %r14d, %r14d
jle 0x52f7
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
xorl %ecx, %ecx
movsd (%rbx,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x52e1
popq %rbx
popq %r14
popq %rbp
retq