// File: martinda3[P]Compiler/src/TCparser.cpp
// Function: toyc::TCparser::CompoundStatement()
ASstatement* TCparser::CompoundStatement() // Need statment and error handling
	{
		// CompoundStatement --> LCURLY { Type ID SEMICOLON } { Statement } RCURLY
		enteringDEBUG("Compound Statement");
        int loc;
		ASdefinition* operand[MAX_STATEMENTS];
		ASstatement* operand2[MAX_STATEMENTS];
		AStype* operand4[1];
		int i1 = 0;
		int i2 = 0;
		accept(LCURLY);
		while (buff->getTokenType() == INT || buff->getTokenType() == CHAR) // { Type ID SEMICOLON }
		{
			operand4[0] = 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 variable compound");
                    exit(EXIT_FAILURE);
                }
                symTable->getSym(loc)->setType(VAR);
                symTable->getSym(loc)->setOffset(_nextOffset);
                symTable->getSym(loc)->getNextOffset();
            }
			accept(ID);
			operand[i1] = new ASvarDef(operand4, 1);
			i1++;
			accept(SEMICOLON);
		}
		try
		{
			enteringDEBUG("Statement");
			while (buff->getTokenType() != RCURLY)
			{
				operand2[i2] = Statement();
				i2++;
			}
		}
		catch (int t) {}
		accept(RCURLY);
		exitingDEBUG("Statement");
		exitingDEBUG("Compound Statement");
		return new ASblockState(operand, i1, operand2, i2);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2100, %rsp           # imm = 0x2100
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2088(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x2080(%rbp)
callq 0x95c0
movq -0x2080(%rbp), %rdx
leaq 0x23c6f(%rip), %rsi     # 0x33287
leaq -0x28(%rbp), %rdi
callq 0x13550
jmp 0xf623
leaq -0x28(%rbp), %rdi
callq 0xd790
jmp 0xf62e
leaq -0x28(%rbp), %rdi
callq 0x9658
leaq -0x29(%rbp), %rdi
callq 0x93b0
movq -0x2088(%rbp), %rdi
movl $0x0, -0x1f8c(%rbp)
movl $0x0, -0x1f90(%rbp)
movl $0x22, %esi
callq 0xe670
movq -0x2088(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1be60
movl %eax, %ecx
movb $0x1, %al
cmpl $0x3, %ecx
movb %al, -0x2089(%rbp)
je 0xf6a0
movq -0x2088(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1be60
cmpl $0x5, %eax
sete %al
movb %al, -0x2089(%rbp)
movb -0x2089(%rbp), %al
testb $0x1, %al
jne 0xf6af
jmp 0xfa22
movq -0x2088(%rbp), %rdi
callq 0xe280
movq %rax, %rcx
movq -0x2088(%rbp), %rax
movq %rcx, -0x1f88(%rbp)
movq 0x8(%rax), %rdi
callq 0x1be60
cmpl $0x18, %eax
jne 0xf98a
movq -0x2088(%rbp), %rax
leaq 0x35f74(%rip), %rcx     # 0x45660
movq (%rcx), %rcx
movq %rcx, -0x20a0(%rbp)
movq 0x8(%rax), %rsi
leaq -0x1fb0(%rbp), %rdi
movq %rdi, -0x2098(%rbp)
callq 0x1be70
movq -0x20a0(%rbp), %rdi
movq -0x2098(%rbp), %rsi
callq 0x31840
movl %eax, -0x2090(%rbp)
jmp 0xf728
movl -0x2090(%rbp), %eax
movl %eax, -0x40(%rbp)
leaq -0x1fb0(%rbp), %rdi
callq 0x9658
cmpl $-0x1, -0x40(%rbp)
jne 0xf877
leaq 0x35f12(%rip), %rax     # 0x45660
movq (%rax), %rax
movq %rax, -0x20b0(%rbp)
movl $0x48, %edi
callq 0x9350
movq %rax, %rcx
movq -0x2088(%rbp), %rax
movq %rcx, -0x20a8(%rbp)
movb $0x1, -0x1fd1(%rbp)
movq 0x8(%rax), %rsi
leaq -0x1fd0(%rbp), %rdi
callq 0x1be70
jmp 0xf78c
movq -0x20a8(%rbp), %rdi
leaq -0x1fd0(%rbp), %rsi
movl $0x3, %edx
callq 0x1fe10
jmp 0xf7a6
movq -0x20a8(%rbp), %rsi
movq -0x20b0(%rbp), %rdi
movb $0x0, -0x1fd1(%rbp)
callq 0x317c0
movl %eax, -0x20b4(%rbp)
jmp 0xf7c8
movl -0x20b4(%rbp), %eax
movl %eax, -0x40(%rbp)
leaq -0x1fd0(%rbp), %rdi
callq 0x9658
jmp 0xf931
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xf805
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x9658
leaq -0x29(%rbp), %rdi
callq 0x93b0
jmp 0xfcce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1fb0(%rbp), %rdi
callq 0x9658
jmp 0xfcce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xf856
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1fd0(%rbp), %rdi
callq 0x9658
testb $0x1, -0x1fd1(%rbp)
jne 0xf861
jmp 0xf872
movq -0x20a8(%rbp), %rdi
movl $0x48, %esi
callq 0x9360
jmp 0xfcce
cmpl $-0x1, -0x40(%rbp)
jle 0xf92f
movq -0x2088(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20c8(%rbp)
leaq -0x1ff9(%rbp), %rdi
movq %rdi, -0x20c0(%rbp)
callq 0x95c0
movq -0x20c0(%rbp), %rdx
leaq 0x239e7(%rip), %rsi     # 0x3329a
leaq -0x1ff8(%rbp), %rdi
callq 0x13550
jmp 0xf8c1
movq -0x20c8(%rbp), %rdi
leaq -0x1ff8(%rbp), %rsi
callq 0x1b380
jmp 0xf8d6
leaq -0x1ff8(%rbp), %rdi
callq 0x9658
leaq -0x1ff9(%rbp), %rdi
callq 0x93b0
movl $0x1, %edi
callq 0x9410
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xf91e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1ff8(%rbp), %rdi
callq 0x9658
leaq -0x1ff9(%rbp), %rdi
callq 0x93b0
jmp 0xfcce
jmp 0xf931
leaq 0x35d28(%rip), %rax     # 0x45660
movq (%rax), %rdi
movl -0x40(%rbp), %esi
callq 0x31930
movq %rax, %rdi
xorl %esi, %esi
callq 0x1ff10
leaq 0x35d0c(%rip), %rax     # 0x45660
movq (%rax), %rdi
movl -0x40(%rbp), %esi
callq 0x31930
movq %rax, %rdi
leaq 0x359e3(%rip), %rax     # 0x4534c
movl (%rax), %esi
callq 0x1ffd0
leaq 0x35ce9(%rip), %rax     # 0x45660
movq (%rax), %rdi
movl -0x40(%rbp), %esi
callq 0x31930
movq %rax, %rdi
callq 0x1fff0
movq -0x2088(%rbp), %rdi
movl $0x18, %esi
callq 0xe670
movl $0xfc0, %edi            # imm = 0xFC0
callq 0x9350
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x20d0(%rbp)
leaq -0x1f88(%rbp), %rsi
movl $0x1, %edx
callq 0x1efb0
jmp 0xf9c5
movq -0x2088(%rbp), %rdi
movq -0x20d0(%rbp), %rcx
movslq -0x1f8c(%rbp), %rax
movq %rcx, -0xfe0(%rbp,%rax,8)
movl -0x1f8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f8c(%rbp)
movl $0x27, %esi
callq 0xe670
jmp 0xf665
movq -0x20d0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0xfc0, %esi            # imm = 0xFC0
callq 0x9360
jmp 0xfcce
leaq -0x2021(%rbp), %rdi
movq %rdi, -0x20d8(%rbp)
callq 0x95c0
movq -0x20d8(%rbp), %rdx
leaq 0x238e6(%rip), %rsi     # 0x33329
leaq -0x2020(%rbp), %rdi
callq 0x13550
jmp 0xfa51
leaq -0x2020(%rbp), %rdi
callq 0xd790
jmp 0xfa5f
leaq -0x2020(%rbp), %rdi
callq 0x9658
leaq -0x2021(%rbp), %rdi
callq 0x93b0
movq -0x2088(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1be60
movl %eax, -0x20dc(%rbp)
jmp 0xfa8f
movl -0x20dc(%rbp), %eax
cmpl $0x23, %eax
je 0xfc44
movq -0x2088(%rbp), %rdi
callq 0x10270
movq %rax, -0x20e8(%rbp)
jmp 0xfab3
movq -0x20e8(%rbp), %rcx
movslq -0x1f90(%rbp), %rax
movq %rcx, -0x1f80(%rbp,%rax,8)
movl -0x1f90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f90(%rbp)
jmp 0xfa77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xfb00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2020(%rbp), %rdi
callq 0x9658
leaq -0x2021(%rbp), %rdi
callq 0x93b0
jmp 0xfb1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xfcce
movq -0x38(%rbp), %rdi
callq 0x9140
movl (%rax), %eax
movl %eax, -0x2028(%rbp)
callq 0x9540
movq -0x2088(%rbp), %rdi
movl $0x23, %esi
callq 0xe670
leaq -0x2049(%rbp), %rdi
movq %rdi, -0x20f0(%rbp)
callq 0x95c0
movq -0x20f0(%rbp), %rdx
leaq 0x237b7(%rip), %rsi     # 0x33329
leaq -0x2048(%rbp), %rdi
callq 0x13550
jmp 0xfb80
leaq -0x2048(%rbp), %rdi
callq 0xda50
jmp 0xfb8e
leaq -0x2048(%rbp), %rdi
callq 0x9658
leaq -0x2049(%rbp), %rdi
callq 0x93b0
leaq -0x2071(%rbp), %rdi
movq %rdi, -0x20f8(%rbp)
callq 0x95c0
movq -0x20f8(%rbp), %rdx
leaq 0x236c0(%rip), %rsi     # 0x33287
leaq -0x2070(%rbp), %rdi
callq 0x13550
jmp 0xfbd5
leaq -0x2070(%rbp), %rdi
callq 0xda50
jmp 0xfbe3
leaq -0x2070(%rbp), %rdi
callq 0x9658
leaq -0x2071(%rbp), %rdi
callq 0x93b0
movl $0x1f60, %edi           # imm = 0x1F60
callq 0x9350
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x2100(%rbp)
movl -0x1f8c(%rbp), %edx
movl -0x1f90(%rbp), %r8d
leaq -0xfe0(%rbp), %rsi
leaq -0x1f80(%rbp), %rcx
callq 0x2db70
jmp 0xfc34
movq -0x2100(%rbp), %rax
addq $0x2100, %rsp           # imm = 0x2100
popq %rbp
retq
jmp 0xfb40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xfc6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2048(%rbp), %rdi
callq 0x9658
leaq -0x2049(%rbp), %rdi
callq 0x93b0
jmp 0xfcce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xfca3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2070(%rbp), %rdi
callq 0x9658
leaq -0x2071(%rbp), %rdi
callq 0x93b0
jmp 0xfcce
movq -0x2100(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x1f60, %esi           # imm = 0x1F60
callq 0x9360
movq -0x38(%rbp), %rdi
callq 0x95b0
nopw (%rax,%rax)