// File: /workspace/github_c_makefile_star2_O2/MartinNovotny25[P]VUT-FIT-IFJ2020/semantics.c
// Function: enter_else_body
void enter_else_body(TDLList *L, tBSTNodePtrLocal *elsenode, functionData params, char *id){
    // preskoc else
    TDLLSucc(L);
    // prescko {
    TDLLSucc(L);

    while(L->Act->tdata.type != t_BRACES_R){
        if ((L->Act->tdata.type == t_IDENTIFIER) && (L->Act->lptr->tdata.type != t_FUNC) && (L->Act->rptr->tdata.type == t_LEFT_BRACKET)) {
            checkCallFunction(L, L->Act->tdata.lex, elsenode);
        }
        if(L->Act->tdata.type == t_IDENTIFIER && L->Act->rptr->tdata.type == t_ASSIGN){
			TDLLElemPtr temp_node = L->Act;
			while(temp_node->tdata.type != t_EOL){
				if(temp_node->lptr->tdata.type == t_EOL){
					assign_vals_control(L, elsenode, params);
					break;
				}
				TDLLPred(L);
				temp_node = temp_node->lptr;
			}
		}
        
        if (L->Act->tdata.type == t_DEFINITION_2) {
            TDLLPred(L);
			dec_var_control(L, elsenode, params);
        }
        if (L->Act->tdata.type == t_FOR) {           
            enter_for_body(L, elsenode, params, id);  
        }
        if (L->Act->tdata.type == t_IF) {
            TDLLSucc(L);          
			enter_if_body(L, elsenode, params, id);
        }
        if (L->Act->tdata.type == t_RETURN) {
            checkReturnStatement(L, id, elsenode);
        }
        
        TDLLSucc(L);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1040(%rsp), %r12
callq 0x12c2
movq %r15, %rdi
callq 0x12c2
pushq $0x13
popq %rbp
movq 0x8(%r15), %r13
movl 0x8(%r13), %eax
cmpl $0x13, %eax
je 0x4c65
cmpl $0x33, %eax
jne 0x4cd9
jmp 0x4d85
movq 0x10(%r13), %rax
cmpl $0x1c, 0x8(%rax)
je 0x4c93
movq 0x18(%r13), %rax
cmpl $0x6, 0x8(%rax)
jne 0x4c93
movq (%r13), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x45c5
movq 0x8(%r15), %r13
cmpl $0x13, 0x8(%r13)
jne 0x4cd9
movq 0x18(%r13), %rax
cmpl $0x3, 0x8(%rax)
jne 0x4cd9
movl %ebp, %eax
cmpl $0x2f, %eax
je 0x4cd9
movq 0x10(%r13), %rax
cmpl $0x2f, 0x8(%rax)
je 0x4cc0
movq %r15, %rdi
callq 0x1586
movq 0x10(%r13), %r13
movl 0x8(%r13), %eax
jmp 0x4c9f
movl $0x201, %ecx            # imm = 0x201
movq %rsp, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r15, %rdi
movq %r14, %rsi
callq 0x4d97
movq 0x8(%r15), %rax
movl 0x8(%rax), %eax
cmpl $0x32, %eax
jne 0x4d0d
movq %r15, %rdi
callq 0x1586
movl $0x201, %ecx            # imm = 0x201
movq %rsp, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r15, %rdi
movq %r14, %rsi
callq 0x5770
movq 0x8(%r15), %rax
movl 0x8(%rax), %eax
cmpl $0x1a, %eax
jne 0x4d35
movl $0x201, %ecx            # imm = 0x201
movq %rsp, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5de1
movq 0x8(%r15), %rax
movl 0x8(%rax), %eax
cmpl $0x16, %eax
jne 0x4d65
movq %r15, %rdi
callq 0x12c2
movl $0x201, %ecx            # imm = 0x201
movq %rsp, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5ff9
movq 0x8(%r15), %rax
movl 0x8(%rax), %eax
cmpl $0x19, %eax
jne 0x4d78
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x437c
movq %r15, %rdi
callq 0x12c2
jmp 0x4c4e
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq