// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1048, %rsp           # imm = 0x1048
movq %rdi, %r14
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1e204(%rip), %rsi     # 0x2a180
leaq 0x1e207(%rip), %rdx     # 0x2a18a
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0xfc42
movq %rbx, %rdi
callq 0xbac6
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xbfaf
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8260
movl $0x4, %edi
callq 0x8250
movq %rax, %r15
movl $0x0, (%rax)
movq %r14, %rdi
callq 0xc2f6
movq %rax, %r13
movq 0x8(%r14), %rdi
callq 0x179ac
cmpl $0x18, %eax
jne 0xc0eb
movq %r13, %rbx
leaq 0x2e587(%rip), %rax     # 0x3a570
movq (%rax), %r12
movq 0x8(%r14), %rsi
leaq 0x80(%rsp), %r13
movq %r13, %rdi
callq 0x179b0
movq %r12, %rdi
movq %r13, %rsi
callq 0x28862
movl %eax, %ebp
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc02e
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8260
cmpl $-0x1, %ebp
je 0xc083
movq %rbx, %r13
testl %ebp, %ebp
js 0xc0eb
movq (%r14), %rbx
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1e0f7(%rip), %rsi     # 0x2a148
leaq 0x1e10b(%rip), %rdx     # 0x2a163
leaq 0x20(%rsp), %rdi
callq 0xfc42
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x16ebd
leaq 0x20(%rsp), %rdi
callq 0x8488
movl $0x1, %edi
callq 0x82e0
leaq 0x2e4e6(%rip), %rax     # 0x3a570
movq (%rax), %rbp
movl $0x48, %edi
callq 0x8250
movq %rax, %r13
movq 0x8(%r14), %rsi
leaq 0x40(%rsp), %rdi
callq 0x179b0
movb $0x1, %r12b
leaq 0x40(%rsp), %rsi
movq %r13, %rdi
movl $0x3, %edx
callq 0x1b7b2
xorl %r12d, %r12d
movq %rbp, %rdi
movq %r13, %rsi
callq 0x28820
movl %eax, %ebp
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc0e8
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8260
movq %rbx, %r13
movq %r14, %rdi
movl $0x18, %esi
callq 0xc558
movq 0x8(%r14), %rdi
callq 0x179ac
cmpl $0x27, %eax
jne 0xc168
movl $0x10, %edi
callq 0x8250
movq %rax, %r14
movq %rax, %rdi
callq 0x1a7e4
leaq 0x2e44e(%rip), %rbx     # 0x3a570
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x28934
xorl %r15d, %r15d
movq %rax, %rdi
xorl %esi, %esi
callq 0x1b846
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x28934
leaq 0x2e11a(%rip), %rcx     # 0x3a264
movl (%rcx), %esi
movq %rax, %rdi
callq 0x1b89c
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x28934
movq %rax, %rdi
callq 0x1b8a0
jmp 0xc1b5
movq 0x8(%r14), %rdi
callq 0x179ac
cmpl $0x1e, %eax
jne 0xc1af
leaq 0xa0(%rsp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0xc63c
movq %rax, %r14
movl (%r15), %r15d
leaq 0x2e3da(%rip), %rax     # 0x3a570
movq (%rax), %rdi
movl %ebp, %esi
callq 0x28934
movq %rax, %rdi
movl $0x1, %esi
callq 0x1b846
jmp 0xc1b5
xorl %r15d, %r15d
xorl %r14d, %r14d
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1dfba(%rip), %rsi     # 0x2a180
leaq 0x1dfbd(%rip), %rdx     # 0x2a18a
movq %rsp, %rdi
callq 0xfc42
movq %rsp, %rdi
callq 0xbd28
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0xc1f3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8260
movl $0xfc8, %edi            # imm = 0xFC8
callq 0x8250
movq %rax, %r12
leaq 0xa0(%rsp), %rdx
movq %rax, %rdi
movq %r13, %rsi
movl %r15d, %ecx
movq %r14, %r8
callq 0xfcd4
movq %r12, %rax
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0xc2ed
movq 0x30(%rsp), %rsi
jmp 0xc2e5
jmp 0xc2ce
movq %rax, %rbx
movb $0x1, %r12b
jmp 0xc274
movq %rax, %rbx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc274
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8260
testb %r12b, %r12b
je 0xc2ed
movl $0x48, %esi
movq %r13, %rdi
jmp 0xc2e8
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
jmp 0xc2e8
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc2ed
movq 0x90(%rsp), %rsi
jmp 0xc2e5
movq %rax, %rbx
movl $0xfc8, %esi            # imm = 0xFC8
movq %r12, %rdi
jmp 0xc2e8
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0xc2ed
movq 0x10(%rsp), %rsi
jmp 0xc2e5
movq %rax, %rbx
jmp 0xc2ed
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xc2ed
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8260
movq %rbx, %rdi
callq 0x8420
nop