// File: /workspace/github_cpp_makefile_star2_O2/araujoigor[P]ipp-compiler/./src/include/IDefinition.hpp
// Function: IDefinition::generateCode(std::basic_fstream<char, std::char_traits<char>>&)
void generateCode(std::fstream& fileStream) {
		int i;

		/* Primeiramente escreve-se o tipo da definição em questão */
		fileStream << getCppType() + " ";

		/*
		 * Primeiramente, processa-se as definições que recebem como valor um numero ou uma string.
		 */
		for(i = 0; i < (int)vars.size() - 1; i++){
			IData* actual = vars[i];

			/* Escreve-se o nome da variável */
			fileStream << actual->getId();

			/* E se ela possuir um valor, escreve-se esse valor. */
			if(actual->getHasValue()){
				fileStream << " = ";
				actual->printValue(fileStream);
			}

			/* Adiciona-se uma virgula, já que se trata de uma multipla definição */
			fileStream << ", ";
		}

		if(vars.size() > 0){
			IData* actual = vars[i];
			fileStream << vars[i]->getId();
			if(actual->getHasValue()){
				fileStream << " = ";
				actual->printValue(fileStream);
			}
			i++;
		}

		/*
		 * Checa-se então as variáveis que tem como valor outras variáveis.
		 */

		for(auto it = varEqualsVarMapping.begin(); it != varEqualsVarMapping.end(); ++it){
			/* Obtemos as variáveis a esquerda e a direita (que recebe e cede o valor, respectivamente) */
			IData *rightVar = ownerBlock->getLocalVariable(it->second);
			IData *leftVar = ownerBlock->getLocalVariable(it->first);

			/* Caso a variavél da direita não exista, gera-se um erro. */
			if(rightVar == NULL){
				std::string errorMsg = "Variavel " + it->second + " nao declarada.";
				throw ISourceErrorException(errorMsg, myLine);
			}

			/* Caso não haja compatibilidade de tipos, gera-se um erro */
			if(rightVar->getType() != type && !(type == "real" && rightVar->getType() == "inteiro") ){
				std::string errorMsg = "Impossivel atribuir '" + it->second + "' (" + rightVar->getType() + ") a '" + it->first + "' (" + type + "). Tipos incompativeis.";
				throw ISourceErrorException(errorMsg, myLine);
			}

			if(type == "inteiro" && rightVar->getType() == "inteiro"){
				((IInteger *)leftVar)->setValue(((IInteger *)rightVar)->getValue());
			}else if(type == "real" && rightVar->getType() == "inteiro"){
				((IReal *)leftVar)->setValue(((IInteger *)rightVar)->getValue());
			}else if(type == "real" && rightVar->getType() == "real"){
				((IReal *)leftVar)->setValue(((IReal *)rightVar)->getValue());
			}else{
				std::string errorMsg = "Impossivel atribuir '"+ it->second + "' (" + rightVar->getType() + ") a '" + it->first + "' (" + type + "). Tipos incompativeis.";
				throw ISourceErrorException(errorMsg, myLine);
			}

			/* Se houver mais de uma definição, adiciona-se uma virgula. */
			if(i > 0)
				fileStream << ", ";

			/* E escreve-se o nome das variaveis a esquerda e a direita */
			fileStream << it->first << " = " << it->second;
			i++;

		}

		/*
		 * Finalmente, checa-se então as variáveis que tem como valor uma expressãom matemática
		 */
		for(auto it = varEqualsMathMapping.begin(); it != varEqualsMathMapping.end(); ++it){
			int mathType;

			/* Se houver mais de uma definição, adicionamos uma virgula. */
			if(i > 0)
				fileStream << ", ";

			/* E escreve-se o nome da variável a direita e a expressão a esquerda. */
			fileStream << it->first << " = " << it->second->checkAndGetExpression(ownerBlock, myLine);

			/* Realiza-se a analise de compatibilidade de tipos */
			mathType = it->second->getMathType();

			if(mathType == IMath::TYPE_REAL && type == IInteger::myType){
				std::cout << "Atencao: usar uma variavel real em uma operacao para uma variavel inteira causa perda de dados. " << std::endl;
			}else if(type == "string"){
				std::string errorMsg = "Impossivel atribuir uma expressao matematica a variavel string " + it->first;
				throw ISourceErrorException(errorMsg, myLine);
			}
		}

		/* No final da atribuição, adicionamos um ; */
		fileStream << ";" << std::endl;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x98(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xc666
leaq 0x1c999(%rip), %rdx     # 0x28340
leaq -0x68(%rbp), %rdi
movq %r14, %rsi
callq 0xc63c
movq %r15, -0x30(%rbp)
movq %rbx, -0x38(%rbp)
leaq 0x10(%rbx), %r14
leaq -0x68(%rbp), %rsi
movq %r14, %rdi
callq 0x8340
movq %r14, -0x40(%rbp)
leaq -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x8930
leaq -0x98(%rbp), %rdi
callq 0x8930
xorl %esi, %esi
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
leaq 0x1c824(%rip), %r12     # 0x2821e
movq -0x30(%rbp), %rcx
movq 0x38(%rcx), %rax
movq 0x40(%rcx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
shlq $0x1d, %rdx
addq %r15, %rdx
sarq $0x20, %rdx
cmpq %rdx, %rsi
jge 0xba7f
movq %rsi, %rbx
movq (%rax,%rsi,8), %r13
leaq 0x8(%r13), %rsi
movq %r14, %rdi
callq 0x85b0
movq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x8340
movq %r14, %rdi
callq 0x8930
cmpb $0x1, 0x28(%r13)
jne 0xba68
movq -0x40(%rbp), %rdi
leaq 0x1c7ab(%rip), %rsi     # 0x28200
callq 0x8390
movq (%r13), %rax
movq %r13, %rdi
movq -0x38(%rbp), %rsi
callq *0x18(%rax)
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x8390
movq %rbx, %rsi
incq %rsi
jmp 0xb9fa
cmpq %rax, %rcx
movq %rsi, -0x48(%rbp)
je 0xbae7
movq (%rax,%rsi,8), %r14
leaq 0x8(%r14), %rsi
leaq -0x68(%rbp), %r15
movq %r15, %rdi
callq 0x85b0
movq -0x40(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x8340
leaq -0x68(%rbp), %rdi
callq 0x8930
cmpb $0x1, 0x28(%r14)
movq -0x30(%rbp), %r12
jne 0xbadb
leaq 0x1c73a(%rip), %rsi     # 0x28200
movq %r13, %rdi
callq 0x8390
movq (%r14), %rax
movq %r14, %rdi
movq -0x38(%rbp), %rsi
callq *0x18(%rax)
movq -0x48(%rbp), %rax
incl %eax
movq %rax, -0x48(%rbp)
jmp 0xbaeb
movq -0x30(%rbp), %r12
movq 0x68(%r12), %r13
leaq 0x58(%r12), %rax
movq %rax, -0xa8(%rbp)
leaq 0x18(%r12), %rax
movq %rax, -0x38(%rbp)
leaq -0x230(%rbp), %r14
cmpq -0xa8(%rbp), %r13
je 0xbd96
movq 0x10(%r12), %rbx
leaq 0x40(%r13), %rsi
movq %r14, %rdi
movq %rsi, -0x70(%rbp)
callq 0x85b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc772
movq %r14, %rdi
movq %rax, %r15
movq %r13, %r14
addq $0x20, %r13
callq 0x8930
movq 0x10(%r12), %rbx
leaq -0x250(%rbp), %r12
movq %r12, %rdi
movq %r13, -0x78(%rbp)
movq %r13, %rsi
callq 0x85b0
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc772
movq %rax, %rbx
movq %r12, %rdi
callq 0x8930
testq %r15, %r15
movq -0x38(%rbp), %r12
je 0xc030
movq (%r15), %rax
leaq -0x68(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq *0x10(%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0xc8fa
testb %al, %al
movq %r14, -0xb0(%rbp)
movq %rbx, -0xa0(%rbp)
je 0xbc1a
movq %r12, %rdi
leaq 0x1c096(%rip), %r13     # 0x27c56
movq %r13, %rsi
callq 0xa748
testb %al, %al
je 0xc122
movq (%r15), %rax
leaq -0x98(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq *0x10(%rax)
leaq -0x68(%rbp), %r14
movq %r12, %rdi
leaq 0x1c06a(%rip), %rbx     # 0x27c5b
movq %rbx, %rsi
callq 0xa748
movq %r12, %rdi
movl %eax, %r12d
callq 0x8930
movq %r14, %rdi
callq 0x8930
testb %r12b, %r12b
movq -0x38(%rbp), %r12
jne 0xbc33
jmp 0xc12b
movq %r13, %rdi
callq 0x8930
movq %r13, %r14
leaq 0x1c02a(%rip), %r13     # 0x27c56
leaq 0x1c028(%rip), %rbx     # 0x27c5b
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa748
testb %al, %al
je 0xbc88
movq (%r15), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x10(%rax)
movq %r14, %rdi
leaq 0x1c003(%rip), %rsi     # 0x27c5b
callq 0xa748
movl %eax, %r12d
movq %r14, %rdi
callq 0x8930
testb %r12b, %r12b
movq -0x30(%rbp), %r12
je 0xbc88
movl 0x2c(%r15), %eax
movq -0xa0(%rbp), %rcx
movb $0x1, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
jmp 0xbd31
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0xa748
testb %al, %al
movq -0xa0(%rbp), %rbx
je 0xbcdf
movq (%r15), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x10(%rax)
movq %r14, %rdi
leaq 0x1bfa6(%rip), %rsi     # 0x27c5b
callq 0xa748
movl %eax, %r12d
movq %r14, %rdi
callq 0x8930
testb %r12b, %r12b
movq -0x30(%rbp), %r12
je 0xbcdf
cvtsi2sdl 0x2c(%r15), %xmm0
movb $0x1, 0x28(%rbx)
movsd %xmm0, 0x30(%rbx)
jmp 0xbd31
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0xa748
testb %al, %al
je 0xbeab
movq (%r15), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x10(%rax)
movq %r14, %rdi
movq %r13, %rsi
callq 0xa748
movl %eax, %r12d
movq %r14, %rdi
callq 0x8930
testb %r12b, %r12b
je 0xbeab
movsd 0x30(%r15), %xmm0
movb $0x1, 0x28(%rbx)
movsd %xmm0, 0x30(%rbx)
movq -0x30(%rbp), %r12
cmpl $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rbx
leaq -0x230(%rbp), %r14
je 0xbd51
movq %rbx, %rdi
leaq 0x1c4d2(%rip), %rsi     # 0x2821e
callq 0x8390
movq %rbx, %rdi
movq -0x78(%rbp), %rsi
callq 0x8340
movq %rax, %rdi
leaq 0x1c499(%rip), %rsi     # 0x28200
callq 0x8390
movq %rax, %rdi
movq -0x70(%rbp), %rsi
callq 0x8340
movq -0x48(%rbp), %rax
incl %eax
movq %rax, -0x48(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x82d0
movq %rax, %r13
jmp 0xbb0c
movq 0x98(%r12), %r14
leaq 0x88(%r12), %r15
leaq -0x68(%rbp), %r12
movq -0x40(%rbp), %r13
cmpq %r15, %r14
je 0xbe82
cmpl $0x0, -0x48(%rbp)
jle 0xbdcc
movq %r13, %rdi
leaq 0x1c457(%rip), %rsi     # 0x2821e
callq 0x8390
leaq 0x20(%r14), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8340
movq %rax, %rdi
leaq 0x1c41b(%rip), %rsi     # 0x28200
callq 0x8390
movq %rax, %r13
movq 0x40(%r14), %rsi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdx
movl 0x8(%rax), %ecx
movq %r12, %rdi
callq 0xc9a2
movq %r13, %rdi
movq %r12, %rsi
callq 0x8340
movq %r12, %rdi
callq 0x8930
movq 0x40(%r14), %rax
cmpl $0x1, 0x38(%rax)
jne 0xbe56
movq -0x38(%rbp), %rdi
leaq 0x306ec(%rip), %rsi     # 0x3c518
callq 0xce8f
testb %al, %al
je 0xbe56
movq 0x30184(%rip), %rdi     # 0x3bfc0
leaq 0x1c420(%rip), %rsi     # 0x28263
callq 0x8390
movq %rax, %rdi
callq 0x81f0
movq -0x40(%rbp), %r13
jmp 0xbe72
movq -0x38(%rbp), %rdi
leaq 0x1c4b3(%rip), %rsi     # 0x28314
callq 0xa748
testb %al, %al
movq -0x40(%rbp), %r13
jne 0xc0bb
movq %r14, %rdi
callq 0x82d0
movq %rax, %r14
jmp 0xbdae
leaq 0x208e4(%rip), %rsi     # 0x2c76d
movq %r13, %rdi
callq 0x8390
movq %rax, %rdi
callq 0x81f0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c379(%rip), %rsi     # 0x2822b
leaq -0x190(%rbp), %rbx
movq %rbx, %rdi
movq -0x70(%rbp), %rdx
callq 0xc83b
leaq 0x1c375(%rip), %rdx     # 0x28241
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
callq 0xc63c
movq (%r15), %rax
leaq -0xd0(%rbp), %rdi
movq %r15, %rsi
callq *0x10(%rax)
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0xc930
leaq 0x1c339(%rip), %rdx     # 0x28245
leaq -0x130(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xc63c
leaq -0x150(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0xc907
leaq 0x1c304(%rip), %rdx     # 0x28241
leaq -0x170(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xc63c
leaq -0x98(%rbp), %rdi
leaq -0x170(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0xc907
leaq 0x1c2dd(%rip), %rdx     # 0x2824b
leaq -0x68(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xc63c
leaq -0x98(%rbp), %rdi
callq 0x8930
leaq -0x170(%rbp), %rdi
callq 0x8930
leaq -0x150(%rbp), %rdi
callq 0x8930
leaq -0x130(%rbp), %rdi
callq 0x8930
leaq -0x110(%rbp), %rdi
callq 0x8930
leaq -0xd0(%rbp), %rdi
callq 0x8930
leaq -0xf0(%rbp), %rdi
callq 0x8930
leaq -0x190(%rbp), %rdi
callq 0x8930
pushq $0x28
popq %rdi
callq 0x8200
movq %rax, %r14
leaq -0x1d0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x85b0
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edx
movb $0x1, %r15b
leaq -0x1d0(%rbp), %rsi
movq %r14, %rdi
callq 0xc8b2
xorl %r15d, %r15d
leaq 0x2f094(%rip), %rsi     # 0x3b0b0
leaq 0x8cd(%rip), %rdx       # 0xc8f0
movq %r14, %rdi
callq 0x87a0
jmp 0xc2ab
leaq 0x1c1ea(%rip), %rsi     # 0x28221
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
movq -0x70(%rbp), %rdx
callq 0xc83b
leaq 0x20704(%rip), %rdx     # 0x2c755
leaq -0x68(%rbp), %rdi
movq %rbx, %rsi
callq 0xc63c
leaq -0x98(%rbp), %rdi
callq 0x8930
pushq $0x28
popq %rdi
callq 0x8200
movq %rax, %r14
leaq -0x210(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x85b0
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edx
movb $0x1, %r15b
leaq -0x210(%rbp), %rsi
movq %r14, %rdi
callq 0xc8b2
xorl %r15d, %r15d
leaq 0x2f009(%rip), %rsi     # 0x3b0b0
leaq 0x842(%rip), %rdx       # 0xc8f0
movq %r14, %rdi
callq 0x87a0
jmp 0xc2ab
leaq 0x1c202(%rip), %rsi     # 0x282c4
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rdx
callq 0xc83b
pushq $0x28
popq %rdi
callq 0x8200
movq %rax, %r14
leaq -0x1b0(%rbp), %rdi
movq %r15, %rsi
callq 0x85b0
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edx
movb $0x1, %r15b
leaq -0x1b0(%rbp), %rsi
movq %r14, %rdi
callq 0xc8b2
xorl %r15d, %r15d
leaq 0x2efa2(%rip), %rsi     # 0x3b0b0
leaq 0x7db(%rip), %rdx       # 0xc8f0
movq %r14, %rdi
callq 0x87a0
jmp 0xc2ab
leaq -0x68(%rbp), %rdi
callq 0x8930
leaq 0x1c0f9(%rip), %rsi     # 0x2822b
leaq -0x190(%rbp), %rbx
movq %rbx, %rdi
movq -0x70(%rbp), %rdx
callq 0xc83b
leaq 0x1c0f5(%rip), %rdx     # 0x28241
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
callq 0xc63c
movq (%r15), %rax
leaq -0xd0(%rbp), %rdi
movq %r15, %rsi
callq *0x10(%rax)
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0xc930
leaq 0x1c0b9(%rip), %rdx     # 0x28245
leaq -0x130(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xc63c
leaq -0x150(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0xc907
leaq 0x1c084(%rip), %rdx     # 0x28241
leaq -0x170(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xc63c
leaq -0x98(%rbp), %rdi
leaq -0x170(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0xc907
leaq 0x1c05d(%rip), %rdx     # 0x2824b
leaq -0x68(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xc63c
leaq -0x98(%rbp), %rdi
callq 0x8930
leaq -0x170(%rbp), %rdi
callq 0x8930
leaq -0x150(%rbp), %rdi
callq 0x8930
leaq -0x130(%rbp), %rdi
callq 0x8930
leaq -0x110(%rbp), %rdi
callq 0x8930
leaq -0xd0(%rbp), %rdi
callq 0x8930
leaq -0xf0(%rbp), %rdi
callq 0x8930
leaq -0x190(%rbp), %rdi
callq 0x8930
pushq $0x28
popq %rdi
callq 0x8200
movq %rax, %r14
leaq -0x1f0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x85b0
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edx
movb $0x1, %r15b
leaq -0x1f0(%rbp), %rsi
movq %r14, %rdi
callq 0xc8b2
xorl %r15d, %r15d
leaq 0x2ee14(%rip), %rsi     # 0x3b0b0
leaq 0x64d(%rip), %rdx       # 0xc8f0
movq %r14, %rdi
callq 0x87a0
movq %rax, %rbx
leaq -0x1f0(%rbp), %rdi
jmp 0xc388
jmp 0xc394
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
jmp 0xc388
jmp 0xc394
jmp 0xc2d5
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x8930
jmp 0xc2eb
jmp 0xc2e8
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
callq 0x8930
jmp 0xc2fe
jmp 0xc2fb
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x8930
jmp 0xc329
jmp 0xc3d7
jmp 0xc326
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x8930
jmp 0xc3a6
jmp 0xc3a3
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x8930
jmp 0xc33c
jmp 0xc339
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0x8930
jmp 0xc34f
jmp 0xc34c
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x8930
jmp 0xc370
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
jmp 0xc388
jmp 0xc394
jmp 0xc36d
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x8930
jmp 0xc3b4
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x8930
testb %r15b, %r15b
jne 0xc397
jmp 0xc3da
movq %rax, %rbx
movq %r14, %rdi
callq 0x82f0
jmp 0xc3da
jmp 0xc3d7
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
jmp 0xc3de
jmp 0xc3b1
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
jmp 0xc3de
jmp 0xc3d7
movq %rax, %rbx
leaq -0x230(%rbp), %rdi
jmp 0xc3de
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
jmp 0xc3de
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x8930
movq %rbx, %rdi
callq 0x87e0
nop