// File: /workspace/github_cpp_makefile_star2_O3/martinda3[P]Compiler/src/TCparser.cpp
// Function: toyc::TCparser::Definition()
ASdefinition* TCparser::Definition()
	{
		// Definition --> Type ID ( FunctionDefinition | SEMICOLON )
		enteringDEBUG("Definition");
        int loc;
		AStype* operand2 = NULL;
		ASdefinition* operand3[MAX_STATEMENTS];
		int operand4 = 0;
		int* num = new int;
		*num = 0;
		ASstatement* operand5 = NULL;
		operand2 = Type();
        if (buff->getTokenType() == ID)
        {
            loc = symTable->find(buff->getLexeme());
            if (loc == -1) loc = symTable->add(new TCsymbol(buff->getLexeme(),NO_TYPE));
            else if (loc > -1)
            {
                reportSEMANTIC_ERROR(scanner,"Cannot redeclare a function");
                exit(EXIT_FAILURE);
            }
        }
		accept(ID);
		if (buff->getTokenType() == SEMICOLON)
		{
			operand5 = new ASstatement();
            symTable->getSym(loc)->setType(VAR);
            symTable->getSym(loc)->setOffset(_nextOffset);
            symTable->getSym(loc)->getNextOffset();
		}
		else if (buff->getTokenType() == LPAREN)
		{
			operand5 = FunctionDefinition(operand3, num);
			operand4 = *num;
            symTable->getSym(loc)->setType(FUNC);
		}
		exitingDEBUG("Definition");
		return new ASfuncDef(operand2, operand3, operand4, operand5);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1058, %rsp           # imm = 0x1058
movq %rdi, %r14
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1e21d(%rip), %rsi     # 0x2a180
leaq 0x1e220(%rip), %rdx     # 0x2a18a
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
callq 0xfc2a
movq %rbx, %rdi
callq 0xbaaa
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xbf99
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x8260
movl $0x4, %edi
callq 0x8250
movq %rax, %r15
movl $0x0, (%rax)
movq %r14, %rdi
callq 0xc2ea
movq %rax, %r13
movq 0x8(%r14), %rdi
callq 0x17fcc
cmpl $0x18, %eax
jne 0xc0dc
movq %r13, %rbx
leaq 0x2e59d(%rip), %rax     # 0x3a570
movq (%rax), %r12
movq 0x8(%r14), %rsi
leaq 0x90(%rsp), %r13
movq %r13, %rdi
callq 0x17fd0
movq %r12, %rdi
movq %r13, %rsi
callq 0x28e6e
movl %eax, %ebp
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc018
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x8260
cmpl $-0x1, %ebp
je 0xc06d
movq %rbx, %r13
testl %ebp, %ebp
js 0xc0dc
movq (%r14), %rbx
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1e10d(%rip), %rsi     # 0x2a148
leaq 0x1e121(%rip), %rdx     # 0x2a163
leaq 0x30(%rsp), %rdi
callq 0xfc2a
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x174db
leaq 0x30(%rsp), %rdi
callq 0x8488
movl $0x1, %edi
callq 0x82e0
leaq 0x2e4fc(%rip), %rax     # 0x3a570
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl $0x48, %edi
callq 0x8250
movq %rax, %r13
movq 0x8(%r14), %rsi
leaq 0x50(%rsp), %rdi
callq 0x17fd0
movb $0x1, %r12b
leaq 0x50(%rsp), %rsi
movq %r13, %rdi
movl $0x3, %edx
callq 0x1bdd6
xorl %r12d, %r12d
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x28e2c
movl %eax, %ebp
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc0d9
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x8260
movq %rbx, %r13
movq %r14, %rdi
movl $0x18, %esi
callq 0xc54c
movq 0x8(%r14), %rdi
callq 0x17fcc
cmpl $0x27, %eax
jne 0xc159
movl $0x10, %edi
callq 0x8250
movq %rax, %r14
movq %rax, %rdi
callq 0x1ae1c
leaq 0x2e45d(%rip), %rbx     # 0x3a570
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x28f44
xorl %r15d, %r15d
movq %rax, %rdi
xorl %esi, %esi
callq 0x1be6a
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x28f44
leaq 0x2e129(%rip), %rcx     # 0x3a264
movl (%rcx), %esi
movq %rax, %rdi
callq 0x1bec0
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x28f44
movq %rax, %rdi
callq 0x1bec4
jmp 0xc1a6
movq 0x8(%r14), %rdi
callq 0x17fcc
cmpl $0x1e, %eax
jne 0xc1a0
leaq 0xb0(%rsp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0xc630
movq %rax, %r14
movl (%r15), %r15d
leaq 0x2e3e9(%rip), %rax     # 0x3a570
movq (%rax), %rdi
movl %ebp, %esi
callq 0x28f44
movq %rax, %rdi
movl $0x1, %esi
callq 0x1be6a
jmp 0xc1a6
xorl %r15d, %r15d
xorl %r14d, %r14d
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1dfc9(%rip), %rsi     # 0x2a180
leaq 0x1dfcc(%rip), %rdx     # 0x2a18a
leaq 0x10(%rsp), %rdi
callq 0xfc2a
leaq 0x10(%rsp), %rdi
callq 0xbd0c
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xc1e9
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8260
movl $0xfc8, %edi            # imm = 0xFC8
callq 0x8250
movq %rax, %r12
leaq 0xb0(%rsp), %rdx
movq %rax, %rdi
movq %r13, %rsi
movl %r15d, %ecx
movq %r14, %r8
callq 0xfcc0
movq %r12, %rax
addq $0x1058, %rsp           # imm = 0x1058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0xc2e1
movq 0x40(%rsp), %rsi
jmp 0xc2d9
jmp 0xc2bf
movq %rax, %rbx
jmp 0xc269
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc264
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x8260
testb %r12b, %r12b
je 0xc2e1
movl $0x48, %esi
movq %r13, %rdi
jmp 0xc2dc
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
jmp 0xc2dc
movq %rax, %rbx
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc2e1
movq 0xa0(%rsp), %rsi
jmp 0xc2d9
movq %rax, %rbx
movl $0xfc8, %esi            # imm = 0xFC8
movq %r12, %rdi
jmp 0xc2dc
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xc2e1
movq 0x20(%rsp), %rsi
jmp 0xc2d9
movq %rax, %rbx
jmp 0xc2e1
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xc2e1
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x8260
movq %rbx, %rdi
callq 0x8420
nop