// File: araujoigor[P]ipp-compiler/./src/include/IMath.hpp
// Function: IMath::checkAndGetExpression[abi:cxx11](IBlock*, int)
std::string checkAndGetExpression(IBlock *ownerBlock, int myLine) {

		/* Utiliza-se um tokenizer que quebra a expressão matemática nos seus operadores */
		boost::char_separator<char> separator("+-*/() ");
		Tokenizer tokens(expression, separator);

		/* Para cada token, verificamos se exitem erros, como variáveis não declaradas
		 * ou valores String
		 */
		for(auto tokenIterator = tokens.begin(); tokenIterator != tokens.end(); tokenIterator++){
			/* Se o token atual NÃO for um NUMERO, deve ser uma variável */
			if(!isNumber(*tokenIterator)){
				/* Portanto obtemos a variavel */
				IData *data = ownerBlock->getLocalVariable(*tokenIterator);
				std::string errorMsg;

				/* Se não for uma variável, então é uma string ou a variável não foi declarada
				 * Então geramos o erro aproriado
				 */
				if(data == NULL){
					if(tokenIterator->find("\"") != std::string::npos)
						errorMsg = "Impossivel utilizar uma string em uma expressao matematica (valor " + *tokenIterator + ")";
					else
						errorMsg = "Variavel " + *tokenIterator + " nao declarada.";

					throw ISourceErrorException(errorMsg, myLine);
				}
				/* Se for uma variavel string, também geramos um erro.*/
				else if(data->getType() == IString::myType){
					errorMsg = "Impossivel usar uma string em uma expressao matematica (variavel " + *tokenIterator + ")" ;
					throw ISourceErrorException(errorMsg, myLine);
				}
				else if(data->getType() == IReal::myType)
					mathType = TYPE_REAL;
			}else if(!IMath::isInteger(*tokenIterator))
				mathType = TYPE_REAL;
		}

		if(outType == TYPE_INTEGER){
			expression.insert(0, "(int)");
		}

		return expression;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x500, %rsp            # imm = 0x500
movq %rdi, -0x470(%rbp)
movq %rdi, %rax
movq %rax, -0x468(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x460(%rbp)
leaq 0x4a94b(%rip), %rsi     # 0x5d748
xorl %ecx, %ecx
movl %ecx, %edx
leaq -0x70(%rbp), %rdi
movq %rdi, -0x458(%rbp)
callq 0x13880
movq -0x460(%rbp), %rsi
movq -0x458(%rbp), %rdx
leaq -0xd0(%rbp), %rdi
callq 0x13960
jmp 0x12e2d
leaq -0x168(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x139c0
jmp 0x12e42
jmp 0x12e44
leaq -0x1f0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x13ab0
jmp 0x12e59
leaq -0x168(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x13a70
movb %al, -0x471(%rbp)
jmp 0x12e74
leaq -0x1f0(%rbp), %rdi
callq 0x13b60
movb -0x471(%rbp), %al
testb $0x1, %al
jne 0x12f03
leaq -0x168(%rbp), %rdi
callq 0x13b60
jmp 0x13570
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x135de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x135d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x13562
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x13b60
jmp 0x13562
leaq -0x168(%rbp), %rdi
callq 0x13b90
movq %rax, -0x480(%rbp)
jmp 0x12f18
movq -0x480(%rbp), %rsi
leaq -0x210(%rbp), %rdi
callq 0x9240
jmp 0x12f2d
leaq -0x210(%rbp), %rdi
callq 0xda40
movb %al, -0x481(%rbp)
jmp 0x12f41
movb -0x481(%rbp), %al
xorb $-0x1, %al
movb %al, -0x482(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x9c30
movb -0x482(%rbp), %al
testb $0x1, %al
jne 0x12f6a
jmp 0x134a2
movq -0x18(%rbp), %rax
movq %rax, -0x498(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x13b90
movq %rax, -0x490(%rbp)
jmp 0x12f8a
movq -0x490(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0x9240
jmp 0x12f9f
movq -0x498(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x127e0
movq %rax, -0x4a0(%rbp)
jmp 0x12fbb
leaq -0x238(%rbp), %rdi
callq 0x9c30
movq -0x4a0(%rbp), %rax
movq %rax, -0x218(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x97d0
cmpq $0x0, -0x218(%rbp)
jne 0x13278
leaq -0x168(%rbp), %rdi
callq 0x13bc0
movq %rax, -0x4a8(%rbp)
jmp 0x13004
movq -0x4a8(%rbp), %rdi
leaq 0x4a49a(%rip), %rsi     # 0x5d4ac
xorl %eax, %eax
movl %eax, %edx
callq 0x9be0
cmpq $-0x1, %rax
je 0x13122
leaq -0x168(%rbp), %rdi
callq 0x13b90
movq %rax, -0x4b0(%rbp)
jmp 0x1303a
movq -0x4b0(%rbp), %rdx
leaq 0x4a708(%rip), %rsi     # 0x5d750
leaq -0x298(%rbp), %rdi
callq 0x12960
jmp 0x13056
leaq 0x4be50(%rip), %rdx     # 0x5eead
leaq -0x278(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x123f0
jmp 0x13072
leaq -0x258(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x96a0
leaq -0x278(%rbp), %rdi
callq 0x9c30
leaq -0x298(%rbp), %rdi
callq 0x9c30
jmp 0x131bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x9c30
jmp 0x13562
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x9c30
jmp 0x13562
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x13491
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x9c30
jmp 0x13491
leaq -0x168(%rbp), %rdi
callq 0x13b90
movq %rax, -0x4b8(%rbp)
jmp 0x13137
movq -0x4b8(%rbp), %rdx
leaq 0x4a4ea(%rip), %rsi     # 0x5d62f
leaq -0x2d8(%rbp), %rdi
callq 0x12960
jmp 0x13153
leaq 0x4ea35(%rip), %rdx     # 0x61b8f
leaq -0x2b8(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x123f0
jmp 0x1316f
leaq -0x258(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x96a0
leaq -0x2b8(%rbp), %rdi
callq 0x9c30
leaq -0x2d8(%rbp), %rdi
callq 0x9c30
jmp 0x131bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x9c30
jmp 0x13491
movb $0x1, -0x2f9(%rbp)
movl $0x28, %edi
callq 0x9290
movq %rax, -0x4c0(%rbp)
leaq -0x2f8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x9240
jmp 0x131ec
movq -0x4c0(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq -0x2f8(%rbp), %rsi
callq 0x12a70
jmp 0x13204
movq -0x4c0(%rbp), %rdi
movb $0x0, -0x2f9(%rbp)
leaq 0x6de3f(%rip), %rsi     # 0x81058
leaq -0x740(%rip), %rdx      # 0x12ae0
callq 0x9a20
jmp 0x135f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x1325c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x9c30
testb $0x1, -0x2f9(%rbp)
jne 0x13267
jmp 0x13273
movq -0x4c0(%rbp), %rdi
callq 0x9400
jmp 0x13491
movq -0x218(%rbp), %rsi
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq -0x320(%rbp), %rdi
callq *%rax
jmp 0x13291
leaq -0x320(%rbp), %rdi
leaq 0x6f3c1(%rip), %rsi     # 0x82660
callq 0x13620
movb %al, -0x4c1(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x9c30
movb -0x4c1(%rbp), %al
testb $0x1, %al
jne 0x132c5
jmp 0x13424
leaq -0x168(%rbp), %rdi
callq 0x13b90
movq %rax, -0x4d0(%rbp)
jmp 0x132da
movq -0x4d0(%rbp), %rdx
leaq 0x4a4ab(%rip), %rsi     # 0x5d793
leaq -0x360(%rbp), %rdi
callq 0x12960
jmp 0x132f6
leaq 0x4bbb0(%rip), %rdx     # 0x5eead
leaq -0x340(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x123f0
jmp 0x13312
leaq -0x258(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
leaq -0x340(%rbp), %rsi
movq %rsi, -0x4e8(%rbp)
callq 0x96a0
movq -0x4e8(%rbp), %rdi
callq 0x9c30
leaq -0x360(%rbp), %rdi
callq 0x9c30
movb $0x1, -0x381(%rbp)
movl $0x28, %edi
callq 0x9290
movq -0x4e0(%rbp), %rsi
movq %rax, -0x4d8(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x9240
jmp 0x13378
movq -0x4d8(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq -0x380(%rbp), %rsi
callq 0x12a70
jmp 0x13390
movq -0x4d8(%rbp), %rdi
movb $0x0, -0x381(%rbp)
leaq 0x6dcb3(%rip), %rsi     # 0x81058
leaq -0x8cc(%rip), %rdx      # 0x12ae0
callq 0x9a20
jmp 0x135f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x360(%rbp), %rdi
callq 0x9c30
jmp 0x13491
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x1340b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x9c30
testb $0x1, -0x381(%rbp)
jne 0x13416
jmp 0x13422
movq -0x4d8(%rbp), %rdi
callq 0x9400
jmp 0x13491
movq -0x218(%rbp), %rsi
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq -0x3a8(%rbp), %rdi
callq *%rax
jmp 0x1343d
leaq -0x3a8(%rbp), %rdi
leaq 0x6f235(%rip), %rsi     # 0x82680
callq 0x13620
movb %al, -0x4e9(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x9c30
movb -0x4e9(%rbp), %al
testb $0x1, %al
jne 0x1346e
jmp 0x1347c
movq -0x460(%rbp), %rax
movl $0x1, 0x38(%rax)
jmp 0x1347e
jmp 0x13480
leaq -0x258(%rbp), %rdi
callq 0x9c30
jmp 0x13538
leaq -0x258(%rbp), %rdi
callq 0x9c30
jmp 0x13562
leaq -0x168(%rbp), %rdi
callq 0x13b90
movq %rax, -0x4f8(%rbp)
jmp 0x134b7
movq -0x4f8(%rbp), %rsi
leaq -0x3c8(%rbp), %rdi
callq 0x9240
jmp 0x134cc
leaq -0x3c8(%rbp), %rdi
callq 0xe310
movb %al, -0x4f9(%rbp)
jmp 0x134e0
movb -0x4f9(%rbp), %al
xorb $-0x1, %al
movb %al, -0x4fa(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x9c30
movb -0x4fa(%rbp), %al
testb $0x1, %al
jne 0x13506
jmp 0x13536
movq -0x460(%rbp), %rax
movl $0x1, 0x38(%rax)
jmp 0x13536
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x9c30
jmp 0x13562
jmp 0x13538
jmp 0x1353a
leaq -0x450(%rbp), %rdi
leaq -0x168(%rbp), %rsi
xorl %edx, %edx
callq 0x13bf0
jmp 0x13551
leaq -0x450(%rbp), %rdi
callq 0x13b60
jmp 0x12e44
leaq -0x168(%rbp), %rdi
callq 0x13b60
jmp 0x135d2
movq -0x460(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
jne 0x13598
movq -0x460(%rbp), %rdi
leaq 0x4a24a(%rip), %rdx     # 0x5d7d5
xorl %eax, %eax
movl %eax, %esi
callq 0x9130
jmp 0x13596
jmp 0x13598
movq -0x460(%rbp), %rsi
movq -0x470(%rbp), %rdi
callq 0x9240
jmp 0x135ad
leaq -0xd0(%rbp), %rdi
callq 0x13c70
leaq -0x70(%rbp), %rdi
callq 0x13c90
movq -0x468(%rbp), %rax
addq $0x500, %rsp            # imm = 0x500
popq %rbp
retq
leaq -0xd0(%rbp), %rdi
callq 0x13c70
leaq -0x70(%rbp), %rdi
callq 0x13c90
movq -0xd8(%rbp), %rdi
callq 0x9a90
nopw %cs:(%rax,%rax)
nopl (%rax)